From owner-svn-src-head@freebsd.org Sun Dec 2 00:41:44 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 35598132D848; Sun, 2 Dec 2018 00:41: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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D137B7B1DB; Sun, 2 Dec 2018 00:41:43 +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 B322D1F439; Sun, 2 Dec 2018 00:41:43 +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 wB20fhZF012656; Sun, 2 Dec 2018 00:41:43 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB20fhP4012655; Sun, 2 Dec 2018 00:41:43 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201812020041.wB20fhP4012655@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Sun, 2 Dec 2018 00:41:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341390 - head/tests/sys/geom/class/eli X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/tests/sys/geom/class/eli X-SVN-Commit-Revision: 341390 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D137B7B1DB X-Spamd-Result: default: False [-0.18 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.04)[-0.037,0]; NEURAL_SPAM_LONG(0.00)[0.005,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_SHORT(-0.15)[-0.147,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Dec 2018 00:41:44 -0000 Author: asomers Date: Sun Dec 2 00:41:43 2018 New Revision: 341390 URL: https://svnweb.freebsd.org/changeset/base/341390 Log: Remove some dead code from the geli tests This is detritus in the Makefile, leftover from 327662. MFC after: 2 weeks Modified: head/tests/sys/geom/class/eli/Makefile Modified: head/tests/sys/geom/class/eli/Makefile ============================================================================== --- head/tests/sys/geom/class/eli/Makefile Sat Dec 1 21:37:47 2018 (r341389) +++ head/tests/sys/geom/class/eli/Makefile Sun Dec 2 00:41:43 2018 (r341390) @@ -21,10 +21,6 @@ ATF_TESTS_SH+= setkey_test ${PACKAGE}FILES+= conf.sh -.for t in ${TAP_TESTS_SH} -TEST_METADATA.$t+= required_user="root" -.endfor - CFLAGS.pbkdf2_test= -I${SRCTOP}/sys SRCS.pbkdf2_test= \ From owner-svn-src-head@freebsd.org Sun Dec 2 02:20:36 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 34089130B070; Sun, 2 Dec 2018 02:20:36 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CB9327D912; Sun, 2 Dec 2018 02:20:35 +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 9792220476; Sun, 2 Dec 2018 02:20:35 +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 wB22KZtF060363; Sun, 2 Dec 2018 02:20:35 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB22KZsq060362; Sun, 2 Dec 2018 02:20:35 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201812020220.wB22KZsq060362@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sun, 2 Dec 2018 02:20:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341391 - head/stand/uboot/common X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/stand/uboot/common X-SVN-Commit-Revision: 341391 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: CB9327D912 X-Spamd-Result: default: False [0.02 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.04)[-0.037,0]; NEURAL_SPAM_LONG(0.00)[0.005,0]; NEURAL_SPAM_SHORT(0.06)[0.056,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Dec 2018 02:20:36 -0000 Author: jhibbits Date: Sun Dec 2 02:20:35 2018 New Revision: 341391 URL: https://svnweb.freebsd.org/changeset/base/341391 Log: ubldr: Force 'usefdt' variable to 1 for powerpc The fdt is gated, on powerpc, with a 'usefdt' environment variable. Force enable it in ubldr, so that the fdt is passed through the metadata. Modified: head/stand/uboot/common/main.c Modified: head/stand/uboot/common/main.c ============================================================================== --- head/stand/uboot/common/main.c Sun Dec 2 00:41:43 2018 (r341390) +++ head/stand/uboot/common/main.c Sun Dec 2 02:20:35 2018 (r341391) @@ -497,6 +497,9 @@ main(int argc, char **argv) do_interact: setenv("LINES", "24", 1); /* optional */ setenv("prompt", "loader>", 1); +#ifdef __powerpc__ + setenv("usefdt", "1", 1); +#endif archsw.arch_loadaddr = uboot_loadaddr; archsw.arch_getdev = uboot_getdev; From owner-svn-src-head@freebsd.org Sun Dec 2 03:03:58 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AF082130CFDB; Sun, 2 Dec 2018 03:03:58 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-lj1-x235.google.com (mail-lj1-x235.google.com [IPv6:2a00:1450:4864:20::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D69EF7FF56; Sun, 2 Dec 2018 03:03:57 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by mail-lj1-x235.google.com with SMTP id v1-v6so8340766ljd.0; Sat, 01 Dec 2018 19:03:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alumni-cwru-edu.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=orV+Dr5QLNAj4is/KZR3/YJczqGP0jHOuiqAkcGePIQ=; b=iUzh7nXzpQ/M6liq0yQfALLOmwqmy1b4Bsq7UAjSuzSx7LVbInXmRDxqUaoxZkpmFQ y3G0h3QDg9i8G5VciKR5d8F9S0KCFDmE9GWEwmTd9MswZedibKc18ltQt+qapsIidNgM TJ8mCUd1G1wzxFEchSChFxPp2KBwphE3WKYK62+1JUXH3C69hfcMEvmHsvR5TMciYXdM ACFQYaDx8KsEvQpe6SuCdZmtppNw2vUMzLIdHlT/DzTsQmhlmXvYVZQYVD9qofrKxXnF xnq8I8ujV0XSYfo2TyJ8IYmbEyggdnN2TmJOKzr7hrbuKjKI596bGC9cgbmz30Ct4gk9 lrcg== 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=orV+Dr5QLNAj4is/KZR3/YJczqGP0jHOuiqAkcGePIQ=; b=Jo+g15kiyyxtB1y/ZiAifHgJcBbn2TOrCdjI6l6gM6pSveyPtZ1jx5B3iUNjRdhCW+ KB+C7ZzxjJuTByj1JKMjv1Rk3VGLGJeIT2TfJIfeVXYYg1KhhjRoHT6m3XcuK5MmkP09 gU8bFGchsXS1DfWt6kk3u2ex9tgX0eCOQvKE5XiwYnaTzdHC5lwbkQG+r1Hy2cOh9oFd 4Pjil0s1PDXDFXfkwqJ8dfxj3zDmTpd9en3/aMGqrzjuveaAv+YmNqLIaNDVL53YLsSm YvRAqiTa5DG1iZvZZYNnQgB87zaDg48Axw21T1sLMfPDEYSfz8Z+EeZvT8vo/58exJMo fRFg== X-Gm-Message-State: AA+aEWbOom5dYcZQHxLTY6hWwGDvz0liXZr8Otcy9aiclS7mKpZ2JyQU R4z6WuoU8CWl8fVNfUHhsb2wpJU4muPaWU8QweDTqeYE X-Google-Smtp-Source: AFSGD/UkAHImugHrH3GTgPsSpE3+wI16xWlZK8/r1nFcN88xldI/H1PjERhmOmCLw7OckYUfRpHlRSVSg/PWvN9UkbM= X-Received: by 2002:a2e:8007:: with SMTP id j7-v6mr7303314ljg.22.1543719833216; Sat, 01 Dec 2018 19:03:53 -0800 (PST) MIME-Version: 1.0 References: <201811262145.wAQLjRwO048495@repo.freebsd.org> In-Reply-To: <201811262145.wAQLjRwO048495@repo.freebsd.org> From: Justin Hibbits Date: Sat, 1 Dec 2018 21:03:40 -0600 Message-ID: Subject: Re: svn commit: r340997 - head/lib/libarchive To: Martin Matuska Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: D69EF7FF56 X-Spamd-Result: default: False [-3.29 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; R_DKIM_ALLOW(-0.20)[alumni-cwru-edu.20150623.gappssmtp.com]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[cwru.edu]; NEURAL_HAM_LONG(-1.00)[-0.996,0]; TO_DN_SOME(0.00)[]; IP_SCORE(-0.56)[ipnet: 2a00:1450::/32(-1.42), asn: 15169(-1.30), country: US(-0.09)]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; DKIM_TRACE(0.00)[alumni-cwru-edu.20150623.gappssmtp.com:+]; RCVD_IN_DNSWL_NONE(0.00)[5.3.2.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]; NEURAL_HAM_SHORT(-0.52)[-0.522,0]; FORGED_SENDER(0.30)[jrh29@alumni.cwru.edu,chmeeedalf@gmail.com]; RCVD_TLS_LAST(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[jrh29@alumni.cwru.edu,chmeeedalf@gmail.com]; RCVD_COUNT_TWO(0.00)[2] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Dec 2018 03:03:58 -0000 On Mon, Nov 26, 2018 at 3:45 PM Martin Matuska wrote: > > Author: mm > Date: Mon Nov 26 21:45:27 2018 > New Revision: 340997 > URL: https://svnweb.freebsd.org/changeset/base/340997 > > Log: > libarchive configuration changes > - move HAVE_BZLIB_H, HAVE_LIBLZMA and HAVE_LZMA_H to config_freebsd.h > - activate support for multi-threaded lzma encoding [1] > > PR: 233543 [1] > Reported by: cem > MFC after: 1 week > > Modified: > head/lib/libarchive/Makefile > head/lib/libarchive/config_freebsd.h > > Modified: head/lib/libarchive/Makefile > ============================================================================== > --- head/lib/libarchive/Makefile Mon Nov 26 20:56:05 2018 (r340996) > +++ head/lib/libarchive/Makefile Mon Nov 26 21:45:27 2018 (r340997) > @@ -7,7 +7,6 @@ _LIBARCHIVEDIR= ${SRCTOP}/contrib/libarchive > LIB= archive > > LIBADD= z bz2 lzma bsdxml > -CFLAGS+= -DHAVE_BZLIB_H=1 -DHAVE_LIBLZMA=1 -DHAVE_LZMA_H=1 > > # FreeBSD SHLIB_MAJOR value is managed as part of the FreeBSD system. > # It has no real relation to the libarchive version number. > > Modified: head/lib/libarchive/config_freebsd.h > ============================================================================== > --- head/lib/libarchive/config_freebsd.h Mon Nov 26 20:56:05 2018 (r340996) > +++ head/lib/libarchive/config_freebsd.h Mon Nov 26 21:45:27 2018 (r340997) > @@ -133,14 +133,17 @@ > #define HAVE_LCHFLAGS 1 > #define HAVE_LCHMOD 1 > #define HAVE_LCHOWN 1 > +#define HAVE_LIBLZMA 1 > #define HAVE_LIBZ 1 > #define HAVE_LIMITS_H 1 > #define HAVE_LINK 1 > +#define HAVE_LZMA_H 1 > #define HAVE_LOCALE_H 1 > #define HAVE_LOCALTIME_R 1 > #define HAVE_LONG_LONG_INT 1 > #define HAVE_LSTAT 1 > #define HAVE_LUTIMES 1 > +#define HAVE_LZMA_STREAM_ENCODER_MT 1 > #define HAVE_MBRTOWC 1 > #define HAVE_MEMMOVE 1 > #define HAVE_MEMORY_H 1 > This breaks ports-mgmt/pkg now, with the following failure log: --- pkg-static --- /usr/lib/liblzma.a(stream_encoder_mt.o): In function `mythread_cond_init': /usr/local/poudriere/jails/ppc64/usr/src/contrib/xz/src/common/mythread.h:230: undefined reference to `pthread_condattr_init' /usr/local/poudriere/jails/ppc64/usr/src/contrib/xz/src/common/mythread.h:233: undefined reference to `pthread_condattr_setclock' /usr/local/poudriere/jails/ppc64/usr/src/contrib/xz/src/common/mythread.h:237: undefined reference to `pthread_condattr_destroy' /usr/lib/liblzma.a(stream_encoder_mt.o): In function `get_thread': /usr/local/poudriere/jails/ppc64/usr/src/contrib/xz/src/common/mythread.h:237: undefined reference to `pthread_condattr_destroy' /usr/lib/liblzma.a(stream_encoder_mt.o): In function `mythread_cond_init': /usr/local/poudriere/jails/ppc64/usr/src/contrib/xz/src/common/mythread.h:233: undefined reference to `pthread_condattr_setclock' /usr/local/poudriere/jails/ppc64/usr/src/contrib/xz/src/common/mythread.h:237: undefined reference to `pthread_condattr_destroy' /usr/local/poudriere/jails/ppc64/usr/src/contrib/xz/src/common/mythread.h:230: undefined reference to `pthread_condattr_init' /usr/local/poudriere/jails/ppc64/usr/src/contrib/xz/src/common/mythread.h:237: undefined reference to `pthread_condattr_destroy' *** [pkg-static] Error code 1 - Justin From owner-svn-src-head@freebsd.org Sun Dec 2 05:06:41 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2DC1A1310ACE; Sun, 2 Dec 2018 05:06:41 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CCA6084538; Sun, 2 Dec 2018 05:06:40 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ACDCB22122; Sun, 2 Dec 2018 05:06:40 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB256eaJ048472; Sun, 2 Dec 2018 05:06:40 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB256cDU048458; Sun, 2 Dec 2018 05:06:38 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201812020506.wB256cDU048458@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Sun, 2 Dec 2018 05:06:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341392 - in head/tests/sys/geom/class: . eli mirror X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in head/tests/sys/geom/class: . eli mirror X-SVN-Commit-Revision: 341392 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: CCA6084538 X-Spamd-Result: default: False [0.38 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_SPAM_LONG(0.14)[0.141,0]; NEURAL_SPAM_MEDIUM(0.16)[0.163,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_SPAM_SHORT(0.07)[0.072,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Dec 2018 05:06:41 -0000 Author: asomers Date: Sun Dec 2 05:06:37 2018 New Revision: 341392 URL: https://svnweb.freebsd.org/changeset/base/341392 Log: Unbreak geli/gmirror testcases if their geom classes cannot be loaded The problem with the logic prior to this commit was twofold: 1. The wrong set of idioms (TAP-compatible) were being applied to the ATF testcases when run, resulting in confusing ATF failure results on setup. 2. The cleanup subroutines were broken when the geom classes could not be loaded as they exited with 0 unexpectedly. This commit changes the test code to source the class-specific configuration (conf.sh) once globally, instead of sourcing it per testcase and per cleanup subroutine, and to call the ATF-specific setup subroutine(s) inline in the testcases. The refactoring done is effectively a no-op for the TAP testcases, modulo any refactoring done to create common code between the ATF and TAP testcases. This unbreaks the geli testcases converted to ATF in r327662 and r327683, and the gmirror testcases added in r327780, respectively, when the geom class could not be loaded. tests/sys/geom/class/mirror/... While here, ignore errors when turning debug failpoint sysctl off, which could occur if the gmirror class was not loaded. Submitted by: ngie MFC after: 2 weeks Pull Request: https://github.com/freebsd/freebsd/pull/241 Modified: head/tests/sys/geom/class/eli/attach_test.sh head/tests/sys/geom/class/eli/conf.sh head/tests/sys/geom/class/eli/configure_test.sh head/tests/sys/geom/class/eli/delkey_test.sh head/tests/sys/geom/class/eli/detach_test.sh head/tests/sys/geom/class/eli/init_test.sh head/tests/sys/geom/class/eli/integrity_test.sh head/tests/sys/geom/class/eli/kill_test.sh head/tests/sys/geom/class/eli/misc_test.sh head/tests/sys/geom/class/eli/onetime_test.sh head/tests/sys/geom/class/eli/resize_test.sh head/tests/sys/geom/class/eli/setkey_test.sh head/tests/sys/geom/class/geom_subr.sh head/tests/sys/geom/class/mirror/sync_error.sh Modified: head/tests/sys/geom/class/eli/attach_test.sh ============================================================================== --- head/tests/sys/geom/class/eli/attach_test.sh Sun Dec 2 02:20:35 2018 (r341391) +++ head/tests/sys/geom/class/eli/attach_test.sh Sun Dec 2 05:06:37 2018 (r341392) @@ -1,5 +1,7 @@ # $FreeBSD$ +. $(atf_get_srcdir)/conf.sh + atf_test_case attach_d cleanup attach_d_head() { @@ -8,7 +10,7 @@ attach_d_head() } attach_d_body() { - . $(atf_get_srcdir)/conf.sh + geli_test_setup sectors=100 md=$(attach_md -t malloc -s `expr $sectors + 1`) @@ -35,7 +37,6 @@ attach_d_body() } attach_d_cleanup() { - . $(atf_get_srcdir)/conf.sh geli_test_cleanup } @@ -47,7 +48,7 @@ attach_r_head() } attach_r_body() { - . $(atf_get_srcdir)/conf.sh + geli_test_setup sectors=100 md=$(attach_md -t malloc -s `expr $sectors + 1`) @@ -64,7 +65,6 @@ attach_r_body() } attach_r_cleanup() { - . $(atf_get_srcdir)/conf.sh geli_test_cleanup } @@ -76,7 +76,7 @@ nokey_head() } nokey_body() { - . $(atf_get_srcdir)/conf.sh + geli_test_setup sectors=100 md=$(attach_md -t malloc -s `expr $sectors + 1`) @@ -88,7 +88,6 @@ nokey_body() } nokey_cleanup() { - . $(atf_get_srcdir)/conf.sh geli_test_cleanup } Modified: head/tests/sys/geom/class/eli/conf.sh ============================================================================== --- head/tests/sys/geom/class/eli/conf.sh Sun Dec 2 02:20:35 2018 (r341391) +++ head/tests/sys/geom/class/eli/conf.sh Sun Dec 2 05:06:37 2018 (r341392) @@ -82,7 +82,6 @@ for_each_geli_config_nointegrity() { done } - geli_test_cleanup() { if [ -f "$TEST_MDS_FILE" ]; then @@ -95,4 +94,10 @@ geli_test_cleanup() true } +geli_test_setup() +{ + geom_atf_test_setup +} + +ATF_TEST=true . `dirname $0`/../geom_subr.sh Modified: head/tests/sys/geom/class/eli/configure_test.sh ============================================================================== --- head/tests/sys/geom/class/eli/configure_test.sh Sun Dec 2 02:20:35 2018 (r341391) +++ head/tests/sys/geom/class/eli/configure_test.sh Sun Dec 2 05:06:37 2018 (r341392) @@ -1,5 +1,7 @@ # $FreeBSD$ +. $(atf_get_srcdir)/conf.sh + atf_test_case configure_b_B cleanup configure_b_B_head() { @@ -8,7 +10,7 @@ configure_b_B_head() } configure_b_B_body() { - . $(atf_get_srcdir)/conf.sh + geli_test_setup sectors=100 md=$(attach_md -t malloc -s `expr $sectors + 1`) @@ -49,7 +51,6 @@ configure_b_B_body() } configure_b_B_cleanup() { - . $(atf_get_srcdir)/conf.sh geli_test_cleanup } Modified: head/tests/sys/geom/class/eli/delkey_test.sh ============================================================================== --- head/tests/sys/geom/class/eli/delkey_test.sh Sun Dec 2 02:20:35 2018 (r341391) +++ head/tests/sys/geom/class/eli/delkey_test.sh Sun Dec 2 05:06:37 2018 (r341392) @@ -1,6 +1,8 @@ #!/bin/sh # $FreeBSD$ +. $(atf_get_srcdir)/conf.sh + atf_test_case delkey cleanup delkey_head() { @@ -9,7 +11,7 @@ delkey_head() } delkey_body() { - . $(atf_get_srcdir)/conf.sh + geli_test_setup sectors=100 md=$(attach_md -t malloc -s `expr $sectors + 1`) @@ -76,7 +78,6 @@ delkey_body() } delkey_cleanup() { - . $(atf_get_srcdir)/conf.sh geli_test_cleanup } @@ -88,7 +89,7 @@ delkey_readonly_head() } delkey_readonly_body() { - . $(atf_get_srcdir)/conf.sh + geli_test_setup sectors=100 md=$(attach_md -t malloc -s `expr $sectors + 1`) @@ -103,7 +104,6 @@ delkey_readonly_body() } delkey_readonly_cleanup() { - . $(atf_get_srcdir)/conf.sh geli_test_cleanup } Modified: head/tests/sys/geom/class/eli/detach_test.sh ============================================================================== --- head/tests/sys/geom/class/eli/detach_test.sh Sun Dec 2 02:20:35 2018 (r341391) +++ head/tests/sys/geom/class/eli/detach_test.sh Sun Dec 2 05:06:37 2018 (r341392) @@ -1,5 +1,7 @@ # $FreeBSD$ +. $(atf_get_srcdir)/conf.sh + atf_test_case detach_l cleanup detach_l_head() { @@ -8,7 +10,7 @@ detach_l_head() } detach_l_body() { - . $(atf_get_srcdir)/conf.sh + geli_test_setup sectors=100 md=$(attach_md -t malloc -s `expr $sectors + 1`) @@ -36,7 +38,6 @@ detach_l_body() } detach_l_cleanup() { - . $(atf_get_srcdir)/conf.sh geli_test_cleanup } Modified: head/tests/sys/geom/class/eli/init_test.sh ============================================================================== --- head/tests/sys/geom/class/eli/init_test.sh Sun Dec 2 02:20:35 2018 (r341391) +++ head/tests/sys/geom/class/eli/init_test.sh Sun Dec 2 05:06:37 2018 (r341392) @@ -1,6 +1,8 @@ #!/bin/sh # $FreeBSD$ +. $(atf_get_srcdir)/conf.sh + init_test() { cipher=$1 @@ -39,7 +41,7 @@ init_head() } init_body() { - . $(atf_get_srcdir)/conf.sh + geli_test_setup sectors=32 @@ -50,7 +52,6 @@ init_body() } init_cleanup() { - . $(atf_get_srcdir)/conf.sh geli_test_cleanup } @@ -62,7 +63,7 @@ init_B_head() } init_B_body() { - . $(atf_get_srcdir)/conf.sh + geli_test_setup sectors=100 @@ -104,7 +105,6 @@ init_B_body() } init_B_cleanup() { - . $(atf_get_srcdir)/conf.sh geli_test_cleanup } @@ -116,7 +116,7 @@ init_J_head() } init_J_body() { - . $(atf_get_srcdir)/conf.sh + geli_test_setup sectors=100 md=$(attach_md -t malloc -s `expr $sectors + 1`) @@ -223,7 +223,6 @@ init_J_body() } init_J_cleanup() { - . $(atf_get_srcdir)/conf.sh geli_test_cleanup } @@ -260,7 +259,7 @@ init_a_head() } init_a_body() { - . $(atf_get_srcdir)/conf.sh + geli_test_setup sectors=100 @@ -272,7 +271,6 @@ init_a_body() } init_a_cleanup() { - . $(atf_get_srcdir)/conf.sh geli_test_cleanup } @@ -304,7 +302,7 @@ init_alias_head() } init_alias_body() { - . $(atf_get_srcdir)/conf.sh + geli_test_setup md=$(attach_md -t malloc -s 1024k) atf_check dd if=/dev/random of=keyfile bs=512 count=16 status=none @@ -330,7 +328,6 @@ init_alias_body() } init_alias_cleanup() { - . $(atf_get_srcdir)/conf.sh geli_test_cleanup } @@ -342,7 +339,7 @@ init_i_P_head() } init_i_P_body() { - . $(atf_get_srcdir)/conf.sh + geli_test_setup sectors=100 md=$(attach_md -t malloc -s `expr $sectors + 1`) @@ -354,7 +351,6 @@ init_i_P_body() } init_i_P_cleanup() { - . $(atf_get_srcdir)/conf.sh geli_test_cleanup } @@ -366,7 +362,7 @@ nokey_head() } nokey_body() { - . $(atf_get_srcdir)/conf.sh + geli_test_setup sectors=100 md=$(attach_md -t malloc -s `expr $sectors + 1`) @@ -376,7 +372,6 @@ nokey_body() } nokey_cleanup() { - . $(atf_get_srcdir)/conf.sh geli_test_cleanup } Modified: head/tests/sys/geom/class/eli/integrity_test.sh ============================================================================== --- head/tests/sys/geom/class/eli/integrity_test.sh Sun Dec 2 02:20:35 2018 (r341391) +++ head/tests/sys/geom/class/eli/integrity_test.sh Sun Dec 2 05:06:37 2018 (r341392) @@ -1,5 +1,7 @@ # $FreeBSD$ +. $(atf_get_srcdir)/conf.sh + copy_test() { cipher=$1 aalgo=$2 @@ -51,18 +53,17 @@ copy_head() } copy_body() { - . $(atf_get_srcdir)/conf.sh + geli_test_setup sectors=2 atf_check dd if=/dev/random of=keyfile bs=512 count=16 status=none dd if=/dev/random of=rnd bs=${MAX_SECSIZE} count=${sectors} status=none - + for_each_geli_config copy_test backing_file } copy_cleanup() { - . $(atf_get_srcdir)/conf.sh geli_test_cleanup } @@ -98,7 +99,7 @@ data_head() } data_body() { - . $(atf_get_srcdir)/conf.sh + geli_test_setup sectors=2 @@ -108,7 +109,6 @@ data_body() } data_cleanup() { - . $(atf_get_srcdir)/conf.sh geli_test_cleanup } @@ -143,7 +143,7 @@ hmac_head() } hmac_body() { - . $(atf_get_srcdir)/conf.sh + geli_test_setup sectors=2 @@ -153,7 +153,6 @@ hmac_body() } hmac_cleanup() { - . $(atf_get_srcdir)/conf.sh geli_test_cleanup } Modified: head/tests/sys/geom/class/eli/kill_test.sh ============================================================================== --- head/tests/sys/geom/class/eli/kill_test.sh Sun Dec 2 02:20:35 2018 (r341391) +++ head/tests/sys/geom/class/eli/kill_test.sh Sun Dec 2 05:06:37 2018 (r341392) @@ -1,5 +1,7 @@ # $FreeBSD$ +. $(atf_get_srcdir)/conf.sh + atf_test_case kill cleanup kill_head() { @@ -8,7 +10,7 @@ kill_head() } kill_body() { - . $(atf_get_srcdir)/conf.sh + geli_test_setup sectors=100 md=$(attach_md -t malloc -s `expr $sectors + 1`) @@ -61,7 +63,6 @@ kill_body() } kill_cleanup() { - . $(atf_get_srcdir)/conf.sh geli_test_cleanup } @@ -73,7 +74,7 @@ kill_readonly_head() } kill_readonly_body() { - . $(atf_get_srcdir)/conf.sh + geli_test_setup sectors=100 md=$(attach_md -t malloc -s `expr $sectors + 1`) @@ -91,7 +92,6 @@ kill_readonly_body() } kill_readonly_cleanup() { - . $(atf_get_srcdir)/conf.sh geli_test_cleanup } Modified: head/tests/sys/geom/class/eli/misc_test.sh ============================================================================== --- head/tests/sys/geom/class/eli/misc_test.sh Sun Dec 2 02:20:35 2018 (r341391) +++ head/tests/sys/geom/class/eli/misc_test.sh Sun Dec 2 05:06:37 2018 (r341392) @@ -24,6 +24,8 @@ # # $FreeBSD$ +. $(atf_get_srcdir)/conf.sh + atf_test_case preserve_props cleanup preserve_props_head() { @@ -33,7 +35,8 @@ preserve_props_head() } preserve_props_body() { - . $(atf_get_srcdir)/conf.sh + geli_test_setup + md=$(attach_md -s1m) atf_check geli onetime /dev/${md} md_secsize=$(diskinfo ${md} | cut -wf 2) @@ -45,7 +48,6 @@ preserve_props_body() } preserve_props_cleanup() { - . $(atf_get_srcdir)/conf.sh geli_test_cleanup } @@ -59,7 +61,8 @@ preserve_disk_props_head() } preserve_disk_props_body() { - . $(atf_get_srcdir)/conf.sh + geli_test_setup + disks=`atf_config_get disks` disk=${disks%% *} if [ -z "$disk" ]; then @@ -82,7 +85,6 @@ preserve_disk_props_body() } preserve_disk_props_cleanup() { - . $(atf_get_srcdir)/conf.sh disk_cleanup geli_test_cleanup } @@ -96,8 +98,10 @@ physpath_head() } physpath_body() { - . $(atf_get_srcdir)/conf.sh - load_gnop + geli_test_setup + if ! error_message=$(geom_load_class_if_needed nop); then + atf_skip "$error_message" + fi md=$(attach_md -s1m) # If the underlying device has no physical path, then geli should not @@ -116,8 +120,6 @@ physpath_body() } physpath_cleanup() { - . $(atf_get_srcdir)/conf.sh - if [ -f "$TEST_MDS_FILE" ]; then while read md; do [ -c /dev/${md}.nop.eli ] && \ @@ -166,12 +168,5 @@ disk_cleanup() disk=${disks%% *} if [ -n "$disk" ]; then geli kill ${disk} 2>/dev/null - fi -} - -load_gnop() -{ - if ! kldstat -q -m g_nop; then - geom nop load || atf_skip "could not load module for geom nop" fi } Modified: head/tests/sys/geom/class/eli/onetime_test.sh ============================================================================== --- head/tests/sys/geom/class/eli/onetime_test.sh Sun Dec 2 02:20:35 2018 (r341391) +++ head/tests/sys/geom/class/eli/onetime_test.sh Sun Dec 2 05:06:37 2018 (r341392) @@ -1,5 +1,7 @@ # $FreeBSD$ +. $(atf_get_srcdir)/conf.sh + onetime_test() { cipher=$1 @@ -35,7 +37,8 @@ onetime_head() } onetime_body() { - . $(atf_get_srcdir)/conf.sh + geli_test_setup + sectors=100 dd if=/dev/random of=rnd bs=${MAX_SECSIZE} count=${sectors} status=none @@ -43,7 +46,6 @@ onetime_body() } onetime_cleanup() { - . $(atf_get_srcdir)/conf.sh geli_test_cleanup } @@ -78,7 +80,8 @@ onetime_a_head() } onetime_a_body() { - . $(atf_get_srcdir)/conf.sh + geli_test_setup + sectors=8 atf_check dd if=/dev/random of=rnd bs=$MAX_SECSIZE count=$sectors \ @@ -87,7 +90,6 @@ onetime_a_body() } onetime_a_cleanup() { - . $(atf_get_srcdir)/conf.sh geli_test_cleanup } @@ -99,7 +101,7 @@ onetime_d_head() } onetime_d_body() { - . $(atf_get_srcdir)/conf.sh + geli_test_setup sectors=100 md=$(attach_md -t malloc -s $sectors) @@ -125,7 +127,6 @@ onetime_d_body() } onetime_d_cleanup() { - . $(atf_get_srcdir)/conf.sh geli_test_cleanup } Modified: head/tests/sys/geom/class/eli/resize_test.sh ============================================================================== --- head/tests/sys/geom/class/eli/resize_test.sh Sun Dec 2 02:20:35 2018 (r341391) +++ head/tests/sys/geom/class/eli/resize_test.sh Sun Dec 2 05:06:37 2018 (r341392) @@ -1,6 +1,8 @@ #!/bin/sh # $FreeBSD$ +. $(atf_get_srcdir)/conf.sh + atf_test_case resize cleanup resize_head() { @@ -9,7 +11,8 @@ resize_head() } resize_body() { - . $(atf_get_srcdir)/conf.sh + geli_test_setup + BLK=512 BLKS_PER_MB=2048 @@ -67,8 +70,6 @@ resize_body() } resize_cleanup() { - . $(atf_get_srcdir)/conf.sh - if [ -f "$TEST_MDS_FILE" ]; then while read md; do [ -c /dev/${md}a.eli ] && \ Modified: head/tests/sys/geom/class/eli/setkey_test.sh ============================================================================== --- head/tests/sys/geom/class/eli/setkey_test.sh Sun Dec 2 02:20:35 2018 (r341391) +++ head/tests/sys/geom/class/eli/setkey_test.sh Sun Dec 2 05:06:37 2018 (r341392) @@ -1,6 +1,8 @@ #!/bin/sh # $FreeBSD$ +. $(atf_get_srcdir)/conf.sh + atf_test_case setkey cleanup setkey_head() { @@ -9,7 +11,7 @@ setkey_head() } setkey_body() { - . $(atf_get_srcdir)/conf.sh + geli_test_setup sectors=100 md=$(attach_md -t malloc -s `expr $sectors + 1`) @@ -88,7 +90,6 @@ setkey_body() } setkey_cleanup() { - . $(atf_get_srcdir)/conf.sh geli_test_cleanup } @@ -100,7 +101,7 @@ setkey_readonly_head() } setkey_readonly_body() { - . $(atf_get_srcdir)/conf.sh + geli_test_setup sectors=100 md=$(attach_md -t malloc -s `expr $sectors + 1`) @@ -114,7 +115,6 @@ setkey_readonly_body() } setkey_readonly_cleanup() { - . $(atf_get_srcdir)/conf.sh geli_test_cleanup } @@ -126,7 +126,7 @@ nokey_head() } nokey_body() { - . $(atf_get_srcdir)/conf.sh + geli_test_setup sectors=100 md=$(attach_md -t malloc -s `expr $sectors + 1`) @@ -152,7 +152,6 @@ nokey_body() } nokey_cleanup() { - . $(atf_get_srcdir)/conf.sh geli_test_cleanup } Modified: head/tests/sys/geom/class/geom_subr.sh ============================================================================== --- head/tests/sys/geom/class/geom_subr.sh Sun Dec 2 02:20:35 2018 (r341391) +++ head/tests/sys/geom/class/geom_subr.sh Sun Dec 2 05:06:37 2018 (r341392) @@ -1,6 +1,9 @@ #!/bin/sh # $FreeBSD$ +# NOTE: existence is sanity-checked in `geom_verify_temp_mds_file_existence(..)` +TEST_MDS_FILE="$(mktemp test_mds.${0##*/}.XXXXXXXX)" + devwait() { while :; do @@ -40,30 +43,55 @@ geom_test_cleanup() echo "# Removing test memory disk: $test_md" mdconfig -d -u $test_md done < $TEST_MDS_FILE + rm -f "$TEST_MDS_FILE" fi - rm -f "$TEST_MDS_FILE" } -if [ $(id -u) -ne 0 ]; then - echo '1..0 # SKIP tests must be run as root' - exit 0 -fi +geom_verify_temp_mds_file_existence() +{ + if [ ! -f $TEST_MDS_FILE ]; then + echo "test md(4) devices file creation unsuccessful" + return 1 + fi +} -# If the geom class isn't already loaded, try loading it. -if ! kldstat -q -m g_${class}; then - if ! geom ${class} load; then - echo "1..0 # SKIP could not load module for geom class=${class}" +geom_load_class_if_needed() +{ + local class=$1 + + # If the geom class isn't already loaded, try loading it. + if ! kldstat -q -m g_${class}; then + if ! geom ${class} load; then + echo "could not load module for geom class=${class}" + return 1 + fi + fi + return 0 +} + +geom_atf_test_setup() +{ + if ! error_message=$(geom_verify_temp_mds_file_existence); then + atf_skip "$error_message" + fi + if ! error_message=$(geom_load_class_if_needed $class); then + atf_skip "$error_message" + fi +} + +geom_tap_test_setup() +{ + if ! error_message=$(geom_verify_temp_mds_file_existence); then + echo "1..0 # SKIP $error_message" + exit 1 + fi + if ! error_message=$(geom_load_class_if_needed $class); then + echo "1..0 # SKIP $error_message" exit 0 fi -fi +} -# Need to keep track of the test md devices to avoid the scenario where a test -# failing will cause the other tests to bomb out, or a test failing will leave -# a large number of md(4) devices lingering around -: ${TMPDIR=/tmp} -export TMPDIR -if ! TEST_MDS_FILE=$(mktemp ${TMPDIR}/test_mds.XXXXXX); then - echo 'Failed to create temporary file for tracking the test md(4) devices' - echo 'Bail out!' - exit 1 +: ${ATF_TEST=false} +if ! $ATF_TEST; then + geom_tap_test_setup fi Modified: head/tests/sys/geom/class/mirror/sync_error.sh ============================================================================== --- head/tests/sys/geom/class/mirror/sync_error.sh Sun Dec 2 02:20:35 2018 (r341391) +++ head/tests/sys/geom/class/mirror/sync_error.sh Sun Dec 2 05:06:37 2018 (r341392) @@ -1,5 +1,8 @@ # $FreeBSD$ +ATF_TEST=true +. $(atf_get_srcdir)/conf.sh + REG_READ_FP=debug.fail_point.g_mirror_regular_request_read atf_test_case sync_read_error_2_disks cleanup @@ -11,7 +14,7 @@ sync_read_error_2_disks_head() } sync_read_error_2_disks_body() { - . $(atf_get_srcdir)/conf.sh + geom_atf_test_setup f1=$(mktemp ${base}.XXXXXX) f2=$(mktemp ${base}.XXXXXX) @@ -25,7 +28,7 @@ sync_read_error_2_disks_body() atf_check gmirror label $name $md1 devwait - atf_check -s exit:0 -e empty -o not-empty sysctl ${REG_READ_FP}='1*return(5)' + atf_check -s ignore -e empty -o not-empty sysctl ${REG_READ_FP}='1*return(5)' # If a read error occurs while synchronizing and the mirror contains # a single active disk, gmirror has no choice but to fail the @@ -39,9 +42,7 @@ sync_read_error_2_disks_body() } sync_read_error_2_disks_cleanup() { - . $(atf_get_srcdir)/conf.sh - - atf_check -s exit:0 -e empty -o not-empty sysctl ${REG_READ_FP}='off' + atf_check -s ignore -e ignore -o ignore sysctl ${REG_READ_FP}='off' gmirror_test_cleanup } @@ -54,7 +55,7 @@ sync_read_error_3_disks_head() } sync_read_error_3_disks_body() { - . $(atf_get_srcdir)/conf.sh + geom_atf_test_setup f1=$(mktemp ${base}.XXXXXX) f2=$(mktemp ${base}.XXXXXX) @@ -97,9 +98,7 @@ sync_read_error_3_disks_body() } sync_read_error_3_disks_cleanup() { - . $(atf_get_srcdir)/conf.sh - - atf_check -s exit:0 -e empty -o not-empty sysctl ${REG_READ_FP}='off' + atf_check -s ignore -e ignore -o ignore sysctl ${REG_READ_FP}='off' gmirror_test_cleanup } From owner-svn-src-head@freebsd.org Sun Dec 2 07:39:18 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E27051313BCD; Sun, 2 Dec 2018 07:39:17 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 877DA88759; Sun, 2 Dec 2018 07:39:17 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 62028239CB; Sun, 2 Dec 2018 07:39:17 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB27dHA5024490; Sun, 2 Dec 2018 07:39:17 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB27dHc0024489; Sun, 2 Dec 2018 07:39:17 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201812020739.wB27dHc0024489@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Sun, 2 Dec 2018 07:39:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341393 - head/sys/arm/arm X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: head/sys/arm/arm X-SVN-Commit-Revision: 341393 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 877DA88759 X-Spamd-Result: default: False [0.49 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.04)[-0.037,0]; NEURAL_SPAM_SHORT(0.53)[0.527,0]; NEURAL_SPAM_LONG(0.00)[0.005,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Dec 2018 07:39:18 -0000 Author: mmel Date: Sun Dec 2 07:39:16 2018 New Revision: 341393 URL: https://svnweb.freebsd.org/changeset/base/341393 Log: Return computed real memory size, not a value from similarly named global variable. MFC after: 1 week Modified: head/sys/arm/arm/physmem.c Modified: head/sys/arm/arm/physmem.c ============================================================================== --- head/sys/arm/arm/physmem.c Sun Dec 2 05:06:37 2018 (r341392) +++ head/sys/arm/arm/physmem.c Sun Dec 2 07:39:16 2018 (r341393) @@ -265,7 +265,7 @@ regions_to_avail(vm_paddr_t *avail, uint32_t exflags, if (pavail != NULL) *pavail = availmem; if (prealmem != NULL) - *prealmem = realmem; + *prealmem = totalmem; return (acnt); } From owner-svn-src-head@freebsd.org Sun Dec 2 12:53:40 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4316D1321958; Sun, 2 Dec 2018 12:53:40 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DE3D06BBB8; Sun, 2 Dec 2018 12:53:39 +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 C01CB26EC0; Sun, 2 Dec 2018 12:53:39 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB2Crdth095259; Sun, 2 Dec 2018 12:53:39 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB2CrdWe095258; Sun, 2 Dec 2018 12:53:39 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201812021253.wB2CrdWe095258@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 2 Dec 2018 12:53:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341397 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 341397 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: DE3D06BBB8 X-Spamd-Result: default: False [-0.15 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.04)[-0.037,0]; NEURAL_HAM_SHORT(-0.11)[-0.113,0]; NEURAL_SPAM_LONG(0.00)[0.005,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Dec 2018 12:53:40 -0000 Author: kib Date: Sun Dec 2 12:53:39 2018 New Revision: 341397 URL: https://svnweb.freebsd.org/changeset/base/341397 Log: Correct accuracy of the barrier writes accounting. Discussed with: mckusick MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Sun Dec 2 12:51:49 2018 (r341396) +++ head/sys/kern/vfs_bio.c Sun Dec 2 12:53:39 2018 (r341397) @@ -2231,7 +2231,7 @@ bufwrite(struct buf *bp) } if (bp->b_flags & B_BARRIER) - barrierwrites++; + atomic_add_long(&barrierwrites, 1); oldflags = bp->b_flags; From owner-svn-src-head@freebsd.org Sun Dec 2 13:16:48 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 953691322151; Sun, 2 Dec 2018 13:16:48 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 32AE56C721; Sun, 2 Dec 2018 13:16:48 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0D6B72721A; Sun, 2 Dec 2018 13:16:48 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB2DGli5005865; Sun, 2 Dec 2018 13:16:47 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB2DGkmC005859; Sun, 2 Dec 2018 13:16:46 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201812021316.wB2DGkmC005859@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 2 Dec 2018 13:16:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341398 - in head/sys: dev/xen/gntdev sys vm X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: dev/xen/gntdev sys vm X-SVN-Commit-Revision: 341398 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 32AE56C721 X-Spamd-Result: default: False [-0.02 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_SHORT(-0.10)[-0.096,0]; NEURAL_SPAM_LONG(0.05)[0.050,0]; NEURAL_SPAM_MEDIUM(0.03)[0.029,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Dec 2018 13:16:48 -0000 Author: kib Date: Sun Dec 2 13:16:46 2018 New Revision: 341398 URL: https://svnweb.freebsd.org/changeset/base/341398 Log: Change the vm_ooffset_t type to unsigned. The type represents byte offset in the vm_object_t data space, which does not span negative offsets in FreeBSD VM. The change matches byte offset signess with the unsignedness of the vm_pindex_t which represents the type of the page indexes in the objects. This allows to remove the UOFF_TO_IDX() macro which was used when we have to forcibly interpret the type as unsigned anyway. Also it fixes a lot of implicit bugs in the device drivers d_mmap methods. Reviewed by: alc, markj (previous version) Tested by: pho MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/xen/gntdev/gntdev.c head/sys/sys/types.h head/sys/vm/device_pager.c head/sys/vm/sg_pager.c head/sys/vm/vm_map.c head/sys/vm/vm_object.h Modified: head/sys/dev/xen/gntdev/gntdev.c ============================================================================== --- head/sys/dev/xen/gntdev/gntdev.c Sun Dec 2 12:53:39 2018 (r341397) +++ head/sys/dev/xen/gntdev/gntdev.c Sun Dec 2 13:16:46 2018 (r341398) @@ -814,8 +814,8 @@ gntdev_gmap_pg_fault(vm_object_t object, vm_ooffset_t relative_offset = offset - gmap->file_index; - pidx = UOFF_TO_IDX(offset); - ridx = UOFF_TO_IDX(relative_offset); + pidx = OFF_TO_IDX(offset); + ridx = OFF_TO_IDX(relative_offset); if (ridx >= gmap->count || gmap->grant_map_ops[ridx].status != GNTST_okay) return (VM_PAGER_FAIL); @@ -1085,7 +1085,7 @@ mmap_gref(struct per_user_data *priv_user, struct gntd break; vm_page_insert(gref->page, mem_obj, - UOFF_TO_IDX(gref->file_index)); + OFF_TO_IDX(gref->file_index)); count--; } @@ -1225,7 +1225,7 @@ gntdev_mmap_single(struct cdev *cdev, vm_ooffset_t *of if (error != 0) return (EINVAL); - count = UOFF_TO_IDX(size); + count = OFF_TO_IDX(size); gref_start = gntdev_find_grefs(priv_user, *offset, count); if (gref_start) { Modified: head/sys/sys/types.h ============================================================================== --- head/sys/sys/types.h Sun Dec 2 12:53:39 2018 (r341397) +++ head/sys/sys/types.h Sun Dec 2 13:16:46 2018 (r341398) @@ -261,7 +261,7 @@ typedef __uint64_t kvaddr_t; typedef __uint64_t ksize_t; typedef __vm_offset_t vm_offset_t; -typedef __int64_t vm_ooffset_t; +typedef __uint64_t vm_ooffset_t; typedef __vm_paddr_t vm_paddr_t; typedef __uint64_t vm_pindex_t; typedef __vm_size_t vm_size_t; Modified: head/sys/vm/device_pager.c ============================================================================== --- head/sys/vm/device_pager.c Sun Dec 2 12:53:39 2018 (r341397) +++ head/sys/vm/device_pager.c Sun Dec 2 13:16:46 2018 (r341398) @@ -150,9 +150,9 @@ cdev_pager_allocate(void *handle, enum obj_type tp, st * of the page size. Do a check to avoid wrap. */ size = round_page(size); - pindex = UOFF_TO_IDX(foff) + UOFF_TO_IDX(size); - if (pindex > OBJ_MAX_SIZE || pindex < UOFF_TO_IDX(foff) || - pindex < UOFF_TO_IDX(size)) + pindex = OFF_TO_IDX(foff) + OFF_TO_IDX(size); + if (pindex > OBJ_MAX_SIZE || pindex < OFF_TO_IDX(foff) || + pindex < OFF_TO_IDX(size)) return (NULL); if (ops->cdev_pg_ctor(handle, size, prot, foff, cred, &color) != 0) Modified: head/sys/vm/sg_pager.c ============================================================================== --- head/sys/vm/sg_pager.c Sun Dec 2 12:53:39 2018 (r341397) +++ head/sys/vm/sg_pager.c Sun Dec 2 13:16:46 2018 (r341398) @@ -100,9 +100,9 @@ sg_pager_alloc(void *handle, vm_ooffset_t size, vm_pro * to map beyond that. */ size = round_page(size); - pindex = UOFF_TO_IDX(foff) + UOFF_TO_IDX(size); - if (pindex > npages || pindex < UOFF_TO_IDX(foff) || - pindex < UOFF_TO_IDX(size)) + pindex = OFF_TO_IDX(foff) + OFF_TO_IDX(size); + if (pindex > npages || pindex < OFF_TO_IDX(foff) || + pindex < OFF_TO_IDX(size)) return (NULL); /* Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Sun Dec 2 12:53:39 2018 (r341397) +++ head/sys/vm/vm_map.c Sun Dec 2 13:16:46 2018 (r341398) @@ -4213,7 +4213,7 @@ RetryLookupLocked: * Return the object/offset from this entry. If the entry was * copy-on-write or empty, it has been fixed up. */ - *pindex = UOFF_TO_IDX((vaddr - entry->start) + entry->offset); + *pindex = OFF_TO_IDX((vaddr - entry->start) + entry->offset); *object = entry->object.vm_object; *out_prot = prot; @@ -4294,7 +4294,7 @@ vm_map_lookup_locked(vm_map_t *var_map, /* IN/OUT */ * Return the object/offset from this entry. If the entry was * copy-on-write or empty, it has been fixed up. */ - *pindex = UOFF_TO_IDX((vaddr - entry->start) + entry->offset); + *pindex = OFF_TO_IDX((vaddr - entry->start) + entry->offset); *object = entry->object.vm_object; *out_prot = prot; Modified: head/sys/vm/vm_object.h ============================================================================== --- head/sys/vm/vm_object.h Sun Dec 2 12:53:39 2018 (r341397) +++ head/sys/vm/vm_object.h Sun Dec 2 13:16:46 2018 (r341398) @@ -196,20 +196,13 @@ struct vm_object { /* * Helpers to perform conversion between vm_object page indexes and offsets. * IDX_TO_OFF() converts an index into an offset. - * OFF_TO_IDX() converts an offset into an index. Since offsets are signed - * by default, the sign propagation in OFF_TO_IDX(), when applied to - * negative offsets, is intentional and returns a vm_object page index - * that cannot be created by a userspace mapping. - * UOFF_TO_IDX() treats the offset as an unsigned value and converts it - * into an index accordingly. Use it only when the full range of offset - * values are allowed. Currently, this only applies to device mappings. + * OFF_TO_IDX() converts an offset into an index. * OBJ_MAX_SIZE specifies the maximum page index corresponding to the * maximum unsigned offset. */ #define IDX_TO_OFF(idx) (((vm_ooffset_t)(idx)) << PAGE_SHIFT) #define OFF_TO_IDX(off) ((vm_pindex_t)(((vm_ooffset_t)(off)) >> PAGE_SHIFT)) -#define UOFF_TO_IDX(off) (((vm_pindex_t)(off)) >> PAGE_SHIFT) -#define OBJ_MAX_SIZE (UOFF_TO_IDX(UINT64_MAX) + 1) +#define OBJ_MAX_SIZE (OFF_TO_IDX(UINT64_MAX) + 1) #ifdef _KERNEL From owner-svn-src-head@freebsd.org Sun Dec 2 13:27:37 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BE46913223A8; Sun, 2 Dec 2018 13:27:37 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 56F646CB4A; Sun, 2 Dec 2018 13:27:37 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 29B43273AB; Sun, 2 Dec 2018 13:27:37 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB2DRaVK011104; Sun, 2 Dec 2018 13:27:36 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB2DRaoc011103; Sun, 2 Dec 2018 13:27:36 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201812021327.wB2DRaoc011103@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 2 Dec 2018 13:27:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341399 - head/sys/dev/acpica X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/dev/acpica X-SVN-Commit-Revision: 341399 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 56F646CB4A X-Spamd-Result: default: False [-0.15 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.04)[-0.037,0]; NEURAL_HAM_SHORT(-0.11)[-0.113,0]; NEURAL_SPAM_LONG(0.00)[0.005,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Dec 2018 13:27:37 -0000 Author: kib Date: Sun Dec 2 13:27:36 2018 New Revision: 341399 URL: https://svnweb.freebsd.org/changeset/base/341399 Log: Fix off by one in hpet_mmap() csw method. Reported by: C Turt Reviewed by: alc, markj Tested by: pho admbug: 781 MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/acpica/acpi_hpet.c Modified: head/sys/dev/acpica/acpi_hpet.c ============================================================================== --- head/sys/dev/acpica/acpi_hpet.c Sun Dec 2 13:16:46 2018 (r341398) +++ head/sys/dev/acpica/acpi_hpet.c Sun Dec 2 13:27:36 2018 (r341399) @@ -396,7 +396,7 @@ hpet_mmap(struct cdev *cdev, vm_ooffset_t offset, vm_p struct hpet_softc *sc; sc = cdev->si_drv1; - if (offset > rman_get_size(sc->mem_res)) + if (offset >= rman_get_size(sc->mem_res)) return (EINVAL); if (!sc->mmap_allow_write && (nprot & PROT_WRITE)) return (EPERM); From owner-svn-src-head@freebsd.org Sun Dec 2 13:29:14 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 40B241322427; Sun, 2 Dec 2018 13:29:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D764B6CCBE; Sun, 2 Dec 2018 13:29:13 +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 B79E0273AD; Sun, 2 Dec 2018 13:29:13 +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 wB2DTDUQ011208; Sun, 2 Dec 2018 13:29:13 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB2DTDBo011207; Sun, 2 Dec 2018 13:29:13 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201812021329.wB2DTDBo011207@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 2 Dec 2018 13:29:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341400 - head/sys/dev/sound/pcm X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/dev/sound/pcm X-SVN-Commit-Revision: 341400 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D764B6CCBE X-Spamd-Result: default: False [-0.15 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.04)[-0.037,0]; NEURAL_HAM_SHORT(-0.11)[-0.113,0]; NEURAL_SPAM_LONG(0.00)[0.005,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Dec 2018 13:29:14 -0000 Author: kib Date: Sun Dec 2 13:29:13 2018 New Revision: 341400 URL: https://svnweb.freebsd.org/changeset/base/341400 Log: Add a comment noting that the additional range checks are not needed. The object size is set in the dsp_mmap_single() which provides the range limit by vm_fault(). Reported by: C Turt Reviewed by: alc, markj admbug: 781 MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/sound/pcm/dsp.c Modified: head/sys/dev/sound/pcm/dsp.c ============================================================================== --- head/sys/dev/sound/pcm/dsp.c Sun Dec 2 13:27:36 2018 (r341399) +++ head/sys/dev/sound/pcm/dsp.c Sun Dec 2 13:29:13 2018 (r341400) @@ -2205,7 +2205,10 @@ dsp_mmap(struct cdev *i_dev, vm_ooffset_t offset, vm_p int nprot, vm_memattr_t *memattr) { - /* XXX memattr is not honored */ + /* + * offset is in range due to checks in dsp_mmap_single(). + * XXX memattr is not honored. + */ *paddr = vtophys(offset); return (0); } From owner-svn-src-head@freebsd.org Sun Dec 2 18:31:00 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D3E27132A05D; Sun, 2 Dec 2018 18:30:59 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 747A47806D; Sun, 2 Dec 2018 18:30:59 +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 3E1472610; Sun, 2 Dec 2018 18:30:59 +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 wB2IUxmt088707; Sun, 2 Dec 2018 18:30:59 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB2IUwuh088704; Sun, 2 Dec 2018 18:30:58 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201812021830.wB2IUwuh088704@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 2 Dec 2018 18:30:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341402 - in head/sys: arm/ti dev/altera/avgen dev/terasic/mtl X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: arm/ti dev/altera/avgen dev/terasic/mtl X-SVN-Commit-Revision: 341402 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 747A47806D X-Spamd-Result: default: False [0.47 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_SPAM_LONG(0.05)[0.050,0]; NEURAL_SPAM_MEDIUM(0.03)[0.029,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_SPAM_SHORT(0.39)[0.389,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Dec 2018 18:31:00 -0000 Author: kib Date: Sun Dec 2 18:30:58 2018 New Revision: 341402 URL: https://svnweb.freebsd.org/changeset/base/341402 Log: Fix off-by-one (page) errors in checks in d_mmap methods of several drivers. Reported by: C Turt Reviewed by: alc, markj admbug: 781 MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/arm/ti/ti_pruss.c head/sys/dev/altera/avgen/altera_avgen.c head/sys/dev/terasic/mtl/terasic_mtl_reg.c head/sys/dev/terasic/mtl/terasic_mtl_text.c Modified: head/sys/arm/ti/ti_pruss.c ============================================================================== --- head/sys/arm/ti/ti_pruss.c Sun Dec 2 18:08:27 2018 (r341401) +++ head/sys/arm/ti/ti_pruss.c Sun Dec 2 18:30:58 2018 (r341402) @@ -704,7 +704,7 @@ ti_pruss_mmap(struct cdev *cdev, vm_ooffset_t offset, device_t dev = cdev->si_drv1; struct ti_pruss_softc *sc = device_get_softc(dev); - if (offset > rman_get_size(sc->sc_mem_res)) + if (offset >= rman_get_size(sc->sc_mem_res)) return (ENOSPC); *paddr = rman_get_start(sc->sc_mem_res) + offset; *memattr = VM_MEMATTR_UNCACHEABLE; Modified: head/sys/dev/altera/avgen/altera_avgen.c ============================================================================== --- head/sys/dev/altera/avgen/altera_avgen.c Sun Dec 2 18:08:27 2018 (r341401) +++ head/sys/dev/altera/avgen/altera_avgen.c Sun Dec 2 18:30:58 2018 (r341402) @@ -229,6 +229,7 @@ altera_avgen_mmap(struct cdev *dev, vm_ooffset_t offse return (EACCES); } if (trunc_page(offset) == offset && + offset + PAGE_SIZE > offset && rman_get_size(sc->avg_res) >= offset + PAGE_SIZE) { *paddr = rman_get_start(sc->avg_res) + offset; *memattr = VM_MEMATTR_UNCACHEABLE; Modified: head/sys/dev/terasic/mtl/terasic_mtl_reg.c ============================================================================== --- head/sys/dev/terasic/mtl/terasic_mtl_reg.c Sun Dec 2 18:08:27 2018 (r341401) +++ head/sys/dev/terasic/mtl/terasic_mtl_reg.c Sun Dec 2 18:30:58 2018 (r341402) @@ -132,6 +132,7 @@ terasic_mtl_reg_mmap(struct cdev *dev, vm_ooffset_t of sc = dev->si_drv1; error = 0; if (trunc_page(offset) == offset && + offset + PAGE_SIZE > offset && rman_get_size(sc->mtl_reg_res) >= offset + PAGE_SIZE) { *paddr = rman_get_start(sc->mtl_reg_res) + offset; *memattr = VM_MEMATTR_UNCACHEABLE; Modified: head/sys/dev/terasic/mtl/terasic_mtl_text.c ============================================================================== --- head/sys/dev/terasic/mtl/terasic_mtl_text.c Sun Dec 2 18:08:27 2018 (r341401) +++ head/sys/dev/terasic/mtl/terasic_mtl_text.c Sun Dec 2 18:30:58 2018 (r341402) @@ -131,6 +131,7 @@ terasic_mtl_text_mmap(struct cdev *dev, vm_ooffset_t o sc = dev->si_drv1; error = 0; if (trunc_page(offset) == offset && + offset + PAGE_SIZE > offset && rman_get_size(sc->mtl_text_res) >= offset + PAGE_SIZE) { *paddr = rman_get_start(sc->mtl_text_res) + offset; *memattr = VM_MEMATTR_UNCACHEABLE; From owner-svn-src-head@freebsd.org Sun Dec 2 19:35:23 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ED3F9132B8C6; Sun, 2 Dec 2018 19:35:22 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 949CE7A22C; Sun, 2 Dec 2018 19:35:22 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 75C473163; Sun, 2 Dec 2018 19:35:22 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB2JZM16023877; Sun, 2 Dec 2018 19:35:22 GMT (envelope-from andreast@FreeBSD.org) Received: (from andreast@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB2JZMgE023876; Sun, 2 Dec 2018 19:35:22 GMT (envelope-from andreast@FreeBSD.org) Message-Id: <201812021935.wB2JZMgE023876@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andreast set sender to andreast@FreeBSD.org using -f From: Andreas Tobler Date: Sun, 2 Dec 2018 19:35:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341404 - head/sys/modules/dtb/rockchip X-SVN-Group: head X-SVN-Commit-Author: andreast X-SVN-Commit-Paths: head/sys/modules/dtb/rockchip X-SVN-Commit-Revision: 341404 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 949CE7A22C X-Spamd-Result: default: False [0.33 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.04)[-0.037,0]; NEURAL_SPAM_LONG(0.00)[0.005,0]; NEURAL_SPAM_SHORT(0.37)[0.366,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Dec 2018 19:35:23 -0000 Author: andreast Date: Sun Dec 2 19:35:22 2018 New Revision: 341404 URL: https://svnweb.freebsd.org/changeset/base/341404 Log: Add rule to build the dtb for the rock64 board. Reviewed by: manu@ Added: head/sys/modules/dtb/rockchip/ head/sys/modules/dtb/rockchip/Makefile (contents, props changed) Added: head/sys/modules/dtb/rockchip/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/dtb/rockchip/Makefile Sun Dec 2 19:35:22 2018 (r341404) @@ -0,0 +1,7 @@ +# $FreeBSD$ +# For now only for rk3328-rock64 dts file. + +DTS= \ + rockchip/rk3328-rock64.dts + +.include From owner-svn-src-head@freebsd.org Sun Dec 2 19:36:21 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 01A00132B96B; Sun, 2 Dec 2018 19:36:21 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9BE437A3A8; Sun, 2 Dec 2018 19:36:20 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7D2193164; Sun, 2 Dec 2018 19:36:20 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB2JaKOw023981; Sun, 2 Dec 2018 19:36:20 GMT (envelope-from andreast@FreeBSD.org) Received: (from andreast@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB2JaKj3023980; Sun, 2 Dec 2018 19:36:20 GMT (envelope-from andreast@FreeBSD.org) Message-Id: <201812021936.wB2JaKj3023980@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andreast set sender to andreast@FreeBSD.org using -f From: Andreas Tobler Date: Sun, 2 Dec 2018 19:36:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341405 - head/sys/arm64/conf X-SVN-Group: head X-SVN-Commit-Author: andreast X-SVN-Commit-Paths: head/sys/arm64/conf X-SVN-Commit-Revision: 341405 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9BE437A3A8 X-Spamd-Result: default: False [0.20 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.10)[-0.104,0]; NEURAL_SPAM_SHORT(0.34)[0.342,0]; NEURAL_HAM_LONG(-0.04)[-0.041,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Dec 2018 19:36:21 -0000 Author: andreast Date: Sun Dec 2 19:36:20 2018 New Revision: 341405 URL: https://svnweb.freebsd.org/changeset/base/341405 Log: Build the dtb for the rock64 board. Reviewed by: manu@ Modified: head/sys/arm64/conf/GENERIC Modified: head/sys/arm64/conf/GENERIC ============================================================================== --- head/sys/arm64/conf/GENERIC Sun Dec 2 19:35:22 2018 (r341404) +++ head/sys/arm64/conf/GENERIC Sun Dec 2 19:36:20 2018 (r341405) @@ -285,4 +285,4 @@ options FDT device acpi # DTBs -makeoptions MODULES_EXTRA="dtb/allwinner" +makeoptions MODULES_EXTRA="dtb/allwinner dtb/rockchip" From owner-svn-src-head@freebsd.org Sun Dec 2 21:58:37 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 26CCC130A97A; Sun, 2 Dec 2018 21:58:37 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BD351801FB; Sun, 2 Dec 2018 21:58:36 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 99E574CFD; Sun, 2 Dec 2018 21:58:36 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB2LwaLm097306; Sun, 2 Dec 2018 21:58:36 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB2LwadF097305; Sun, 2 Dec 2018 21:58:36 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201812022158.wB2LwadF097305@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Sun, 2 Dec 2018 21:58:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341406 - head/sys/arm/mv X-SVN-Group: head X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: head/sys/arm/mv X-SVN-Commit-Revision: 341406 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: BD351801FB X-Spamd-Result: default: False [-0.13 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.04)[-0.037,0]; NEURAL_SPAM_LONG(0.00)[0.005,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_SHORT(-0.10)[-0.098,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Dec 2018 21:58:37 -0000 Author: gonzo Date: Sun Dec 2 21:58:36 2018 New Revision: 341406 URL: https://svnweb.freebsd.org/changeset/base/341406 Log: Fix PCI driver unload for Marvell PCI controller Add generic implementation for bus_deactivate_resource method. Without it bus_release_resource fails with "Failed to release active resource" message MFC after: 1 week Modified: head/sys/arm/mv/mv_pci_ctrl.c Modified: head/sys/arm/mv/mv_pci_ctrl.c ============================================================================== --- head/sys/arm/mv/mv_pci_ctrl.c Sun Dec 2 19:36:20 2018 (r341405) +++ head/sys/arm/mv/mv_pci_ctrl.c Sun Dec 2 21:58:36 2018 (r341406) @@ -97,6 +97,7 @@ static device_method_t mv_pcib_ctrl_methods[] = { DEVMETHOD(bus_alloc_resource, mv_pcib_ctrl_alloc_resource), DEVMETHOD(bus_release_resource, bus_generic_release_resource), DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), + DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), /* ofw_bus interface */ From owner-svn-src-head@freebsd.org Sun Dec 2 23:10:59 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 53B44130C85F; Sun, 2 Dec 2018 23:10:59 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0986582B51; Sun, 2 Dec 2018 23:10:59 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E001F588D; Sun, 2 Dec 2018 23:10:58 +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 wB2NAwlY034566; Sun, 2 Dec 2018 23:10:58 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB2NAuHc034019; Sun, 2 Dec 2018 23:10:56 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201812022310.wB2NAuHc034019@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 2 Dec 2018 23:10:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341407 - head/sbin/nvmecontrol X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sbin/nvmecontrol X-SVN-Commit-Revision: 341407 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0986582B51 X-Spamd-Result: default: False [0.07 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_SHORT(-0.12)[-0.119,0]; NEURAL_SPAM_LONG(0.10)[0.096,0]; NEURAL_SPAM_MEDIUM(0.10)[0.096,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Dec 2018 23:10:59 -0000 Author: imp Date: Sun Dec 2 23:10:55 2018 New Revision: 341407 URL: https://svnweb.freebsd.org/changeset/base/341407 Log: Move nvmecontrol to using linker sets for commands More commands will be added to nvmecontrol. Also, there will be a few more vendor commands (some of which may need to remain private to companies writing them). The first step on that journey is to move to using linker sets to dispatch commands. The next step will be using dlopen to bring in the .so's that have the command that might need to remain private for seamless integration. Similar changes to this will be needed for vendor specific log pages. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D18403 Modified: head/sbin/nvmecontrol/devlist.c head/sbin/nvmecontrol/firmware.c head/sbin/nvmecontrol/format.c head/sbin/nvmecontrol/identify.c head/sbin/nvmecontrol/logpage.c head/sbin/nvmecontrol/ns.c head/sbin/nvmecontrol/nvmecontrol.c head/sbin/nvmecontrol/nvmecontrol.h head/sbin/nvmecontrol/perftest.c head/sbin/nvmecontrol/power.c head/sbin/nvmecontrol/reset.c head/sbin/nvmecontrol/wdc.c Modified: head/sbin/nvmecontrol/devlist.c ============================================================================== --- head/sbin/nvmecontrol/devlist.c Sun Dec 2 21:58:36 2018 (r341406) +++ head/sbin/nvmecontrol/devlist.c Sun Dec 2 23:10:55 2018 (r341407) @@ -43,6 +43,9 @@ __FBSDID("$FreeBSD$"); #include "nvmecontrol.h" +#define DEVLIST_USAGE \ +" nvmecontrol devlist\n" + static void devlist_usage(void) { @@ -64,7 +67,7 @@ ns_get_sector_size(struct nvme_namespace_data *nsdata) return (1 << lbads); } -void +static void devlist(int argc, char *argv[]) { struct nvme_controller_data cdata; @@ -124,3 +127,5 @@ devlist(int argc, char *argv[]) exit(1); } + +NVME_COMMAND(top, devlist, devlist, DEVLIST_USAGE); Modified: head/sbin/nvmecontrol/firmware.c ============================================================================== --- head/sbin/nvmecontrol/firmware.c Sun Dec 2 21:58:36 2018 (r341406) +++ head/sbin/nvmecontrol/firmware.c Sun Dec 2 23:10:55 2018 (r341407) @@ -50,6 +50,10 @@ __FBSDID("$FreeBSD$"); #include "nvmecontrol.h" +#define FIRMWARE_USAGE \ +" nvmecontrol firmware [-s slot] [-f path_to_firmware] [-a] \n" + + static int slot_has_valid_firmware(int fd, int slot) { @@ -178,7 +182,7 @@ firmware_usage(void) exit(1); } -void +static void firmware(int argc, char *argv[]) { int fd = -1, slot = 0; @@ -338,3 +342,5 @@ firmware(int argc, char *argv[]) close(fd); exit(0); } + +NVME_COMMAND(top, firmware, firmware, FIRMWARE_USAGE); Modified: head/sbin/nvmecontrol/format.c ============================================================================== --- head/sbin/nvmecontrol/format.c Sun Dec 2 21:58:36 2018 (r341406) +++ head/sbin/nvmecontrol/format.c Sun Dec 2 23:10:55 2018 (r341407) @@ -43,6 +43,9 @@ __FBSDID("$FreeBSD$"); #include "nvmecontrol.h" +#define FORMAT_USAGE \ +" nvmecontrol format [-f fmt] [-m mset] [-p pi] [-l pil] [-E] [-C] \n" + static void format_usage(void) { @@ -51,7 +54,7 @@ format_usage(void) exit(1); } -void +static void format(int argc, char *argv[]) { struct nvme_controller_data cd; @@ -185,3 +188,5 @@ format(int argc, char *argv[]) close(fd); exit(0); } + +NVME_COMMAND(top, format, format, FORMAT_USAGE); Modified: head/sbin/nvmecontrol/identify.c ============================================================================== --- head/sbin/nvmecontrol/identify.c Sun Dec 2 21:58:36 2018 (r341406) +++ head/sbin/nvmecontrol/identify.c Sun Dec 2 23:10:55 2018 (r341407) @@ -43,6 +43,9 @@ __FBSDID("$FreeBSD$"); #include "nvmecontrol.h" #include "nvmecontrol_ext.h" +#define IDENTIFY_USAGE \ +" nvmecontrol identify [-x [-v]] \n" + static void print_namespace(struct nvme_namespace_data *nsdata) { @@ -265,7 +268,7 @@ identify_ns(int argc, char *argv[]) exit(0); } -void +static void identify(int argc, char *argv[]) { char *target; @@ -293,3 +296,5 @@ identify(int argc, char *argv[]) else identify_ns(argc, argv); } + +NVME_COMMAND(top, identify, identify, IDENTIFY_USAGE); Modified: head/sbin/nvmecontrol/logpage.c ============================================================================== --- head/sbin/nvmecontrol/logpage.c Sun Dec 2 21:58:36 2018 (r341406) +++ head/sbin/nvmecontrol/logpage.c Sun Dec 2 23:10:55 2018 (r341407) @@ -48,6 +48,9 @@ __FBSDID("$FreeBSD$"); #include "nvmecontrol.h" +#define LOGPAGE_USAGE \ +" nvmecontrol logpage <-p page_id> [-b] [-v vendor] [-x] \n" \ + #define DEFAULT_SIZE (4096) #define MAX_FW_SLOTS (7) @@ -908,7 +911,7 @@ logpage_help(void) exit(1); } -void +static void logpage(int argc, char *argv[]) { int fd; @@ -1031,3 +1034,5 @@ logpage(int argc, char *argv[]) close(fd); exit(0); } + +NVME_COMMAND(top, logpage, logpage, LOGPAGE_USAGE); Modified: head/sbin/nvmecontrol/ns.c ============================================================================== --- head/sbin/nvmecontrol/ns.c Sun Dec 2 21:58:36 2018 (r341406) +++ head/sbin/nvmecontrol/ns.c Sun Dec 2 23:10:55 2018 (r341407) @@ -41,6 +41,11 @@ __FBSDID("$FreeBSD$"); #include "nvmecontrol.h" +SET_DECLARE(ns, struct nvme_function); + +#define NS_USAGE \ +" nvmecontrol ns (create|delete|attach|detach)\n" + /* handles NVME_OPC_NAMESPACE_MANAGEMENT and ATTACHMENT admin cmds */ #define NSCREATE_USAGE \ @@ -60,13 +65,10 @@ void nsdelete(int argc, char *argv[]); void nsattach(int argc, char *argv[]); void nsdetach(int argc, char *argv[]); -static struct nvme_function ns_funcs[] = { - {"create", nscreate, NSCREATE_USAGE}, - {"delete", nsdelete, NSDELETE_USAGE}, - {"attach", nsattach, NSATTACH_USAGE}, - {"detach", nsdetach, NSDETACH_USAGE}, - {NULL, NULL, NULL}, -}; +NVME_COMMAND(ns, create, nscreate, NSCREATE_USAGE); +NVME_COMMAND(ns, delete, nsdelete, NSDELETE_USAGE); +NVME_COMMAND(ns, attach, nsattach, NSATTACH_USAGE); +NVME_COMMAND(ns, detach, nsdetach, NSDETACH_USAGE); static void nscreate_usage(void) @@ -466,9 +468,11 @@ nsdetach(int argc, char *argv[]) exit(0); } -void +static void ns(int argc, char *argv[]) { - dispatch(argc, argv, ns_funcs); + DISPATCH(argc, argv, ns); } + +NVME_COMMAND(top, ns, ns, NS_USAGE); Modified: head/sbin/nvmecontrol/nvmecontrol.c ============================================================================== --- head/sbin/nvmecontrol/nvmecontrol.c Sun Dec 2 21:58:36 2018 (r341406) +++ head/sbin/nvmecontrol/nvmecontrol.c Sun Dec 2 23:10:55 2018 (r341407) @@ -47,51 +47,39 @@ __FBSDID("$FreeBSD$"); #include "nvmecontrol.h" +SET_DECLARE(top, struct nvme_function); -static struct nvme_function funcs[] = { - {"devlist", devlist, DEVLIST_USAGE}, - {"identify", identify, IDENTIFY_USAGE}, - {"perftest", perftest, PERFTEST_USAGE}, - {"reset", reset, RESET_USAGE}, - {"logpage", logpage, LOGPAGE_USAGE}, - {"firmware", firmware, FIRMWARE_USAGE}, - {"format", format, FORMAT_USAGE}, - {"power", power, POWER_USAGE}, - {"wdc", wdc, WDC_USAGE}, - {"ns", ns, NS_USAGE}, - {NULL, NULL, NULL}, -}; - -void -gen_usage(struct nvme_function *f) +static void +gen_usage_set(struct nvme_function **f, struct nvme_function **flimit) { fprintf(stderr, "usage:\n"); - while (f->name != NULL) { - fprintf(stderr, "%s", f->usage); + while (f < flimit) { + fprintf(stderr, "%s", (*f)->usage); f++; } exit(1); } void -dispatch(int argc, char *argv[], struct nvme_function *tbl) +dispatch_set(int argc, char *argv[], struct nvme_function **tbl, + struct nvme_function **tbl_limit) { - struct nvme_function *f = tbl; + struct nvme_function **f = tbl; if (argv[1] == NULL) { - gen_usage(tbl); + gen_usage_set(tbl, tbl_limit); return; } - while (f->name != NULL) { - if (strcmp(argv[1], f->name) == 0) - f->fn(argc-1, &argv[1]); + while (f < tbl_limit) { + if (strcmp(argv[1], (*f)->name) == 0) + (*f)->fn(argc-1, &argv[1]); f++; } fprintf(stderr, "Unknown command: %s\n", argv[1]); - gen_usage(tbl); + gen_usage_set(tbl, tbl_limit); } static void @@ -243,9 +231,9 @@ main(int argc, char *argv[]) { if (argc < 2) - gen_usage(funcs); + gen_usage_set(SET_BEGIN(top), SET_LIMIT(top)); - dispatch(argc, argv, funcs); + DISPATCH(argc, argv, top); return (0); } Modified: head/sbin/nvmecontrol/nvmecontrol.h ============================================================================== --- head/sbin/nvmecontrol/nvmecontrol.h Sun Dec 2 21:58:36 2018 (r341406) +++ head/sbin/nvmecontrol/nvmecontrol.h Sun Dec 2 23:10:55 2018 (r341407) @@ -31,6 +31,7 @@ #ifndef __NVMECONTROL_H__ #define __NVMECONTROL_H__ +#include #include typedef void (*nvme_fn_t)(int argc, char *argv[]); @@ -41,53 +42,15 @@ struct nvme_function { const char *usage; }; +#define NVME_CMDSET(set, sym) DATA_SET(set, sym) +#define NVME_COMMAND(set, nam, function, usage_str) \ + static struct nvme_function function ## _nvme_cmd = \ + { .name = #nam, .fn = function, .usage = usage_str }; \ + NVME_CMDSET(set, function ## _nvme_cmd) + #define NVME_CTRLR_PREFIX "nvme" #define NVME_NS_PREFIX "ns" -#define DEVLIST_USAGE \ -" nvmecontrol devlist\n" - -#define IDENTIFY_USAGE \ -" nvmecontrol identify [-x [-v]] \n" - -#define PERFTEST_USAGE \ -" nvmecontrol perftest <-n num_threads> <-o read|write>\n" \ -" <-s size_in_bytes> <-t time_in_seconds>\n" \ -" <-i intr|wait> [-f refthread] [-p]\n" \ -" \n" - -#define RESET_USAGE \ -" nvmecontrol reset \n" - -#define LOGPAGE_USAGE \ -" nvmecontrol logpage <-p page_id> [-b] [-v vendor] [-x] \n" \ - -#define FIRMWARE_USAGE \ -" nvmecontrol firmware [-s slot] [-f path_to_firmware] [-a] \n" - -#define FORMAT_USAGE \ -" nvmecontrol format [-f fmt] [-m mset] [-p pi] [-l pil] [-E] [-C] \n" - -#define POWER_USAGE \ -" nvmecontrol power [-l] [-p new-state [-w workload-hint]] \n" - -#define WDC_USAGE \ -" nvmecontrol wdc (cap-diag|drive-log|get-crash-dump|purge|purge-montior)\n" - -#define NS_USAGE \ -" nvmecontrol ns (create|delete|attach|detach)\n" - -void devlist(int argc, char *argv[]); -void identify(int argc, char *argv[]); -void perftest(int argc, char *argv[]); -void reset(int argc, char *argv[]); -void logpage(int argc, char *argv[]); -void firmware(int argc, char *argv[]); -void format(int argc, char *argv[]); -void power(int argc, char *argv[]); -void wdc(int argc, char *argv[]); -void ns(int argc, char *argv[]); - int open_dev(const char *str, int *fd, int show_error, int exit_on_error); void parse_ns_str(const char *ns_str, char *ctrlr_str, uint32_t *nsid); void read_controller_data(int fd, struct nvme_controller_data *cdata); @@ -95,8 +58,12 @@ void read_namespace_data(int fd, uint32_t nsid, struct void print_hex(void *data, uint32_t length); void read_logpage(int fd, uint8_t log_page, uint32_t nsid, void *payload, uint32_t payload_size); -void gen_usage(struct nvme_function *); -void dispatch(int argc, char *argv[], struct nvme_function *f); + +void dispatch_set(int argc, char *argv[], struct nvme_function **tbl, + struct nvme_function **tbl_limit); + +#define DISPATCH(argc, argv, set) \ + dispatch_set(argc, argv, SET_BEGIN(set), SET_LIMIT(set)) /* Utility Routines */ /* Modified: head/sbin/nvmecontrol/perftest.c ============================================================================== --- head/sbin/nvmecontrol/perftest.c Sun Dec 2 21:58:36 2018 (r341406) +++ head/sbin/nvmecontrol/perftest.c Sun Dec 2 23:10:55 2018 (r341407) @@ -45,6 +45,12 @@ __FBSDID("$FreeBSD$"); #include "nvmecontrol.h" +#define PERFTEST_USAGE \ +" nvmecontrol perftest <-n num_threads> <-o read|write>\n" \ +" <-s size_in_bytes> <-t time_in_seconds>\n" \ +" <-i intr|wait> [-f refthread] [-p]\n" \ +" \n" + static void print_perftest(struct nvme_io_test *io_test, bool perthread) { @@ -76,7 +82,7 @@ perftest_usage(void) exit(1); } -void +static void perftest(int argc, char *argv[]) { struct nvme_io_test io_test; @@ -176,3 +182,5 @@ perftest(int argc, char *argv[]) print_perftest(&io_test, perthread); exit(0); } + +NVME_COMMAND(top, perftest, perftest, PERFTEST_USAGE); Modified: head/sbin/nvmecontrol/power.c ============================================================================== --- head/sbin/nvmecontrol/power.c Sun Dec 2 21:58:36 2018 (r341406) +++ head/sbin/nvmecontrol/power.c Sun Dec 2 23:10:55 2018 (r341407) @@ -44,6 +44,9 @@ __FBSDID("$FreeBSD$"); _Static_assert(sizeof(struct nvme_power_state) == 256 / NBBY, "nvme_power_state size wrong"); +#define POWER_USAGE \ +" nvmecontrol power [-l] [-p new-state [-w workload-hint]] \n" + static void power_usage(void) { @@ -133,7 +136,7 @@ power_show(int fd) printf("Current Power Mode is %d\n", pt.cpl.cdw0); } -void +static void power(int argc, char *argv[]) { struct nvme_controller_data cdata; @@ -193,3 +196,5 @@ out: close(fd); exit(0); } + +NVME_COMMAND(top, power, power, POWER_USAGE); Modified: head/sbin/nvmecontrol/reset.c ============================================================================== --- head/sbin/nvmecontrol/reset.c Sun Dec 2 21:58:36 2018 (r341406) +++ head/sbin/nvmecontrol/reset.c Sun Dec 2 23:10:55 2018 (r341407) @@ -41,6 +41,9 @@ __FBSDID("$FreeBSD$"); #include "nvmecontrol.h" +#define RESET_USAGE \ +" nvmecontrol reset \n" + static void reset_usage(void) { @@ -49,7 +52,7 @@ reset_usage(void) exit(1); } -void +static void reset(int argc, char *argv[]) { int ch, fd; @@ -71,3 +74,5 @@ reset(int argc, char *argv[]) exit(0); } + +NVME_COMMAND(top, reset, reset, RESET_USAGE); Modified: head/sbin/nvmecontrol/wdc.c ============================================================================== --- head/sbin/nvmecontrol/wdc.c Sun Dec 2 21:58:36 2018 (r341406) +++ head/sbin/nvmecontrol/wdc.c Sun Dec 2 23:10:55 2018 (r341407) @@ -42,6 +42,11 @@ __FBSDID("$FreeBSD$"); #include "nvmecontrol.h" +#define WDC_USAGE \ +" nvmecontrol wdc (cap-diag|drive-log|get-crash-dump|purge|purge-montior)\n" + +SET_DECLARE(wdc, struct nvme_function); + #define WDC_NVME_TOC_SIZE 8 #define WDC_NVME_CAP_DIAG_OPCODE 0xe6 @@ -51,10 +56,7 @@ static void wdc_cap_diag(int argc, char *argv[]); #define WDC_CAP_DIAG_USAGE "\tnvmecontrol wdc cap-diag [-o path-template]\n" -static struct nvme_function wdc_funcs[] = { - {"cap-diag", wdc_cap_diag, WDC_CAP_DIAG_USAGE}, - {NULL, NULL, NULL}, -}; +NVME_COMMAND(wdc, cap-diag, wdc_cap_diag, WDC_CAP_DIAG_USAGE); static void wdc_append_serial_name(int fd, char *buf, size_t len, const char *suffix) @@ -188,9 +190,11 @@ wdc_cap_diag(int argc, char *argv[]) exit(1); } -void +static void wdc(int argc, char *argv[]) { - dispatch(argc, argv, wdc_funcs); + DISPATCH(argc, argv, wdc); } + +NVME_COMMAND(top, wdc, wdc, WDC_USAGE); From owner-svn-src-head@freebsd.org Sun Dec 2 23:12:17 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 53F0E130CD34; Sun, 2 Dec 2018 23:12:17 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EFC7782F6A; Sun, 2 Dec 2018 23:12:16 +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 D169859EF; Sun, 2 Dec 2018 23:12:16 +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 wB2NCGcE036943; Sun, 2 Dec 2018 23:12:16 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB2NCGFF036940; Sun, 2 Dec 2018 23:12:16 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201812022312.wB2NCGFF036940@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 2 Dec 2018 23:12:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341408 - head/sbin/nvmecontrol X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sbin/nvmecontrol X-SVN-Commit-Revision: 341408 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: EFC7782F6A X-Spamd-Result: default: False [-0.03 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_SHORT(-0.11)[-0.108,0]; NEURAL_SPAM_LONG(0.05)[0.050,0]; NEURAL_SPAM_MEDIUM(0.03)[0.029,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Dec 2018 23:12:17 -0000 Author: imp Date: Sun Dec 2 23:12:16 2018 New Revision: 341408 URL: https://svnweb.freebsd.org/changeset/base/341408 Log: Make logpage functions a linker set. Move logpage function def to header. Convert all the logpage_function elements to elements of the linker set. Leave them all in logpage.c for the moment. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D18403 Modified: head/sbin/nvmecontrol/logpage.c head/sbin/nvmecontrol/nvmecontrol.h Modified: head/sbin/nvmecontrol/logpage.c ============================================================================== --- head/sbin/nvmecontrol/logpage.c Sun Dec 2 23:10:55 2018 (r341407) +++ head/sbin/nvmecontrol/logpage.c Sun Dec 2 23:12:16 2018 (r341408) @@ -48,14 +48,14 @@ __FBSDID("$FreeBSD$"); #include "nvmecontrol.h" +SET_DECLARE(logpage, struct logpage_function); + #define LOGPAGE_USAGE \ " nvmecontrol logpage <-p page_id> [-b] [-v vendor] [-x] \n" \ #define DEFAULT_SIZE (4096) #define MAX_FW_SLOTS (7) -typedef void (*print_fn_t)(const struct nvme_controller_data *cdata, void *buf, uint32_t size); - struct kv_name { uint32_t key; @@ -853,39 +853,40 @@ print_hgst_info_log(const struct nvme_controller_data * Make sure you keep all the pages of one vendor together so -v help * lists all the vendors pages. */ -static struct logpage_function { - uint8_t log_page; - const char *vendor; - const char *name; - print_fn_t print_fn; - size_t size; -} logfuncs[] = { - {NVME_LOG_ERROR, NULL, "Drive Error Log", - print_log_error, 0}, - {NVME_LOG_HEALTH_INFORMATION, NULL, "Health/SMART Data", - print_log_health, sizeof(struct nvme_health_information_page)}, - {NVME_LOG_FIRMWARE_SLOT, NULL, "Firmware Information", - print_log_firmware, sizeof(struct nvme_firmware_page)}, - {HGST_INFO_LOG, "hgst", "Detailed Health/SMART", - print_hgst_info_log, DEFAULT_SIZE}, - {HGST_INFO_LOG, "wdc", "Detailed Health/SMART", - print_hgst_info_log, DEFAULT_SIZE}, - {HGST_INFO_LOG, "wds", "Detailed Health/SMART", - print_hgst_info_log, DEFAULT_SIZE}, - {INTEL_LOG_TEMP_STATS, "intel", "Temperature Stats", - print_intel_temp_stats, sizeof(struct intel_log_temp_stats)}, - {INTEL_LOG_READ_LAT_LOG, "intel", "Read Latencies", - print_intel_read_lat_log, DEFAULT_SIZE}, - {INTEL_LOG_WRITE_LAT_LOG, "intel", "Write Latencies", - print_intel_write_lat_log, DEFAULT_SIZE}, - {INTEL_LOG_ADD_SMART, "intel", "Extra Health/SMART Data", - print_intel_add_smart, DEFAULT_SIZE}, - {INTEL_LOG_ADD_SMART, "samsung", "Extra Health/SMART Data", - print_intel_add_smart, DEFAULT_SIZE}, +NVME_LOGPAGE(error, + NVME_LOG_ERROR, NULL, "Drive Error Log", + print_log_error, 0); +NVME_LOGPAGE(health, + NVME_LOG_HEALTH_INFORMATION, NULL, "Health/SMART Data", + print_log_health, sizeof(struct nvme_health_information_page)); +NVME_LOGPAGE(fw, + NVME_LOG_FIRMWARE_SLOT, NULL, "Firmware Information", + print_log_firmware, sizeof(struct nvme_firmware_page)); +NVME_LOGPAGE(hgst_info, + HGST_INFO_LOG, "hgst", "Detailed Health/SMART", + print_hgst_info_log, DEFAULT_SIZE); +NVME_LOGPAGE(wdc_info, + HGST_INFO_LOG, "wdc", "Detailed Health/SMART", + print_hgst_info_log, DEFAULT_SIZE); +NVME_LOGPAGE(wds_info, + HGST_INFO_LOG, "wds", "Detailed Health/SMART", + print_hgst_info_log, DEFAULT_SIZE); +NVME_LOGPAGE(intel_temp, + INTEL_LOG_TEMP_STATS, "intel", "Temperature Stats", + print_intel_temp_stats, sizeof(struct intel_log_temp_stats)); +NVME_LOGPAGE(intel_rlat, + INTEL_LOG_READ_LAT_LOG, "intel", "Read Latencies", + print_intel_read_lat_log, DEFAULT_SIZE); +NVME_LOGPAGE(intel_wlat, + INTEL_LOG_WRITE_LAT_LOG, "intel", "Write Latencies", + print_intel_write_lat_log, DEFAULT_SIZE); +NVME_LOGPAGE(intel_smart, + INTEL_LOG_ADD_SMART, "intel", "Extra Health/SMART Data", + print_intel_add_smart, DEFAULT_SIZE); +NVME_LOGPAGE(samsung_smart, + INTEL_LOG_ADD_SMART, "samsung", "Extra Health/SMART Data", + print_intel_add_smart, DEFAULT_SIZE); - {0, NULL, NULL, NULL, 0}, -}; - static void logpage_usage(void) { @@ -897,15 +898,15 @@ logpage_usage(void) static void logpage_help(void) { - struct logpage_function *f; + struct logpage_function **f; const char *v; fprintf(stderr, "\n"); fprintf(stderr, "%-8s %-10s %s\n", "Page", "Vendor","Page Name"); fprintf(stderr, "-------- ---------- ----------\n"); - for (f = logfuncs; f->log_page > 0; f++) { - v = f->vendor == NULL ? "-" : f->vendor; - fprintf(stderr, "0x%02x %-10s %s\n", f->log_page, v, f->name); + for (f = SET_BEGIN(logpage); f < SET_LIMIT(logpage); f++) { + v = (*f)->vendor == NULL ? "-" : (*f)->vendor; + fprintf(stderr, "0x%02x %-10s %s\n", (*f)->log_page, v, (*f)->name); } exit(1); @@ -923,7 +924,7 @@ logpage(int argc, char *argv[]) uint32_t nsid, size; void *buf; const char *vendor = NULL; - struct logpage_function *f; + struct logpage_function **f; struct nvme_controller_data cdata; print_fn_t print_fn; uint8_t ns_smart; @@ -1009,14 +1010,14 @@ logpage(int argc, char *argv[]) * the page is vendor specific, don't match the print function * unless the vendors match. */ - for (f = logfuncs; f->log_page > 0; f++) { - if (f->vendor != NULL && vendor != NULL && - strcmp(f->vendor, vendor) != 0) + for (f = SET_BEGIN(logpage); f < SET_LIMIT(logpage); f++) { + if ((*f)->vendor != NULL && vendor != NULL && + strcmp((*f)->vendor, vendor) != 0) continue; - if (log_page != f->log_page) + if (log_page != (*f)->log_page) continue; - print_fn = f->print_fn; - size = f->size; + print_fn = (*f)->print_fn; + size = (*f)->size; break; } } Modified: head/sbin/nvmecontrol/nvmecontrol.h ============================================================================== --- head/sbin/nvmecontrol/nvmecontrol.h Sun Dec 2 23:10:55 2018 (r341407) +++ head/sbin/nvmecontrol/nvmecontrol.h Sun Dec 2 23:12:16 2018 (r341408) @@ -48,6 +48,27 @@ struct nvme_function { { .name = #nam, .fn = function, .usage = usage_str }; \ NVME_CMDSET(set, function ## _nvme_cmd) +typedef void (*print_fn_t)(const struct nvme_controller_data *cdata, void *buf, uint32_t size); + +struct logpage_function { + uint8_t log_page; + const char *vendor; + const char *name; + print_fn_t print_fn; + size_t size; +}; + +#define NVME_LOGPAGESET(sym) DATA_SET(logpage, sym) +#define NVME_LOGPAGE(unique, lp, vend, nam, fn, sz) \ + static struct logpage_function unique ## _lpf = { \ + .log_page = lp, \ + .vendor = vend, \ + .name = nam, \ + .print_fn = fn, \ + .size = sz, \ + } ; \ + NVME_LOGPAGESET(unique ## _lpf) + #define NVME_CTRLR_PREFIX "nvme" #define NVME_NS_PREFIX "ns" From owner-svn-src-head@freebsd.org Sun Dec 2 23:12:30 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 43325130CD78; Sun, 2 Dec 2018 23:12:30 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DED568317F; Sun, 2 Dec 2018 23:12:29 +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 7F70759FA; Sun, 2 Dec 2018 23:12:27 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB2NCRCc037695; Sun, 2 Dec 2018 23:12:27 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB2NCRqO037693; Sun, 2 Dec 2018 23:12:27 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201812022312.wB2NCRqO037693@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 2 Dec 2018 23:12:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341409 - head/sbin/nvmecontrol X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sbin/nvmecontrol X-SVN-Commit-Revision: 341409 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: DED568317F X-Spamd-Result: default: False [-0.13 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.04)[-0.037,0]; NEURAL_SPAM_LONG(0.00)[0.005,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_SHORT(-0.10)[-0.098,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Dec 2018 23:12:30 -0000 Author: imp Date: Sun Dec 2 23:12:26 2018 New Revision: 341409 URL: https://svnweb.freebsd.org/changeset/base/341409 Log: Move common logpage routines into nvmecontrol.h For the upcoming move of vendor specific code into vendor specific files, make the common logpage routines global and move them to nvmecontrol.h. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D18403 Modified: head/sbin/nvmecontrol/logpage.c head/sbin/nvmecontrol/nvmecontrol.h Modified: head/sbin/nvmecontrol/logpage.c ============================================================================== --- head/sbin/nvmecontrol/logpage.c Sun Dec 2 23:12:16 2018 (r341408) +++ head/sbin/nvmecontrol/logpage.c Sun Dec 2 23:12:26 2018 (r341409) @@ -53,16 +53,9 @@ SET_DECLARE(logpage, struct logpage_function); #define LOGPAGE_USAGE \ " nvmecontrol logpage <-p page_id> [-b] [-v vendor] [-x] \n" \ -#define DEFAULT_SIZE (4096) #define MAX_FW_SLOTS (7) -struct kv_name -{ - uint32_t key; - const char *name; -}; - -static const char * +const char * kv_lookup(const struct kv_name *kv, size_t kv_count, uint32_t key) { static char bad[32]; Modified: head/sbin/nvmecontrol/nvmecontrol.h ============================================================================== --- head/sbin/nvmecontrol/nvmecontrol.h Sun Dec 2 23:12:16 2018 (r341408) +++ head/sbin/nvmecontrol/nvmecontrol.h Sun Dec 2 23:12:26 2018 (r341409) @@ -69,6 +69,14 @@ struct logpage_function { } ; \ NVME_LOGPAGESET(unique ## _lpf) +#define DEFAULT_SIZE (4096) +struct kv_name { + uint32_t key; + const char *name; +}; + +const char *kv_lookup(const struct kv_name *kv, size_t kv_count, uint32_t key); + #define NVME_CTRLR_PREFIX "nvme" #define NVME_NS_PREFIX "ns" From owner-svn-src-head@freebsd.org Sun Dec 2 23:12:40 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1262D130CDC5; Sun, 2 Dec 2018 23:12:40 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BD04683243; Sun, 2 Dec 2018 23:12: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 24D8B5A03; Sun, 2 Dec 2018 23:12:38 +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 wB2NCcbs037753; Sun, 2 Dec 2018 23:12:38 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB2NCb6u037751; Sun, 2 Dec 2018 23:12:37 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201812022312.wB2NCb6u037751@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 2 Dec 2018 23:12:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341410 - head/sbin/nvmecontrol X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sbin/nvmecontrol X-SVN-Commit-Revision: 341410 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: BD04683243 X-Spamd-Result: default: False [0.17 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_SHORT(-0.13)[-0.129,0]; NEURAL_SPAM_LONG(0.14)[0.141,0]; NEURAL_SPAM_MEDIUM(0.16)[0.163,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Dec 2018 23:12:40 -0000 Author: imp Date: Sun Dec 2 23:12:37 2018 New Revision: 341410 URL: https://svnweb.freebsd.org/changeset/base/341410 Log: Move the hgst/wdc log page printing code into wdc.c These are all hgst/wdc specific, so move them into the wdc.c to live with the wdc command. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D18403 Modified: head/sbin/nvmecontrol/logpage.c head/sbin/nvmecontrol/wdc.c Modified: head/sbin/nvmecontrol/logpage.c ============================================================================== --- head/sbin/nvmecontrol/logpage.c Sun Dec 2 23:12:26 2018 (r341409) +++ head/sbin/nvmecontrol/logpage.c Sun Dec 2 23:12:37 2018 (r341410) @@ -441,405 +441,6 @@ print_intel_add_smart(const struct nvme_controller_dat } /* - * HGST's 0xc1 page. This is a grab bag of additional data. Please see - * https://www.hgst.com/sites/default/files/resources/US_SN150_ProdManual.pdf - * https://www.hgst.com/sites/default/files/resources/US_SN100_ProdManual.pdf - * Appendix A for details - */ - -typedef void (*subprint_fn_t)(void *buf, uint16_t subtype, uint8_t res, uint32_t size); - -struct subpage_print -{ - uint16_t key; - subprint_fn_t fn; -}; - -static void print_hgst_info_write_errors(void *buf, uint16_t subtype, uint8_t res, uint32_t size); -static void print_hgst_info_read_errors(void *buf, uint16_t subtype, uint8_t res, uint32_t size); -static void print_hgst_info_verify_errors(void *buf, uint16_t subtype, uint8_t res, uint32_t size); -static void print_hgst_info_self_test(void *buf, uint16_t subtype, uint8_t res, uint32_t size); -static void print_hgst_info_background_scan(void *buf, uint16_t subtype, uint8_t res, uint32_t size); -static void print_hgst_info_erase_errors(void *buf, uint16_t subtype, uint8_t res, uint32_t size); -static void print_hgst_info_erase_counts(void *buf, uint16_t subtype, uint8_t res, uint32_t size); -static void print_hgst_info_temp_history(void *buf, uint16_t subtype, uint8_t res, uint32_t size); -static void print_hgst_info_ssd_perf(void *buf, uint16_t subtype, uint8_t res, uint32_t size); -static void print_hgst_info_firmware_load(void *buf, uint16_t subtype, uint8_t res, uint32_t size); - -static struct subpage_print hgst_subpage[] = { - { 0x02, print_hgst_info_write_errors }, - { 0x03, print_hgst_info_read_errors }, - { 0x05, print_hgst_info_verify_errors }, - { 0x10, print_hgst_info_self_test }, - { 0x15, print_hgst_info_background_scan }, - { 0x30, print_hgst_info_erase_errors }, - { 0x31, print_hgst_info_erase_counts }, - { 0x32, print_hgst_info_temp_history }, - { 0x37, print_hgst_info_ssd_perf }, - { 0x38, print_hgst_info_firmware_load }, -}; - -/* Print a subpage that is basically just key value pairs */ -static void -print_hgst_info_subpage_gen(void *buf, uint16_t subtype __unused, uint32_t size, - const struct kv_name *kv, size_t kv_count) -{ - uint8_t *wsp, *esp; - uint16_t ptype; - uint8_t plen; - uint64_t param; - int i; - - wsp = buf; - esp = wsp + size; - while (wsp < esp) { - ptype = le16dec(wsp); - wsp += 2; - wsp++; /* Flags, just ignore */ - plen = *wsp++; - param = 0; - for (i = 0; i < plen; i++) - param |= (uint64_t)*wsp++ << (i * 8); - printf(" %-30s: %jd\n", kv_lookup(kv, kv_count, ptype), (uintmax_t)param); - } -} - -static void -print_hgst_info_write_errors(void *buf, uint16_t subtype, uint8_t res __unused, uint32_t size) -{ - static struct kv_name kv[] = - { - { 0x0000, "Corrected Without Delay" }, - { 0x0001, "Corrected Maybe Delayed" }, - { 0x0002, "Re-Writes" }, - { 0x0003, "Errors Corrected" }, - { 0x0004, "Correct Algorithm Used" }, - { 0x0005, "Bytes Processed" }, - { 0x0006, "Uncorrected Errors" }, - { 0x8000, "Flash Write Commands" }, - { 0x8001, "HGST Special" }, - }; - - printf("Write Errors Subpage:\n"); - print_hgst_info_subpage_gen(buf, subtype, size, kv, nitems(kv)); -} - -static void -print_hgst_info_read_errors(void *buf, uint16_t subtype, uint8_t res __unused, uint32_t size) -{ - static struct kv_name kv[] = - { - { 0x0000, "Corrected Without Delay" }, - { 0x0001, "Corrected Maybe Delayed" }, - { 0x0002, "Re-Reads" }, - { 0x0003, "Errors Corrected" }, - { 0x0004, "Correct Algorithm Used" }, - { 0x0005, "Bytes Processed" }, - { 0x0006, "Uncorrected Errors" }, - { 0x8000, "Flash Read Commands" }, - { 0x8001, "XOR Recovered" }, - { 0x8002, "Total Corrected Bits" }, - }; - - printf("Read Errors Subpage:\n"); - print_hgst_info_subpage_gen(buf, subtype, size, kv, nitems(kv)); -} - -static void -print_hgst_info_verify_errors(void *buf, uint16_t subtype, uint8_t res __unused, uint32_t size) -{ - static struct kv_name kv[] = - { - { 0x0000, "Corrected Without Delay" }, - { 0x0001, "Corrected Maybe Delayed" }, - { 0x0002, "Re-Reads" }, - { 0x0003, "Errors Corrected" }, - { 0x0004, "Correct Algorithm Used" }, - { 0x0005, "Bytes Processed" }, - { 0x0006, "Uncorrected Errors" }, - { 0x8000, "Commands Processed" }, - }; - - printf("Verify Errors Subpage:\n"); - print_hgst_info_subpage_gen(buf, subtype, size, kv, nitems(kv)); -} - -static void -print_hgst_info_self_test(void *buf, uint16_t subtype __unused, uint8_t res __unused, uint32_t size) -{ - size_t i; - uint8_t *walker = buf; - uint16_t code, hrs; - uint32_t lba; - - printf("Self Test Subpage:\n"); - for (i = 0; i < size / 20; i++) { /* Each entry is 20 bytes */ - code = le16dec(walker); - walker += 2; - walker++; /* Ignore fixed flags */ - if (*walker == 0) /* Last entry is zero length */ - break; - if (*walker++ != 0x10) { - printf("Bad length for self test report\n"); - return; - } - printf(" %-30s: %d\n", "Recent Test", code); - printf(" %-28s: %#x\n", "Self-Test Results", *walker & 0xf); - printf(" %-28s: %#x\n", "Self-Test Code", (*walker >> 5) & 0x7); - walker++; - printf(" %-28s: %#x\n", "Self-Test Number", *walker++); - hrs = le16dec(walker); - walker += 2; - lba = le32dec(walker); - walker += 4; - printf(" %-28s: %u\n", "Total Power On Hrs", hrs); - printf(" %-28s: %#jx (%jd)\n", "LBA", (uintmax_t)lba, (uintmax_t)lba); - printf(" %-28s: %#x\n", "Sense Key", *walker++ & 0xf); - printf(" %-28s: %#x\n", "Additional Sense Code", *walker++); - printf(" %-28s: %#x\n", "Additional Sense Qualifier", *walker++); - printf(" %-28s: %#x\n", "Vendor Specific Detail", *walker++); - } -} - -static void -print_hgst_info_background_scan(void *buf, uint16_t subtype __unused, uint8_t res __unused, uint32_t size) -{ - uint8_t *walker = buf; - uint8_t status; - uint16_t code, nscan, progress; - uint32_t pom, nand; - - printf("Background Media Scan Subpage:\n"); - /* Decode the header */ - code = le16dec(walker); - walker += 2; - walker++; /* Ignore fixed flags */ - if (*walker++ != 0x10) { - printf("Bad length for background scan header\n"); - return; - } - if (code != 0) { - printf("Expceted code 0, found code %#x\n", code); - return; - } - pom = le32dec(walker); - walker += 4; - walker++; /* Reserved */ - status = *walker++; - nscan = le16dec(walker); - walker += 2; - progress = le16dec(walker); - walker += 2; - walker += 6; /* Reserved */ - printf(" %-30s: %d\n", "Power On Minutes", pom); - printf(" %-30s: %x (%s)\n", "BMS Status", status, - status == 0 ? "idle" : (status == 1 ? "active" : (status == 8 ? "suspended" : "unknown"))); - printf(" %-30s: %d\n", "Number of BMS", nscan); - printf(" %-30s: %d\n", "Progress Current BMS", progress); - /* Report retirements */ - if (walker - (uint8_t *)buf != 20) { - printf("Coding error, offset not 20\n"); - return; - } - size -= 20; - printf(" %-30s: %d\n", "BMS retirements", size / 0x18); - while (size > 0) { - code = le16dec(walker); - walker += 2; - walker++; - if (*walker++ != 0x14) { - printf("Bad length parameter\n"); - return; - } - pom = le32dec(walker); - walker += 4; - /* - * Spec sheet says the following are hard coded, if true, just - * print the NAND retirement. - */ - if (walker[0] == 0x41 && - walker[1] == 0x0b && - walker[2] == 0x01 && - walker[3] == 0x00 && - walker[4] == 0x00 && - walker[5] == 0x00 && - walker[6] == 0x00 && - walker[7] == 0x00) { - walker += 8; - walker += 4; /* Skip reserved */ - nand = le32dec(walker); - walker += 4; - printf(" %-30s: %d\n", "Retirement number", code); - printf(" %-28s: %#x\n", "NAND (C/T)BBBPPP", nand); - } else { - printf("Parameter %#x entry corrupt\n", code); - walker += 16; - } - } -} - -static void -print_hgst_info_erase_errors(void *buf, uint16_t subtype __unused, uint8_t res __unused, uint32_t size) -{ - static struct kv_name kv[] = - { - { 0x0000, "Corrected Without Delay" }, - { 0x0001, "Corrected Maybe Delayed" }, - { 0x0002, "Re-Erase" }, - { 0x0003, "Errors Corrected" }, - { 0x0004, "Correct Algorithm Used" }, - { 0x0005, "Bytes Processed" }, - { 0x0006, "Uncorrected Errors" }, - { 0x8000, "Flash Erase Commands" }, - { 0x8001, "Mfg Defect Count" }, - { 0x8002, "Grown Defect Count" }, - { 0x8003, "Erase Count -- User" }, - { 0x8004, "Erase Count -- System" }, - }; - - printf("Erase Errors Subpage:\n"); - print_hgst_info_subpage_gen(buf, subtype, size, kv, nitems(kv)); -} - -static void -print_hgst_info_erase_counts(void *buf, uint16_t subtype, uint8_t res __unused, uint32_t size) -{ - /* My drive doesn't export this -- so not coding up */ - printf("XXX: Erase counts subpage: %p, %#x %d\n", buf, subtype, size); -} - -static void -print_hgst_info_temp_history(void *buf, uint16_t subtype __unused, uint8_t res __unused, uint32_t size __unused) -{ - uint8_t *walker = buf; - uint32_t min; - - printf("Temperature History:\n"); - printf(" %-30s: %d C\n", "Current Temperature", *walker++); - printf(" %-30s: %d C\n", "Reference Temperature", *walker++); - printf(" %-30s: %d C\n", "Maximum Temperature", *walker++); - printf(" %-30s: %d C\n", "Minimum Temperature", *walker++); - min = le32dec(walker); - walker += 4; - printf(" %-30s: %d:%02d:00\n", "Max Temperature Time", min / 60, min % 60); - min = le32dec(walker); - walker += 4; - printf(" %-30s: %d:%02d:00\n", "Over Temperature Duration", min / 60, min % 60); - min = le32dec(walker); - walker += 4; - printf(" %-30s: %d:%02d:00\n", "Min Temperature Time", min / 60, min % 60); -} - -static void -print_hgst_info_ssd_perf(void *buf, uint16_t subtype __unused, uint8_t res, uint32_t size __unused) -{ - uint8_t *walker = buf; - uint64_t val; - - printf("SSD Performance Subpage Type %d:\n", res); - val = le64dec(walker); - walker += 8; - printf(" %-30s: %ju\n", "Host Read Commands", val); - val = le64dec(walker); - walker += 8; - printf(" %-30s: %ju\n", "Host Read Blocks", val); - val = le64dec(walker); - walker += 8; - printf(" %-30s: %ju\n", "Host Cache Read Hits Commands", val); - val = le64dec(walker); - walker += 8; - printf(" %-30s: %ju\n", "Host Cache Read Hits Blocks", val); - val = le64dec(walker); - walker += 8; - printf(" %-30s: %ju\n", "Host Read Commands Stalled", val); - val = le64dec(walker); - walker += 8; - printf(" %-30s: %ju\n", "Host Write Commands", val); - val = le64dec(walker); - walker += 8; - printf(" %-30s: %ju\n", "Host Write Blocks", val); - val = le64dec(walker); - walker += 8; - printf(" %-30s: %ju\n", "Host Write Odd Start Commands", val); - val = le64dec(walker); - walker += 8; - printf(" %-30s: %ju\n", "Host Write Odd End Commands", val); - val = le64dec(walker); - walker += 8; - printf(" %-30s: %ju\n", "Host Write Commands Stalled", val); - val = le64dec(walker); - walker += 8; - printf(" %-30s: %ju\n", "NAND Read Commands", val); - val = le64dec(walker); - walker += 8; - printf(" %-30s: %ju\n", "NAND Read Blocks", val); - val = le64dec(walker); - walker += 8; - printf(" %-30s: %ju\n", "NAND Write Commands", val); - val = le64dec(walker); - walker += 8; - printf(" %-30s: %ju\n", "NAND Write Blocks", val); - val = le64dec(walker); - walker += 8; - printf(" %-30s: %ju\n", "NAND Read Before Writes", val); -} - -static void -print_hgst_info_firmware_load(void *buf, uint16_t subtype __unused, uint8_t res __unused, uint32_t size __unused) -{ - uint8_t *walker = buf; - - printf("Firmware Load Subpage:\n"); - printf(" %-30s: %d\n", "Firmware Downloads", le32dec(walker)); -} - -static void -kv_indirect(void *buf, uint32_t subtype, uint8_t res, uint32_t size, struct subpage_print *sp, size_t nsp) -{ - size_t i; - - for (i = 0; i < nsp; i++, sp++) { - if (sp->key == subtype) { - sp->fn(buf, subtype, res, size); - return; - } - } - printf("No handler for page type %x\n", subtype); -} - -static void -print_hgst_info_log(const struct nvme_controller_data *cdata __unused, void *buf, uint32_t size __unused) -{ - uint8_t *walker, *end, *subpage; - int pages; - uint16_t len; - uint8_t subtype, res; - - printf("HGST Extra Info Log\n"); - printf("===================\n"); - - walker = buf; - pages = *walker++; - walker++; - len = le16dec(walker); - walker += 2; - end = walker + len; /* Length is exclusive of this header */ - - while (walker < end) { - subpage = walker + 4; - subtype = *walker++ & 0x3f; /* subtype */ - res = *walker++; /* Reserved */ - len = le16dec(walker); - walker += len + 2; /* Length, not incl header */ - if (walker > end) { - printf("Ooops! Off the end of the list\n"); - break; - } - kv_indirect(subpage, subtype, res, len, hgst_subpage, nitems(hgst_subpage)); - } -} - -/* * Table of log page printer / sizing. * * This includes Intel specific pages that are widely implemented. @@ -855,15 +456,6 @@ NVME_LOGPAGE(health, NVME_LOGPAGE(fw, NVME_LOG_FIRMWARE_SLOT, NULL, "Firmware Information", print_log_firmware, sizeof(struct nvme_firmware_page)); -NVME_LOGPAGE(hgst_info, - HGST_INFO_LOG, "hgst", "Detailed Health/SMART", - print_hgst_info_log, DEFAULT_SIZE); -NVME_LOGPAGE(wdc_info, - HGST_INFO_LOG, "wdc", "Detailed Health/SMART", - print_hgst_info_log, DEFAULT_SIZE); -NVME_LOGPAGE(wds_info, - HGST_INFO_LOG, "wds", "Detailed Health/SMART", - print_hgst_info_log, DEFAULT_SIZE); NVME_LOGPAGE(intel_temp, INTEL_LOG_TEMP_STATS, "intel", "Temperature Stats", print_intel_temp_stats, sizeof(struct intel_log_temp_stats)); Modified: head/sbin/nvmecontrol/wdc.c ============================================================================== --- head/sbin/nvmecontrol/wdc.c Sun Dec 2 23:12:26 2018 (r341409) +++ head/sbin/nvmecontrol/wdc.c Sun Dec 2 23:12:37 2018 (r341410) @@ -197,4 +197,412 @@ wdc(int argc, char *argv[]) DISPATCH(argc, argv, wdc); } +/* + * HGST's 0xc1 page. This is a grab bag of additional data. Please see + * https://www.hgst.com/sites/default/files/resources/US_SN150_ProdManual.pdf + * https://www.hgst.com/sites/default/files/resources/US_SN100_ProdManual.pdf + * Appendix A for details + */ + +typedef void (*subprint_fn_t)(void *buf, uint16_t subtype, uint8_t res, uint32_t size); + +struct subpage_print +{ + uint16_t key; + subprint_fn_t fn; +}; + +static void print_hgst_info_write_errors(void *buf, uint16_t subtype, uint8_t res, uint32_t size); +static void print_hgst_info_read_errors(void *buf, uint16_t subtype, uint8_t res, uint32_t size); +static void print_hgst_info_verify_errors(void *buf, uint16_t subtype, uint8_t res, uint32_t size); +static void print_hgst_info_self_test(void *buf, uint16_t subtype, uint8_t res, uint32_t size); +static void print_hgst_info_background_scan(void *buf, uint16_t subtype, uint8_t res, uint32_t size); +static void print_hgst_info_erase_errors(void *buf, uint16_t subtype, uint8_t res, uint32_t size); +static void print_hgst_info_erase_counts(void *buf, uint16_t subtype, uint8_t res, uint32_t size); +static void print_hgst_info_temp_history(void *buf, uint16_t subtype, uint8_t res, uint32_t size); +static void print_hgst_info_ssd_perf(void *buf, uint16_t subtype, uint8_t res, uint32_t size); +static void print_hgst_info_firmware_load(void *buf, uint16_t subtype, uint8_t res, uint32_t size); + +static struct subpage_print hgst_subpage[] = { + { 0x02, print_hgst_info_write_errors }, + { 0x03, print_hgst_info_read_errors }, + { 0x05, print_hgst_info_verify_errors }, + { 0x10, print_hgst_info_self_test }, + { 0x15, print_hgst_info_background_scan }, + { 0x30, print_hgst_info_erase_errors }, + { 0x31, print_hgst_info_erase_counts }, + { 0x32, print_hgst_info_temp_history }, + { 0x37, print_hgst_info_ssd_perf }, + { 0x38, print_hgst_info_firmware_load }, +}; + +/* Print a subpage that is basically just key value pairs */ +static void +print_hgst_info_subpage_gen(void *buf, uint16_t subtype __unused, uint32_t size, + const struct kv_name *kv, size_t kv_count) +{ + uint8_t *wsp, *esp; + uint16_t ptype; + uint8_t plen; + uint64_t param; + int i; + + wsp = buf; + esp = wsp + size; + while (wsp < esp) { + ptype = le16dec(wsp); + wsp += 2; + wsp++; /* Flags, just ignore */ + plen = *wsp++; + param = 0; + for (i = 0; i < plen; i++) + param |= (uint64_t)*wsp++ << (i * 8); + printf(" %-30s: %jd\n", kv_lookup(kv, kv_count, ptype), (uintmax_t)param); + } +} + +static void +print_hgst_info_write_errors(void *buf, uint16_t subtype, uint8_t res __unused, uint32_t size) +{ + static struct kv_name kv[] = + { + { 0x0000, "Corrected Without Delay" }, + { 0x0001, "Corrected Maybe Delayed" }, + { 0x0002, "Re-Writes" }, + { 0x0003, "Errors Corrected" }, + { 0x0004, "Correct Algorithm Used" }, + { 0x0005, "Bytes Processed" }, + { 0x0006, "Uncorrected Errors" }, + { 0x8000, "Flash Write Commands" }, + { 0x8001, "HGST Special" }, + }; + + printf("Write Errors Subpage:\n"); + print_hgst_info_subpage_gen(buf, subtype, size, kv, nitems(kv)); +} + +static void +print_hgst_info_read_errors(void *buf, uint16_t subtype, uint8_t res __unused, uint32_t size) +{ + static struct kv_name kv[] = + { + { 0x0000, "Corrected Without Delay" }, + { 0x0001, "Corrected Maybe Delayed" }, + { 0x0002, "Re-Reads" }, + { 0x0003, "Errors Corrected" }, + { 0x0004, "Correct Algorithm Used" }, + { 0x0005, "Bytes Processed" }, + { 0x0006, "Uncorrected Errors" }, + { 0x8000, "Flash Read Commands" }, + { 0x8001, "XOR Recovered" }, + { 0x8002, "Total Corrected Bits" }, + }; + + printf("Read Errors Subpage:\n"); + print_hgst_info_subpage_gen(buf, subtype, size, kv, nitems(kv)); +} + +static void +print_hgst_info_verify_errors(void *buf, uint16_t subtype, uint8_t res __unused, uint32_t size) +{ + static struct kv_name kv[] = + { + { 0x0000, "Corrected Without Delay" }, + { 0x0001, "Corrected Maybe Delayed" }, + { 0x0002, "Re-Reads" }, + { 0x0003, "Errors Corrected" }, + { 0x0004, "Correct Algorithm Used" }, + { 0x0005, "Bytes Processed" }, + { 0x0006, "Uncorrected Errors" }, + { 0x8000, "Commands Processed" }, + }; + + printf("Verify Errors Subpage:\n"); + print_hgst_info_subpage_gen(buf, subtype, size, kv, nitems(kv)); +} + +static void +print_hgst_info_self_test(void *buf, uint16_t subtype __unused, uint8_t res __unused, uint32_t size) +{ + size_t i; + uint8_t *walker = buf; + uint16_t code, hrs; + uint32_t lba; + + printf("Self Test Subpage:\n"); + for (i = 0; i < size / 20; i++) { /* Each entry is 20 bytes */ + code = le16dec(walker); + walker += 2; + walker++; /* Ignore fixed flags */ + if (*walker == 0) /* Last entry is zero length */ + break; + if (*walker++ != 0x10) { + printf("Bad length for self test report\n"); + return; + } + printf(" %-30s: %d\n", "Recent Test", code); + printf(" %-28s: %#x\n", "Self-Test Results", *walker & 0xf); + printf(" %-28s: %#x\n", "Self-Test Code", (*walker >> 5) & 0x7); + walker++; + printf(" %-28s: %#x\n", "Self-Test Number", *walker++); + hrs = le16dec(walker); + walker += 2; + lba = le32dec(walker); + walker += 4; + printf(" %-28s: %u\n", "Total Power On Hrs", hrs); + printf(" %-28s: %#jx (%jd)\n", "LBA", (uintmax_t)lba, (uintmax_t)lba); + printf(" %-28s: %#x\n", "Sense Key", *walker++ & 0xf); + printf(" %-28s: %#x\n", "Additional Sense Code", *walker++); + printf(" %-28s: %#x\n", "Additional Sense Qualifier", *walker++); + printf(" %-28s: %#x\n", "Vendor Specific Detail", *walker++); + } +} + +static void +print_hgst_info_background_scan(void *buf, uint16_t subtype __unused, uint8_t res __unused, uint32_t size) +{ + uint8_t *walker = buf; + uint8_t status; + uint16_t code, nscan, progress; + uint32_t pom, nand; + + printf("Background Media Scan Subpage:\n"); + /* Decode the header */ + code = le16dec(walker); + walker += 2; + walker++; /* Ignore fixed flags */ + if (*walker++ != 0x10) { + printf("Bad length for background scan header\n"); + return; + } + if (code != 0) { + printf("Expceted code 0, found code %#x\n", code); + return; + } + pom = le32dec(walker); + walker += 4; + walker++; /* Reserved */ + status = *walker++; + nscan = le16dec(walker); + walker += 2; + progress = le16dec(walker); + walker += 2; + walker += 6; /* Reserved */ + printf(" %-30s: %d\n", "Power On Minutes", pom); + printf(" %-30s: %x (%s)\n", "BMS Status", status, + status == 0 ? "idle" : (status == 1 ? "active" : (status == 8 ? "suspended" : "unknown"))); + printf(" %-30s: %d\n", "Number of BMS", nscan); + printf(" %-30s: %d\n", "Progress Current BMS", progress); + /* Report retirements */ + if (walker - (uint8_t *)buf != 20) { + printf("Coding error, offset not 20\n"); + return; + } + size -= 20; + printf(" %-30s: %d\n", "BMS retirements", size / 0x18); + while (size > 0) { + code = le16dec(walker); + walker += 2; + walker++; + if (*walker++ != 0x14) { + printf("Bad length parameter\n"); + return; + } + pom = le32dec(walker); + walker += 4; + /* + * Spec sheet says the following are hard coded, if true, just + * print the NAND retirement. + */ + if (walker[0] == 0x41 && + walker[1] == 0x0b && + walker[2] == 0x01 && + walker[3] == 0x00 && + walker[4] == 0x00 && + walker[5] == 0x00 && + walker[6] == 0x00 && + walker[7] == 0x00) { + walker += 8; + walker += 4; /* Skip reserved */ + nand = le32dec(walker); + walker += 4; + printf(" %-30s: %d\n", "Retirement number", code); + printf(" %-28s: %#x\n", "NAND (C/T)BBBPPP", nand); + } else { + printf("Parameter %#x entry corrupt\n", code); + walker += 16; + } + } +} + +static void +print_hgst_info_erase_errors(void *buf, uint16_t subtype __unused, uint8_t res __unused, uint32_t size) +{ + static struct kv_name kv[] = + { + { 0x0000, "Corrected Without Delay" }, + { 0x0001, "Corrected Maybe Delayed" }, + { 0x0002, "Re-Erase" }, + { 0x0003, "Errors Corrected" }, + { 0x0004, "Correct Algorithm Used" }, + { 0x0005, "Bytes Processed" }, + { 0x0006, "Uncorrected Errors" }, + { 0x8000, "Flash Erase Commands" }, + { 0x8001, "Mfg Defect Count" }, + { 0x8002, "Grown Defect Count" }, + { 0x8003, "Erase Count -- User" }, + { 0x8004, "Erase Count -- System" }, + }; + + printf("Erase Errors Subpage:\n"); + print_hgst_info_subpage_gen(buf, subtype, size, kv, nitems(kv)); +} + +static void +print_hgst_info_erase_counts(void *buf, uint16_t subtype, uint8_t res __unused, uint32_t size) +{ + /* My drive doesn't export this -- so not coding up */ + printf("XXX: Erase counts subpage: %p, %#x %d\n", buf, subtype, size); +} + +static void +print_hgst_info_temp_history(void *buf, uint16_t subtype __unused, uint8_t res __unused, uint32_t size __unused) +{ + uint8_t *walker = buf; + uint32_t min; + + printf("Temperature History:\n"); + printf(" %-30s: %d C\n", "Current Temperature", *walker++); + printf(" %-30s: %d C\n", "Reference Temperature", *walker++); + printf(" %-30s: %d C\n", "Maximum Temperature", *walker++); + printf(" %-30s: %d C\n", "Minimum Temperature", *walker++); + min = le32dec(walker); + walker += 4; + printf(" %-30s: %d:%02d:00\n", "Max Temperature Time", min / 60, min % 60); + min = le32dec(walker); + walker += 4; + printf(" %-30s: %d:%02d:00\n", "Over Temperature Duration", min / 60, min % 60); + min = le32dec(walker); + walker += 4; + printf(" %-30s: %d:%02d:00\n", "Min Temperature Time", min / 60, min % 60); +} + +static void +print_hgst_info_ssd_perf(void *buf, uint16_t subtype __unused, uint8_t res, uint32_t size __unused) +{ + uint8_t *walker = buf; + uint64_t val; + + printf("SSD Performance Subpage Type %d:\n", res); + val = le64dec(walker); + walker += 8; + printf(" %-30s: %ju\n", "Host Read Commands", val); + val = le64dec(walker); + walker += 8; + printf(" %-30s: %ju\n", "Host Read Blocks", val); + val = le64dec(walker); + walker += 8; + printf(" %-30s: %ju\n", "Host Cache Read Hits Commands", val); + val = le64dec(walker); + walker += 8; + printf(" %-30s: %ju\n", "Host Cache Read Hits Blocks", val); + val = le64dec(walker); + walker += 8; + printf(" %-30s: %ju\n", "Host Read Commands Stalled", val); + val = le64dec(walker); + walker += 8; + printf(" %-30s: %ju\n", "Host Write Commands", val); + val = le64dec(walker); + walker += 8; + printf(" %-30s: %ju\n", "Host Write Blocks", val); + val = le64dec(walker); + walker += 8; + printf(" %-30s: %ju\n", "Host Write Odd Start Commands", val); + val = le64dec(walker); + walker += 8; + printf(" %-30s: %ju\n", "Host Write Odd End Commands", val); + val = le64dec(walker); + walker += 8; + printf(" %-30s: %ju\n", "Host Write Commands Stalled", val); + val = le64dec(walker); + walker += 8; + printf(" %-30s: %ju\n", "NAND Read Commands", val); + val = le64dec(walker); + walker += 8; + printf(" %-30s: %ju\n", "NAND Read Blocks", val); + val = le64dec(walker); + walker += 8; + printf(" %-30s: %ju\n", "NAND Write Commands", val); + val = le64dec(walker); + walker += 8; + printf(" %-30s: %ju\n", "NAND Write Blocks", val); + val = le64dec(walker); + walker += 8; + printf(" %-30s: %ju\n", "NAND Read Before Writes", val); +} + +static void +print_hgst_info_firmware_load(void *buf, uint16_t subtype __unused, uint8_t res __unused, uint32_t size __unused) +{ + uint8_t *walker = buf; + + printf("Firmware Load Subpage:\n"); + printf(" %-30s: %d\n", "Firmware Downloads", le32dec(walker)); +} + +static void +kv_indirect(void *buf, uint32_t subtype, uint8_t res, uint32_t size, struct subpage_print *sp, size_t nsp) +{ + size_t i; + + for (i = 0; i < nsp; i++, sp++) { + if (sp->key == subtype) { + sp->fn(buf, subtype, res, size); + return; + } + } + printf("No handler for page type %x\n", subtype); +} + +static void +print_hgst_info_log(const struct nvme_controller_data *cdata __unused, void *buf, uint32_t size __unused) +{ + uint8_t *walker, *end, *subpage; + int pages; + uint16_t len; + uint8_t subtype, res; + + printf("HGST Extra Info Log\n"); + printf("===================\n"); + + walker = buf; + pages = *walker++; + walker++; + len = le16dec(walker); + walker += 2; + end = walker + len; /* Length is exclusive of this header */ + + while (walker < end) { + subpage = walker + 4; + subtype = *walker++ & 0x3f; /* subtype */ + res = *walker++; /* Reserved */ + len = le16dec(walker); + walker += len + 2; /* Length, not incl header */ + if (walker > end) { + printf("Ooops! Off the end of the list\n"); + break; + } + kv_indirect(subpage, subtype, res, len, hgst_subpage, nitems(hgst_subpage)); + } +} + +NVME_LOGPAGE(hgst_info, + HGST_INFO_LOG, "hgst", "Detailed Health/SMART", + print_hgst_info_log, DEFAULT_SIZE); +NVME_LOGPAGE(wdc_info, + HGST_INFO_LOG, "wdc", "Detailed Health/SMART", + print_hgst_info_log, DEFAULT_SIZE); +NVME_LOGPAGE(wds_info, + HGST_INFO_LOG, "wds", "Detailed Health/SMART", + print_hgst_info_log, DEFAULT_SIZE); NVME_COMMAND(top, wdc, wdc, WDC_USAGE); From owner-svn-src-head@freebsd.org Sun Dec 2 23:12:51 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EE7D4130CE17; Sun, 2 Dec 2018 23:12:50 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BD8C8332F; Sun, 2 Dec 2018 23:12:50 +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 891E45A04; Sun, 2 Dec 2018 23:12:48 +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 wB2NCm6M037810; Sun, 2 Dec 2018 23:12:48 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB2NCmiV037809; Sun, 2 Dec 2018 23:12:48 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201812022312.wB2NCmiV037809@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 2 Dec 2018 23:12:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341411 - head/sbin/nvmecontrol X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sbin/nvmecontrol X-SVN-Commit-Revision: 341411 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4BD8C8332F X-Spamd-Result: default: False [-0.13 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.04)[-0.037,0]; NEURAL_SPAM_LONG(0.00)[0.005,0]; NEURAL_HAM_SHORT(-0.10)[-0.098,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Dec 2018 23:12:51 -0000 Author: imp Date: Sun Dec 2 23:12:48 2018 New Revision: 341411 URL: https://svnweb.freebsd.org/changeset/base/341411 Log: Return after we find the dispatched function. If the dispatched function doesn't exit, then we get can get a spurious function not found message. They all do exit, but this is a little cleaner. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D18403 Modified: head/sbin/nvmecontrol/nvmecontrol.c Modified: head/sbin/nvmecontrol/nvmecontrol.c ============================================================================== --- head/sbin/nvmecontrol/nvmecontrol.c Sun Dec 2 23:12:37 2018 (r341410) +++ head/sbin/nvmecontrol/nvmecontrol.c Sun Dec 2 23:12:48 2018 (r341411) @@ -73,8 +73,10 @@ dispatch_set(int argc, char *argv[], struct nvme_funct } while (f < tbl_limit) { - if (strcmp(argv[1], (*f)->name) == 0) + if (strcmp(argv[1], (*f)->name) == 0) { (*f)->fn(argc-1, &argv[1]); + return; + } f++; } From owner-svn-src-head@freebsd.org Sun Dec 2 23:13:02 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8E6BB130CE52; Sun, 2 Dec 2018 23:13:02 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3435E83437; Sun, 2 Dec 2018 23:13:02 +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 A83A45A05; Sun, 2 Dec 2018 23:13:01 +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 wB2ND1rW037882; Sun, 2 Dec 2018 23:13:01 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB2NCxM4037866; Sun, 2 Dec 2018 23:12:59 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201812022312.wB2NCxM4037866@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 2 Dec 2018 23:12:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341412 - head/sbin/nvmecontrol X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sbin/nvmecontrol X-SVN-Commit-Revision: 341412 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3435E83437 X-Spamd-Result: default: False [0.17 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_SHORT(-0.13)[-0.129,0]; NEURAL_SPAM_LONG(0.14)[0.141,0]; NEURAL_SPAM_MEDIUM(0.16)[0.163,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Dec 2018 23:13:03 -0000 Author: imp Date: Sun Dec 2 23:12:58 2018 New Revision: 341412 URL: https://svnweb.freebsd.org/changeset/base/341412 Log: Usage cleanup pt 1 Provide a usage() function that takes a struct nvme_function pointer and produces a usage mssage. Eliminate all now-redundant usage functions. Propigate the new argument through the program as needed. Use common routine to print usage. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D18403 Modified: head/sbin/nvmecontrol/devlist.c head/sbin/nvmecontrol/firmware.c head/sbin/nvmecontrol/format.c head/sbin/nvmecontrol/identify.c head/sbin/nvmecontrol/logpage.c head/sbin/nvmecontrol/ns.c head/sbin/nvmecontrol/nvmecontrol.c head/sbin/nvmecontrol/nvmecontrol.h head/sbin/nvmecontrol/perftest.c head/sbin/nvmecontrol/power.c head/sbin/nvmecontrol/reset.c head/sbin/nvmecontrol/wdc.c Modified: head/sbin/nvmecontrol/devlist.c ============================================================================== --- head/sbin/nvmecontrol/devlist.c Sun Dec 2 23:12:48 2018 (r341411) +++ head/sbin/nvmecontrol/devlist.c Sun Dec 2 23:12:58 2018 (r341412) @@ -46,14 +46,6 @@ __FBSDID("$FreeBSD$"); #define DEVLIST_USAGE \ " nvmecontrol devlist\n" -static void -devlist_usage(void) -{ - fprintf(stderr, "usage:\n"); - fprintf(stderr, DEVLIST_USAGE); - exit(1); -} - static inline uint32_t ns_get_sector_size(struct nvme_namespace_data *nsdata) { @@ -68,7 +60,7 @@ ns_get_sector_size(struct nvme_namespace_data *nsdata) } static void -devlist(int argc, char *argv[]) +devlist(struct nvme_function *nf, int argc, char *argv[]) { struct nvme_controller_data cdata; struct nvme_namespace_data nsdata; @@ -80,7 +72,7 @@ devlist(int argc, char *argv[]) while ((ch = getopt(argc, argv, "")) != -1) { switch ((char)ch) { default: - devlist_usage(); + usage(nf); } } Modified: head/sbin/nvmecontrol/firmware.c ============================================================================== --- head/sbin/nvmecontrol/firmware.c Sun Dec 2 23:12:48 2018 (r341411) +++ head/sbin/nvmecontrol/firmware.c Sun Dec 2 23:12:58 2018 (r341412) @@ -53,7 +53,6 @@ __FBSDID("$FreeBSD$"); #define FIRMWARE_USAGE \ " nvmecontrol firmware [-s slot] [-f path_to_firmware] [-a] \n" - static int slot_has_valid_firmware(int fd, int slot) { @@ -175,16 +174,8 @@ activate_firmware(int fd, int slot, int activate_actio } static void -firmware_usage(void) +firmware(struct nvme_function *nf, int argc, char *argv[]) { - fprintf(stderr, "usage:\n"); - fprintf(stderr, FIRMWARE_USAGE); - exit(1); -} - -static void -firmware(int argc, char *argv[]) -{ int fd = -1, slot = 0; int a_flag, s_flag, f_flag; int activate_action, reboot_required; @@ -210,18 +201,18 @@ firmware(int argc, char *argv[]) fprintf(stderr, "\"%s\" not valid slot.\n", optarg); - firmware_usage(); + usage(nf); } else if (slot == 0) { fprintf(stderr, "0 is not a valid slot number. " "Slot numbers start at 1.\n"); - firmware_usage(); + usage(nf); } else if (slot > 7) { fprintf(stderr, "Slot number %s specified which is " "greater than max allowed slot number of " "7.\n", optarg); - firmware_usage(); + usage(nf); } s_flag = true; break; @@ -234,20 +225,20 @@ firmware(int argc, char *argv[]) /* Check that a controller (and not a namespace) was specified. */ if (optind >= argc || strstr(argv[optind], NVME_NS_PREFIX) != NULL) - firmware_usage(); + usage(nf); if (!f_flag && !a_flag) { fprintf(stderr, "Neither a replace ([-f path_to_firmware]) nor " "activate ([-a]) firmware image action\n" "was specified.\n"); - firmware_usage(); + usage(nf); } if (!f_flag && a_flag && slot == 0) { fprintf(stderr, "Slot number to activate not specified.\n"); - firmware_usage(); + usage(nf); } controller = argv[optind]; Modified: head/sbin/nvmecontrol/format.c ============================================================================== --- head/sbin/nvmecontrol/format.c Sun Dec 2 23:12:48 2018 (r341411) +++ head/sbin/nvmecontrol/format.c Sun Dec 2 23:12:58 2018 (r341412) @@ -47,16 +47,8 @@ __FBSDID("$FreeBSD$"); " nvmecontrol format [-f fmt] [-m mset] [-p pi] [-l pil] [-E] [-C] \n" static void -format_usage(void) +format(struct nvme_function *nf, int argc, char *argv[]) { - fprintf(stderr, "usage:\n"); - fprintf(stderr, FORMAT_USAGE); - exit(1); -} - -static void -format(int argc, char *argv[]) -{ struct nvme_controller_data cd; struct nvme_namespace_data nsd; struct nvme_pt_command pt; @@ -67,7 +59,7 @@ format(int argc, char *argv[]) int lbaf = -1, mset = -1, pi = -1, pil = -1, ses = 0; if (argc < 2) - format_usage(); + usage(nf); while ((ch = getopt(argc, argv, "f:m:p:l:EC")) != -1) { switch ((char)ch) { @@ -94,13 +86,13 @@ format(int argc, char *argv[]) ses = 2; break; default: - format_usage(); + usage(nf); } } /* Check that a controller or namespace was specified. */ if (optind >= argc) - format_usage(); + usage(nf); target = argv[optind]; /* Modified: head/sbin/nvmecontrol/identify.c ============================================================================== --- head/sbin/nvmecontrol/identify.c Sun Dec 2 23:12:48 2018 (r341411) +++ head/sbin/nvmecontrol/identify.c Sun Dec 2 23:12:58 2018 (r341412) @@ -150,16 +150,8 @@ print_namespace(struct nvme_namespace_data *nsdata) } static void -identify_usage(void) +identify_ctrlr(struct nvme_function *nf, int argc, char *argv[]) { - fprintf(stderr, "usage:\n"); - fprintf(stderr, IDENTIFY_USAGE); - exit(1); -} - -static void -identify_ctrlr(int argc, char *argv[]) -{ struct nvme_controller_data cdata; int ch, fd, hexflag = 0, hexlength; int verboseflag = 0; @@ -173,13 +165,13 @@ identify_ctrlr(int argc, char *argv[]) hexflag = 1; break; default: - identify_usage(); + usage(nf); } } /* Check that a controller was specified. */ if (optind >= argc) - identify_usage(); + usage(nf); open_dev(argv[optind], &fd, 1, 1); read_controller_data(fd, &cdata); @@ -197,7 +189,7 @@ identify_ctrlr(int argc, char *argv[]) if (verboseflag == 1) { fprintf(stderr, "-v not currently supported without -x\n"); - identify_usage(); + usage(nf); } nvme_print_controller(&cdata); @@ -205,7 +197,7 @@ identify_ctrlr(int argc, char *argv[]) } static void -identify_ns(int argc, char *argv[]) +identify_ns(struct nvme_function *nf,int argc, char *argv[]) { struct nvme_namespace_data nsdata; char path[64]; @@ -222,13 +214,13 @@ identify_ns(int argc, char *argv[]) hexflag = 1; break; default: - identify_usage(); + usage(nf); } } /* Check that a namespace was specified. */ if (optind >= argc) - identify_usage(); + usage(nf); /* * Check if the specified device node exists before continuing. @@ -261,7 +253,7 @@ identify_ns(int argc, char *argv[]) if (verboseflag == 1) { fprintf(stderr, "-v not currently supported without -x\n"); - identify_usage(); + usage(nf); } print_namespace(&nsdata); @@ -269,18 +261,18 @@ identify_ns(int argc, char *argv[]) } static void -identify(int argc, char *argv[]) +identify(struct nvme_function *nf, int argc, char *argv[]) { char *target; if (argc < 2) - identify_usage(); + usage(nf); while (getopt(argc, argv, "vx") != -1) ; /* Check that a controller or namespace was specified. */ if (optind >= argc) - identify_usage(); + usage(nf); target = argv[optind]; @@ -292,9 +284,9 @@ identify(int argc, char *argv[]) * otherwise, consider it a controller. */ if (strstr(target, NVME_NS_PREFIX) == NULL) - identify_ctrlr(argc, argv); + identify_ctrlr(nf, argc, argv); else - identify_ns(argc, argv); + identify_ns(nf, argc, argv); } NVME_COMMAND(top, identify, identify, IDENTIFY_USAGE); Modified: head/sbin/nvmecontrol/logpage.c ============================================================================== --- head/sbin/nvmecontrol/logpage.c Sun Dec 2 23:12:48 2018 (r341411) +++ head/sbin/nvmecontrol/logpage.c Sun Dec 2 23:12:58 2018 (r341412) @@ -473,14 +473,6 @@ NVME_LOGPAGE(samsung_smart, print_intel_add_smart, DEFAULT_SIZE); static void -logpage_usage(void) -{ - fprintf(stderr, "usage:\n"); - fprintf(stderr, LOGPAGE_USAGE); - exit(1); -} - -static void logpage_help(void) { struct logpage_function **f; @@ -498,7 +490,7 @@ logpage_help(void) } static void -logpage(int argc, char *argv[]) +logpage(struct nvme_function *nf, int argc, char *argv[]) { int fd; int log_page = 0, pageflag = false; @@ -529,7 +521,7 @@ logpage(int argc, char *argv[]) fprintf(stderr, "\"%s\" not valid log page id.\n", optarg); - logpage_usage(); + usage(nf); } pageflag = true; break; @@ -546,12 +538,12 @@ logpage(int argc, char *argv[]) if (!pageflag) { printf("Missing page_id (-p).\n"); - logpage_usage(); + usage(nf); } /* Check that a controller and/or namespace was specified. */ if (optind >= argc) - logpage_usage(); + usage(nf); if (strstr(argv[optind], NVME_NS_PREFIX) != NULL) { ns_specified = true; Modified: head/sbin/nvmecontrol/ns.c ============================================================================== --- head/sbin/nvmecontrol/ns.c Sun Dec 2 23:12:48 2018 (r341411) +++ head/sbin/nvmecontrol/ns.c Sun Dec 2 23:12:58 2018 (r341412) @@ -60,48 +60,16 @@ SET_DECLARE(ns, struct nvme_function); #define NSDETACH_USAGE \ " nvmecontrol ns detach -n nsid [-c ctrlrid] nvmeN\n" -void nscreate(int argc, char *argv[]); -void nsdelete(int argc, char *argv[]); -void nsattach(int argc, char *argv[]); -void nsdetach(int argc, char *argv[]); +void nscreate(struct nvme_function *nf, int argc, char *argv[]); +void nsdelete(struct nvme_function *nf, int argc, char *argv[]); +void nsattach(struct nvme_function *nf, int argc, char *argv[]); +void nsdetach(struct nvme_function *nf, int argc, char *argv[]); NVME_COMMAND(ns, create, nscreate, NSCREATE_USAGE); NVME_COMMAND(ns, delete, nsdelete, NSDELETE_USAGE); NVME_COMMAND(ns, attach, nsattach, NSATTACH_USAGE); NVME_COMMAND(ns, detach, nsdetach, NSDETACH_USAGE); -static void -nscreate_usage(void) -{ - fprintf(stderr, "usage:\n"); - fprintf(stderr, NSCREATE_USAGE); - exit(1); -} - -static void -nsdelete_usage(void) -{ - fprintf(stderr, "usage:\n"); - fprintf(stderr, NSDELETE_USAGE); - exit(1); -} - -static void -nsattach_usage(void) -{ - fprintf(stderr, "usage:\n"); - fprintf(stderr, NSATTACH_USAGE); - exit(1); -} - -static void -nsdetach_usage(void) -{ - fprintf(stderr, "usage:\n"); - fprintf(stderr, NSDETACH_USAGE); - exit(1); -} - struct ns_result_str { uint16_t res; const char * str; @@ -142,7 +110,7 @@ get_res_str(uint16_t res) * 0xb = Thin Provisioning Not supported */ void -nscreate(int argc, char *argv[]) +nscreate(struct nvme_function *nf, int argc, char *argv[]) { struct nvme_pt_command pt; struct nvme_controller_data cd; @@ -151,7 +119,7 @@ nscreate(int argc, char *argv[]) int ch, fd, result, lbaf = 0, mset = 0, nmic = -1, pi = 0, pil = 0; if (optind >= argc) - nscreate_usage(); + usage(nf); while ((ch = getopt(argc, argv, "s:c:f:m:n:p:l:")) != -1) { switch (ch) { @@ -177,17 +145,17 @@ nscreate(int argc, char *argv[]) pil = strtol(optarg, NULL, 0); break; default: - nscreate_usage(); + usage(nf); } } if (optind >= argc) - nscreate_usage(); + usage(nf); if (cap == -1) cap = nsze; if (nsze == -1 || cap == -1) - nscreate_usage(); + usage(nf); open_dev(argv[optind], &fd, 1, 1); read_controller_data(fd, &cd); @@ -237,7 +205,7 @@ nscreate(int argc, char *argv[]) } void -nsdelete(int argc, char *argv[]) +nsdelete(struct nvme_function *nf, int argc, char *argv[]) { struct nvme_pt_command pt; struct nvme_controller_data cd; @@ -245,7 +213,7 @@ nsdelete(int argc, char *argv[]) char buf[2]; if (optind >= argc) - nsdelete_usage(); + usage(nf); while ((ch = getopt(argc, argv, "n:")) != -1) { switch ((char)ch) { @@ -253,12 +221,12 @@ nsdelete(int argc, char *argv[]) nsid = strtol(optarg, (char **)NULL, 0); break; default: - nsdelete_usage(); + usage(nf); } } if (optind >= argc || nsid == -2) - nsdelete_usage(); + usage(nf); open_dev(argv[optind], &fd, 1, 1); read_controller_data(fd, &cd); @@ -304,7 +272,7 @@ nsdelete(int argc, char *argv[]) * 0x2 Invalid Field can occur if ctrlrid d.n.e in system. */ void -nsattach(int argc, char *argv[]) +nsattach(struct nvme_function *nf, int argc, char *argv[]) { struct nvme_pt_command pt; struct nvme_controller_data cd; @@ -313,7 +281,7 @@ nsattach(int argc, char *argv[]) uint16_t clist[2048]; if (optind >= argc) - nsattach_usage(); + usage(nf); while ((ch = getopt(argc, argv, "n:c:")) != -1) { switch (ch) { @@ -324,15 +292,15 @@ nsattach(int argc, char *argv[]) ctrlrid = strtol(optarg, (char **)NULL, 0); break; default: - nsattach_usage(); + usage(nf); } } if (optind >= argc) - nsattach_usage(); + usage(nf); if (nsid == -1 ) - nsattach_usage(); + usage(nf); open_dev(argv[optind], &fd, 1, 1); read_controller_data(fd, &cd); @@ -383,7 +351,7 @@ nsattach(int argc, char *argv[]) } void -nsdetach(int argc, char *argv[]) +nsdetach(struct nvme_function *nf, int argc, char *argv[]) { struct nvme_pt_command pt; struct nvme_controller_data cd; @@ -392,7 +360,7 @@ nsdetach(int argc, char *argv[]) uint16_t clist[2048]; if (optind >= argc) - nsdetach_usage(); + usage(nf); while ((ch = getopt(argc, argv, "n:c:")) != -1) { switch (ch) { @@ -403,15 +371,15 @@ nsdetach(int argc, char *argv[]) ctrlrid = strtol(optarg, (char **)NULL, 0); break; default: - nsdetach_usage(); + usage(nf); } } if (optind >= argc) - nsdetach_usage(); + usage(nf); if (nsid == -1) - nsdetach_usage(); + usage(nf); open_dev(argv[optind], &fd, 1, 1); read_controller_data(fd, &cd); @@ -469,7 +437,7 @@ nsdetach(int argc, char *argv[]) } static void -ns(int argc, char *argv[]) +ns(struct nvme_function *nf __unused, int argc, char *argv[]) { DISPATCH(argc, argv, ns); Modified: head/sbin/nvmecontrol/nvmecontrol.c ============================================================================== --- head/sbin/nvmecontrol/nvmecontrol.c Sun Dec 2 23:12:48 2018 (r341411) +++ head/sbin/nvmecontrol/nvmecontrol.c Sun Dec 2 23:12:58 2018 (r341412) @@ -50,18 +50,33 @@ __FBSDID("$FreeBSD$"); SET_DECLARE(top, struct nvme_function); static void +print_usage(const struct nvme_function *f) +{ + fprintf(stderr, "%s", f->usage); +} + +static void gen_usage_set(struct nvme_function **f, struct nvme_function **flimit) { fprintf(stderr, "usage:\n"); while (f < flimit) { - fprintf(stderr, "%s", (*f)->usage); + print_usage(*f); f++; } exit(1); } void +usage(const struct nvme_function *f) +{ + + fprintf(stderr, "usage:\n"); + print_usage(f); + exit(1); +} + +void dispatch_set(int argc, char *argv[], struct nvme_function **tbl, struct nvme_function **tbl_limit) { @@ -74,7 +89,7 @@ dispatch_set(int argc, char *argv[], struct nvme_funct while (f < tbl_limit) { if (strcmp(argv[1], (*f)->name) == 0) { - (*f)->fn(argc-1, &argv[1]); + (*f)->fn(*f, argc-1, &argv[1]); return; } f++; Modified: head/sbin/nvmecontrol/nvmecontrol.h ============================================================================== --- head/sbin/nvmecontrol/nvmecontrol.h Sun Dec 2 23:12:48 2018 (r341411) +++ head/sbin/nvmecontrol/nvmecontrol.h Sun Dec 2 23:12:58 2018 (r341412) @@ -34,7 +34,8 @@ #include #include -typedef void (*nvme_fn_t)(int argc, char *argv[]); +struct nvme_function; +typedef void (*nvme_fn_t)(struct nvme_function *nf, int argc, char *argv[]); struct nvme_function { const char *name; @@ -88,6 +89,7 @@ void print_hex(void *data, uint32_t length); void read_logpage(int fd, uint8_t log_page, uint32_t nsid, void *payload, uint32_t payload_size); +void usage(const struct nvme_function *f); void dispatch_set(int argc, char *argv[], struct nvme_function **tbl, struct nvme_function **tbl_limit); Modified: head/sbin/nvmecontrol/perftest.c ============================================================================== --- head/sbin/nvmecontrol/perftest.c Sun Dec 2 23:12:48 2018 (r341411) +++ head/sbin/nvmecontrol/perftest.c Sun Dec 2 23:12:58 2018 (r341412) @@ -75,16 +75,8 @@ print_perftest(struct nvme_io_test *io_test, bool pert } static void -perftest_usage(void) +perftest(struct nvme_function *nf, int argc, char *argv[]) { - fprintf(stderr, "usage:\n"); - fprintf(stderr, PERFTEST_USAGE); - exit(1); -} - -static void -perftest(int argc, char *argv[]) -{ struct nvme_io_test io_test; int fd; int opt; @@ -118,13 +110,13 @@ perftest(int argc, char *argv[]) fprintf(stderr, "\"%s\" not valid number of threads.\n", optarg); - perftest_usage(); + usage(nf); } else if (io_test.num_threads == 0 || io_test.num_threads > 128) { fprintf(stderr, "\"%s\" not valid number of threads.\n", optarg); - perftest_usage(); + usage(nf); } break; case 'o': @@ -137,7 +129,7 @@ perftest(int argc, char *argv[]) else { fprintf(stderr, "\"%s\" not valid opcode.\n", optarg); - perftest_usage(); + usage(nf); } break; case 'p': @@ -155,7 +147,7 @@ perftest(int argc, char *argv[]) } else { fprintf(stderr, "\"%s\" not valid size.\n", optarg); - perftest_usage(); + usage(nf); } break; case 't': @@ -165,14 +157,15 @@ perftest(int argc, char *argv[]) fprintf(stderr, "\"%s\" not valid time duration.\n", optarg); - perftest_usage(); + usage(nf); } break; } } if (!nflag || !oflag || !sflag || !tflag || optind >= argc) - perftest_usage(); + usage(nf); + open_dev(argv[optind], &fd, 1, 1); if (ioctl(fd, ioctl_cmd, &io_test) < 0) Modified: head/sbin/nvmecontrol/power.c ============================================================================== --- head/sbin/nvmecontrol/power.c Sun Dec 2 23:12:48 2018 (r341411) +++ head/sbin/nvmecontrol/power.c Sun Dec 2 23:12:58 2018 (r341412) @@ -48,14 +48,6 @@ _Static_assert(sizeof(struct nvme_power_state) == 256 " nvmecontrol power [-l] [-p new-state [-w workload-hint]] \n" static void -power_usage(void) -{ - fprintf(stderr, "usage:\n"); - fprintf(stderr, POWER_USAGE); - exit(1); -} - -static void power_list_one(int i, struct nvme_power_state *nps) { int mpower, apower, ipower; @@ -137,7 +129,7 @@ power_show(int fd) } static void -power(int argc, char *argv[]) +power(struct nvme_function *nf, int argc, char *argv[]) { struct nvme_controller_data cdata; int ch, listflag = 0, powerflag = 0, power_val = 0, fd; @@ -154,28 +146,28 @@ power(int argc, char *argv[]) power_val = strtol(optarg, &end, 0); if (*end != '\0') { fprintf(stderr, "Invalid power state number: %s\n", optarg); - power_usage(); + usage(nf); } break; case 'w': workload = strtol(optarg, &end, 0); if (*end != '\0') { fprintf(stderr, "Invalid workload hint: %s\n", optarg); - power_usage(); + usage(nf); } break; default: - power_usage(); + usage(nf); } } /* Check that a controller was specified. */ if (optind >= argc) - power_usage(); + usage(nf); if (listflag && powerflag) { fprintf(stderr, "Can't set power and list power states\n"); - power_usage(); + usage(nf); } open_dev(argv[optind], &fd, 1, 1); Modified: head/sbin/nvmecontrol/reset.c ============================================================================== --- head/sbin/nvmecontrol/reset.c Sun Dec 2 23:12:48 2018 (r341411) +++ head/sbin/nvmecontrol/reset.c Sun Dec 2 23:12:58 2018 (r341412) @@ -45,28 +45,20 @@ __FBSDID("$FreeBSD$"); " nvmecontrol reset \n" static void -reset_usage(void) +reset(struct nvme_function *nf, int argc, char *argv[]) { - fprintf(stderr, "usage:\n"); - fprintf(stderr, RESET_USAGE); - exit(1); -} - -static void -reset(int argc, char *argv[]) -{ int ch, fd; while ((ch = getopt(argc, argv, "")) != -1) { switch ((char)ch) { default: - reset_usage(); + usage(nf); } } /* Check that a controller was specified. */ if (optind >= argc) - reset_usage(); + usage(nf); open_dev(argv[optind], &fd, 1, 1); if (ioctl(fd, NVME_RESET_CONTROLLER) < 0) Modified: head/sbin/nvmecontrol/wdc.c ============================================================================== --- head/sbin/nvmecontrol/wdc.c Sun Dec 2 23:12:48 2018 (r341411) +++ head/sbin/nvmecontrol/wdc.c Sun Dec 2 23:12:58 2018 (r341412) @@ -52,7 +52,7 @@ SET_DECLARE(wdc, struct nvme_function); #define WDC_NVME_CAP_DIAG_OPCODE 0xe6 #define WDC_NVME_CAP_DIAG_CMD 0x0000 -static void wdc_cap_diag(int argc, char *argv[]); +static void wdc_cap_diag(struct nvme_function *nf, int argc, char *argv[]); #define WDC_CAP_DIAG_USAGE "\tnvmecontrol wdc cap-diag [-o path-template]\n" @@ -154,16 +154,8 @@ wdc_do_dump(int fd, char *tmpl, const char *suffix, ui } static void -wdc_cap_diag_usage(void) +wdc_cap_diag(struct nvme_function *nf, int argc, char *argv[]) { - fprintf(stderr, "usage:\n"); - fprintf(stderr, WDC_CAP_DIAG_USAGE); - exit(1); -} - -static void -wdc_cap_diag(int argc, char *argv[]) -{ char path_tmpl[MAXPATHLEN]; int ch, fd; @@ -174,12 +166,12 @@ wdc_cap_diag(int argc, char *argv[]) strlcpy(path_tmpl, optarg, MAXPATHLEN); break; default: - wdc_cap_diag_usage(); + usage(nf); } } /* Check that a controller was specified. */ if (optind >= argc) - wdc_cap_diag_usage(); + usage(nf); open_dev(argv[optind], &fd, 1, 1); wdc_do_dump(fd, path_tmpl, "cap_diag", WDC_NVME_CAP_DIAG_OPCODE, @@ -191,7 +183,7 @@ wdc_cap_diag(int argc, char *argv[]) } static void -wdc(int argc, char *argv[]) +wdc(struct nvme_function *nf __unused, int argc, char *argv[]) { DISPATCH(argc, argv, wdc); From owner-svn-src-head@freebsd.org Sun Dec 2 23:13:20 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 403E6130CE9A; Sun, 2 Dec 2018 23:13:20 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BFA22835A0; Sun, 2 Dec 2018 23:13:16 +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 A3BAD5A07; Sun, 2 Dec 2018 23:13:14 +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 wB2NDERB037949; Sun, 2 Dec 2018 23:13:14 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB2NDCtR037938; Sun, 2 Dec 2018 23:13:12 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201812022313.wB2NDCtR037938@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 2 Dec 2018 23:13:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341413 - head/sbin/nvmecontrol X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sbin/nvmecontrol X-SVN-Commit-Revision: 341413 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: BFA22835A0 X-Spamd-Result: default: False [0.07 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_SHORT(-0.12)[-0.119,0]; NEURAL_SPAM_LONG(0.10)[0.096,0]; NEURAL_SPAM_MEDIUM(0.10)[0.096,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Dec 2018 23:13:20 -0000 Author: imp Date: Sun Dec 2 23:13:12 2018 New Revision: 341413 URL: https://svnweb.freebsd.org/changeset/base/341413 Log: Usage cleanup pt 2 Eliminage redundant spaces and nvmecontrol at start of all the usage strings. Update the usage printing code to add them back when presenting to the user. Allow multi-line usage messages and print proper leading spaces for lines starting with a space. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D18403 Modified: head/sbin/nvmecontrol/devlist.c head/sbin/nvmecontrol/firmware.c head/sbin/nvmecontrol/format.c head/sbin/nvmecontrol/identify.c head/sbin/nvmecontrol/logpage.c head/sbin/nvmecontrol/ns.c head/sbin/nvmecontrol/nvmecontrol.c head/sbin/nvmecontrol/perftest.c head/sbin/nvmecontrol/power.c head/sbin/nvmecontrol/reset.c head/sbin/nvmecontrol/wdc.c Modified: head/sbin/nvmecontrol/devlist.c ============================================================================== --- head/sbin/nvmecontrol/devlist.c Sun Dec 2 23:12:58 2018 (r341412) +++ head/sbin/nvmecontrol/devlist.c Sun Dec 2 23:13:12 2018 (r341413) @@ -44,7 +44,7 @@ __FBSDID("$FreeBSD$"); #include "nvmecontrol.h" #define DEVLIST_USAGE \ -" nvmecontrol devlist\n" + "devlist\n" static inline uint32_t ns_get_sector_size(struct nvme_namespace_data *nsdata) Modified: head/sbin/nvmecontrol/firmware.c ============================================================================== --- head/sbin/nvmecontrol/firmware.c Sun Dec 2 23:12:58 2018 (r341412) +++ head/sbin/nvmecontrol/firmware.c Sun Dec 2 23:13:12 2018 (r341413) @@ -51,7 +51,7 @@ __FBSDID("$FreeBSD$"); #include "nvmecontrol.h" #define FIRMWARE_USAGE \ -" nvmecontrol firmware [-s slot] [-f path_to_firmware] [-a] \n" + "firmware [-s slot] [-f path_to_firmware] [-a] \n" static int slot_has_valid_firmware(int fd, int slot) Modified: head/sbin/nvmecontrol/format.c ============================================================================== --- head/sbin/nvmecontrol/format.c Sun Dec 2 23:12:58 2018 (r341412) +++ head/sbin/nvmecontrol/format.c Sun Dec 2 23:13:12 2018 (r341413) @@ -44,7 +44,7 @@ __FBSDID("$FreeBSD$"); #include "nvmecontrol.h" #define FORMAT_USAGE \ -" nvmecontrol format [-f fmt] [-m mset] [-p pi] [-l pil] [-E] [-C] \n" + "format [-f fmt] [-m mset] [-p pi] [-l pil] [-E] [-C] \n" static void format(struct nvme_function *nf, int argc, char *argv[]) Modified: head/sbin/nvmecontrol/identify.c ============================================================================== --- head/sbin/nvmecontrol/identify.c Sun Dec 2 23:12:58 2018 (r341412) +++ head/sbin/nvmecontrol/identify.c Sun Dec 2 23:13:12 2018 (r341413) @@ -44,7 +44,7 @@ __FBSDID("$FreeBSD$"); #include "nvmecontrol_ext.h" #define IDENTIFY_USAGE \ -" nvmecontrol identify [-x [-v]] \n" + "identify [-x [-v]] \n" static void print_namespace(struct nvme_namespace_data *nsdata) Modified: head/sbin/nvmecontrol/logpage.c ============================================================================== --- head/sbin/nvmecontrol/logpage.c Sun Dec 2 23:12:58 2018 (r341412) +++ head/sbin/nvmecontrol/logpage.c Sun Dec 2 23:13:12 2018 (r341413) @@ -51,7 +51,7 @@ __FBSDID("$FreeBSD$"); SET_DECLARE(logpage, struct logpage_function); #define LOGPAGE_USAGE \ -" nvmecontrol logpage <-p page_id> [-b] [-v vendor] [-x] \n" \ + "logpage <-p page_id> [-b] [-v vendor] [-x] \n" \ #define MAX_FW_SLOTS (7) Modified: head/sbin/nvmecontrol/ns.c ============================================================================== --- head/sbin/nvmecontrol/ns.c Sun Dec 2 23:12:58 2018 (r341412) +++ head/sbin/nvmecontrol/ns.c Sun Dec 2 23:13:12 2018 (r341413) @@ -43,22 +43,22 @@ __FBSDID("$FreeBSD$"); SET_DECLARE(ns, struct nvme_function); -#define NS_USAGE \ -" nvmecontrol ns (create|delete|attach|detach)\n" +#define NS_USAGE \ + "ns (create|delete|attach|detach)\n" /* handles NVME_OPC_NAMESPACE_MANAGEMENT and ATTACHMENT admin cmds */ #define NSCREATE_USAGE \ -" nvmecontrol ns create -s size [-c cap] [-f fmt] [-m mset] [-n nmic] [-p pi] [-l pil] nvmeN\n" + "ns create -s size [-c cap] [-f fmt] [-m mset] [-n nmic] [-p pi] [-l pil] nvmeN\n" #define NSDELETE_USAGE \ -" nvmecontrol ns delete -n nsid nvmeN\n" + "ns delete -n nsid nvmeN\n" #define NSATTACH_USAGE \ -" nvmecontrol ns attach -n nsid [-c ctrlrid] nvmeN \n" + "ns attach -n nsid [-c ctrlrid] nvmeN \n" #define NSDETACH_USAGE \ -" nvmecontrol ns detach -n nsid [-c ctrlrid] nvmeN\n" + "ns detach -n nsid [-c ctrlrid] nvmeN\n" void nscreate(struct nvme_function *nf, int argc, char *argv[]); void nsdelete(struct nvme_function *nf, int argc, char *argv[]); Modified: head/sbin/nvmecontrol/nvmecontrol.c ============================================================================== --- head/sbin/nvmecontrol/nvmecontrol.c Sun Dec 2 23:12:58 2018 (r341412) +++ head/sbin/nvmecontrol/nvmecontrol.c Sun Dec 2 23:13:12 2018 (r341413) @@ -52,7 +52,24 @@ SET_DECLARE(top, struct nvme_function); static void print_usage(const struct nvme_function *f) { - fprintf(stderr, "%s", f->usage); + const char *cp; + char ch; + bool need_prefix = true; + + cp = f->usage; + while (*cp) { + ch = *cp++; + if (need_prefix) { + if (ch != ' ') + fputs(" nvmecontrol ", stderr); + else + fputs(" ", stderr); + } + fputc(ch, stderr); + need_prefix = (ch == '\n'); + } + if (!need_prefix) + fputc('\n', stderr); } static void Modified: head/sbin/nvmecontrol/perftest.c ============================================================================== --- head/sbin/nvmecontrol/perftest.c Sun Dec 2 23:12:58 2018 (r341412) +++ head/sbin/nvmecontrol/perftest.c Sun Dec 2 23:13:12 2018 (r341413) @@ -46,10 +46,10 @@ __FBSDID("$FreeBSD$"); #include "nvmecontrol.h" #define PERFTEST_USAGE \ -" nvmecontrol perftest <-n num_threads> <-o read|write>\n" \ -" <-s size_in_bytes> <-t time_in_seconds>\n" \ -" <-i intr|wait> [-f refthread] [-p]\n" \ -" \n" + "perftest <-n num_threads> <-o read|write>\n" \ + " <-s size_in_bytes> <-t time_in_seconds>\n" \ + " <-i intr|wait> [-f refthread] [-p]\n" \ + " \n" static void print_perftest(struct nvme_io_test *io_test, bool perthread) Modified: head/sbin/nvmecontrol/power.c ============================================================================== --- head/sbin/nvmecontrol/power.c Sun Dec 2 23:12:58 2018 (r341412) +++ head/sbin/nvmecontrol/power.c Sun Dec 2 23:13:12 2018 (r341413) @@ -45,7 +45,7 @@ _Static_assert(sizeof(struct nvme_power_state) == 256 "nvme_power_state size wrong"); #define POWER_USAGE \ -" nvmecontrol power [-l] [-p new-state [-w workload-hint]] \n" + "power [-l] [-p new-state [-w workload-hint]] \n" static void power_list_one(int i, struct nvme_power_state *nps) Modified: head/sbin/nvmecontrol/reset.c ============================================================================== --- head/sbin/nvmecontrol/reset.c Sun Dec 2 23:12:58 2018 (r341412) +++ head/sbin/nvmecontrol/reset.c Sun Dec 2 23:13:12 2018 (r341413) @@ -42,7 +42,7 @@ __FBSDID("$FreeBSD$"); #include "nvmecontrol.h" #define RESET_USAGE \ -" nvmecontrol reset \n" + "reset \n" static void reset(struct nvme_function *nf, int argc, char *argv[]) Modified: head/sbin/nvmecontrol/wdc.c ============================================================================== --- head/sbin/nvmecontrol/wdc.c Sun Dec 2 23:12:58 2018 (r341412) +++ head/sbin/nvmecontrol/wdc.c Sun Dec 2 23:13:12 2018 (r341413) @@ -43,7 +43,7 @@ __FBSDID("$FreeBSD$"); #include "nvmecontrol.h" #define WDC_USAGE \ -" nvmecontrol wdc (cap-diag|drive-log|get-crash-dump|purge|purge-montior)\n" + "wdc (cap-diag)\n" SET_DECLARE(wdc, struct nvme_function); @@ -54,7 +54,7 @@ SET_DECLARE(wdc, struct nvme_function); static void wdc_cap_diag(struct nvme_function *nf, int argc, char *argv[]); -#define WDC_CAP_DIAG_USAGE "\tnvmecontrol wdc cap-diag [-o path-template]\n" +#define WDC_CAP_DIAG_USAGE "wdc cap-diag [-o path-template]\n" NVME_COMMAND(wdc, cap-diag, wdc_cap_diag, WDC_CAP_DIAG_USAGE); From owner-svn-src-head@freebsd.org Sun Dec 2 23:13:29 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E52EC130CEF6; Sun, 2 Dec 2018 23:13:26 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0858C8363F; Sun, 2 Dec 2018 23:13:26 +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 B783E5A08; Sun, 2 Dec 2018 23:13:25 +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 wB2NDPBY038009; Sun, 2 Dec 2018 23:13:25 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB2NDPMb038005; Sun, 2 Dec 2018 23:13:25 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201812022313.wB2NDPMb038005@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 2 Dec 2018 23:13:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341414 - head/sbin/nvmecontrol X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sbin/nvmecontrol X-SVN-Commit-Revision: 341414 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0858C8363F X-Spamd-Result: default: False [0.07 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_SPAM_MEDIUM(0.10)[0.096,0]; NEURAL_HAM_SHORT(-0.12)[-0.119,0]; NEURAL_SPAM_LONG(0.10)[0.096,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Dec 2018 23:13:29 -0000 Author: imp Date: Sun Dec 2 23:13:24 2018 New Revision: 341414 URL: https://svnweb.freebsd.org/changeset/base/341414 Log: Move Intel specific log pages to intel.c Move the Intel specific log pages (including the one that samsung implements) to intel.c. Add comment to the samsung vendor that it will be going away soon. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D18403 Added: head/sbin/nvmecontrol/intel.c (contents, props changed) Modified: head/sbin/nvmecontrol/Makefile head/sbin/nvmecontrol/logpage.c head/sbin/nvmecontrol/nvmecontrol.h Modified: head/sbin/nvmecontrol/Makefile ============================================================================== --- head/sbin/nvmecontrol/Makefile Sun Dec 2 23:13:12 2018 (r341413) +++ head/sbin/nvmecontrol/Makefile Sun Dec 2 23:13:24 2018 (r341414) @@ -3,7 +3,8 @@ PACKAGE=runtime PROG= nvmecontrol SRCS= nvmecontrol.c devlist.c firmware.c format.c identify.c identify_ext.c logpage.c \ - perftest.c reset.c ns.c nvme_util.c power.c nc_util.c wdc.c + perftest.c reset.c ns.c nvme_util.c power.c nc_util.c +SRCS+= wdc.c intel.c MAN= nvmecontrol.8 .PATH: ${SRCTOP}/sys/dev/nvme Added: head/sbin/nvmecontrol/intel.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/nvmecontrol/intel.c Sun Dec 2 23:13:24 2018 (r341414) @@ -0,0 +1,198 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2013 EMC Corp. + * All rights reserved. + * + * Copyright (C) 2012-2013 Intel Corporation + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "nvmecontrol.h" + +/* + * Intel specific log pages from + * http://www.intel.com/content/dam/www/public/us/en/documents/product-specifications/ssd-dc-p3700-spec.pdf + * + * Though the version as of this date has a typo for the size of log page 0xca, + * offset 147: it is only 1 byte, not 6. + */ +static void +print_intel_temp_stats(const struct nvme_controller_data *cdata __unused, void *buf, uint32_t size __unused) +{ + struct intel_log_temp_stats *temp = buf; + + printf("Intel Temperature Log\n"); + printf("=====================\n"); + + printf("Current: "); + print_temp(temp->current); + printf("Overtemp Last Flags %#jx\n", (uintmax_t)temp->overtemp_flag_last); + printf("Overtemp Lifetime Flags %#jx\n", (uintmax_t)temp->overtemp_flag_life); + printf("Max Temperature "); + print_temp(temp->max_temp); + printf("Min Temperature "); + print_temp(temp->min_temp); + printf("Max Operating Temperature "); + print_temp(temp->max_oper_temp); + printf("Min Operating Temperature "); + print_temp(temp->min_oper_temp); + printf("Estimated Temperature Offset: %ju C/K\n", (uintmax_t)temp->est_offset); +} + +/* + * Format from Table 22, section 5.7 IO Command Latency Statistics. + * Read and write stats pages have identical encoding. + */ +static void +print_intel_read_write_lat_log(const struct nvme_controller_data *cdata __unused, void *buf, uint32_t size __unused) +{ + const char *walker = buf; + int i; + + printf("Major: %d\n", le16dec(walker + 0)); + printf("Minor: %d\n", le16dec(walker + 2)); + for (i = 0; i < 32; i++) + printf("%4dus-%4dus: %ju\n", i * 32, (i + 1) * 32, (uintmax_t)le32dec(walker + 4 + i * 4)); + for (i = 1; i < 32; i++) + printf("%4dms-%4dms: %ju\n", i, i + 1, (uintmax_t)le32dec(walker + 132 + i * 4)); + for (i = 1; i < 32; i++) + printf("%4dms-%4dms: %ju\n", i * 32, (i + 1) * 32, (uintmax_t)le32dec(walker + 256 + i * 4)); +} + +static void +print_intel_read_lat_log(const struct nvme_controller_data *cdata __unused, void *buf, uint32_t size) +{ + + printf("Intel Read Latency Log\n"); + printf("======================\n"); + print_intel_read_write_lat_log(cdata, buf, size); +} + +static void +print_intel_write_lat_log(const struct nvme_controller_data *cdata __unused, void *buf, uint32_t size) +{ + + printf("Intel Write Latency Log\n"); + printf("=======================\n"); + print_intel_read_write_lat_log(cdata, buf, size); +} + +/* + * Table 19. 5.4 SMART Attributes. Samsung also implements this and some extra data not documented. + */ +static void +print_intel_add_smart(const struct nvme_controller_data *cdata __unused, void *buf, uint32_t size __unused) +{ + uint8_t *walker = buf; + uint8_t *end = walker + 150; + const char *name; + uint64_t raw; + uint8_t normalized; + + static struct kv_name kv[] = + { + { 0xab, "Program Fail Count" }, + { 0xac, "Erase Fail Count" }, + { 0xad, "Wear Leveling Count" }, + { 0xb8, "End to End Error Count" }, + { 0xc7, "CRC Error Count" }, + { 0xe2, "Timed: Media Wear" }, + { 0xe3, "Timed: Host Read %" }, + { 0xe4, "Timed: Elapsed Time" }, + { 0xea, "Thermal Throttle Status" }, + { 0xf0, "Retry Buffer Overflows" }, + { 0xf3, "PLL Lock Loss Count" }, + { 0xf4, "NAND Bytes Written" }, + { 0xf5, "Host Bytes Written" }, + }; + + printf("Additional SMART Data Log\n"); + printf("=========================\n"); + /* + * walker[0] = Key + * walker[1,2] = reserved + * walker[3] = Normalized Value + * walker[4] = reserved + * walker[5..10] = Little Endian Raw value + * (or other represenations) + * walker[11] = reserved + */ + while (walker < end) { + name = kv_lookup(kv, nitems(kv), *walker); + normalized = walker[3]; + raw = le48dec(walker + 5); + switch (*walker){ + case 0: + break; + case 0xad: + printf("%-32s: %3d min: %u max: %u ave: %u\n", name, normalized, + le16dec(walker + 5), le16dec(walker + 7), le16dec(walker + 9)); + break; + case 0xe2: + printf("%-32s: %3d %.3f%%\n", name, normalized, raw / 1024.0); + break; + case 0xea: + printf("%-32s: %3d %d%% %d times\n", name, normalized, walker[5], le32dec(walker+6)); + break; + default: + printf("%-32s: %3d %ju\n", name, normalized, (uintmax_t)raw); + break; + } + walker += 12; + } +} + +NVME_LOGPAGE(intel_temp, + INTEL_LOG_TEMP_STATS, "intel", "Temperature Stats", + print_intel_temp_stats, sizeof(struct intel_log_temp_stats)); +NVME_LOGPAGE(intel_rlat, + INTEL_LOG_READ_LAT_LOG, "intel", "Read Latencies", + print_intel_read_lat_log, DEFAULT_SIZE); +NVME_LOGPAGE(intel_wlat, + INTEL_LOG_WRITE_LAT_LOG, "intel", "Write Latencies", + print_intel_write_lat_log, DEFAULT_SIZE); +NVME_LOGPAGE(intel_smart, + INTEL_LOG_ADD_SMART, "intel", "Extra Health/SMART Data", + print_intel_add_smart, DEFAULT_SIZE); +NVME_LOGPAGE(samsung_smart, /* NOTE, this will be deleted before 13.0 */ + INTEL_LOG_ADD_SMART, "samsung", "Extra Health/SMART Data", + print_intel_add_smart, DEFAULT_SIZE); Modified: head/sbin/nvmecontrol/logpage.c ============================================================================== --- head/sbin/nvmecontrol/logpage.c Sun Dec 2 23:13:12 2018 (r341413) +++ head/sbin/nvmecontrol/logpage.c Sun Dec 2 23:13:24 2018 (r341414) @@ -191,7 +191,7 @@ print_log_error(const struct nvme_controller_data *cda } } -static void +void print_temp(uint16_t t) { printf("%u K, %2.2f C, %3.2f F\n", t, (float)t - 273.15, (float)t * 9 / 5 - 459.67); @@ -308,142 +308,8 @@ print_log_firmware(const struct nvme_controller_data * } /* - * Intel specific log pages from - * http://www.intel.com/content/dam/www/public/us/en/documents/product-specifications/ssd-dc-p3700-spec.pdf - * - * Though the version as of this date has a typo for the size of log page 0xca, - * offset 147: it is only 1 byte, not 6. - */ -static void -print_intel_temp_stats(const struct nvme_controller_data *cdata __unused, void *buf, uint32_t size __unused) -{ - struct intel_log_temp_stats *temp = buf; - - printf("Intel Temperature Log\n"); - printf("=====================\n"); - - printf("Current: "); - print_temp(temp->current); - printf("Overtemp Last Flags %#jx\n", (uintmax_t)temp->overtemp_flag_last); - printf("Overtemp Lifetime Flags %#jx\n", (uintmax_t)temp->overtemp_flag_life); - printf("Max Temperature "); - print_temp(temp->max_temp); - printf("Min Temperature "); - print_temp(temp->min_temp); - printf("Max Operating Temperature "); - print_temp(temp->max_oper_temp); - printf("Min Operating Temperature "); - print_temp(temp->min_oper_temp); - printf("Estimated Temperature Offset: %ju C/K\n", (uintmax_t)temp->est_offset); -} - -/* - * Format from Table 22, section 5.7 IO Command Latency Statistics. - * Read and write stats pages have identical encoding. - */ -static void -print_intel_read_write_lat_log(const struct nvme_controller_data *cdata __unused, void *buf, uint32_t size __unused) -{ - const char *walker = buf; - int i; - - printf("Major: %d\n", le16dec(walker + 0)); - printf("Minor: %d\n", le16dec(walker + 2)); - for (i = 0; i < 32; i++) - printf("%4dus-%4dus: %ju\n", i * 32, (i + 1) * 32, (uintmax_t)le32dec(walker + 4 + i * 4)); - for (i = 1; i < 32; i++) - printf("%4dms-%4dms: %ju\n", i, i + 1, (uintmax_t)le32dec(walker + 132 + i * 4)); - for (i = 1; i < 32; i++) - printf("%4dms-%4dms: %ju\n", i * 32, (i + 1) * 32, (uintmax_t)le32dec(walker + 256 + i * 4)); -} - -static void -print_intel_read_lat_log(const struct nvme_controller_data *cdata __unused, void *buf, uint32_t size) -{ - - printf("Intel Read Latency Log\n"); - printf("======================\n"); - print_intel_read_write_lat_log(cdata, buf, size); -} - -static void -print_intel_write_lat_log(const struct nvme_controller_data *cdata __unused, void *buf, uint32_t size) -{ - - printf("Intel Write Latency Log\n"); - printf("=======================\n"); - print_intel_read_write_lat_log(cdata, buf, size); -} - -/* - * Table 19. 5.4 SMART Attributes. Samsung also implements this and some extra data not documented. - */ -static void -print_intel_add_smart(const struct nvme_controller_data *cdata __unused, void *buf, uint32_t size __unused) -{ - uint8_t *walker = buf; - uint8_t *end = walker + 150; - const char *name; - uint64_t raw; - uint8_t normalized; - - static struct kv_name kv[] = - { - { 0xab, "Program Fail Count" }, - { 0xac, "Erase Fail Count" }, - { 0xad, "Wear Leveling Count" }, - { 0xb8, "End to End Error Count" }, - { 0xc7, "CRC Error Count" }, - { 0xe2, "Timed: Media Wear" }, - { 0xe3, "Timed: Host Read %" }, - { 0xe4, "Timed: Elapsed Time" }, - { 0xea, "Thermal Throttle Status" }, - { 0xf0, "Retry Buffer Overflows" }, - { 0xf3, "PLL Lock Loss Count" }, - { 0xf4, "NAND Bytes Written" }, - { 0xf5, "Host Bytes Written" }, - }; - - printf("Additional SMART Data Log\n"); - printf("=========================\n"); - /* - * walker[0] = Key - * walker[1,2] = reserved - * walker[3] = Normalized Value - * walker[4] = reserved - * walker[5..10] = Little Endian Raw value - * (or other represenations) - * walker[11] = reserved - */ - while (walker < end) { - name = kv_lookup(kv, nitems(kv), *walker); - normalized = walker[3]; - raw = le48dec(walker + 5); - switch (*walker){ - case 0: - break; - case 0xad: - printf("%-32s: %3d min: %u max: %u ave: %u\n", name, normalized, - le16dec(walker + 5), le16dec(walker + 7), le16dec(walker + 9)); - break; - case 0xe2: - printf("%-32s: %3d %.3f%%\n", name, normalized, raw / 1024.0); - break; - case 0xea: - printf("%-32s: %3d %d%% %d times\n", name, normalized, walker[5], le32dec(walker+6)); - break; - default: - printf("%-32s: %3d %ju\n", name, normalized, (uintmax_t)raw); - break; - } - walker += 12; - } -} - -/* * Table of log page printer / sizing. * - * This includes Intel specific pages that are widely implemented. * Make sure you keep all the pages of one vendor together so -v help * lists all the vendors pages. */ @@ -456,21 +322,6 @@ NVME_LOGPAGE(health, NVME_LOGPAGE(fw, NVME_LOG_FIRMWARE_SLOT, NULL, "Firmware Information", print_log_firmware, sizeof(struct nvme_firmware_page)); -NVME_LOGPAGE(intel_temp, - INTEL_LOG_TEMP_STATS, "intel", "Temperature Stats", - print_intel_temp_stats, sizeof(struct intel_log_temp_stats)); -NVME_LOGPAGE(intel_rlat, - INTEL_LOG_READ_LAT_LOG, "intel", "Read Latencies", - print_intel_read_lat_log, DEFAULT_SIZE); -NVME_LOGPAGE(intel_wlat, - INTEL_LOG_WRITE_LAT_LOG, "intel", "Write Latencies", - print_intel_write_lat_log, DEFAULT_SIZE); -NVME_LOGPAGE(intel_smart, - INTEL_LOG_ADD_SMART, "intel", "Extra Health/SMART Data", - print_intel_add_smart, DEFAULT_SIZE); -NVME_LOGPAGE(samsung_smart, - INTEL_LOG_ADD_SMART, "samsung", "Extra Health/SMART Data", - print_intel_add_smart, DEFAULT_SIZE); static void logpage_help(void) Modified: head/sbin/nvmecontrol/nvmecontrol.h ============================================================================== --- head/sbin/nvmecontrol/nvmecontrol.h Sun Dec 2 23:13:12 2018 (r341413) +++ head/sbin/nvmecontrol/nvmecontrol.h Sun Dec 2 23:13:24 2018 (r341414) @@ -88,6 +88,7 @@ void read_namespace_data(int fd, uint32_t nsid, struct void print_hex(void *data, uint32_t length); void read_logpage(int fd, uint8_t log_page, uint32_t nsid, void *payload, uint32_t payload_size); +void print_temp(uint16_t t); void usage(const struct nvme_function *f); void dispatch_set(int argc, char *argv[], struct nvme_function **tbl, From owner-svn-src-head@freebsd.org Sun Dec 2 23:13:43 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CCCE3130CF49; Sun, 2 Dec 2018 23:13:42 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3D11883743; Sun, 2 Dec 2018 23:13:36 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1536F5A09; Sun, 2 Dec 2018 23:13:36 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB2NDZ9C038064; Sun, 2 Dec 2018 23:13:35 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB2NDZvL038063; Sun, 2 Dec 2018 23:13:35 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201812022313.wB2NDZvL038063@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 2 Dec 2018 23:13:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341415 - head/sbin/nvmecontrol X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sbin/nvmecontrol X-SVN-Commit-Revision: 341415 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3D11883743 X-Spamd-Result: default: False [-0.13 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.04)[-0.037,0]; NEURAL_SPAM_LONG(0.00)[0.005,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_SHORT(-0.10)[-0.098,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Dec 2018 23:13:43 -0000 Author: imp Date: Sun Dec 2 23:13:35 2018 New Revision: 341415 URL: https://svnweb.freebsd.org/changeset/base/341415 Log: Delete the undocumented alias 'wds'. This was a typo for wdc. Eliminate it since it was in error. People should use either 'wdc' or 'hgst' for the vendor from now on. 'hgst' works for all versions this functionality is present for. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D18403 Modified: head/sbin/nvmecontrol/wdc.c Modified: head/sbin/nvmecontrol/wdc.c ============================================================================== --- head/sbin/nvmecontrol/wdc.c Sun Dec 2 23:13:24 2018 (r341414) +++ head/sbin/nvmecontrol/wdc.c Sun Dec 2 23:13:35 2018 (r341415) @@ -594,7 +594,4 @@ NVME_LOGPAGE(hgst_info, NVME_LOGPAGE(wdc_info, HGST_INFO_LOG, "wdc", "Detailed Health/SMART", print_hgst_info_log, DEFAULT_SIZE); -NVME_LOGPAGE(wds_info, - HGST_INFO_LOG, "wds", "Detailed Health/SMART", - print_hgst_info_log, DEFAULT_SIZE); NVME_COMMAND(top, wdc, wdc, WDC_USAGE); From owner-svn-src-head@freebsd.org Sun Dec 2 23:13:52 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8AC13130CFD6; Sun, 2 Dec 2018 23:13:52 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8929C83843; Sun, 2 Dec 2018 23:13: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 6B5505A0A; Sun, 2 Dec 2018 23:13:46 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB2NDksx038121; Sun, 2 Dec 2018 23:13:46 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB2NDkgR038120; Sun, 2 Dec 2018 23:13:46 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201812022313.wB2NDkgR038120@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 2 Dec 2018 23:13:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341416 - head/sbin/nvmecontrol X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sbin/nvmecontrol X-SVN-Commit-Revision: 341416 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8929C83843 X-Spamd-Result: default: False [-0.13 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.04)[-0.037,0]; NEURAL_SPAM_LONG(0.00)[0.005,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_SHORT(-0.10)[-0.098,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Dec 2018 23:13:53 -0000 Author: imp Date: Sun Dec 2 23:13:45 2018 New Revision: 341416 URL: https://svnweb.freebsd.org/changeset/base/341416 Log: Fix typo in comment Sponsored by: Netflix Modified: head/sbin/nvmecontrol/logpage.c Modified: head/sbin/nvmecontrol/logpage.c ============================================================================== --- head/sbin/nvmecontrol/logpage.c Sun Dec 2 23:13:35 2018 (r341415) +++ head/sbin/nvmecontrol/logpage.c Sun Dec 2 23:13:45 2018 (r341416) @@ -434,7 +434,7 @@ logpage(struct nvme_function *nf, int argc, char *argv /* * See if there is a pretty print function for the specified log * page. If one isn't found, we just revert to the default - * (print_hex). If there was a vendor specified bt the user, and + * (print_hex). If there was a vendor specified by the user, and * the page is vendor specific, don't match the print function * unless the vendors match. */ From owner-svn-src-head@freebsd.org Mon Dec 3 03:32:59 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DD26A13140D6; Mon, 3 Dec 2018 03:32:58 +0000 (UTC) (envelope-from sbruno@freebsd.org) Received: from mail.ignoranthack.me (ignoranthack.me [199.102.79.106]) (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 519C66EC56; Mon, 3 Dec 2018 03:32:58 +0000 (UTC) (envelope-from sbruno@freebsd.org) Received: from [192.168.0.6] (97-123-16-122.albq.qwest.net [97.123.16.122]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: sbruno@ignoranthack.me) by mail.ignoranthack.me (Postfix) with ESMTPSA id F07E01AFBD8; Sun, 2 Dec 2018 20:09:06 +0000 (UTC) Subject: Re: svn commit: r340841 - in head: . share/mk sys/sys To: Andrew Turner , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201811231645.wANGj8BW035694@repo.freebsd.org> From: Sean Bruno Openpgp: preference=signencrypt Autocrypt: addr=sbruno@freebsd.org; prefer-encrypt=mutual; keydata= xsBNBFk+0UEBCADaf4bgxxKvMOhRV5NPoGWRCCGm49d6+1VFNlQ77WsY/+Zvf95TPULdRlnG w648KfxWt7+O3kdKhdRwnqlXWC7zA2Qt0dRE1yIqOGJ4jp4INvp/bcxWzgr0aoKOjrlnfxRV bh+s0rzdZt6TsNL3cVYxkC8oezjaUkHdW4mFJU249U1QJogkF8g0FeKNfEcjEkwJNX6lQJH+ EzCWT0NCk6J+Xyo+zOOljxPp1OUfdvZi3ulkU/qTZstGVWxFVsP8xQklV/y3AFcbIYx6iGJ4 5L7WuB0IWhO7Z4yHENr8wFaNYwpod9i4egX2BugbrM8pOfhN2/qqdeG1L5LMtXw3yyAhABEB AAHNN1NlYW4gQnJ1bm8gKEZyZWVCU0QgRGV2ZWxvcGVyIEtleSkgPHNicnVub0BmcmVlYnNk Lm9yZz7CwJQEEwEKAD4WIQToxOn4gDUE4eP0ujS95PX+ibX8tgUCWT7RQQIbAwUJBaOagAUL CQgHAwUVCgkICwUWAwIBAAIeAQIXgAAKCRC95PX+ibX8ttKTCACFKzRc56EBAlVotq02EjZP SfX+unlk6AuPBzShxqRxeK+bGYVCigrYd1M8nnskv0dEiZ5iYeND9HIxbpEyopqgpVTibA7w gBXaZ7SOEhNX1wXwg14JrralfSmPFMYni+sWegPMX/zwfAsn1z4mG1Nn44Xqo3o7CfpkMPy6 M5Bow2IDzIhEYISLR+urxs74/aHU35PLtBSDtu18914SEMDdva27MARN8mbeCDbuJVfGCPWy YHuy2t+9u2Zn5Dd+t3sBXLM9gpeaMm+4x6TNPpESygbVdh4tDdjVZ9DK/bWFg0kMgfZoaq6J l0jNsQXrZV3bzYNFbVw04pFcvA2GIJ7xzsBNBFk+0UEBCADIXBmQOaKMHGbc9vwjhV4Oj5aZ DdhNedn12FVeTdOXJvuTOusgxS29lla0RenHGDsgD08UiFpasBXWq/E+BhQ19d+iRbLLR17O KKc1ZGefoVbLARLXD68J5j4XAyK+6k2KqBLlqzAEpHTzsksM9naARkVXiEVcrt6ciw0FSm8n kuK3gDKKe93XfzfP+TQdbvvzJc7Fa+appLbXz61TM1aikaQlda8bWubDegwXbuoJdB34xU1m yjr/N4o+raL0x7QrzdH+wwgrTTo+H4S2c1972Skt5K5tbxLowfHicRl23V8itVQr3sBtlX4+ 66q+Apm7+R36bUS/k+G45Sp6iPpxABEBAAHCwHwEGAEKACYWIQToxOn4gDUE4eP0ujS95PX+ ibX8tgUCWT7RQQIbDAUJBaOagAAKCRC95PX+ibX8trrIB/9Pljqt/JGamD9tx4dOVmxSyFg9 z2xzgklTLuDgS73MM120mM7ao9AQUeWiSle/H0UCK7xPOzC/aeUC4oygDQKAfkkNbCNTo3+A qDjBRA8qx0e9a/QjDL+RFgD4L5kLT4tToY8T8HaBp8h03LBfk510IaI8oL/Jg7vpM3PDtJMW tUi2H+yNFmL3NfM2oBToWKLFsoP54f/eeeImrNnrlLjLHPzqS+/9apgYqX2Jwiv3tHBc4FTO GuY8VvF7BpixJs8Pc2RUuCfSyodrp1YG1kRGlXAH0cqwwr0Zmk4+7dZvtVQMCl6kS6q1+84q JwtItxS2eXSEA4NO0sQ3BXUywANh Message-ID: <9ac37e3f-c327-ba83-d43c-82b2f9115ad0@freebsd.org> Date: Sun, 2 Dec 2018 20:32:52 -0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.3.2 MIME-Version: 1.0 In-Reply-To: <201811231645.wANGj8BW035694@repo.freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="oFlhsct2QXj8qwrJnwoupu5SHQ6mJfSEo" X-Rspamd-Queue-Id: 519C66EC56 X-Spamd-Result: default: False [-0.75 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.75)[-0.748,0]; ASN(0.00)[asn:36236, ipnet:199.102.76.0/22, country:US]; NEURAL_SPAM_SHORT(0.54)[0.540,0]; NEURAL_HAM_LONG(-0.54)[-0.538,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Dec 2018 03:32:59 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --oFlhsct2QXj8qwrJnwoupu5SHQ6mJfSEo Content-Type: multipart/mixed; boundary="n5Ef0mzfKPOSjJAESvCWb8JpSWj1EbdhQ"; protected-headers="v1" From: Sean Bruno To: Andrew Turner , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <9ac37e3f-c327-ba83-d43c-82b2f9115ad0@freebsd.org> Subject: Re: svn commit: r340841 - in head: . share/mk sys/sys References: <201811231645.wANGj8BW035694@repo.freebsd.org> In-Reply-To: <201811231645.wANGj8BW035694@repo.freebsd.org> --n5Ef0mzfKPOSjJAESvCWb8JpSWj1EbdhQ Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable I just had to disable this on the PowerPC64 build in the FreeBSD Cluster. It led to the following error during linking: cc -O2 -pipe -g -MD -MF.depend.enhash.o -MTenhash.o -std=3Dgnu99 -fstack-protector-strong -c enhash.c -o enhash.o cc -O2 -pipe -g -std=3Dgnu99 -fstack-protector-strong -o enhash.full enhash.o -lmd /usr/bin/ld: crtsavres.o: No such file: No such file or directory *** Error code 1 Stop. make: stopped in /usr/local/poudriere/data/packages/pkgsync/enhash cc -O2 -pipe -g -std=3Dgnu99 -fstack-protector-strong -o dehash.full dehash.o /usr/bin/ld: crtsavres.o: No such file: No such file or directory *** Error code 1 Stop. make: stopped in /usr/local/poudriere/data/packages/pkgsync/dehash On 11/23/18 9:45 AM, Andrew Turner wrote: > Author: andrew > Date: Fri Nov 23 16:45:07 2018 > New Revision: 340841 > URL: https://svnweb.freebsd.org/changeset/base/340841 >=20 > Log: > Enable the BSD crtbegin/crtend by default. > =20 > It has passed an exp run on amd64 and i386, and has testing on arm64.= On > other architectures it is expected to run, however it can be disabled= by > building world with -DWITHOUT_BSD_CRTBEGIN. > =20 > Sponsored by: DARPA, AFRL >=20 > Modified: > head/UPDATING > head/share/mk/src.opts.mk > head/sys/sys/param.h >=20 > Modified: head/UPDATING > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/UPDATING Fri Nov 23 16:33:03 2018 (r340840) > +++ head/UPDATING Fri Nov 23 16:45:07 2018 (r340841) > @@ -31,6 +31,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW: > disable the most expensive debugging functionality run > "ln -s 'abort:false,junk:false' /etc/malloc.conf".) > =20 > +20181123: > + The BSD crtbegin and crtend code has been enabled by default. It has > + had extensive testing on amd64, arm64, and i386. It can be disabled > + by building a world with -DWITHOUT_BSD_CRTBEGIN. > + > 20181115: > The set of CTM commands (ctm, ctm_smail, ctm_rmail, ctm_dequeue) > has been converted to a port (misc/ctm) and will be removed from >=20 > Modified: head/share/mk/src.opts.mk > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/share/mk/src.opts.mk Fri Nov 23 16:33:03 2018 (r340840) > +++ head/share/mk/src.opts.mk Fri Nov 23 16:45:07 2018 (r340841) > @@ -71,6 +71,7 @@ __DEFAULT_YES_OPTIONS =3D \ > BOOTPARAMD \ > BOOTPD \ > BSD_CPIO \ > + BSD_CRTBEGIN \ > BSDINSTALL \ > BSNMP \ > BZIP2 \ > @@ -193,7 +194,6 @@ __DEFAULT_YES_OPTIONS =3D \ > ZONEINFO > =20 > __DEFAULT_NO_OPTIONS =3D \ > - BSD_CRTBEGIN \ > BSD_GREP \ > CLANG_EXTRAS \ > DTRACE_TESTS \ >=20 > Modified: head/sys/sys/param.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/sys/param.h Fri Nov 23 16:33:03 2018 (r340840) > +++ head/sys/sys/param.h Fri Nov 23 16:45:07 2018 (r340841) > @@ -60,7 +60,7 @@ > * in the range 5 to 9. > */ > #undef __FreeBSD_version > -#define __FreeBSD_version 1300003 /* Master, propagated to newvers */ > +#define __FreeBSD_version 1300004 /* Master, propagated to newvers */ > =20 > /* > * __FreeBSD_kernel__ indicates that this system uses the kernel of Fr= eeBSD, >=20 >=20 --n5Ef0mzfKPOSjJAESvCWb8JpSWj1EbdhQ-- --oFlhsct2QXj8qwrJnwoupu5SHQ6mJfSEo Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQGTBAEBCgB9FiEE6MTp+IA1BOHj9Lo0veT1/om1/LYFAlwEo+RfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEU4 QzRFOUY4ODAzNTA0RTFFM0Y0QkEzNEJERTRGNUZFODlCNUZDQjYACgkQveT1/om1 /LZnfQgAmWIWNGm7kx4+q5dwt64nppu37pBT5eNt7aYJDbo3C10YIz8ZX+9enqls AmbzFqVaI+ZGti6sJT6dBUrrgwZ0nI+3sHw/K2+ZW+Gb5t1BfSlo3rhFiBtpj/Wh QvCg1zdD4SUIdXhgLSu/2s7X1t9O4qTEPspSwef1c/S4VVTnDCgPU4niHwqdNoIF ZpqcwqLqjMsKQgTpZJMzjoqBOVshev8pDYwt2yX86AGR99MsMNyJ6xxPnxrt9+UE EEqMT7cegtrACFfVzh8Z4O4lgnXkf2u263IpecAckqgqK08BaRkDuOTqx0N15GWP +CC0F94gu+cg3PDi3LD9YkGxRtHWMA== =nJTz -----END PGP SIGNATURE----- --oFlhsct2QXj8qwrJnwoupu5SHQ6mJfSEo-- From owner-svn-src-head@freebsd.org Mon Dec 3 03:58:32 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 652AC13147EB; Mon, 3 Dec 2018 03:58:32 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 032B96F678; Mon, 3 Dec 2018 03:58:32 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D76E410991; Mon, 3 Dec 2018 03:58:31 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB33wVIj081828; Mon, 3 Dec 2018 03:58:31 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB33wUl1081824; Mon, 3 Dec 2018 03:58:30 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201812030358.wB33wUl1081824@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 3 Dec 2018 03:58:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341420 - in head/stand: i386/common i386/gptboot i386/loader i386/zfsboot libsa/zfs X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in head/stand: i386/common i386/gptboot i386/loader i386/zfsboot libsa/zfs X-SVN-Commit-Revision: 341420 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 032B96F678 X-Spamd-Result: default: False [0.51 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_SPAM_LONG(0.05)[0.050,0]; NEURAL_SPAM_SHORT(0.43)[0.425,0]; NEURAL_SPAM_MEDIUM(0.03)[0.029,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Dec 2018 03:58:32 -0000 Author: ian Date: Mon Dec 3 03:58:30 2018 New Revision: 341420 URL: https://svnweb.freebsd.org/changeset/base/341420 Log: Eliminate duplicated code and struct member definitions in the handoff of args data between gptboot/zfsboot and loader(8). Despite what seems like a lot of changes here, there are no actual changes in behavior, or in the data layout in the structures involved. This is just eliminating identical code pasted into multiple locations. In detail, the changes are... - Move struct zfs_boot_args definition from libsa/zfs/libzfs.h to i386/common/bootargs.h because it is specific to x86 booting and the handoff between zfsboot and loader, and has no relation to the zfs library code in general. - The geli_boot_args and zfs_boot_args structs both contain an identical set of member variables containing geli information. Extract this out to a new geli_boot_data struct, and embed it in the arg-passing structs. - Provide new routines geli_import_boot_data() and geli_export_boot_data() that can be shared between gptboot, zfsboot, and loader instead of pasting identical code into several different .c files. - Remove some checks for a NULL pointer that can never be true because the pointer being tested was set using pointer math (kargs + 1) and that can never result in NULL in this code. Modified: head/stand/i386/common/bootargs.h head/stand/i386/gptboot/gptboot.c head/stand/i386/loader/main.c head/stand/i386/zfsboot/zfsboot.c head/stand/libsa/zfs/libzfs.h Modified: head/stand/i386/common/bootargs.h ============================================================================== --- head/stand/i386/common/bootargs.h Mon Dec 3 02:38:15 2018 (r341419) +++ head/stand/i386/common/bootargs.h Mon Dec 3 03:58:30 2018 (r341420) @@ -84,11 +84,15 @@ struct bootargs #ifdef LOADER_GELI_SUPPORT #include +#include "geliboot.h" #endif -struct geli_boot_args +/* + * geli_boot_data is embedded in geli_boot_args (passed from gptboot to loader) + * and in zfs_boot_args (passed from zfsboot and gptzfsboot to loader). + */ +struct geli_boot_data { - uint32_t size; union { char gelipw[256]; struct { @@ -104,6 +108,49 @@ struct geli_boot_args #endif }; }; +}; + +#ifdef LOADER_GELI_SUPPORT + +static inline void +export_geli_boot_data(struct geli_boot_data *gbdata) +{ + + gbdata->notapw = '\0'; + gbdata->keybuf_sentinel = KEYBUF_SENTINEL; + gbdata->keybuf = malloc(sizeof(struct keybuf) + + (GELI_MAX_KEYS * sizeof(struct keybuf_ent))); + geli_export_key_buffer(gbdata->keybuf); +} + +static inline void +import_geli_boot_data(struct geli_boot_data *gbdata) +{ + + if (gbdata->gelipw[0] != '\0') { + setenv("kern.geom.eli.passphrase", gbdata->gelipw, 1); + explicit_bzero(gbdata->gelipw, sizeof(gbdata->gelipw)); + } else if (gbdata->keybuf_sentinel == KEYBUF_SENTINEL) { + geli_import_key_buffer(gbdata->keybuf); + } +} +#endif /* LOADER_GELI_SUPPORT */ + +struct geli_boot_args +{ + uint32_t size; + struct geli_boot_data gelidata; +}; + +struct zfs_boot_args +{ + uint32_t size; + uint32_t reserved; + uint64_t pool; + uint64_t root; + uint64_t primary_pool; + uint64_t primary_vdev; + struct geli_boot_data gelidata; }; #endif /*__ASSEMBLER__*/ Modified: head/stand/i386/gptboot/gptboot.c ============================================================================== --- head/stand/i386/gptboot/gptboot.c Mon Dec 3 02:38:15 2018 (r341419) +++ head/stand/i386/gptboot/gptboot.c Mon Dec 3 03:58:30 2018 (r341420) @@ -114,7 +114,6 @@ static int vdev_read(void *vdev __unused, void *priv, #ifdef LOADER_GELI_SUPPORT #include "geliboot.h" static char gelipw[GELI_PW_MAXLEN]; -static struct keybuf *gelibuf; #endif struct gptdsk { @@ -480,12 +479,7 @@ load(void) #ifdef LOADER_GELI_SUPPORT geliargs.size = sizeof(geliargs); explicit_bzero(gelipw, sizeof(gelipw)); - gelibuf = malloc(sizeof(struct keybuf) + - (GELI_MAX_KEYS * sizeof(struct keybuf_ent))); - geli_export_key_buffer(gelibuf); - geliargs.notapw = '\0'; - geliargs.keybuf_sentinel = KEYBUF_SENTINEL; - geliargs.keybuf = gelibuf; + export_geli_boot_data(&geliargs.gelidata); #endif /* * Note that the geliargs struct is passed by value, not by pointer. Modified: head/stand/i386/loader/main.c ============================================================================== --- head/stand/i386/loader/main.c Mon Dec 3 02:38:15 2018 (r341419) +++ head/stand/i386/loader/main.c Mon Dec 3 03:58:30 2018 (r341420) @@ -172,15 +172,8 @@ main(void) #ifdef LOADER_GELI_SUPPORT if ((kargs->bootflags & KARGS_FLAGS_EXTARG) != 0) { zargs = (struct zfs_boot_args *)(kargs + 1); - if (zargs != NULL && zargs->size >= offsetof(struct zfs_boot_args, gelipw)) { - if (zargs->size >= offsetof(struct zfs_boot_args, keybuf_sentinel) && - zargs->keybuf_sentinel == KEYBUF_SENTINEL) { - geli_import_key_buffer(zargs->keybuf); - } - if (zargs->gelipw[0] != '\0') { - setenv("kern.geom.eli.passphrase", zargs->gelipw, 1); - explicit_bzero(zargs->gelipw, sizeof(zargs->gelipw)); - } + if (zargs->size > offsetof(struct zfs_boot_args, gelidata)) { + import_geli_boot_data(&zargs->gelidata); } } #endif /* LOADER_GELI_SUPPORT */ @@ -188,14 +181,8 @@ main(void) #ifdef LOADER_GELI_SUPPORT if ((kargs->bootflags & KARGS_FLAGS_EXTARG) != 0) { gargs = (struct geli_boot_args *)(kargs + 1); - if (gargs != NULL && gargs->size >= offsetof(struct geli_boot_args, gelipw)) { - if (gargs->keybuf_sentinel == KEYBUF_SENTINEL) { - geli_import_key_buffer(gargs->keybuf); - } - if (gargs->gelipw[0] != '\0') { - setenv("kern.geom.eli.passphrase", gargs->gelipw, 1); - explicit_bzero(gargs->gelipw, sizeof(gargs->gelipw)); - } + if (gargs->size >= offsetof(struct geli_boot_args, gelidata)) { + import_geli_boot_data(&gargs->gelidata); } } #endif /* LOADER_GELI_SUPPORT */ Modified: head/stand/i386/zfsboot/zfsboot.c ============================================================================== --- head/stand/i386/zfsboot/zfsboot.c Mon Dec 3 02:38:15 2018 (r341419) +++ head/stand/i386/zfsboot/zfsboot.c Mon Dec 3 03:58:30 2018 (r341420) @@ -129,7 +129,6 @@ int main(void); #ifdef LOADER_GELI_SUPPORT #include "geliboot.h" static char gelipw[GELI_PW_MAXLEN]; -static struct keybuf *gelibuf; #endif struct zfsdsk { @@ -993,13 +992,7 @@ load(void) zfsargs.primary_pool = primary_spa->spa_guid; #ifdef LOADER_GELI_SUPPORT explicit_bzero(gelipw, sizeof(gelipw)); - gelibuf = malloc(sizeof(struct keybuf) + (GELI_MAX_KEYS * sizeof(struct keybuf_ent))); - geli_export_key_buffer(gelibuf); - zfsargs.notapw = '\0'; - zfsargs.keybuf_sentinel = KEYBUF_SENTINEL; - zfsargs.keybuf = gelibuf; -#else - zfsargs.gelipw[0] = '\0'; + export_geli_boot_data(&zfsargs.gelidata); #endif if (primary_vdev != NULL) zfsargs.primary_vdev = primary_vdev->v_guid; Modified: head/stand/libsa/zfs/libzfs.h ============================================================================== --- head/stand/libsa/zfs/libzfs.h Mon Dec 3 02:38:15 2018 (r341419) +++ head/stand/libsa/zfs/libzfs.h Mon Dec 3 03:58:30 2018 (r341420) @@ -44,31 +44,6 @@ struct zfs_devdesc { #include #endif -struct zfs_boot_args -{ - uint32_t size; - uint32_t reserved; - uint64_t pool; - uint64_t root; - uint64_t primary_pool; - uint64_t primary_vdev; - union { - char gelipw[256]; - struct { - char notapw; /* - * single null byte to stop keybuf - * being interpreted as a password - */ - uint32_t keybuf_sentinel; -#ifdef LOADER_GELI_SUPPORT - struct keybuf *keybuf; -#else - void *keybuf; -#endif - }; - }; -}; - int zfs_parsedev(struct zfs_devdesc *dev, const char *devspec, const char **path); char *zfs_fmtdev(void *vdev); From owner-svn-src-head@freebsd.org Mon Dec 3 04:47:29 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0F95D13154F7; Mon, 3 Dec 2018 04:47:29 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A99C170B74; Mon, 3 Dec 2018 04:47:28 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 88BE2111B0; Mon, 3 Dec 2018 04:47:28 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB34lSLm007417; Mon, 3 Dec 2018 04:47:28 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB34lS8j007416; Mon, 3 Dec 2018 04:47:28 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201812030447.wB34lS8j007416@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Mon, 3 Dec 2018 04:47:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341422 - 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: 341422 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A99C170B74 X-Spamd-Result: default: False [0.01 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.04)[-0.037,0]; NEURAL_SPAM_LONG(0.00)[0.005,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_SPAM_SHORT(0.04)[0.043,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Dec 2018 04:47:29 -0000 Author: jhibbits Date: Mon Dec 3 04:47:28 2018 New Revision: 341422 URL: https://svnweb.freebsd.org/changeset/base/341422 Log: powerpc/booke: Check for the metadata address by physical address The metadata pointer will almost never be at or above 'btext', as btext is a relocated symbol, so will be based at VM_MIN_KERNEL_ADDRESS, not at KERNBASE. Check the address against kernload, where the kernel is physically loaded. Modified: head/sys/powerpc/booke/booke_machdep.c Modified: head/sys/powerpc/booke/booke_machdep.c ============================================================================== --- head/sys/powerpc/booke/booke_machdep.c Mon Dec 3 04:07:18 2018 (r341421) +++ head/sys/powerpc/booke/booke_machdep.c Mon Dec 3 04:47:28 2018 (r341422) @@ -158,6 +158,7 @@ extern unsigned char __sbss_start[]; extern unsigned char __sbss_end[]; extern unsigned char _end[]; extern vm_offset_t __endkernel; +extern vm_paddr_t kernload; /* * Bootinfo is passed to us by legacy loaders. Save the address of the @@ -350,7 +351,7 @@ booke_init(u_long arg1, u_long arg2) end += fdt_totalsize((void *)dtbp); __endkernel = end; mdp = NULL; - } else if (arg1 > (uintptr_t)btext) /* FreeBSD loader */ + } else if (arg1 > (uintptr_t)kernload) /* FreeBSD loader */ mdp = (void *)arg1; else /* U-Boot */ mdp = NULL; From owner-svn-src-head@freebsd.org Mon Dec 3 04:49:44 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9AF6D1315582; Mon, 3 Dec 2018 04:49:44 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7561070CEA; Mon, 3 Dec 2018 04:49:43 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by mail-lf1-f47.google.com with SMTP id l10so8078303lfh.9; Sun, 02 Dec 2018 20:49:43 -0800 (PST) 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; bh=XAEJ/QLxfyYD/eUfRoRrxY75oNERMxLo6CtDlvi9y8E=; b=ucZQSHmuZBYipnjLwcTTKzjee3ajr1s2mhvOCVSNmiMeUudFZwD78D8Mflk/pHd5HC IIAml4mkbnImxr7FLtnaAxI7qt7dbK7RH9w2h7IspSPqHN2OHzrmCE8R8PMK2uxEzuLF loZ+O8GhdGeJUpoktNm8aiezXiDd4zu5YjgirKZrMkOb4bdwjh8Rsda2Oyp+pJ4zZvtx QQ4tvT/yGBGS+OB+TkD4nP317uy/0qDpAuKv1m86gwedsbW5KsAUU1dbgkwGaajoTOG6 bkzsFGTvgDzSjjyGnQPJdFhcoRbNr9KrIg/Mcu+IpfnnnS2zWQz4g+yKNj8y8Kb5eCin Q82g== X-Gm-Message-State: AA+aEWYG+edxQb9IaBB3a9wDuh2MR/yq+v0bkoBbaZuqx5TR2Q56lzqD uXwpTUfc+4YMYLYNzIOO9/HucMczZGeMK3Q/SX7H1g== X-Google-Smtp-Source: AFSGD/Uaw0BcDI7WeQCgaUQ79VWfA2aiJBMEoMEbFUpRkEs1JuB253L4AOkFJZQ/LJIHgfhs32etldL7jNXOy5wuwi0= X-Received: by 2002:a19:41c4:: with SMTP id o187mr8616993lfa.32.1543812575976; Sun, 02 Dec 2018 20:49:35 -0800 (PST) MIME-Version: 1.0 References: <201812030447.wB34lS8j007416@repo.freebsd.org> In-Reply-To: <201812030447.wB34lS8j007416@repo.freebsd.org> From: Justin Hibbits Date: Sun, 2 Dec 2018 22:49:23 -0600 Message-ID: Subject: Re: svn commit: r341422 - head/sys/powerpc/booke To: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 7561070CEA X-Spamd-Result: default: False [-3.95 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[freebsd.org]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-0.998,0]; IP_SCORE(-0.98)[ipnet: 209.85.128.0/17(-3.52), asn: 15169(-1.27), country: US(-0.09)]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; NEURAL_HAM_SHORT(-0.97)[-0.965,0]; RCVD_IN_DNSWL_NONE(0.00)[47.167.85.209.list.dnswl.org : 127.0.5.0]; FORGED_SENDER(0.30)[jhibbits@freebsd.org,chmeeedalf@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[47.167.85.209.rep.mailspike.net : 127.0.0.17]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[jhibbits@freebsd.org,chmeeedalf@gmail.com]; RCVD_COUNT_TWO(0.00)[2] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Dec 2018 04:49:44 -0000 On Sun, Dec 2, 2018 at 10:47 PM Justin Hibbits wrote: > > Author: jhibbits > Date: Mon Dec 3 04:47:28 2018 > New Revision: 341422 > URL: https://svnweb.freebsd.org/changeset/base/341422 > > Log: > powerpc/booke: Check for the metadata address by physical address > > The metadata pointer will almost never be at or above 'btext', as btext is a > relocated symbol, so will be based at VM_MIN_KERNEL_ADDRESS, not at > KERNBASE. Check the address against kernload, where the kernel is > physically loaded. Rather, at this time VM_MIN_KERNEL_ADDRESS is equal to KERNBASE, but I'm in the process of moving KERNBASE so that the kernel can be loaded by ubldr without needing 4GB RAM. From owner-svn-src-head@freebsd.org Mon Dec 3 04:56:07 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C59121315801; Mon, 3 Dec 2018 04:56:07 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6BBA271182; Mon, 3 Dec 2018 04:56:07 +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 4C9F911364; Mon, 3 Dec 2018 04:56:07 +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 wB34u76D012436; Mon, 3 Dec 2018 04:56:07 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB34u7Bd012435; Mon, 3 Dec 2018 04:56:07 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201812030456.wB34u7Bd012435@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Mon, 3 Dec 2018 04:56:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341423 - head/sys/powerpc/powerpc X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/powerpc X-SVN-Commit-Revision: 341423 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6BBA271182 X-Spamd-Result: default: False [0.01 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.04)[-0.037,0]; NEURAL_SPAM_LONG(0.00)[0.005,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_SPAM_SHORT(0.04)[0.043,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Dec 2018 04:56:07 -0000 Author: jhibbits Date: Mon Dec 3 04:56:06 2018 New Revision: 341423 URL: https://svnweb.freebsd.org/changeset/base/341423 Log: powerpc: Check for a fdt in the metadata if it doesn't already exist It's possible the fdt pointer was passed in via the metadata, as is done in ubldr. Check for the fdt here, instead of working with a NULL fdt, and panicking. Modified: head/sys/powerpc/powerpc/machdep.c Modified: head/sys/powerpc/powerpc/machdep.c ============================================================================== --- head/sys/powerpc/powerpc/machdep.c Mon Dec 3 04:47:28 2018 (r341422) +++ head/sys/powerpc/powerpc/machdep.c Mon Dec 3 04:56:06 2018 (r341423) @@ -137,6 +137,10 @@ int cacheline_size = 32; #endif int hw_direct_map = 1; +#ifdef BOOKE +extern vm_paddr_t kernload; +#endif + extern void *ap_pcpu; struct pcpu __pcpu[MAXCPU]; @@ -295,6 +299,8 @@ powerpc_init(vm_offset_t fdt, vm_offset_t toc, vm_offs #ifdef AIM if ((uintptr_t)&powerpc_init > DMAP_BASE_ADDRESS) md_offset = DMAP_BASE_ADDRESS; +#else /* BOOKE */ + md_offset = VM_MIN_KERNEL_ADDRESS - kernload; #endif preload_metadata = mdp; @@ -309,6 +315,11 @@ powerpc_init(vm_offset_t fdt, vm_offset_t toc, vm_offs if (envp != NULL) envp += md_offset; init_static_kenv(envp, 0); + if (fdt == 0) { + fdt = MD_FETCH(kmdp, MODINFOMD_DTBP, uintptr_t); + if (fdt != 0) + fdt += md_offset; + } kernelendphys = MD_FETCH(kmdp, MODINFOMD_KERNEND, vm_offset_t); if (kernelendphys != 0) From owner-svn-src-head@freebsd.org Mon Dec 3 06:09:50 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4A3211317014; Mon, 3 Dec 2018 06:09:50 +0000 (UTC) (envelope-from zeising@freebsd.org) Received: from mail.daemonic.se (mail.daemonic.se [IPv6:2607:f740:d:20::25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B776872F4C; Mon, 3 Dec 2018 06:09:49 +0000 (UTC) (envelope-from zeising@freebsd.org) Received: from cid.daemonic.se (localhost [IPv6:::1]) by mail.daemonic.se (Postfix) with ESMTP id 437ZMv6F7VzDj8V; Mon, 3 Dec 2018 06:09:47 +0000 (UTC) X-Virus-Scanned: amavisd-new at daemonic.se Received: from mail.daemonic.se ([127.0.0.1]) (using TLS with cipher ECDHE-RSA-AES128-GCM-SHA256) by cid.daemonic.se (mailscanner.daemonic.se [127.0.0.1]) (amavisd-new, port 10587) with ESMTPS id 8iW6k2-bUmiL; Mon, 3 Dec 2018 06:09:47 +0000 (UTC) Received: from garnet.daemonic.se (unknown [IPv6:2001:470:dca9:201:380a:bc54:6f12:4a9b]) by mail.daemonic.se (Postfix) with ESMTPSA id 437ZMt6B3qzDhFd; Mon, 3 Dec 2018 06:09:46 +0000 (UTC) Subject: Re: svn commit: r340997 - head/lib/libarchive To: Justin Hibbits , Martin Matuska Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers References: <201811262145.wAQLjRwO048495@repo.freebsd.org> From: Niclas Zeising Message-ID: Date: Mon, 3 Dec 2018 07:09:39 +0100 User-Agent: Mutt/1.5.21 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: B776872F4C X-Spamd-Result: default: False [-0.62 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.41)[-0.409,0]; NEURAL_HAM_SHORT(-0.34)[-0.339,0]; NEURAL_SPAM_LONG(0.13)[0.126,0]; ASN(0.00)[asn:36236, ipnet:2607:f740:d::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Dec 2018 06:09:50 -0000 On 12/2/18 4:03 AM, Justin Hibbits wrote: > On Mon, Nov 26, 2018 at 3:45 PM Martin Matuska wrote: >> >> Author: mm >> Date: Mon Nov 26 21:45:27 2018 >> New Revision: 340997 >> URL: https://svnweb.freebsd.org/changeset/base/340997 >> >> Log: >> libarchive configuration changes >> - move HAVE_BZLIB_H, HAVE_LIBLZMA and HAVE_LZMA_H to config_freebsd.h >> - activate support for multi-threaded lzma encoding [1] >> >> PR: 233543 [1] >> Reported by: cem >> MFC after: 1 week >> >> Modified: >> head/lib/libarchive/Makefile >> head/lib/libarchive/config_freebsd.h >> >> Modified: head/lib/libarchive/Makefile >> ============================================================================== >> --- head/lib/libarchive/Makefile Mon Nov 26 20:56:05 2018 (r340996) >> +++ head/lib/libarchive/Makefile Mon Nov 26 21:45:27 2018 (r340997) >> @@ -7,7 +7,6 @@ _LIBARCHIVEDIR= ${SRCTOP}/contrib/libarchive >> LIB= archive >> >> LIBADD= z bz2 lzma bsdxml >> -CFLAGS+= -DHAVE_BZLIB_H=1 -DHAVE_LIBLZMA=1 -DHAVE_LZMA_H=1 >> >> # FreeBSD SHLIB_MAJOR value is managed as part of the FreeBSD system. >> # It has no real relation to the libarchive version number. >> >> Modified: head/lib/libarchive/config_freebsd.h >> ============================================================================== >> --- head/lib/libarchive/config_freebsd.h Mon Nov 26 20:56:05 2018 (r340996) >> +++ head/lib/libarchive/config_freebsd.h Mon Nov 26 21:45:27 2018 (r340997) >> @@ -133,14 +133,17 @@ >> #define HAVE_LCHFLAGS 1 >> #define HAVE_LCHMOD 1 >> #define HAVE_LCHOWN 1 >> +#define HAVE_LIBLZMA 1 >> #define HAVE_LIBZ 1 >> #define HAVE_LIMITS_H 1 >> #define HAVE_LINK 1 >> +#define HAVE_LZMA_H 1 >> #define HAVE_LOCALE_H 1 >> #define HAVE_LOCALTIME_R 1 >> #define HAVE_LONG_LONG_INT 1 >> #define HAVE_LSTAT 1 >> #define HAVE_LUTIMES 1 >> +#define HAVE_LZMA_STREAM_ENCODER_MT 1 >> #define HAVE_MBRTOWC 1 >> #define HAVE_MEMMOVE 1 >> #define HAVE_MEMORY_H 1 >> > > This breaks ports-mgmt/pkg now, with the following failure log: > > --- pkg-static --- > /usr/lib/liblzma.a(stream_encoder_mt.o): In function `mythread_cond_init': > /usr/local/poudriere/jails/ppc64/usr/src/contrib/xz/src/common/mythread.h:230: > undefined reference to `pthread_condattr_init' > /usr/local/poudriere/jails/ppc64/usr/src/contrib/xz/src/common/mythread.h:233: > undefined reference to `pthread_condattr_setclock' > /usr/local/poudriere/jails/ppc64/usr/src/contrib/xz/src/common/mythread.h:237: > undefined reference to `pthread_condattr_destroy' > /usr/lib/liblzma.a(stream_encoder_mt.o): In function `get_thread': > /usr/local/poudriere/jails/ppc64/usr/src/contrib/xz/src/common/mythread.h:237: > undefined reference to `pthread_condattr_destroy' > /usr/lib/liblzma.a(stream_encoder_mt.o): In function `mythread_cond_init': > /usr/local/poudriere/jails/ppc64/usr/src/contrib/xz/src/common/mythread.h:233: > undefined reference to `pthread_condattr_setclock' > /usr/local/poudriere/jails/ppc64/usr/src/contrib/xz/src/common/mythread.h:237: > undefined reference to `pthread_condattr_destroy' > /usr/local/poudriere/jails/ppc64/usr/src/contrib/xz/src/common/mythread.h:230: > undefined reference to `pthread_condattr_init' > /usr/local/poudriere/jails/ppc64/usr/src/contrib/xz/src/common/mythread.h:237: > undefined reference to `pthread_condattr_destroy' > *** [pkg-static] Error code 1 > I'm seeing the same issue when builing i386 packages on amd64 using poudriere. For some reason the amd64 build is fine. This needs to be reverted or fixed asap. In the diff above it also looks like the -DHAVE_BZLIB_H=1 flag was forgottgen when moving to config_freebsd.h, but perhaps this was intentional. Regards -- Niclas Zeising From owner-svn-src-head@freebsd.org Mon Dec 3 09:40:38 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AF7FA132167D; Mon, 3 Dec 2018 09:40:38 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5725579E1C; Mon, 3 Dec 2018 09:40:38 +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 397EB14202; Mon, 3 Dec 2018 09:40:38 +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 wB39ecoA055887; Mon, 3 Dec 2018 09:40:38 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB39ecGK055878; Mon, 3 Dec 2018 09:40:38 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201812030940.wB39ecGK055878@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Mon, 3 Dec 2018 09:40:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341424 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 341424 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5725579E1C X-Spamd-Result: default: False [-0.09 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.38)[-0.376,0]; NEURAL_SPAM_LONG(0.00)[0.005,0]; NEURAL_SPAM_SHORT(0.28)[0.282,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Dec 2018 09:40:38 -0000 Author: andrew Date: Mon Dec 3 09:40:37 2018 New Revision: 341424 URL: https://svnweb.freebsd.org/changeset/base/341424 Log: Disable the BSD CRT code on powerpc and sparc64, they need extra crt*.o files that haven't been implemented. Reported by: sbruno MFC with: r339738 Sponsored by: DARPA, AFRL Modified: head/share/mk/src.opts.mk Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Mon Dec 3 04:56:06 2018 (r341423) +++ head/share/mk/src.opts.mk Mon Dec 3 09:40:37 2018 (r341424) @@ -386,6 +386,11 @@ BROKEN_OPTIONS+=HYPERV BROKEN_OPTIONS+=NVME .endif +# PowerPC and Sparc64 need extra crt*.o files +.if ${__T:Mpowerpc*} || ${__T:Msparc64} +BROKEN_OPTIONS+=BSD_CRTBEGIN +.endif + .include # From owner-svn-src-head@freebsd.org Mon Dec 3 09:44:03 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F18A313218E0; Mon, 3 Dec 2018 09:44:02 +0000 (UTC) (envelope-from andrew@freebsd.org) Received: from fry.fubar.geek.nz (fry.fubar.geek.nz [139.59.165.16]) by mx1.freebsd.org (Postfix) with ESMTP id 7AE2F7A24D; Mon, 3 Dec 2018 09:44:02 +0000 (UTC) (envelope-from andrew@freebsd.org) Received: from [IPv6:2a02:c7f:1e13:cf00:6df8:632c:863a:2dab] (unknown [IPv6:2a02:c7f:1e13:cf00:6df8:632c:863a:2dab]) by fry.fubar.geek.nz (Postfix) with ESMTPSA id 89B4E4E693; Mon, 3 Dec 2018 09:43:24 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\)) Subject: Re: svn commit: r340841 - in head: . share/mk sys/sys From: Andrew Turner In-Reply-To: <9ac37e3f-c327-ba83-d43c-82b2f9115ad0@freebsd.org> Date: Mon, 3 Dec 2018 09:43:23 +0000 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <388BAE0E-6B46-4825-80E4-F9F8B692763C@freebsd.org> References: <201811231645.wANGj8BW035694@repo.freebsd.org> <9ac37e3f-c327-ba83-d43c-82b2f9115ad0@freebsd.org> To: Sean Bruno X-Mailer: Apple Mail (2.3445.9.1) X-Rspamd-Queue-Id: 7AE2F7A24D X-Spamd-Result: default: False [-1.11 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.87)[-0.868,0]; NEURAL_SPAM_SHORT(0.37)[0.375,0]; NEURAL_HAM_LONG(-0.61)[-0.614,0]; ASN(0.00)[asn:14061, ipnet:139.59.160.0/20, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Dec 2018 09:44:03 -0000 > On 3 Dec 2018, at 03:32, Sean Bruno wrote: >=20 > I just had to disable this on the PowerPC64 build in the FreeBSD > Cluster. It led to the following error during linking: >=20 > cc -O2 -pipe -g -MD -MF.depend.enhash.o -MTenhash.o -std=3Dgnu99 > -fstack-protector-strong -c enhash.c -o enhash.o > cc -O2 -pipe -g -std=3Dgnu99 -fstack-protector-strong -o enhash.full > enhash.o -lmd > /usr/bin/ld: crtsavres.o: No such file: No such file or directory > *** Error code 1 >=20 > Stop. > make: stopped in /usr/local/poudriere/data/packages/pkgsync/enhash > cc -O2 -pipe -g -std=3Dgnu99 -fstack-protector-strong -o dehash.full > dehash.o > /usr/bin/ld: crtsavres.o: No such file: No such file or directory > *** Error code 1 >=20 > Stop. > make: stopped in /usr/local/poudriere/data/packages/pkgsync/dehash I=E2=80=99ve disabled the BSD crt code in r341424 for powerpc and = sparc64. These both seem to need extra crt*.o files that my code = doesn=E2=80=99t handle. Andrew From owner-svn-src-head@freebsd.org Mon Dec 3 12:55:54 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 22F5913276DC; Mon, 3 Dec 2018 12:55:54 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: from mail-oi1-f169.google.com (mail-oi1-f169.google.com [209.85.167.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 84A0881258; Mon, 3 Dec 2018 12:55:53 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: by mail-oi1-f169.google.com with SMTP id i6so10768299oia.6; Mon, 03 Dec 2018 04:55:53 -0800 (PST) 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:content-transfer-encoding; bh=z4CnV6ftTzDt6I3ozaw7QYN0UpxClazU6C9bdstz5Rk=; b=a4pqkJoL/2Lv+EQmFSwiAy0gRw7Zjb2n53vjMH8daJop7K3kT/4MgnUn8oZbknkR14 u5QKm5h3r87gyzXeto80Ivpt2CKSweiHBvMPlG12mFxKtVgASnUs0Za1u2sPpavqF08K 1/q05zRrjTqniV3meSvn/1woYQmw/h8STF/YUP6ORjc7VEtxUaeTHFnAHc54N9ZxUIEh NTsmTp+rAgbr4jnK6w8k1+lWr54Di37AqJEYPd7VwJYCHz7NRkIZsg56c/S8OvJDQs0V Zh8fB6/57EA4cywZVerM0IEqjQcaw7/JNitQ/mmSTQZlYiKiH6m9RsOWvhBCMqwyIXnS ikPQ== X-Gm-Message-State: AA+aEWZsmxa8TaI3q3IodUPLaQaEmuJA/rrWit+6bXfVfiA1rFYMLQ4b X1yDU3eTXTVqO34+XstE6ftg5cWt4we/xgKUosM= X-Google-Smtp-Source: AFSGD/Ucmc/8hWUKTnh2uJ9nvXFqAE85vaCA9CrxLp1lwNDJLRhflZFigVaMV1uW53qiMXwBo+y6q5yOVz/7HTtM+vA= X-Received: by 2002:aca:5e85:: with SMTP id s127mr10182024oib.181.1543841747715; Mon, 03 Dec 2018 04:55:47 -0800 (PST) MIME-Version: 1.0 References: <201811301556.wAUFuFlQ060205@repo.freebsd.org> <5F231C0E-AD6A-4F85-9D65-3EB414B59E6E@lists.zabbadoz.net> <06F736F1-E101-4720-A70C-A58D143CFE49@lists.zabbadoz.net> In-Reply-To: <06F736F1-E101-4720-A70C-A58D143CFE49@lists.zabbadoz.net> From: Edward Napierala Date: Mon, 3 Dec 2018 12:55:36 +0000 Message-ID: Subject: Re: svn commit: r341343 - head/share/man/man7 To: "Bjoern A. Zeeb" Cc: chmeeedalf@gmail.com, Warner Losh , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 84A0881258 X-Spamd-Result: default: False [-3.97 / 15.00]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; RCPT_COUNT_FIVE(0.00)[6]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; NEURAL_HAM_SHORT(-0.98)[-0.982,0]; FORGED_SENDER(0.30)[trasz@freebsd.org,etnapierala@gmail.com]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[trasz@freebsd.org,etnapierala@gmail.com]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-0.998,0]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[169.167.85.209.list.dnswl.org : 127.0.5.0]; IP_SCORE(-0.98)[ipnet: 209.85.128.0/17(-3.52), asn: 15169(-1.29), country: US(-0.09)]; RWL_MAILSPIKE_POSSIBLE(0.00)[169.167.85.209.rep.mailspike.net : 127.0.0.17]; FREEMAIL_CC(0.00)[gmail.com]; RCVD_COUNT_TWO(0.00)[2] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Dec 2018 12:55:54 -0000 pt., 30 lis 2018 o 16:43 Bjoern A. Zeeb napisa=C5=82(a): > > On 30 Nov 2018, at 16:38, Justin Hibbits wrote: > > > On Fri, Nov 30, 2018, 08:36 Warner Losh > > >> > >> > >> On Fri, Nov 30, 2018 at 9:35 AM Justin Hibbits > >> wrote: > >> > >>> > >>> > >>> On Fri, Nov 30, 2018, 08:24 Bjoern A. Zeeb < > >>> bzeeb-lists@lists.zabbadoz.net wrote: > >>> > >>>> On 30 Nov 2018, at 15:56, Edward Tomasz Napierala wrote: > >>>> > >>>>> Author: trasz > >>>>> Date: Fri Nov 30 15:56:14 2018 > >>>>> New Revision: 341343 > >>>>> URL: https://svnweb.freebsd.org/changeset/base/341343 > >>>>> > >>>>> Log: > >>>>> Add an example of rebuilding a single piece of userspace. > >>>>> > >>>>> Modified: > >>>>> head/share/man/man7/development.7 > >>>>> > >>>>> Modified: head/share/man/man7/development.7 > >>>>> > >>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D > >>>>> --- head/share/man/man7/development.7 Fri Nov 30 15:52:03 > >>>>> 2018 (r341342) > >>>>> +++ head/share/man/man7/development.7 Fri Nov 30 15:56:14 > >>>>> 2018 (r341343) > >>>>> @@ -118,6 +118,14 @@ After reboot: > >>>>> cd src > >>>>> make -j8 installworld > >>>>> reboot > >>>>> +.Ed > >>>>> +.Pp > >>>>> +Rebuild and reinstall a single piece of userspace, in this > >>>>> +case > >>>>> +.Xr ls 1 : > >>>>> +.Bd -literal -offset indent > >>>>> +cd src/bin/ls > >>>>> +make clean all install > >>>> > >>>> I always thought the proper sequence was: make clean cleandepend > >>>> obj > >>>> depend all install > >>>> > >>>> However I have recently figured that it=E2=80=99s not actually true = as > >>>> building inside an individual user space source directory seems to > >>>> pick > >>>> up headers etc from the installed machine and not from the source > >>>> tree. > >>>> I keep arguing with myself if that had always been the case or > >>>> not.. I > >>>> am sure some people here do know better than me (so please see this > >>>> as > >>>> asking for help/advise). > >>>> > >>>> /bz > >>>> > >>>> > >>>> When I need the build headers I use > >>> > >>> > >>> make buildenv > >>> ... cd bin/ls > >>> ... make > >>> > >> > >> You can also do cd bin/ls ; make buildenv now too :) > >> > >> Warner > >> > > > > I learn something new everyday! Thanks! > > I guess that should be documented as part of the needed steps then? It should, but as a separate example. I'd like the default to be as simple (and quick) as possible. From owner-svn-src-head@freebsd.org Mon Dec 3 13:15:56 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ED2371327E16; Mon, 3 Dec 2018 13:15:55 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 792AC82503; Mon, 3 Dec 2018 13:15:55 +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 5A3BD166B9; Mon, 3 Dec 2018 13:15:55 +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 wB3DFtjE068613; Mon, 3 Dec 2018 13:15:55 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB3DFtKl068612; Mon, 3 Dec 2018 13:15:55 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201812031315.wB3DFtKl068612@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 3 Dec 2018 13:15:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341425 - head/share/man/man7 X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/share/man/man7 X-SVN-Commit-Revision: 341425 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 792AC82503 X-Spamd-Result: default: False [-0.32 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.38)[-0.376,0]; NEURAL_SPAM_SHORT(0.05)[0.051,0]; NEURAL_SPAM_LONG(0.00)[0.005,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Dec 2018 13:15:56 -0000 Author: trasz Date: Mon Dec 3 13:15:54 2018 New Revision: 341425 URL: https://svnweb.freebsd.org/changeset/base/341425 Log: Use less misleading directory name. MFC after: 2 weeks Sponsored by: DARPA, AFRL Modified: head/share/man/man7/build.7 Modified: head/share/man/man7/build.7 ============================================================================== --- head/share/man/man7/build.7 Mon Dec 3 09:40:37 2018 (r341424) +++ head/share/man/man7/build.7 Mon Dec 3 13:15:54 2018 (r341425) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 10, 2018 +.Dd December 3, 2018 .Dt BUILD 7 .Os .Sh NAME @@ -804,7 +804,7 @@ system for the armv6 architecture on an amd64 host: .Bd -literal -offset indent cd /usr/src make TARGET_ARCH=armv6 buildworld buildkernel -make TARGET_ARCH=armv6 DESTDIR=/clients/arm64 installworld installkernel +make TARGET_ARCH=armv6 DESTDIR=/clients/arm installworld installkernel .Ed .Sh SEE ALSO .Xr cc 1 , From owner-svn-src-head@freebsd.org Mon Dec 3 13:17:14 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9AF3D1327F36; Mon, 3 Dec 2018 13:17:14 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: from mail-oi1-f169.google.com (mail-oi1-f169.google.com [209.85.167.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F4183826B5; Mon, 3 Dec 2018 13:17:13 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: by mail-oi1-f169.google.com with SMTP id b141so10804212oii.12; Mon, 03 Dec 2018 05:17:13 -0800 (PST) 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:content-transfer-encoding; bh=3l4xu/DLs0PSmRyqv4KzkgIgH4ZmmmDQ1D5R2QPH7lo=; b=okzE3a22ddRSBv13s/GBqrv+Za0sqiSV+vqj/pMDsAOKhirGw0FlbB1rgLByXnlEoA JW5WVgGq0ZGYCFgpKAOYw2IZtV5G/XwcXWICi0v8JaSTsxa22dwLamM2Xvl62XR+EMja NYaF8yAmv4wHjS05ikNbt+LmA767x6+gnQTD7T3TM0vxycMHgs7BErmZW5cGYFJ3Dot/ DD0vZNlOynxzBG/5Xx4VRLxte2IluYSqKqacpxXmeIw9tK+tyauhzghygJ3xmV4+/4Mf 07krQ1dHexk0lze4DobocZ3US2BazT5uwsbkHUmXfKjOblBtCSfLUtFMugrV3mp49hIl YiTQ== X-Gm-Message-State: AA+aEWYOKUO0jxjtLyZjQ6WdVml4IRfk5n2RJt+rm20X0f/2Cm63xb5D 3NXcaZK3HSnHxztpZ+oJkzabutK90W0JdLgn7J+xjw== X-Google-Smtp-Source: AFSGD/Wp39Y9SzT8I36BFGwEgBva3ZrsdC3B/6PJhqzgXiS5Tgnrfrd1IO4mtH0NFZ4aBt6x+LXri26EAv93/7MLdQo= X-Received: by 2002:aca:5e85:: with SMTP id s127mr10176181oib.181.1543841545154; Mon, 03 Dec 2018 04:52:25 -0800 (PST) MIME-Version: 1.0 References: <201811301601.wAUG1h3F065286@repo.freebsd.org> <1543599431.1860.161.camel@freebsd.org> <9ac1300e-3e8a-1151-dd8d-3a980bd6cae8@FreeBSD.org> In-Reply-To: <9ac1300e-3e8a-1151-dd8d-3a980bd6cae8@FreeBSD.org> From: Edward Napierala Date: Mon, 3 Dec 2018 12:52:13 +0000 Message-ID: Subject: Re: svn commit: r341344 - head/share/man/man7 To: John Baldwin Cc: Ian Lepore , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: F4183826B5 X-Spamd-Result: default: False [-3.97 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[freebsd.org]; RCPT_COUNT_FIVE(0.00)[5]; NEURAL_HAM_LONG(-1.00)[-0.998,0]; IP_SCORE(-0.98)[ipnet: 209.85.128.0/17(-3.51), asn: 15169(-1.29), country: US(-0.09)]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; NEURAL_HAM_SHORT(-0.98)[-0.983,0]; RCVD_IN_DNSWL_NONE(0.00)[169.167.85.209.list.dnswl.org : 127.0.5.0]; FORGED_SENDER(0.30)[trasz@freebsd.org,etnapierala@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[169.167.85.209.rep.mailspike.net : 127.0.0.17]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[trasz@freebsd.org,etnapierala@gmail.com]; RCVD_COUNT_TWO(0.00)[2] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Dec 2018 13:17:14 -0000 pt., 30 lis 2018 o 17:47 John Baldwin napisa=C5=82(a): > > On 11/30/18 9:37 AM, Ian Lepore wrote: > > On Fri, 2018-11-30 at 16:01 +0000, Edward Tomasz Napierala wrote: > >> Author: trasz > >> Date: Fri Nov 30 16:01:43 2018 > >> New Revision: 341344 > >> URL: https://svnweb.freebsd.org/changeset/base/341344 > >> > >> Log: > >> Add an example of quick kernel rebuild. > >> > >> MFC after: 2 weeks > >> Sponsored by: DARPA, AFRL > >> > >> Modified: > >> head/share/man/man7/development.7 > >> > >> Modified: head/share/man/man7/development.7 > >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > >> =3D=3D=3D=3D=3D=3D=3D=3D=3D > >> --- head/share/man/man7/development.7 Fri Nov 30 15:56:14 2018 > >> (r341343) > >> +++ head/share/man/man7/development.7 Fri Nov 30 16:01:43 2018 > >> (r341344) > >> @@ -127,6 +127,14 @@ case > >> cd src/bin/ls > >> make clean all install > >> .Ed > >> +.Pp > >> +Quickly rebuild and reinstall the kernel, only recompiling the files > >> +changed since last build; note that this will only work if the full > >> kernel > >> +build has been completed in the past, not on a fresh source tree: > >> +.Bd -literal -offset indent > >> +cd src > >> +make -j8 kernel KERNFAST=3D1 > > > > It might also be worth mentioning that if you're building a kernel > > other than GENERIC, you can use KERNFAST=3Dconfigname instead of > > KERNFAST=3D1 KERNCONF=3Dconfigname > > You could perhaps just use 'KERNFAST=3DGENERIC' in this example and it wo= uld > effectively communicate that I think. We could, but this complicates things. As it is now, it just doesn't mention (nor affect) the kernel config name at all, instead using KERNFAST as a binary flag. Also, trying to actually set the kernel name using KERNF= AST would probably result in failed build, since for KERNFAST to work, you need to have previously completed a non-KERNFAST build with that config name. From owner-svn-src-head@freebsd.org Mon Dec 3 15:59:47 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ADF2B132B1CC; Mon, 3 Dec 2018 15:59:47 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 519EF88260; Mon, 3 Dec 2018 15:59:47 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2EE0F1815E; Mon, 3 Dec 2018 15:59:47 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB3FxloL051638; Mon, 3 Dec 2018 15:59:47 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB3FxkFM051635; Mon, 3 Dec 2018 15:59:46 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201812031559.wB3FxkFM051635@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 3 Dec 2018 15:59:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341429 - in head: lib/libc lib/libthr libexec/rtld-elf X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head: lib/libc lib/libthr libexec/rtld-elf X-SVN-Commit-Revision: 341429 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 519EF88260 X-Spamd-Result: default: False [-0.17 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.38)[-0.376,0]; NEURAL_SPAM_SHORT(0.20)[0.205,0]; NEURAL_SPAM_LONG(0.00)[0.005,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Dec 2018 15:59:47 -0000 Author: emaste Date: Mon Dec 3 15:59:46 2018 New Revision: 341429 URL: https://svnweb.freebsd.org/changeset/base/341429 Log: disable BIND_NOW in libc, libthr, and rtld An issue remains with BIND_NOW and processes using threads. For now, restore libc's BIND_NOW disable, and also disable BIND_NOW in rtld and libthr. A patch is in review (D18400) that likely fixes this issue, but just disable BIND_NOW pending further testing after it is committed. PR: 233333 Sponsored by: The FreeBSD Foundation Modified: head/lib/libc/Makefile head/lib/libthr/Makefile head/libexec/rtld-elf/Makefile Modified: head/lib/libc/Makefile ============================================================================== --- head/lib/libc/Makefile Mon Dec 3 15:25:40 2018 (r341428) +++ head/lib/libc/Makefile Mon Dec 3 15:59:46 2018 (r341429) @@ -6,6 +6,8 @@ SHLIBDIR?= /lib .include +# BIND_NOW in libc results in segfault at startup (PR 233333) +MK_BIND_NOW= no # Force building of libc_pic.a MK_TOOLCHAIN= yes Modified: head/lib/libthr/Makefile ============================================================================== --- head/lib/libthr/Makefile Mon Dec 3 15:25:40 2018 (r341428) +++ head/lib/libthr/Makefile Mon Dec 3 15:59:46 2018 (r341429) @@ -9,6 +9,7 @@ PACKAGE= clibs SHLIBDIR?= /lib .include +MK_BIND_NOW= no MK_SSP= no LIB=thr Modified: head/libexec/rtld-elf/Makefile ============================================================================== --- head/libexec/rtld-elf/Makefile Mon Dec 3 15:25:40 2018 (r341428) +++ head/libexec/rtld-elf/Makefile Mon Dec 3 15:59:46 2018 (r341429) @@ -6,6 +6,7 @@ .include PACKAGE= clibs +MK_BIND_NOW= no MK_SSP= no CONFS= libmap.conf From owner-svn-src-head@freebsd.org Mon Dec 3 16:14:28 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 31AB5132B72D; Mon, 3 Dec 2018 16:14:28 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-it1-x130.google.com (mail-it1-x130.google.com [IPv6:2607:f8b0:4864:20::130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 81C7988C5C; Mon, 3 Dec 2018 16:14:27 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by mail-it1-x130.google.com with SMTP id a6so9348300itl.4; Mon, 03 Dec 2018 08:14:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UwqS8kO2n6X87l2VBwhwAbDxdRZK3L3BTrWGg0wxYfc=; b=c2Zi04vXl/w2w9xxq12TiyxD8qktaa+gOfwb/LrNVVCgztOCm+3SVaklhqyuF2Iw5o ZDw0QfL5AfsYpmnbW/9ufWLcQJN6Nojumi47vhAp9/S9klVv5IwgNZW/vNmYILdNxaPq h3Ni1L29XawrHy9+9+jEYWDffvR2vACgz8phWenJlKpCW55h0KWDzX1Ev/+0eskWBzuW Y6uM9wbsY/YbSLek5KFp47gb0u9sIh3h4RXX5YX1jFXZMtp32TNEVhYnKD8HYb0BItd4 tjFxIb0sRptMbpVjrBvuWTsIKZv0RKzVAa94ucvNkfddMrwR6uOuXgzVDUNZ3KsngaII CH0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=UwqS8kO2n6X87l2VBwhwAbDxdRZK3L3BTrWGg0wxYfc=; b=EBTQYcwFj+y2g6KB0PJjptQu55oTDyseqNLkZEv5lVcXHa6+iuwbwnHHb79Sr8UJ9S 8U59jguGXunjSXA7f1P5vnWE40gcjddqlabNYeTbGtkWY6aAhKA43EIBLwjMQeNQnUig 4+WtJHT3l4x3OeZzQ2rDACRczkpeb52/wIbeXAxRZAt9vFF7LriBrKdmHRk/24bgE/nh krrvzV19Iz+KMWsVB9hnVEcPaUidW5X77Uo3EmA+roitylg7jHBzkF0sqv71A4Iqg+H1 yKGTLG1j9pkzdInN0yHyJ+BXFtzE7bhy/YuBD4YGnWWdY1ZHpo6MxlwkLr+IdU1uj8hA E+4g== X-Gm-Message-State: AA+aEWZNt/E0hVXjOrp0NGyl8suoiLXKXBN5OhdmKFTMnaJZXDHvyKNm DYG9obp/lfC55bixhUXknuj7yxAE X-Google-Smtp-Source: AFSGD/X8qmN7lbD5YX0SEdmyysWYob4j7Z21a8PVphyh7OeZ3K2lRJqiWG+s3Tyr8IOIzulODhr+BQ== X-Received: by 2002:a24:80cc:: with SMTP id g195mr8035449itd.178.1543853666603; Mon, 03 Dec 2018 08:14:26 -0800 (PST) Received: from ralga.knownspace (173-25-245-129.client.mchsi.com. [173.25.245.129]) by smtp.gmail.com with ESMTPSA id k2sm3720848itk.35.2018.12.03.08.14.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 Dec 2018 08:14:26 -0800 (PST) Sender: Justin Hibbits Date: Mon, 3 Dec 2018 10:14:19 -0600 From: Justin Hibbits To: Konstantin Belousov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r341177 - head/sys/powerpc/powerpc Message-ID: <20181203101403.08017039@ralga.knownspace> In-Reply-To: <20181129105622.GL2378@kib.kiev.ua> References: <201811290339.wAT3dBqf027972@repo.freebsd.org> <20181129105622.GL2378@kib.kiev.ua> X-Mailer: Claws Mail 3.17.1 (GTK+ 2.24.32; powerpc64-portbld-freebsd13.0) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 81C7988C5C X-Spamd-Result: default: False [-4.99 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[FreeBSD.org]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; RCVD_IN_DNSWL_NONE(0.00)[0.3.1.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]; NEURAL_HAM_SHORT(-0.98)[-0.980,0]; IP_SCORE(-1.80)[ip: (-5.93), ipnet: 2607:f8b0::/32(-1.66), asn: 15169(-1.29), country: US(-0.09)]; FORGED_SENDER(0.30)[jhibbits@FreeBSD.org,chmeeedalf@gmail.com]; FREEMAIL_TO(0.00)[gmail.com]; RCVD_TLS_LAST(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[jhibbits@FreeBSD.org,chmeeedalf@gmail.com] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Dec 2018 16:14:28 -0000 On Thu, 29 Nov 2018 12:56:22 +0200 Konstantin Belousov wrote: > On Thu, Nov 29, 2018 at 03:39:11AM +0000, Justin Hibbits wrote: > > Author: jhibbits > > Date: Thu Nov 29 03:39:11 2018 > > New Revision: 341177 > > URL: https://svnweb.freebsd.org/changeset/base/341177 > > > > Log: > > Fix thread creation in PowerPC64 ELFv2 processes. > > > > Summary: > > Currently, the upcall used to create threads assumes ELFv1. > > > > Instead, we should check which sysentvec is in use on the process > > and act accordingly. > > > > This makes ELFv2 threaded processes work. > > > > Submitted by: git_bdragon.rtk0.net > > Differential Revision: https://reviews.freebsd.org/D18330 > > > > Modified: > > head/sys/powerpc/powerpc/exec_machdep.c > > > > Modified: head/sys/powerpc/powerpc/exec_machdep.c > > ============================================================================== > > --- head/sys/powerpc/powerpc/exec_machdep.c Thu Nov 29 > > 02:52:08 2018 (r341176) +++ > > head/sys/powerpc/powerpc/exec_machdep.c Thu Nov 29 03:39:11 > > 2018 (r341177) @@ -124,6 +124,10 @@ static int > > grab_mcontext32(struct thread *td, mcontext static int > > grab_mcontext(struct thread *, mcontext_t *, int); > > +#ifdef __powerpc64__ > > +extern struct sysentvec elf64_freebsd_sysvec_v2; > > +#endif > > + > > void > > sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) > > { > > @@ -1014,11 +1018,18 @@ cpu_set_upcall(struct thread *td, void > > (*entry)(void * #endif > > } else { > > #ifdef __powerpc64__ > > - register_t entry_desc[3]; > > - (void)copyin((void *)entry, entry_desc, > > sizeof(entry_desc)); > > - tf->srr0 = entry_desc[0]; > > - tf->fixreg[2] = entry_desc[1]; > > - tf->fixreg[11] = entry_desc[2]; > > + if (td->td_proc->p_sysent == > > &elf64_freebsd_sysvec_v2) { > I recommend you to not do this, instead add a new sv_flag to indicate > ELFv2 for PPC. We already have almost machine-specific flags like > ia32. Hi Kib, Thanks for the tip. I'll look closer at how you do it over on the x86 side. I'm not sure why the separate sysvec for ELFv2, so I'll need to check. - Justin From owner-svn-src-head@freebsd.org Mon Dec 3 16:21:48 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 679BD132BAD4; Mon, 3 Dec 2018 16:21:48 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-it1-x142.google.com (mail-it1-x142.google.com [IPv6:2607:f8b0:4864:20::142]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AEA008914F; Mon, 3 Dec 2018 16:21:47 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by mail-it1-x142.google.com with SMTP id c9so9424443itj.1; Mon, 03 Dec 2018 08:21:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xkH8ERIRDKa9Xym77l2ToTbhfkNMLt+71fXDiqpFlbA=; b=K8LQmSCPr03htwuR7kKe+8OrfTn/3xX6PfF/Yg/pG54GtVOJFBGC/SSzdjfIFCgfJS vFyjSljSS72/0EFXZHTkJpfHj5b1VrZdljqS5FOqZMC/tcomEcTz54kTAyPVdbLvCxjE e3NSottdL900iG5O8F2B0P91bTFYGeZqUFhQoXlHAzVXFZoE8Fhol+r8vuNocl6hsyPg VOL7aVNhlESIowCnXnfN2LexTo9rrpvceWrUhLuxWtA7zDQvXw+v+0V6IiJA79ZCbChX wjXXXCSRZZGROSeztrVA8fcYkvQl3Q04bUhtMWVV08TFKfUxcjkWXZewn17Wd1ZpeV1U U/0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=xkH8ERIRDKa9Xym77l2ToTbhfkNMLt+71fXDiqpFlbA=; b=OGTqPEIFBqsvLp+sLDrGIqUPCJ+RUh8yTf/6vdQ4VfZNkdDeBojY6tqIeWvz1k98r9 YBSIZI4kyiYUg5yeEWh0QaOkRwDs7LcXuD/FXjhPl74ltvF4XxjV7JUyXxWt7FGFw4KY WGrSIJrDx8D109/8lu7VOJ8ak9qaAcEndd0HI92Uge0bdazmddoXBWPbnV70LB5xH1tg SHQGF6A5z2GQrQ60UFlqsAJ8S7DH6MRlj4mj8k30qwl9L6YigRhgIfenn8aDKOHf9AaP G7DD8qrhhMj5EbzVLAyKro88YfAmp1fEQ4hD88+JNKH75tZo34cI6igcaih35pMh5SYN lwPg== X-Gm-Message-State: AA+aEWYr5RkLnyxwuUwVfWi72Q8WIX5aIpP6vjKehIwErGFcISTSgN9P UDJv4U+d5GblRIlXgS/Zu50= X-Google-Smtp-Source: AFSGD/XYXh2ct3EE3KUeHdTQi7gpLsQzvWdkqyWwy7EYZIl0uqMlI2SrGUcGFCbE6UOyh3jv7aEeQA== X-Received: by 2002:a24:2fcb:: with SMTP id j194mr8698709itj.56.1543854106792; Mon, 03 Dec 2018 08:21:46 -0800 (PST) Received: from ralga.knownspace (173-25-245-129.client.mchsi.com. [173.25.245.129]) by smtp.gmail.com with ESMTPSA id c10sm5156304iok.23.2018.12.03.08.20.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 Dec 2018 08:20:43 -0800 (PST) Sender: Justin Hibbits Date: Mon, 3 Dec 2018 10:20:07 -0600 From: Justin Hibbits To: Bruce Evans Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r341103 - head/sys/powerpc/include Message-ID: <20181203102007.4021aa32@ralga.knownspace> In-Reply-To: <20181128151148.X1660@besplex.bde.org> References: <201811280248.wAS2miqW055485@repo.freebsd.org> <20181128151148.X1660@besplex.bde.org> X-Mailer: Claws Mail 3.17.1 (GTK+ 2.24.32; powerpc64-portbld-freebsd13.0) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: AEA008914F X-Spamd-Result: default: False [-1.51 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com]; NEURAL_HAM_MEDIUM(-0.59)[-0.590,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; NEURAL_HAM_LONG(-0.86)[-0.864,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[FreeBSD.org]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; RCVD_IN_DNSWL_NONE(0.00)[2.4.1.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]; NEURAL_HAM_SHORT(-0.08)[-0.076,0]; IP_SCORE(0.23)[ip: (4.19), ipnet: 2607:f8b0::/32(-1.66), asn: 15169(-1.29), country: US(-0.09)]; FORGED_SENDER(0.30)[jhibbits@FreeBSD.org,chmeeedalf@gmail.com]; FREEMAIL_TO(0.00)[optusnet.com.au]; RCVD_TLS_LAST(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[jhibbits@FreeBSD.org,chmeeedalf@gmail.com] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Dec 2018 16:21:48 -0000 On Wed, 28 Nov 2018 16:31:33 +1100 (EST) Bruce Evans wrote: > On Wed, 28 Nov 2018, Justin Hibbits wrote: > > > Log: > > powerpc: Fix the powerpc64 build post-r341102 > > > > VM_MIN_KERNEL_ADDRESS is now used in locore.S, but the UL suffix > > isn't permitted in .S files. > > The UL suffix is arguably a style bug in .c files too. It was not > even wrong (it had no effect) this case, but nearby code seems to be > more broken. > > A ULL suffix would be unarguably a style bug everywhere. I'll take a closer look at this eventually. I'm in the process of overhauling a lot of the Book-E bits to play nicer with loader, etc. This does involve touching vmparam.h a lot, so I'll think about cleaning it up for these cases as well. > > > Modified: head/sys/powerpc/include/vmparam.h > > ============================================================================== > > --- head/sys/powerpc/include/vmparam.h Wed Nov 28 02:00:27 > > 2018 (r341102) +++ head/sys/powerpc/include/vmparam.h > > Wed Nov 28 02:48:43 2018 (r341103) @@ -106,8 +106,13 @@ > > #define FREEBSD32_USRSTACK FREEBSD32_SHAREDPAGE > > > > #ifdef __powerpc64__ > > +#ifndef LOCORE > > #define VM_MIN_KERNEL_ADDRESS > > 0xe000000000000000UL #define > > VM_MAX_KERNEL_ADDRESS 0xe0000007ffffffffUL +#else > > +#define VM_MIN_KERNEL_ADDRESS > > 0xe000000000000000 +#define > > VM_MAX_KERNEL_ADDRESS 0xe0000007ffffffff +#endif > > These constants automatically have type unsigned long, since they are > larger that LONG_MAX and smaller than ULONG_MAX. Thus the UL suffix > had no effect except to break in asm files. > > This would not be true for smaller constants. Smaller constants often > need to be combined or shifted back and forth, and then it may be > necessary to use them as unsigned int or unsigned long constants > (signed constants are better handled by implicit conversions between > int and long unless they are mixed with unsigned constants). This is > sometimes done using U or UL or suffixes. I don't like this. Cases > where the natural type doesn't work are delicate and it is better to > not hide the unnatural conversions by implicitly converting using a > suffix on some constants. > > The correct fix is to remove the bogus UL suffixes and not add any > ifdefs. > > On 32-bit arches, the above constants would have natural type > [(long long abomination; should be deleted]. The abominatation is > unavoidable, but badly written code increases it using explicit > [abomination deleted] suffixes. > > > #define VM_MAX_SAFE_KERNEL_ADDRESS > > VM_MAX_KERNEL_ADDRESS #endif > > Nearby code has mounds of unportabilities and style bugs. E.g., > - VM_MIN_ADDRESS for the !LOCORE && 64-bit case has bogus UL suffixes > and bogus parentheses around single tokens. It is 0, so it has > natural type int, so the suffix might be needed to obfuscate > conversions to unsigned long in some cases. > - VM_MIN_ADDRESS for the !LOCORE && 32-bit case casts to vm_offset_t > instead of hard-coding the same conversion using a suffix. The cast > is more technically correct, but is an even larger syntax error -- it > breaks both asm uses and uses in cpp expressions. Indeed, the cast is probably redundant. > - VM_MIN_ADDRESS already had the bogus ifdefs to support LOCORE. > These are expressed in the opposite order (LOCORE is in the outer > ifdef instead of the inner ifdef), which makes them more unreadable. > - similarly for VM_MAXUSER_ADDRESS, plus an extra convolution to > define this in terms of VM_MAXUSER_ADDRESS32 in the 32-bit case, but > only for the !LOCORE case (since VM_MAXUSER_ADDRESS32 doesn't have a > LOCORE ifdef). Agreed. Removing the LOCORE differentiation would certainly clean up the file. > > I used to like casts on constants and macros, like the ones here for > vm_offset_t here, but jake@ convinced me that this was wrong in > connection with PAE and sparc64 work. The wrongness is most obvious > for PAE. vm_paddr_t is 64 bits for PAE, but most vm types for PAE > (especially vm_offset_t) are only 32 bits. If you sprinkle > [abomination deleted] suffixes or casts to uint64_t or vm_paddr_t on > constants or macros, then this is too pessimal and/or confusing for > most vm expressions. Sprinkling UL suffixes and vm_offset_t casts is > relatively harmless only because it usually has no effect, especially > on 32-bit non-PAE arches where even more types are naturally 32 bits. > > The i386 vmparam.h has the following style bugs in this area: > - UL suffixes only for MAXTSIZ and friends > - cast to vm_offset_t only for VM_MIN_KERNEL_ADDRESS > - VM_MAX_KERNEL_ADDRESS and related values are encrypted through about > 10 layers of macros depending on configuration variables like PAE. > Most of the encryption is no longer really used, since it was > mostly to make addresses depend on the user/kernel split. > > The encryptions mostly use signed constants and expressions, but a > critical one is NPDEPTD defined in another file using sizeof(). > Unsigned poisoning from this probably leaks into most macros, but > the resulting types are even less clear than the resulting values > since the resulting values are now documented for the only > supported user/kernel split. > > - bogus extra parentheses only for VM_KMEM_SIZE_SCALE. > > The existence and default value of this macro are also wrong. They > were last almost correct when the default user/kernel split was 3/1 > and the physical memory size was 3 or 4 GB. > > The default for the macro is 3, which is closely related to the > split ratio. This value works to prevent overflow in kva size > calculations when the physical memory size is larger than the total > kva size but less than 3 or 4 GB. Overflow still occurs for PAE > since then the memory size can be larger than 4GB. Other magic > properties of 3 result in the overflows giving reasonable values for > the kva sizes when the memory size is 8GB or 16GB, but not when it is > 12GB (because 12GB / 3 = 4GB = 0GB after overflow, and 0GB is not a > useful kva size). Thanks for the x86 lesson with this. > > Bruce - Justin From owner-svn-src-head@freebsd.org Mon Dec 3 17:18:01 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F2F20132D3BD; Mon, 3 Dec 2018 17:18:00 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 821018B20A; Mon, 3 Dec 2018 17:18:00 +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 600AF18F25; Mon, 3 Dec 2018 17:18:00 +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 wB3HI0GE092508; Mon, 3 Dec 2018 17:18:00 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB3HI0H0092507; Mon, 3 Dec 2018 17:18:00 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201812031718.wB3HI0H0092507@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Mon, 3 Dec 2018 17:18:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341430 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 341430 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 821018B20A X-Spamd-Result: default: False [-0.05 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.30)[-0.297,0]; NEURAL_SPAM_SHORT(0.15)[0.148,0]; NEURAL_SPAM_LONG(0.10)[0.096,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Dec 2018 17:18:01 -0000 Author: vmaffione Date: Mon Dec 3 17:17:59 2018 New Revision: 341430 URL: https://svnweb.freebsd.org/changeset/base/341430 Log: netmap(4): improve man page Reviewed by: bcr Differential Revision: https://reviews.freebsd.org/D18057 Modified: head/share/man/man4/netmap.4 Modified: head/share/man/man4/netmap.4 ============================================================================== --- head/share/man/man4/netmap.4 Mon Dec 3 15:59:46 2018 (r341429) +++ head/share/man/man4/netmap.4 Mon Dec 3 17:17:59 2018 (r341430) @@ -27,17 +27,12 @@ .\" .\" $FreeBSD$ .\" -.Dd October 28, 2018 +.Dd November 20, 2018 .Dt NETMAP 4 .Os .Sh NAME .Nm netmap .Nd a framework for fast packet I/O -.Nm VALE -.Nd a fast VirtuAl Local Ethernet using the netmap API -.Pp -.Nm netmap pipes -.Nd a shared memory packet transport channel .Sh SYNOPSIS .Cd device netmap .Sh DESCRIPTION @@ -79,7 +74,7 @@ with much less than one core on 10 Gbit/s NICs; 35-40 Mpps on 40 Gbit/s NICs (limited by the hardware); about 20 Mpps per core for VALE ports; and over 100 Mpps for -.Nm netmap pipes. +.Nm netmap pipes . NICs without native .Nm support can still use the API in emulated mode, @@ -108,9 +103,9 @@ synchronization and blocking I/O through a file descri and standard OS mechanisms such as .Xr select 2 , .Xr poll 2 , -.Xr epoll 2 , +.Xr kqueue 2 and -.Xr kqueue 2 . +.Xr epoll 7 . All types of .Nm netmap ports and the @@ -218,12 +213,6 @@ Non-blocking I/O is done with special and .Xr poll 2 on the file descriptor permit blocking I/O. -.Xr epoll 2 -and -.Xr kqueue 2 -are not supported on -.Nm -file descriptors. .Pp While a NIC is in .Nm @@ -244,7 +233,7 @@ which is the ultimate reference for the API. The main structures and fields are indicated below: .Bl -tag -width XXX -.It Dv struct netmap_if (one per interface) +.It Dv struct netmap_if (one per interface ) .Bd -literal struct netmap_if { ... @@ -267,14 +256,30 @@ NICs also have an extra tx/rx ring pair connected to t .Em NIOCREGIF can also request additional unbound buffers in the same memory space, to be used as temporary storage for packets. +The number of extra +buffers is specified in the +.Va arg.nr_arg3 +field. +On success, the kernel writes back to +.Va arg.nr_arg3 +the number of extra buffers actually allocated (they may be less +than the amount requested if the memory space ran out of buffers). .Pa ni_bufs_head -contains the index of the first of these free rings, +contains the index of the first of these extra buffers, which are connected in a list (the first uint32_t of each buffer being the index of the next buffer in the list). A .Dv 0 indicates the end of the list. -.It Dv struct netmap_ring (one per ring) +The application is free to modify +this list and use the buffers (i.e., binding them to the slots of a +netmap ring). +When closing the netmap file descriptor, +the kernel frees the buffers contained in the list pointed by +.Pa ni_bufs_head +, irrespectively of the buffers originally provided by the kernel on +.Em NIOCREGIF . +.It Dv struct netmap_ring (one per ring ) .Bd -literal struct netmap_ring { ... @@ -296,7 +301,7 @@ Implements transmit and receive rings, with read/write pointers, metadata and an array of .Em slots describing the buffers. -.It Dv struct netmap_slot (one per buffer) +.It Dv struct netmap_slot (one per buffer ) .Bd -literal struct netmap_slot { uint32_t buf_idx; /* buffer index */ @@ -371,7 +376,6 @@ during the execution of a netmap-related system call. The only exception are slots (and buffers) in the range .Va tail\ . . . head-1 , that are explicitly assigned to the kernel. -.Pp .Ss TRANSMIT RINGS On transmit rings, after a .Nm @@ -498,10 +502,9 @@ can be delayed indefinitely. This flag helps detect when packets have been sent and a file descriptor can be closed. .It NS_FORWARD -When a ring is in 'transparent' mode (see -.Sx TRANSPARENT MODE ) , -packets marked with this flag are forwarded to the other endpoint -at the next system call, thus restoring (in a selective way) +When a ring is in 'transparent' mode, +packets marked with this flag by the user application are forwarded to the +other endpoint at the next system call, thus restoring (in a selective way) the connection between a NIC and the host stack. .It NS_NO_LEARN tells the forwarding code that the source MAC address for this @@ -669,7 +672,7 @@ and does not need to be sequential. On return the pipe will only have a single ring pair with index 0, irrespective of the value of -.Va i. +.Va i . .El .Pp By default, a @@ -681,11 +684,14 @@ no write events are specified. The feature can be disabled by or-ing .Va NETMAP_NO_TX_POLL to the value written to -.Va nr_ringid. +.Va nr_ringid . When this feature is used, packets are transmitted only on .Va ioctl(NIOCTXSYNC) -or select()/poll() are called with a write event (POLLOUT/wfdset) or a full ring. +or +.Va select() / +.Va poll() +are called with a write event (POLLOUT/wfdset) or a full ring. .Pp When registering a virtual interface that is dynamically created to a .Xr vale 4 @@ -698,7 +704,7 @@ number of slots available for transmission. tells the hardware of consumed packets, and asks for newly available packets. .El -.Sh SELECT, POLL, EPOLL, KQUEUE. +.Sh SELECT, POLL, EPOLL, KQUEUE .Xr select 2 and .Xr poll 2 @@ -712,7 +718,7 @@ respectively when write (POLLOUT) and read (POLLIN) ev Both block if no slots are available in the ring .Va ( ring->cur == ring->tail ) . Depending on the platform, -.Xr epoll 2 +.Xr epoll 7 and .Xr kqueue 2 are supported too. @@ -731,7 +737,10 @@ Passing the .Dv NETMAP_DO_RX_POLL flag to .Em NIOCREGIF updates receive rings even without read events. -Note that on epoll and kqueue, +Note that on +.Xr epoll 7 +and +.Xr kqueue 2 , .Dv NETMAP_NO_TX_POLL and .Dv NETMAP_DO_RX_POLL @@ -759,9 +768,9 @@ before .Pp The following functions are available: .Bl -tag -width XXXXX -.It Va struct nm_desc * nm_open(const char *ifname, const struct nmreq *req, uint64_t flags, const struct nm_desc *arg) +.It Va struct nm_desc * nm_open(const char *ifname, const struct nmreq *req, uint64_t flags, const struct nm_desc *arg ) similar to -.Xr pcap_open 3pcap , +.Xr pcap_open_live 3 , binds a file descriptor to a port. .Bl -tag -width XX .It Va ifname @@ -782,44 +791,50 @@ can be set to a combination of the following flags: .Va NETMAP_NO_TX_POLL , .Va NETMAP_DO_RX_POLL (copied into nr_ringid); -.Va NM_OPEN_NO_MMAP (if arg points to the same memory region, +.Va NM_OPEN_NO_MMAP +(if arg points to the same memory region, avoids the mmap and uses the values from it); -.Va NM_OPEN_IFNAME (ignores ifname and uses the values in arg); +.Va NM_OPEN_IFNAME +(ignores ifname and uses the values in arg); .Va NM_OPEN_ARG1 , .Va NM_OPEN_ARG2 , -.Va NM_OPEN_ARG3 (uses the fields from arg); -.Va NM_OPEN_RING_CFG (uses the ring number and sizes from arg). +.Va NM_OPEN_ARG3 +(uses the fields from arg); +.Va NM_OPEN_RING_CFG +(uses the ring number and sizes from arg). .El -.It Va int nm_close(struct nm_desc *d) +.It Va int nm_close(struct nm_desc *d ) closes the file descriptor, unmaps memory, frees resources. -.It Va int nm_inject(struct nm_desc *d, const void *buf, size_t size) -similar to pcap_inject(), pushes a packet to a ring, returns the size +.It Va int nm_inject(struct nm_desc *d, const void *buf, size_t size ) +similar to +.Va pcap_inject() , +pushes a packet to a ring, returns the size of the packet is successful, or 0 on error; -.It Va int nm_dispatch(struct nm_desc *d, int cnt, nm_cb_t cb, u_char *arg) -similar to pcap_dispatch(), applies a callback to incoming packets -.It Va u_char * nm_nextpkt(struct nm_desc *d, struct nm_pkthdr *hdr) -similar to pcap_next(), fetches the next packet +.It Va int nm_dispatch(struct nm_desc *d, int cnt, nm_cb_t cb, u_char *arg ) +similar to +.Va pcap_dispatch() , +applies a callback to incoming packets +.It Va u_char * nm_nextpkt(struct nm_desc *d, struct nm_pkthdr *hdr ) +similar to +.Va pcap_next() , +fetches the next packet .El .Sh SUPPORTED DEVICES .Nm natively supports the following devices: .Pp -On FreeBSD: +On +.Fx : .Xr cxgbe 4 , .Xr em 4 , -.Xr igb 4 , +.Xr iflib 4 +(providing igb, em and lem), .Xr ixgbe 4 , .Xr ixl 4 , -.Xr lem 4 , -.Xr re 4 . +.Xr re 4 , +.Xr vtnet 4 . .Pp -On Linux -.Xr e1000 4 , -.Xr e1000e 4 , -.Xr i40e 4 , -.Xr igb 4 , -.Xr ixgbe 4 , -.Xr r8169 4 . +On Linux e1000, e1000e, i40e, igb, ixgbe, ixgbevf, r8169, virtio_net, vmxnet3. .Pp NICs without native support can still be used in .Nm @@ -848,10 +863,11 @@ globally controls how netmap mode is implemented. .Sh SYSCTL VARIABLES AND MODULE PARAMETERS Some aspect of the operation of .Nm -are controlled through sysctl variables on FreeBSD +are controlled through sysctl variables on +.Fx .Em ( dev.netmap.* ) and module parameters on Linux -.Em ( /sys/module/netmap_lin/parameters/* ) : +.Em ( /sys/module/netmap/parameters/* ) : .Bl -tag -width indent .It Va dev.netmap.admode: 0 Controls the use of native or emulated adapter mode. @@ -861,6 +877,8 @@ Controls the use of native or emulated adapter mode. 1 forces native mode and fails if not available; .Pp 2 forces emulated hence never fails. +.It Va dev.netmap.generic_rings: 1 +Number of rings used for emulated netmap mode .It Va dev.netmap.generic_ringsize: 1024 Ring size used for emulated netmap mode .It Va dev.netmap.generic_mit: 100000 @@ -902,13 +920,15 @@ Batch size used when moving packets across a switch. Values above 64 generally guarantee good performance. +.It Va dev.netmap.ptnet_vnet_hdr: 1 +Allow ptnet devices to use virtio-net headers .El .Sh SYSTEM CALLS .Nm uses .Xr select 2 , .Xr poll 2 , -.Xr epoll 2 +.Xr epoll 7 and .Xr kqueue 2 to wake up processes when significant events occur, and @@ -1077,6 +1097,7 @@ with the network card or the host. .Xr vale-ctl 4 , .Xr bridge 8 , .Xr lb 8 , +.Xr nmreplay 8 , .Xr pkt-gen 8 .Pp .Pa http://info.iet.unipi.it/~luigi/netmap/ From owner-svn-src-head@freebsd.org Mon Dec 3 17:51:11 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8869F132DDED; Mon, 3 Dec 2018 17:51: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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2B7E98C655; Mon, 3 Dec 2018 17:51: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 0DEB219476; Mon, 3 Dec 2018 17:51: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 wB3HpAFT008552; Mon, 3 Dec 2018 17:51:10 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB3HpANa008551; Mon, 3 Dec 2018 17:51:10 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201812031751.wB3HpANa008551@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 3 Dec 2018 17:51:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341433 - head/stand X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/stand X-SVN-Commit-Revision: 341433 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2B7E98C655 X-Spamd-Result: default: False [-0.41 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.38)[-0.376,0]; NEURAL_SPAM_LONG(0.00)[0.005,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_SHORT(-0.03)[-0.035,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Dec 2018 17:51:11 -0000 Author: imp Date: Mon Dec 3 17:51:10 2018 New Revision: 341433 URL: https://svnweb.freebsd.org/changeset/base/341433 Log: Move inclusion of src.opts.mk later. src.opts.mk includes bsd.own.mk. This in turn defines CTFCONVERT_CMD depending on the MK_CTF value. We then set MK_CTF to no, which has no real effect. The solution is to set all the MK_foo values before including src.opts.mk. This should stop the cdboot binary from exploding in size for releases built WITH_CTF=yes in src.conf. Sponsored by: Netflix Modified: head/stand/defs.mk Modified: head/stand/defs.mk ============================================================================== --- head/stand/defs.mk Mon Dec 3 17:46:53 2018 (r341432) +++ head/stand/defs.mk Mon Dec 3 17:51:10 2018 (r341433) @@ -1,12 +1,12 @@ # $FreeBSD$ -.include - -WARNS?=1 - .if !defined(__BOOT_DEFS_MK__) __BOOT_DEFS_MK__=${MFILE} +# We need to define all the MK_ options before including src.opts.mk +# because it includes bsd.own.mk which needs the right MK_ values, +# espeically MK_CTF. + MK_CTF= no MK_SSP= no MK_PROFILE= no @@ -15,6 +15,10 @@ MAN= NO_PIC= INTERNALLIB= .endif + +.include + +WARNS?= 1 BOOTSRC= ${SRCTOP}/stand EFISRC= ${BOOTSRC}/efi From owner-svn-src-head@freebsd.org Mon Dec 3 18:00:47 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 38B12132E53C; Mon, 3 Dec 2018 18:00:47 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A50E68D055; Mon, 3 Dec 2018 18:00:46 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 86326195EC; Mon, 3 Dec 2018 18:00:46 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB3I0kBQ013998; Mon, 3 Dec 2018 18:00:46 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB3I0kJN013997; Mon, 3 Dec 2018 18:00:46 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201812031800.wB3I0kJN013997@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Mon, 3 Dec 2018 18:00:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341435 - head/bin/pkill X-SVN-Group: head X-SVN-Commit-Author: sevan X-SVN-Commit-Paths: head/bin/pkill X-SVN-Commit-Revision: 341435 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A50E68D055 X-Spamd-Result: default: False [-0.41 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.38)[-0.376,0]; NEURAL_SPAM_LONG(0.00)[0.005,0]; NEURAL_HAM_SHORT(-0.03)[-0.035,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Dec 2018 18:00:47 -0000 Author: sevan (doc committer) Date: Mon Dec 3 18:00:46 2018 New Revision: 341435 URL: https://svnweb.freebsd.org/changeset/base/341435 Log: Note these tools use kvm(3) and not procfs as in Solaris. Obtained from: NetBSD MFC after: 7 days Modified: head/bin/pkill/pkill.1 Modified: head/bin/pkill/pkill.1 ============================================================================== --- head/bin/pkill/pkill.1 Mon Dec 3 17:51:22 2018 (r341434) +++ head/bin/pkill/pkill.1 Mon Dec 3 18:00:46 2018 (r341435) @@ -29,7 +29,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd December 1, 2018 +.Dd December 3, 2018 .Dt PKILL 1 .Os .Sh NAME @@ -241,6 +241,11 @@ or .Nm pkill process will never consider itself nor system processes (kernel threads) as a potential match. +.Sh IMPLEMENTATION NOTES +The Sun Solaris implementation utilised procfs to obtain process information. +This implementation utilises +.Xr kvm 3 +instead. .Sh EXIT STATUS The .Nm pgrep @@ -276,6 +281,7 @@ is deprecated, and its use is discouraged in favor of .Xr ps 1 , .Xr flock 2 , .Xr kill 2 , +.Xr kvm 3, .Xr sigaction 2 , .Xr pidfile 3 , .Xr re_format 7 From owner-svn-src-head@freebsd.org Mon Dec 3 18:20:46 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7FACB132EAB1; Mon, 3 Dec 2018 18:20:46 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A7F428DAA8; Mon, 3 Dec 2018 18:20:45 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id wB3IKYCE060925 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 3 Dec 2018 20:20:37 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua wB3IKYCE060925 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id wB3IKYSg060924; Mon, 3 Dec 2018 20:20:34 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 3 Dec 2018 20:20:34 +0200 From: Konstantin Belousov To: Sevan Janiyan Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r341435 - head/bin/pkill Message-ID: <20181203182034.GH2378@kib.kiev.ua> References: <201812031800.wB3I0kJN013997@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201812031800.wB3I0kJN013997@repo.freebsd.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-Rspamd-Queue-Id: A7F428DAA8 X-Spamd-Result: default: False [-5.15 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; FREEMAIL_FROM(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; R_SPF_SOFTFAIL(0.00)[~all]; RCVD_COUNT_THREE(0.00)[3]; TO_DN_SOME(0.00)[]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; NEURAL_HAM_SHORT(-0.99)[-0.989,0]; IP_SCORE(-2.15)[ip: (-2.69), ipnet: 2001:470::/32(-4.49), asn: 6939(-3.48), country: US(-0.09)]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; RCVD_TLS_LAST(0.00)[]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : No valid SPF, No valid DKIM,none] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Dec 2018 18:20:46 -0000 On Mon, Dec 03, 2018 at 06:00:46PM +0000, Sevan Janiyan wrote: > Author: sevan (doc committer) > Date: Mon Dec 3 18:00:46 2018 > New Revision: 341435 > URL: https://svnweb.freebsd.org/changeset/base/341435 > > Log: > Note these tools use kvm(3) and not procfs as in Solaris. > > Obtained from: NetBSD > MFC after: 7 days > > Modified: > head/bin/pkill/pkill.1 > > Modified: head/bin/pkill/pkill.1 > ============================================================================== > --- head/bin/pkill/pkill.1 Mon Dec 3 17:51:22 2018 (r341434) > +++ head/bin/pkill/pkill.1 Mon Dec 3 18:00:46 2018 (r341435) > @@ -29,7 +29,7 @@ > .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE > .\" POSSIBILITY OF SUCH DAMAGE. > .\" > -.Dd December 1, 2018 > +.Dd December 3, 2018 > .Dt PKILL 1 > .Os > .Sh NAME > @@ -241,6 +241,11 @@ or > .Nm pkill > process will never consider itself nor system processes (kernel threads) as > a potential match. > +.Sh IMPLEMENTATION NOTES > +The Sun Solaris implementation utilised procfs to obtain process information. > +This implementation utilises > +.Xr kvm 3 > +instead. I believe this changes, although formally correct, makes invalid impression. kvm(3) internally uses kern.proc MIB to retrieve information about running processes, we do not scavenge /dev/kmem to obtain the list of processes on the live system. An additional sentence stating that, so no thought about access to kmem appear, would improve it. From owner-svn-src-head@freebsd.org Mon Dec 3 18:56:14 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2F880132F61C; Mon, 3 Dec 2018 18:56:14 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail106.syd.optusnet.com.au (mail106.syd.optusnet.com.au [211.29.132.42]) by mx1.freebsd.org (Postfix) with ESMTP id 204948F056; Mon, 3 Dec 2018 18:56:12 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail106.syd.optusnet.com.au (Postfix) with ESMTPS id B8EC63D9092; Tue, 4 Dec 2018 05:56:10 +1100 (AEDT) Date: Tue, 4 Dec 2018 05:56:09 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Justin Hibbits cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r341103 - head/sys/powerpc/include In-Reply-To: <20181203102007.4021aa32@ralga.knownspace> Message-ID: <20181204043712.F3059@besplex.bde.org> References: <201811280248.wAS2miqW055485@repo.freebsd.org> <20181128151148.X1660@besplex.bde.org> <20181203102007.4021aa32@ralga.knownspace> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=FNpr/6gs c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=3ptsJk61p7z6p2NaEGMA:9 a=CjuIK1q_8ugA:10 X-Rspamd-Queue-Id: 204948F056 X-Spamd-Result: default: False [-4.87 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:211.29.132.0/23]; FREEMAIL_FROM(0.00)[optusnet.com.au]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DMARC_NA(0.00)[optusnet.com.au]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; IP_SCORE(-1.56)[ipnet: 211.28.0.0/14(-4.31), asn: 4804(-3.45), country: AU(-0.04)]; MX_GOOD(-0.01)[cached: extmail.optusnet.com.au]; NEURAL_HAM_SHORT(-1.00)[-0.998,0]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[optusnet.com.au]; ASN(0.00)[asn:4804, ipnet:211.28.0.0/14, country:AU]; RCVD_COUNT_TWO(0.00)[2]; RCVD_IN_DNSWL_LOW(-0.10)[42.132.29.211.list.dnswl.org : 127.0.5.1] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Dec 2018 18:56:14 -0000 On Mon, 3 Dec 2018, Justin Hibbits wrote: > On Wed, 28 Nov 2018 16:31:33 +1100 (EST) > Bruce Evans wrote: > >> On Wed, 28 Nov 2018, Justin Hibbits wrote: >> >>> Log: >>> powerpc: Fix the powerpc64 build post-r341102 >>> >>> VM_MIN_KERNEL_ADDRESS is now used in locore.S, but the UL suffix >>> isn't permitted in .S files. >> >> The UL suffix is arguably a style bug in .c files too. It was not >> even wrong (it had no effect) this case, but nearby code seems to be >> more broken. >> >> A ULL suffix would be unarguably a style bug everywhere. > > I'll take a closer look at this eventually. I'm in the process of > overhauling a lot of the Book-E bits to play nicer with loader, etc. > This does involve touching vmparam.h a lot, so I'll think about > cleaning it up for these cases as well. Thanks. >> ... >> The i386 vmparam.h has the following style bugs in this area: >> ... >> - bogus extra parentheses only for VM_KMEM_SIZE_SCALE. >> >> The existence and default value of this macro are also wrong. They >> were last almost correct when the default user/kernel split was 3/1 >> and the physical memory size was 3 or 4 GB. >> >> The default for the macro is 3, which is closely related to the >> split ratio. This value works to prevent overflow in kva size >> calculations when the physical memory size is larger than the total >> kva size but less than 3 or 4 GB. Overflow still occurs for PAE >> since then the memory size can be larger than 4GB. Other magic >> properties of 3 result in the overflows giving reasonable values for >> the kva sizes when the memory size is 8GB or 16GB, but not when it is >> 12GB (because 12GB / 3 = 4GB = 0GB after overflow, and 0GB is not a >> useful kva size). > > Thanks for the x86 lesson with this. Please look at removing VM_KMEM_SIZE_SCALE completely. I'm now trying to convince kib that it is bogus for all arches, but only know exactly what happens on x86. On arches with large kva, the scale factor should be 1 or smaller since there is enough kva to map physmem several times. On arches with small kva, the kmem size should be as large as possible and not depend on the physmem size (except as a micro-optimization for space), since large physmem needs maximal kva and small physmem doesn't require restricting kva. The scale factor of 3 just breaks booting FreeBSD-11 i386 with 48MB physmem, by making kmem about 3 times smaller than it needs to be to map this whole 48MB. The nmbclusters allocation runs out first on my test system, despite more overcommit for mbuf allocations than most. Bruce From owner-svn-src-head@freebsd.org Mon Dec 3 19:16:36 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5F21213300F9; Mon, 3 Dec 2018 19:16:36 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0B98D8FFD0; Mon, 3 Dec 2018 19:16:36 +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 E04141A2DB; Mon, 3 Dec 2018 19:16:35 +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 wB3JGZtR055660; Mon, 3 Dec 2018 19:16:35 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB3JGYX8055653; Mon, 3 Dec 2018 19:16:34 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201812031916.wB3JGYX8055653@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 3 Dec 2018 19:16:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341437 - in head/stand/i386: kgzldr mbr pmbr X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head/stand/i386: kgzldr mbr pmbr X-SVN-Commit-Revision: 341437 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0B98D8FFD0 X-Spamd-Result: default: False [0.40 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.26)[-0.255,0]; NEURAL_SPAM_SHORT(0.52)[0.518,0]; NEURAL_SPAM_LONG(0.14)[0.141,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Dec 2018 19:16:36 -0000 Author: emaste Date: Mon Dec 3 19:16:34 2018 New Revision: 341437 URL: https://svnweb.freebsd.org/changeset/base/341437 Log: stand/i386: rename .s to .S to use Clang IAS As part of the migration away from obsolete binutils we want to retire GNU as. Most assembly files used on amd64 have a .S extension and (via rules in share/mk/bsd.suffixes.mk) are assembled with Clang's Integrated Assembler (IAS). Rename files in stand/i386 to .S to use the integrated assembler. Clang's IAS supports the defsym option (via -Wa,) but only with one dash, not two. As both -defsym and --defsym are accepted by GNU as, use the former. PR: 233611 Reviewed by: tsoome Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D18369 Added: head/stand/i386/kgzldr/crt.S - copied unchanged from r341436, head/stand/i386/kgzldr/crt.s head/stand/i386/kgzldr/sio.S - copied unchanged from r341436, head/stand/i386/kgzldr/sio.s head/stand/i386/kgzldr/start.S - copied unchanged from r341436, head/stand/i386/kgzldr/start.s head/stand/i386/mbr/mbr.S - copied unchanged from r341436, head/stand/i386/mbr/mbr.s head/stand/i386/pmbr/pmbr.S - copied unchanged from r341436, head/stand/i386/pmbr/pmbr.s Deleted: head/stand/i386/kgzldr/crt.s head/stand/i386/kgzldr/sio.s head/stand/i386/kgzldr/start.s head/stand/i386/mbr/mbr.s head/stand/i386/pmbr/pmbr.s Modified: head/stand/i386/kgzldr/Makefile head/stand/i386/mbr/Makefile head/stand/i386/pmbr/Makefile Modified: head/stand/i386/kgzldr/Makefile ============================================================================== --- head/stand/i386/kgzldr/Makefile Mon Dec 3 19:02:14 2018 (r341436) +++ head/stand/i386/kgzldr/Makefile Mon Dec 3 19:16:34 2018 (r341437) @@ -7,7 +7,7 @@ STRIP= BINMODE=${LIBMODE} BINDIR= ${LIBDIR} -SRCS= start.s boot.c subr_inflate.c lib.c crt.s sio.s +SRCS= start.S boot.c subr_inflate.c lib.c crt.S sio.S CFLAGS= -Os CFLAGS+=-DKZIP NO_SHARED= @@ -15,6 +15,6 @@ LDFLAGS+=-Wl,-r .PATH: ${SYSDIR}/kern BOOT_COMCONSOLE_PORT?= 0x3f8 -AFLAGS+=--defsym SIO_PRT=${BOOT_COMCONSOLE_PORT} +ACFLAGS+=-Wa,-defsym,SIO_PRT=${BOOT_COMCONSOLE_PORT} .include Copied: head/stand/i386/kgzldr/crt.S (from r341436, head/stand/i386/kgzldr/crt.s) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/stand/i386/kgzldr/crt.S Mon Dec 3 19:16:34 2018 (r341437, copy of r341436, head/stand/i386/kgzldr/crt.s) @@ -0,0 +1,83 @@ +# +# Copyright (c) 1999 Global Technology Associates, Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, +# OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT +# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# From: btx.s 1.10 1999/02/25 16:27:41 rnordier +# $FreeBSD$ +# + +# Screen defaults and assumptions. + + .set SCR_MAT,0x7 # Mode/attribute + .set SCR_COL,0x50 # Columns per row + .set SCR_ROW,0x19 # Rows per screen + +# BIOS Data Area locations. + + .set BDA_SCR,0x449 # Video mode + .set BDA_POS,0x450 # Cursor position + + .globl crt_putchr + +# void crt_putchr(int c) + +crt_putchr: movb 0x4(%esp,1),%al # Get character + pusha # Save + xorl %ecx,%ecx # Zero for loops + movb $SCR_MAT,%ah # Mode/attribute + movl $BDA_POS,%ebx # BDA pointer + movw (%ebx),%dx # Cursor position + movl $0xb8000,%edi # Regen buffer (color) + cmpb %ah,BDA_SCR-BDA_POS(%ebx) # Mono mode? + jne crt_putchr.1 # No + xorw %di,%di # Regen buffer (mono) +crt_putchr.1: cmpb $0xa,%al # New line? + je crt_putchr.2 # Yes + xchgl %eax,%ecx # Save char + movb $SCR_COL,%al # Columns per row + mulb %dh # * row position + addb %dl,%al # + column + adcb $0x0,%ah # position + shll %eax # * 2 + xchgl %eax,%ecx # Swap char, offset + movw %ax,(%edi,%ecx,1) # Write attr:char + incl %edx # Bump cursor + cmpb $SCR_COL,%dl # Beyond row? + jb crt_putchr.3 # No +crt_putchr.2: xorb %dl,%dl # Zero column + incb %dh # Bump row +crt_putchr.3: cmpb $SCR_ROW,%dh # Beyond screen? + jb crt_putchr.4 # No + leal 2*SCR_COL(%edi),%esi # New top line + movw $(SCR_ROW-1)*SCR_COL/2,%cx # Words to move + rep # Scroll + movsl # screen + movb $' ',%al # Space + movb $SCR_COL,%cl # Columns to clear + rep # Clear + stosw # line + movb $SCR_ROW-1,%dh # Bottom line +crt_putchr.4: movw %dx,(%ebx) # Update position + popa # Restore + ret # To caller Copied: head/stand/i386/kgzldr/sio.S (from r341436, head/stand/i386/kgzldr/sio.s) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/stand/i386/kgzldr/sio.S Mon Dec 3 19:16:34 2018 (r341437, copy of r341436, head/stand/i386/kgzldr/sio.s) @@ -0,0 +1,44 @@ +# +# Copyright (c) 1999 Global Technology Associates, Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, +# OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT +# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# From: sio.s 1.3 1999/01/10 14:48:03 rnordier +# $FreeBSD$ +# + + .globl sio_putchr + +# void sio_putchr(int c) + +sio_putchr: movw $SIO_PRT+0x5,%dx # Line status reg + xor %ecx,%ecx # Timeout + movb $0x40,%ch # counter +sio_putchr.1: inb %dx,%al # Transmitter + testb $0x20,%al # buffer empty? + loopz sio_putchr.1 # No + jz sio_putchr.2 # If timeout + movb 0x4(%esp,1),%al # Get character + subb $0x5,%dl # Transmitter hold reg + outb %al,%dx # Write character +sio_putchr.2: ret # To caller Copied: head/stand/i386/kgzldr/start.S (from r341436, head/stand/i386/kgzldr/start.s) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/stand/i386/kgzldr/start.S Mon Dec 3 19:16:34 2018 (r341437, copy of r341436, head/stand/i386/kgzldr/start.s) @@ -0,0 +1,45 @@ +# +# Copyright (c) 1999 Global Technology Associates, Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, +# OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT +# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# $FreeBSD$ +# + + .set entry,0x10 # kgz.entry + + .globl _start + +# C startup code for kgzldr. + +_start: cld # String ops inc + movl $_edata,%edi # Start of bss + movl $_end,%ecx # Compute + subl %edi,%ecx # size + xorl %eax,%eax # Zero + rep # Clear + stosb # bss + pushl 0x4(%esp) # Pass howto flags + call boot # Call C code + popl %ecx # Clear stack + jmp *kgz+entry # To loaded code Modified: head/stand/i386/mbr/Makefile ============================================================================== --- head/stand/i386/mbr/Makefile Mon Dec 3 19:02:14 2018 (r341436) +++ head/stand/i386/mbr/Makefile Mon Dec 3 19:16:34 2018 (r341437) @@ -3,14 +3,14 @@ PROG= mbr STRIP= BINMODE=${NOBINMODE} -SRCS= ${PROG}.s +SRCS= ${PROG}.S # MBR flags: 0x80 -- try packet interface (also known as EDD or LBA) BOOT_MBR_FLAGS?= 0x80 ORG= 0x600 -AFLAGS+=--defsym FLAGS=${BOOT_MBR_FLAGS} +ACFLAGS+=-Wa,-defsym,FLAGS=${BOOT_MBR_FLAGS} LDFLAGS+=${LDFLAGS_BIN} .include Copied: head/stand/i386/mbr/mbr.S (from r341436, head/stand/i386/mbr/mbr.s) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/stand/i386/mbr/mbr.S Mon Dec 3 19:16:34 2018 (r341437, copy of r341436, head/stand/i386/mbr/mbr.s) @@ -0,0 +1,157 @@ +# +# Copyright (c) 1999 Robert Nordier +# All rights reserved. +# +# Redistribution and use in source and binary forms are freely +# permitted provided that the above copyright notice and this +# paragraph and the following disclaimer are duplicated in all +# such forms. +# +# This software is provided "AS IS" and without any express or +# implied warranties, including, without limitation, the implied +# warranties of merchantability and fitness for a particular +# purpose. +# + +# $FreeBSD$ + +# A 512 byte MBR boot manager that simply boots the active partition. + + .set LOAD,0x7c00 # Load address + .set EXEC,0x600 # Execution address + .set PT_OFF,0x1be # Partition table + .set MAGIC,0xaa55 # Magic: bootable + .set FL_PACKET,0x80 # Flag: try EDD + + .set NHRDRV,0x475 # Number of hard drives + + .globl start # Entry point + .code16 + +# +# Setup the segment registers for flat addressing and setup the stack. +# +start: cld # String ops inc + xorw %ax,%ax # Zero + movw %ax,%es # Address + movw %ax,%ds # data + movw %ax,%ss # Set up + movw $LOAD,%sp # stack +# +# Relocate ourself to a lower address so that we are out of the way when +# we load in the bootstrap from the partition to boot. +# + movw $main-EXEC+LOAD,%si # Source + movw $main,%di # Destination + movw $0x200-(main-start),%cx # Byte count + rep # Relocate + movsb # code +# +# Jump to the relocated code. +# + jmp main-LOAD+EXEC # To relocated code +# +# Scan the partition table looking for an active entry. Note that %ch is +# zero from the repeated string instruction above. We save the offset of +# the active partition in %si and scan the entire table to ensure that only +# one partition is marked active. +# +main: xorw %si,%si # No active partition + movw $partbl,%bx # Partition table + movb $0x4,%cl # Number of entries +main.1: cmpb %ch,(%bx) # Null entry? + je main.2 # Yes + jg err_pt # If 0x1..0x7f + testw %si,%si # Active already found? + jnz err_pt # Yes + movw %bx,%si # Point to active +main.2: addb $0x10,%bl # Till + loop main.1 # done + testw %si,%si # Active found? + jnz main.3 # Yes + int $0x18 # BIOS: Diskless boot +# +# Ok, we've found a possible active partition. Check to see that the drive +# is a valid hard drive number. +# +main.3: cmpb $0x80,%dl # Drive valid? + jb main.4 # No + movb NHRDRV,%dh # Calculate the highest + addb $0x80,%dh # drive number available + cmpb %dh,%dl # Within range? + jb main.5 # Yes +main.4: movb (%si),%dl # Load drive +# +# Ok, now that we have a valid drive and partition entry, load the CHS from +# the partition entry and read the sector from the disk. +# +main.5: movw %sp,%di # Save stack pointer + movb 0x1(%si),%dh # Load head + movw 0x2(%si),%cx # Load cylinder:sector + movw $LOAD,%bx # Transfer buffer + testb $FL_PACKET,flags # Try EDD? + jz main.7 # No. + pushw %cx # Save %cx + pushw %bx # Save %bx + movw $0x55aa,%bx # Magic + movb $0x41,%ah # BIOS: EDD extensions + int $0x13 # present? + jc main.6 # No. + cmpw $0xaa55,%bx # Magic ok? + jne main.6 # No. + testb $0x1,%cl # Packet mode present? + jz main.6 # No. + popw %bx # Restore %bx + pushl $0x0 # Set the LBA + pushl 0x8(%si) # address + pushw %es # Set the address of + pushw %bx # the transfer buffer + pushw $0x1 # Read 1 sector + pushw $0x10 # Packet length + movw %sp,%si # Packer pointer + movw $0x4200,%ax # BIOS: LBA Read from disk + jmp main.8 # Skip the CHS setup +main.6: popw %bx # Restore %bx + popw %cx # Restore %cx +main.7: movw $0x201,%ax # BIOS: Read from disk +main.8: int $0x13 # Call the BIOS + movw %di,%sp # Restore stack + jc err_rd # If error +# +# Now that we've loaded the bootstrap, check for the 0xaa55 signature. If it +# is present, execute the bootstrap we just loaded. +# + cmpw $MAGIC,0x1fe(%bx) # Bootable? + jne err_os # No + jmp *%bx # Invoke bootstrap +# +# Various error message entry points. +# +err_pt: movw $msg_pt,%si # "Invalid partition + jmp putstr # table" + +err_rd: movw $msg_rd,%si # "Error loading + jmp putstr # operating system" + +err_os: movw $msg_os,%si # "Missing operating + jmp putstr # system" +# +# Output an ASCIZ string to the console via the BIOS. +# +putstr.0: movw $0x7,%bx # Page:attribute + movb $0xe,%ah # BIOS: Display + int $0x10 # character +putstr: lodsb # Get character + testb %al,%al # End of string? + jnz putstr.0 # No +putstr.1: jmp putstr.1 # Await reset + +msg_pt: .asciz "Invalid partition table" +msg_rd: .asciz "Error loading operating system" +msg_os: .asciz "Missing operating system" + + .org PT_OFF-1,0x90 +flags: .byte FLAGS # Flags + +partbl: .fill 0x10,0x4,0x0 # Partition table + .word MAGIC # Magic number Modified: head/stand/i386/pmbr/Makefile ============================================================================== --- head/stand/i386/pmbr/Makefile Mon Dec 3 19:02:14 2018 (r341436) +++ head/stand/i386/pmbr/Makefile Mon Dec 3 19:16:34 2018 (r341437) @@ -3,11 +3,13 @@ PROG= pmbr STRIP= BINMODE=${NOBINMODE} -SRCS= ${PROG}.s +SRCS= ${PROG}.S +BOOT_MBR_FLAGS?= 0 + ORG= 0x600 -AFLAGS+=--defsym FLAGS=${BOOT_MBR_FLAGS} +ACFLAGS+=-Wa,-defsym,FLAGS=${BOOT_MBR_FLAGS} LDFLAGS+=${LDFLAGS_BIN} .include Copied: head/stand/i386/pmbr/pmbr.S (from r341436, head/stand/i386/pmbr/pmbr.s) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/stand/i386/pmbr/pmbr.S Mon Dec 3 19:16:34 2018 (r341437, copy of r341436, head/stand/i386/pmbr/pmbr.s) @@ -0,0 +1,252 @@ +#- +# Copyright (c) 2007 Yahoo!, Inc. +# All rights reserved. +# Written by: John Baldwin +# +# 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. +# 3. Neither the name of the author nor the names of any co-contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# +# Partly from: src/sys/boot/i386/mbr/mbr.s 1.7 + +# A 512 byte PMBR boot manager that looks for a FreeBSD boot GPT partition +# and boots it. + + .set LOAD,0x7c00 # Load address + .set EXEC,0x600 # Execution address + .set MAGIC,0xaa55 # Magic: bootable + .set SECSIZE,0x200 # Size of a single disk sector + .set DISKSIG,440 # Disk signature offset + .set STACK,EXEC+SECSIZE*4 # Stack address + .set GPT_ADDR,STACK # GPT header address + .set GPT_SIG,0 + .set GPT_SIG_0,0x20494645 # "EFI " + .set GPT_SIG_1,0x54524150 # "PART" + .set GPT_MYLBA,24 + .set GPT_PART_LBA,72 + .set GPT_NPART,80 + .set GPT_PART_SIZE,84 + .set PART_ADDR,GPT_ADDR+SECSIZE # GPT partition array address + .set PART_TYPE,0 + .set PART_START_LBA,32 + .set PART_END_LBA,40 + .set DPBUF,PART_ADDR+SECSIZE + .set DPBUF_SEC,0x10 # Number of sectors + + .set NHRDRV,0x475 # Number of hard drives + + .globl start # Entry point + .code16 + +# +# Setup the segment registers for flat addressing and setup the stack. +# +start: cld # String ops inc + xorw %ax,%ax # Zero + movw %ax,%es # Address + movw %ax,%ds # data + movw %ax,%ss # Set up + movw $STACK,%sp # stack +# +# Relocate ourself to a lower address so that we have more room to load +# other sectors. +# + movw $main-EXEC+LOAD,%si # Source + movw $main,%di # Destination + movw $SECSIZE-(main-start),%cx # Byte count + rep # Relocate + movsb # code +# +# Jump to the relocated code. +# + jmp main-LOAD+EXEC # To relocated code +# +# Validate drive number in %dl. +# +main: cmpb $0x80,%dl # Drive valid? + jb main.1 # No + movb NHRDRV,%dh # Calculate the highest + addb $0x80,%dh # drive number available + cmpb %dh,%dl # Within range? + jb main.2 # Yes +main.1: movb $0x80,%dl # Assume drive 0x80 +# +# Load the GPT header and verify signature. Try LBA 1 for the primary one and +# the last LBA for the backup if it is broken. +# +main.2: call getdrvparams # Read drive parameters + movb $1,%dh # %dh := 1 (reading primary) +main.2a: movw $GPT_ADDR,%bx + movw $lba,%si + call read # Read header and check GPT sig + cmpl $GPT_SIG_0,GPT_ADDR+GPT_SIG + jnz main.2b + cmpl $GPT_SIG_1,GPT_ADDR+GPT_SIG+4 + jnz main.2b + jmp load_part +main.2b: cmpb $1,%dh # Reading primary? + jne err_pt # If no - invalid table found +# +# Try alternative LBAs from the last sector for the GPT header. +# +main.3: movb $0,%dh # %dh := 0 (reading backup) + movw $DPBUF+DPBUF_SEC,%si # %si = last sector + 1 + movw $lba,%di # %di = $lba +main.3a: decl (%si) # 0x0(%si) = last sec (0-31) + movw $2,%cx + rep + movsw # $lastsec--, copy it to $lba + jmp main.2a # Read the next sector +# +# Load a partition table sector from disk and look for a FreeBSD boot +# partition. +# +load_part: movw $GPT_ADDR+GPT_PART_LBA,%si + movw $PART_ADDR,%bx + call read +scan: movw %bx,%si # Compare partition UUID + movw $boot_uuid,%di # with FreeBSD boot UUID + movb $0x10,%cl + repe cmpsb + jnz next_part # Didn't match, next partition +# +# We found a boot partition. Load it into RAM starting at 0x7c00. +# + movw %bx,%di # Save partition pointer in %di + leaw PART_START_LBA(%di),%si + movw $LOAD/16,%bx + movw %bx,%es + xorw %bx,%bx +load_boot: push %si # Save %si + call read + pop %si # Restore + movl PART_END_LBA(%di),%eax # See if this was the last LBA + cmpl (%si),%eax + jnz next_boot + movl PART_END_LBA+4(%di),%eax + cmpl 4(%si),%eax + jnz next_boot + mov %bx,%es # Reset %es to zero + jmp LOAD # Jump to boot code +next_boot: incl (%si) # Next LBA + adcl $0,4(%si) + mov %es,%ax # Adjust segment for next + addw $SECSIZE/16,%ax # sector + cmp $0x9000,%ax # Don't load past 0x90000, + jae err_big # 545k should be enough for + mov %ax,%es # any boot code. :) + jmp load_boot +# +# Move to the next partition. If we walk off the end of the sector, load +# the next sector. We assume that partition entries are smaller than 64k +# and that they won't span a sector boundary. +# +# XXX: Should we int 0x18 instead of err_noboot if we hit the end of the table? +# +next_part: decl GPT_ADDR+GPT_NPART # Was this the last partition? + jz err_noboot + movw GPT_ADDR+GPT_PART_SIZE,%ax + addw %ax,%bx # Next partition + cmpw $PART_ADDR+0x200,%bx # Still in sector? + jb scan + incl GPT_ADDR+GPT_PART_LBA # Next sector + adcl $0,GPT_ADDR+GPT_PART_LBA+4 + jmp load_part +# +# Load a sector (64-bit LBA at %si) from disk %dl into %es:%bx by creating +# a EDD packet on the stack and passing it to the BIOS. Trashes %ax and %si. +# +read: pushl 0x4(%si) # Set the LBA + pushl 0x0(%si) # address + pushw %es # Set the address of + pushw %bx # the transfer buffer + pushw $0x1 # Read 1 sector + pushw $0x10 # Packet length + movw %sp,%si # Packer pointer + movw $0x4200,%ax # BIOS: LBA Read from disk + int $0x13 # Call the BIOS + add $0x10,%sp # Restore stack + jc err_rd # If error + ret +# +# Check the number of LBAs on the drive index %dx. Trashes %ax and %si. +# +getdrvparams: + movw $DPBUF,%si # Set the address of result buf + movw $0x001e,(%si) # len + movw $0x4800,%ax # BIOS: Read Drive Parameters + int $0x13 # Call the BIOS + jc err_rd # "I/O error" if error + ret +# +# Various error message entry points. +# +err_big: movw $msg_big,%si # "Boot loader too + jmp putstr # large" + +err_pt: movw $msg_pt,%si # "Invalid partition + jmp putstr # table" + +err_rd: movw $msg_rd,%si # "I/O error loading + jmp putstr # boot loader" + +err_noboot: movw $msg_noboot,%si # "Missing boot + jmp putstr # loader" +# +# Output an ASCIZ string to the console via the BIOS. +# +putstr.0: movw $0x7,%bx # Page:attribute + movb $0xe,%ah # BIOS: Display + int $0x10 # character +putstr: lodsb # Get character + testb %al,%al # End of string? + jnz putstr.0 # No +putstr.1: jmp putstr.1 # Await reset + +msg_big: .asciz "Boot loader too large" +msg_pt: .asciz "Invalid partition table" +msg_rd: .asciz "I/O error loading boot loader" +msg_noboot: .asciz "Missing boot loader" + +lba: .quad 1 # LBA of GPT header + +boot_uuid: .long 0x83bd6b9d + .word 0x7f41 + .word 0x11dc + .byte 0xbe + .byte 0x0b + .byte 0x00 + .byte 0x15 + .byte 0x60 + .byte 0xb8 + .byte 0x4f + .byte 0x0f + + .org DISKSIG,0x90 +sig: .long 0 # OS Disk Signature + .word 0 # "Unknown" in PMBR + +partbl: .fill 0x10,0x4,0x0 # Partition table + .word MAGIC # Magic number From owner-svn-src-head@freebsd.org Mon Dec 3 19:34:07 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CA34F13306CD for ; Mon, 3 Dec 2018 19:34:07 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1.eu.mailhop.org (outbound1.eu.mailhop.org [52.28.251.132]) (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 298016A608 for ; Mon, 3 Dec 2018 19:34:07 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1543865640; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=PB/gAWJA+f1Ao1j/Gv3VyheTuwTVNlHGBqfxTnRctVf/z/GEcZTlSfSAf193Z8Wn+fwyj1C4x1vdY jilMbwdxvBOEQzHe7rpZrwuk3ObBZsmSeFzmD9qtpkzLnNjcUA1RwKrucS8A3DVhr9EIBbKrRJPWiD +XV2lSB5Apr7b5sKwSRwIjex1nAepsY5oQpwxtr1qSErmut3zuNkm9tkI5XXlzS1hev03tQP3BEpkP jTrE4O5UvZ33e6TVaHRgTLNFSw6StNvwmX6c4d1gQzjBrlzy6ylYocWBjKCErpDWOsEHoTscqBCBWO uoZNT6tQRUCvt9BMq1J1Pwlv7k1p8ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:dkim-signature:from; bh=F/nRHIB29m62nuA54nM6nMAaIL4gn3BC5u/ASmr7aXM=; b=c94uWF92CpSFviEVWP+o4LBq8Aj1jKd7f5xFc72RIBJ9cj8F1fF5Xv9OWyaeu/AKWQTpa3+dzfTy9 8EXy7OGW52recqMIZRw9AEz2DgkNG+pOKxaynBbslNdXykB1rVN9PszLiXxjkLdESOqdVhZ6z2PzEm MqdGMh9OXOEr1S9873RgALmkTxmnYs6D7c4XsmWVO8swdJ93VVGtjgx4uiatBpJVaoIe3BnZGjHBOe 7HFvxzERO7TS2d/y3l4MWraPOmoX+O1aYeir925GLlonhDmzZBGRn2GE8+SkXSXvmNhPYW0GUbHbyA vxTX/YUoK1aj29iEhwefTFhncpdB+/Q== ARC-Authentication-Results: i=1; outbound3.eu.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:from; bh=F/nRHIB29m62nuA54nM6nMAaIL4gn3BC5u/ASmr7aXM=; b=QdGq6jP4oi8WSVkRqexHR25HEn3OXLgC1GNC5z9i3LhSSbuU2esT+ynNnmqTKn3IJKxn7zxMDjTtQ hgnmQhhSi2p65alft1T8FFQ93FytF3Tp+Evup4Leu7fjUTB6Wu8CbiPeJEO40OB83RuQfaV1i3pijA Oc6WWDrw4D5DHfXxKPp2vRU8XrHC4qThDR3dB8V/R5FSwFJrk3kdN42xYwJqO/97817cgcQj1ZpKdu ayPWCL3csLdN5x3MY45A4Rxs1msroNyRHUJ7hPUq+jD7ryJtmd2D3Z2HJzOhkRiUj2jL4ViD+6AdmW EPCTaH6Q2oaUvRwNdeQ/eMxZBCiot6w== X-MHO-RoutePath: aGlwcGll X-MHO-User: 5b0b22fb-f732-11e8-8a28-a1efd8da9a94 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound3.eu.mailhop.org (Halon) with ESMTPSA id 5b0b22fb-f732-11e8-8a28-a1efd8da9a94; Mon, 03 Dec 2018 19:33:50 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id wB3JRe1a053089; Mon, 3 Dec 2018 12:27:40 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <1543865260.1860.190.camel@freebsd.org> Subject: Re: svn commit: r341103 - head/sys/powerpc/include From: Ian Lepore To: Bruce Evans , Justin Hibbits Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Mon, 03 Dec 2018 12:27:40 -0700 In-Reply-To: <20181204043712.F3059@besplex.bde.org> References: <201811280248.wAS2miqW055485@repo.freebsd.org> <20181128151148.X1660@besplex.bde.org> <20181203102007.4021aa32@ralga.knownspace> <20181204043712.F3059@besplex.bde.org> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 298016A608 X-Spamd-Result: default: False [-0.24 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_SHORT(-0.17)[-0.166,0]; ASN(0.00)[asn:16509, ipnet:52.28.0.0/16, country:US]; NEURAL_HAM_MEDIUM(-0.00)[-0.001,0]; NEURAL_HAM_LONG(-0.07)[-0.074,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Dec 2018 19:34:08 -0000 On Tue, 2018-12-04 at 05:56 +1100, Bruce Evans wrote: > On Mon, 3 Dec 2018, Justin Hibbits wrote: > > [...] > > Please look at removing VM_KMEM_SIZE_SCALE completely.  I'm now trying to > convince kib that it is bogus for all arches, but only know exactly what > happens on x86. > > On arches with large kva, the scale factor should be 1 or smaller since > there is enough kva to map physmem several times. > > On arches with small kva, the kmem size should be as large as possible > and not depend on the physmem size (except as a micro-optimization for > space), since large physmem needs maximal kva and small physmem doesn't > require restricting kva. > > The scale factor of 3 just breaks booting FreeBSD-11 i386 with 48MB > physmem, by making kmem about 3 times smaller than it needs to be to > map this whole 48MB.  The nmbclusters allocation runs out first on my > test system, despite more overcommit for mbuf allocations than most. > > Bruce > I know we had problems with the default scaling on armv7 at $work when we tried to embed a large (150mb) mdrootfs into our kernel for a system with 2gb ram. I had to chase down the meaning of the scale variable (and I certainly could have misunderstood it to any degree), but here's what I wrote about it after fiddling and finding a value that worked for us. This was for early incarnations of 11-stable. # Tuning required to make the kernel work with a large # embedded filesystem... #  # Allocate one page of kmem_arena KVA for every # VM_KMEM_SIZE_SCALE pages of ram.  The default scale is 3, # and with a huge (>100MB) embedded mdroot that doesn't leave # enough virtual address space to allocate enough kernel # stacks, mbufs, and other resources that come out of KVA. options  VM_KMEM_SIZE_SCALE=5 -- Ian From owner-svn-src-head@freebsd.org Mon Dec 3 19:35:22 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A03511330732; Mon, 3 Dec 2018 19:35:22 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 482FB6A784; Mon, 3 Dec 2018 19:35:22 +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 2536F1A626; Mon, 3 Dec 2018 19:35:22 +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 wB3JZLXx065502; Mon, 3 Dec 2018 19:35:21 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB3JZLJS065500; Mon, 3 Dec 2018 19:35:21 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201812031935.wB3JZLJS065500@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Mon, 3 Dec 2018 19:35:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341438 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 341438 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 482FB6A784 X-Spamd-Result: default: False [-0.41 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.38)[-0.376,0]; NEURAL_SPAM_LONG(0.00)[0.005,0]; NEURAL_HAM_SHORT(-0.04)[-0.042,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Dec 2018 19:35:22 -0000 Author: tsoome Date: Mon Dec 3 19:35:21 2018 New Revision: 341438 URL: https://svnweb.freebsd.org/changeset/base/341438 Log: zfs: we can boot from dataset with large_dnode enabled loader has been supporting large_dnode for some time, no need to block the feature for boot dataset. Reviewed by: avg MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D18391 Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Mon Dec 3 19:16:34 2018 (r341437) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Mon Dec 3 19:35:21 2018 (r341438) @@ -615,9 +615,7 @@ spa_prop_validate(spa_t *spa, nvlist_t *props) /* * Must be ZPL, and its property settings - * must be supported by GRUB (compression - * is not gzip, and large blocks or large - * dnodes are not used). + * must be supported. */ if (dmu_objset_type(os) != DMU_OST_ZFS) { @@ -627,12 +625,6 @@ spa_prop_validate(spa_t *spa, nvlist_t *props) zfs_prop_to_name(ZFS_PROP_COMPRESSION), &propval)) == 0 && !BOOTFS_COMPRESS_VALID(propval)) { - error = SET_ERROR(ENOTSUP); - } else if ((error = - dsl_prop_get_int_ds(dmu_objset_ds(os), - zfs_prop_to_name(ZFS_PROP_DNODESIZE), - &propval)) == 0 && - propval != ZFS_DNSIZE_LEGACY) { error = SET_ERROR(ENOTSUP); } else { objnum = dmu_objset_id(os); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Mon Dec 3 19:16:34 2018 (r341437) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Mon Dec 3 19:35:21 2018 (r341438) @@ -4208,16 +4208,6 @@ zfs_check_settable(const char *dsname, nvpair_t *pair, intval != ZFS_DNSIZE_LEGACY) { spa_t *spa; - /* - * If this is a bootable dataset then - * we don't allow large (>512B) dnodes, - * because GRUB doesn't support them. - */ - if (zfs_is_bootfs(dsname) && - intval != ZFS_DNSIZE_LEGACY) { - return (SET_ERROR(EDOM)); - } - if ((err = spa_open(dsname, &spa, FTAG)) != 0) return (err); From owner-svn-src-head@freebsd.org Mon Dec 3 19:55:56 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D712A1330E62; Mon, 3 Dec 2018 19:55:56 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7A37B6B642; Mon, 3 Dec 2018 19:55:56 +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 5B55B1A99F; Mon, 3 Dec 2018 19:55:56 +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 wB3Jtucp077688; Mon, 3 Dec 2018 19:55:56 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB3JtuEr077687; Mon, 3 Dec 2018 19:55:56 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201812031955.wB3JtuEr077687@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 3 Dec 2018 19:55:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341439 - head/libexec/rtld-elf X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/libexec/rtld-elf X-SVN-Commit-Revision: 341439 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7A37B6B642 X-Spamd-Result: default: False [-0.27 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.38)[-0.376,0]; NEURAL_SPAM_SHORT(0.10)[0.097,0]; NEURAL_SPAM_LONG(0.00)[0.005,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Dec 2018 19:55:57 -0000 Author: kib Date: Mon Dec 3 19:55:55 2018 New Revision: 341439 URL: https://svnweb.freebsd.org/changeset/base/341439 Log: Provide naive but self-contained implementations of memset(3) and bzero(3) for rtld. This again reduces rtld dependency on libc, and in future, avoid ifunc relocations when the functions are converted to ifuncs in libc. Reported by: mjg Reviewed by: emaste Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D18400 Modified: head/libexec/rtld-elf/rtld.c Modified: head/libexec/rtld-elf/rtld.c ============================================================================== --- head/libexec/rtld-elf/rtld.c Mon Dec 3 19:35:21 2018 (r341438) +++ head/libexec/rtld-elf/rtld.c Mon Dec 3 19:55:55 2018 (r341439) @@ -5618,3 +5618,25 @@ rtld_strerror(int errnum) return ("Unknown error"); return (sys_errlist[errnum]); } + +/* + * No ifunc relocations. + */ +void * +memset(void *dest, int c, size_t len) +{ + size_t i; + + for (i = 0; i < len; i++) + ((char *)dest)[i] = c; + return (dest); +} + +void +bzero(void *dest, size_t len) +{ + size_t i; + + for (i = 0; i < len; i++) + ((char *)dest)[i] = 0; +} From owner-svn-src-head@freebsd.org Mon Dec 3 20:01:52 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 98B05130A59A; Mon, 3 Dec 2018 20:01:52 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3BEA96C8FE; Mon, 3 Dec 2018 20:01:52 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1C9A21AB14; Mon, 3 Dec 2018 20:01:52 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB3K1pLx084741; Mon, 3 Dec 2018 20:01:51 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB3K1pfH084740; Mon, 3 Dec 2018 20:01:51 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201812032001.wB3K1pfH084740@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Mon, 3 Dec 2018 20:01:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341440 - head/bin/pkill X-SVN-Group: head X-SVN-Commit-Author: sevan X-SVN-Commit-Paths: head/bin/pkill X-SVN-Commit-Revision: 341440 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3BEA96C8FE X-Spamd-Result: default: False [-0.21 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.38)[-0.376,0]; NEURAL_SPAM_LONG(0.00)[0.005,0]; NEURAL_SPAM_SHORT(0.16)[0.159,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Dec 2018 20:01:52 -0000 Author: sevan (doc committer) Date: Mon Dec 3 20:01:51 2018 New Revision: 341440 URL: https://svnweb.freebsd.org/changeset/base/341440 Log: Clarify that /dev/kmem is not used. Move cross ref to right place while here. Submitted by: kib MFC after: 7 days Modified: head/bin/pkill/pkill.1 Modified: head/bin/pkill/pkill.1 ============================================================================== --- head/bin/pkill/pkill.1 Mon Dec 3 19:55:55 2018 (r341439) +++ head/bin/pkill/pkill.1 Mon Dec 3 20:01:51 2018 (r341440) @@ -246,6 +246,13 @@ The Sun Solaris implementation utilised procfs to obta This implementation utilises .Xr kvm 3 instead. +On a live system, +.Xr kvm 3 +uses +.Va kern.proc +MIB to obtain the list of processes, kernel memory through +.Pa /dev/kmem +is not accessed. .Sh EXIT STATUS The .Nm pgrep @@ -281,8 +288,8 @@ is deprecated, and its use is discouraged in favor of .Xr ps 1 , .Xr flock 2 , .Xr kill 2 , -.Xr kvm 3, .Xr sigaction 2 , +.Xr kvm 3 , .Xr pidfile 3 , .Xr re_format 7 .\" Xr signal 7 From owner-svn-src-head@freebsd.org Mon Dec 3 20:03:44 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 452C9130A6C0; Mon, 3 Dec 2018 20:03:44 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DC1FF6CD0E; Mon, 3 Dec 2018 20:03:43 +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 B83411AB50; Mon, 3 Dec 2018 20:03:43 +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 wB3K3h5v084957; Mon, 3 Dec 2018 20:03:43 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB3K3hKg084956; Mon, 3 Dec 2018 20:03:43 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201812032003.wB3K3hKg084956@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 3 Dec 2018 20:03:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341441 - head/libexec/rtld-elf X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/libexec/rtld-elf X-SVN-Commit-Revision: 341441 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: DC1FF6CD0E X-Spamd-Result: default: False [-0.13 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.34)[-0.338,0]; NEURAL_SPAM_SHORT(0.15)[0.155,0]; NEURAL_SPAM_LONG(0.05)[0.050,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Dec 2018 20:03:44 -0000 Author: kib Date: Mon Dec 3 20:03:43 2018 New Revision: 341441 URL: https://svnweb.freebsd.org/changeset/base/341441 Log: Some fixes for LD_BIND_NOW + ifuncs. - Do not perform ifunc relocations together with other PLT relocations in PLT. Instead, do it during an additional pass over the init list, so that ifuncs are resolved in the order of dso dependencies. This allows the ifuncs resolvers to call into depended libs. Init list now includes all objects instead of only objects with init/fini callables. - Disable relro protection around bind_now ifunc relocations. I considered calling ifunc resolvers of dso after initializers of all dependencies are processed, and decided that this is wrong/should not be supported. The order now is normal relocations for all objects->ifunc resolution in init order->initializers, where each step does complete pass over all loaded objects before moving to the next step. Reported, tested and reviewed by: emaste Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D18400 Modified: head/libexec/rtld-elf/rtld.c head/libexec/rtld-elf/rtld.h Modified: head/libexec/rtld-elf/rtld.c ============================================================================== --- head/libexec/rtld-elf/rtld.c Mon Dec 3 20:01:51 2018 (r341440) +++ head/libexec/rtld-elf/rtld.c Mon Dec 3 20:03:43 2018 (r341441) @@ -111,6 +111,7 @@ static void init_pagesizes(Elf_Auxinfo **aux_info); static void init_rtld(caddr_t, Elf_Auxinfo **); static void initlist_add_neededs(Needed_Entry *, Objlist *); static void initlist_add_objects(Obj_Entry *, Obj_Entry *, Objlist *); +static int initlist_objects_ifunc(Objlist *, bool, int, RtldLockState *); static void linkmap_add(Obj_Entry *); static void linkmap_delete(Obj_Entry *); static void load_filtees(Obj_Entry *, int flags, RtldLockState *); @@ -119,6 +120,7 @@ static int load_needed_objects(Obj_Entry *, int); static int load_preload_objects(void); static Obj_Entry *load_object(const char *, int fd, const Obj_Entry *, int); static void map_stacks_exec(RtldLockState *); +static int obj_disable_relro(Obj_Entry *); static int obj_enforce_relro(Obj_Entry *); static Obj_Entry *obj_from_addr(const void *); static void objlist_call_fini(Objlist *, Obj_Entry *, RtldLockState *); @@ -143,8 +145,6 @@ static int relocate_object(Obj_Entry *obj, bool bind_n static int relocate_objects(Obj_Entry *, bool, Obj_Entry *, int, RtldLockState *); static int resolve_object_ifunc(Obj_Entry *, bool, int, RtldLockState *); -static int resolve_objects_ifunc(Obj_Entry *first, bool bind_now, - int flags, RtldLockState *lockstate); static int rtld_dirname(const char *, char *); static int rtld_dirname_abs(const char *, char *); static void *rtld_dlopen(const char *name, int fd, int mode); @@ -730,16 +730,6 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entr map_stacks_exec(NULL); - dbg("resolving ifuncs"); - if (resolve_objects_ifunc(obj_main, - ld_bind_now != NULL && *ld_bind_now != '\0', SYMLOOK_EARLY, - NULL) == -1) - rtld_die(); - - dbg("enforcing main obj relro"); - if (obj_enforce_relro(obj_main) == -1) - rtld_die(); - if (!obj_main->crt_no_init) { /* * Make sure we don't call the main program's init and fini @@ -758,6 +748,12 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entr pre_init(); wlock_acquire(rtld_bind_lock, &lockstate); + + dbg("resolving ifuncs"); + if (initlist_objects_ifunc(&initlist, ld_bind_now != NULL && + *ld_bind_now != '\0', SYMLOOK_EARLY, &lockstate) == -1) + rtld_die(); + if (obj_main->crt_no_init) preinit_main(); objlist_call_init(&initlist, &lockstate); @@ -770,6 +766,11 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entr if (ld_loadfltr || obj->z_loadfltr) load_filtees(obj, 0, &lockstate); } + + dbg("enforcing main obj relro"); + if (obj_enforce_relro(obj_main) == -1) + rtld_die(); + lock_release(rtld_bind_lock, &lockstate); dbg("transferring control to program entry point = %p", obj_main->entry); @@ -2243,9 +2244,7 @@ initlist_add_objects(Obj_Entry *obj, Obj_Entry *tail, initlist_add_neededs(obj->needed_aux_filtees, list); /* Add the object to the init list. */ - if (obj->preinit_array != (Elf_Addr)NULL || obj->init != (Elf_Addr)NULL || - obj->init_array != (Elf_Addr)NULL) - objlist_push_tail(list, obj); + objlist_push_tail(list, obj); /* Add the object to the global fini list in the reverse order. */ if ((obj->fini != (Elf_Addr)NULL || obj->fini_array != (Elf_Addr)NULL) @@ -2894,11 +2893,9 @@ relocate_object(Obj_Entry *obj, bool bind_now, Obj_Ent if (reloc_plt(obj) == -1) return (-1); /* Relocate the jump slots if we are doing immediate binding. */ - if (obj->bind_now || bind_now) { - if (reloc_jmpslots(obj, flags, lockstate) == -1 || - resolve_object_ifunc(obj, true, flags, lockstate) == -1) - return (-1); - } + if ((obj->bind_now || bind_now) && reloc_jmpslots(obj, flags, + lockstate) == -1) + return (-1); /* * Process the non-PLT IFUNC relocations. The relocations are @@ -2964,24 +2961,16 @@ static int resolve_object_ifunc(Obj_Entry *obj, bool bind_now, int flags, RtldLockState *lockstate) { + + if (obj->ifuncs_resolved) + return (0); + obj->ifuncs_resolved = true; if (obj->irelative && reloc_iresolve(obj, lockstate) == -1) return (-1); - if ((obj->bind_now || bind_now) && obj->gnu_ifunc && - reloc_gnu_ifunc(obj, flags, lockstate) == -1) - return (-1); - return (0); -} - -static int -resolve_objects_ifunc(Obj_Entry *first, bool bind_now, int flags, - RtldLockState *lockstate) -{ - Obj_Entry *obj; - - for (obj = first; obj != NULL; obj = TAILQ_NEXT(obj, next)) { - if (obj->marker) - continue; - if (resolve_object_ifunc(obj, bind_now, flags, lockstate) == -1) + if ((obj->bind_now || bind_now) && obj->gnu_ifunc) { + if (obj_disable_relro(obj) || + reloc_gnu_ifunc(obj, flags, lockstate) == -1 || + obj_enforce_relro(obj)) return (-1); } return (0); @@ -2992,9 +2981,13 @@ initlist_objects_ifunc(Objlist *list, bool bind_now, i RtldLockState *lockstate) { Objlist_Entry *elm; + Obj_Entry *obj; STAILQ_FOREACH(elm, list, link) { - if (resolve_object_ifunc(elm->obj, bind_now, flags, + obj = elm->obj; + if (obj->marker) + continue; + if (resolve_object_ifunc(obj, bind_now, flags, lockstate) == -1) return (-1); } @@ -5354,17 +5347,31 @@ _rtld_is_dlopened(void *arg) return (res); } -int -obj_enforce_relro(Obj_Entry *obj) +static int +obj_remap_relro(Obj_Entry *obj, int prot) { if (obj->relro_size > 0 && mprotect(obj->relro_page, obj->relro_size, - PROT_READ) == -1) { - _rtld_error("%s: Cannot enforce relro protection: %s", - obj->path, rtld_strerror(errno)); + prot) == -1) { + _rtld_error("%s: Cannot set relro protection to %#x: %s", + obj->path, prot, rtld_strerror(errno)); return (-1); } return (0); +} + +static int +obj_disable_relro(Obj_Entry *obj) +{ + + return (obj_remap_relro(obj, PROT_READ | PROT_WRITE)); +} + +static int +obj_enforce_relro(Obj_Entry *obj) +{ + + return (obj_remap_relro(obj, PROT_READ)); } static void Modified: head/libexec/rtld-elf/rtld.h ============================================================================== --- head/libexec/rtld-elf/rtld.h Mon Dec 3 20:01:51 2018 (r341440) +++ head/libexec/rtld-elf/rtld.h Mon Dec 3 20:03:43 2018 (r341441) @@ -264,6 +264,7 @@ typedef struct Struct_Obj_Entry { bool irelative : 1; /* Object has R_MACHDEP_IRELATIVE relocs */ bool gnu_ifunc : 1; /* Object has references to STT_GNU_IFUNC */ bool non_plt_gnu_ifunc : 1; /* Object has non-plt IFUNC references */ + bool ifuncs_resolved : 1; /* Object ifuncs were already resolved */ bool crt_no_init : 1; /* Object' crt does not call _init/_fini */ bool valid_hash_sysv : 1; /* A valid System V hash hash tag is available */ bool valid_hash_gnu : 1; /* A valid GNU hash tag is available */ From owner-svn-src-head@freebsd.org Mon Dec 3 20:54:20 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8985F130B7DF; Mon, 3 Dec 2018 20:54:20 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 22BE56E7CC; Mon, 3 Dec 2018 20:54:20 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 03AF71B389; Mon, 3 Dec 2018 20:54:20 +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 wB3KsJOX010634; Mon, 3 Dec 2018 20:54:19 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB3KsI6d010625; Mon, 3 Dec 2018 20:54:18 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201812032054.wB3KsI6d010625@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 3 Dec 2018 20:54:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341442 - in head/sys: amd64/amd64 amd64/ia32 arm/arm fs/procfs i386/i386 kern sparc64/sparc64 X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys: amd64/amd64 amd64/ia32 arm/arm fs/procfs i386/i386 kern sparc64/sparc64 X-SVN-Commit-Revision: 341442 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 22BE56E7CC X-Spamd-Result: default: False [-0.04 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.34)[-0.338,0]; NEURAL_SPAM_LONG(0.05)[0.050,0]; NEURAL_SPAM_SHORT(0.25)[0.247,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Dec 2018 20:54:20 -0000 Author: markj Date: Mon Dec 3 20:54:17 2018 New Revision: 341442 URL: https://svnweb.freebsd.org/changeset/base/341442 Log: Plug memory disclosures via ptrace(2). On some architectures, the structures returned by PT_GET*REGS were not fully populated and could contain uninitialized stack memory. The same issue existed with the register files in procfs. Reported by: Thomas Barabosch, Fraunhofer FKIE Reviewed by: kib MFC after: 3 days Security: kernel stack memory disclosure Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D18421 Modified: head/sys/amd64/amd64/machdep.c head/sys/amd64/ia32/ia32_reg.c head/sys/arm/arm/machdep_kdb.c head/sys/fs/procfs/procfs_dbregs.c head/sys/fs/procfs/procfs_fpregs.c head/sys/fs/procfs/procfs_regs.c head/sys/i386/i386/machdep.c head/sys/kern/sys_process.c head/sys/sparc64/sparc64/machdep.c Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Mon Dec 3 20:03:43 2018 (r341441) +++ head/sys/amd64/amd64/machdep.c Mon Dec 3 20:54:17 2018 (r341442) @@ -2045,6 +2045,7 @@ fill_regs(struct thread *td, struct reg *regs) int fill_frame_regs(struct trapframe *tp, struct reg *regs) { + regs->r_r15 = tp->tf_r15; regs->r_r14 = tp->tf_r14; regs->r_r13 = tp->tf_r13; @@ -2076,6 +2077,8 @@ fill_frame_regs(struct trapframe *tp, struct reg *regs regs->r_fs = 0; regs->r_gs = 0; } + regs->r_err = 0; + regs->r_trapno = 0; return (0); } Modified: head/sys/amd64/ia32/ia32_reg.c ============================================================================== --- head/sys/amd64/ia32/ia32_reg.c Mon Dec 3 20:03:43 2018 (r341441) +++ head/sys/amd64/ia32/ia32_reg.c Mon Dec 3 20:54:17 2018 (r341442) @@ -105,6 +105,8 @@ fill_regs32(struct thread *td, struct reg32 *regs) regs->r_eflags = tp->tf_rflags; regs->r_esp = tp->tf_rsp; regs->r_ss = tp->tf_ss; + regs->r_err = 0; + regs->r_trapno = 0; return (0); } Modified: head/sys/arm/arm/machdep_kdb.c ============================================================================== --- head/sys/arm/arm/machdep_kdb.c Mon Dec 3 20:03:43 2018 (r341441) +++ head/sys/arm/arm/machdep_kdb.c Mon Dec 3 20:54:17 2018 (r341442) @@ -104,6 +104,7 @@ fill_regs(struct thread *td, struct reg *regs) regs->r_cpsr = tf->tf_spsr; return (0); } + int fill_fpregs(struct thread *td, struct fpreg *regs) { @@ -134,8 +135,11 @@ set_fpregs(struct thread *td, struct fpreg *regs) int fill_dbregs(struct thread *td, struct dbreg *regs) { + + bzero(regs, sizeof(*regs)); return (0); } + int set_dbregs(struct thread *td, struct dbreg *regs) { Modified: head/sys/fs/procfs/procfs_dbregs.c ============================================================================== --- head/sys/fs/procfs/procfs_dbregs.c Mon Dec 3 20:03:43 2018 (r341441) +++ head/sys/fs/procfs/procfs_dbregs.c Mon Dec 3 20:54:17 2018 (r341442) @@ -112,8 +112,10 @@ procfs_doprocdbregs(PFS_FILL_ARGS) return (EINVAL); } wrap32 = 1; - } + memset(&r32, 0, sizeof(r32)); + } else #endif + memset(&r, 0, sizeof(r)); error = PROC(read, dbregs, td2, &r); if (error == 0) { PROC_UNLOCK(p); Modified: head/sys/fs/procfs/procfs_fpregs.c ============================================================================== --- head/sys/fs/procfs/procfs_fpregs.c Mon Dec 3 20:03:43 2018 (r341441) +++ head/sys/fs/procfs/procfs_fpregs.c Mon Dec 3 20:54:17 2018 (r341442) @@ -102,7 +102,6 @@ procfs_doprocfpregs(PFS_FILL_ARGS) return (EBUSY); } - /* XXXKSE: */ td2 = FIRST_THREAD_IN_PROC(p); #ifdef COMPAT_FREEBSD32 if (SV_CURPROC_FLAG(SV_ILP32)) { @@ -111,8 +110,10 @@ procfs_doprocfpregs(PFS_FILL_ARGS) return (EINVAL); } wrap32 = 1; - } + memset(&r32, 0, sizeof(r32)); + } else #endif + memset(&r, 0, sizeof(r)); error = PROC(read, fpregs, td2, &r); if (error == 0) { PROC_UNLOCK(p); Modified: head/sys/fs/procfs/procfs_regs.c ============================================================================== --- head/sys/fs/procfs/procfs_regs.c Mon Dec 3 20:03:43 2018 (r341441) +++ head/sys/fs/procfs/procfs_regs.c Mon Dec 3 20:54:17 2018 (r341442) @@ -102,7 +102,6 @@ procfs_doprocregs(PFS_FILL_ARGS) return (EBUSY); } - /* XXXKSE: */ td2 = FIRST_THREAD_IN_PROC(p); #ifdef COMPAT_FREEBSD32 if (SV_CURPROC_FLAG(SV_ILP32)) { @@ -111,8 +110,10 @@ procfs_doprocregs(PFS_FILL_ARGS) return (EINVAL); } wrap32 = 1; - } + memset(&r32, 0, sizeof(r32)); + } else #endif + memset(&r, 0, sizeof(r)); error = PROC(read, regs, td2, &r); if (error == 0) { PROC_UNLOCK(p); Modified: head/sys/i386/i386/machdep.c ============================================================================== --- head/sys/i386/i386/machdep.c Mon Dec 3 20:03:43 2018 (r341441) +++ head/sys/i386/i386/machdep.c Mon Dec 3 20:54:17 2018 (r341442) @@ -2816,6 +2816,7 @@ fill_regs(struct thread *td, struct reg *regs) int fill_frame_regs(struct trapframe *tp, struct reg *regs) { + regs->r_fs = tp->tf_fs; regs->r_es = tp->tf_es; regs->r_ds = tp->tf_ds; @@ -2831,6 +2832,8 @@ fill_frame_regs(struct trapframe *tp, struct reg *regs regs->r_eflags = tp->tf_eflags; regs->r_esp = tp->tf_esp; regs->r_ss = tp->tf_ss; + regs->r_err = 0; + regs->r_trapno = 0; return (0); } Modified: head/sys/kern/sys_process.c ============================================================================== --- head/sys/kern/sys_process.c Mon Dec 3 20:03:43 2018 (r341441) +++ head/sys/kern/sys_process.c Mon Dec 3 20:54:17 2018 (r341442) @@ -541,6 +541,9 @@ struct ptrace_args { * copyin(uap->addr, &r.reg32, sizeof r.reg32); * .. except this is done at runtime. */ +#define BZERO(a, s) wrap32 ? \ + bzero(a ## 32, s ## 32) : \ + bzero(a, s) #define COPYIN(u, k, s) wrap32 ? \ copyin(u, k ## 32, s ## 32) : \ copyin(u, k, s) @@ -573,7 +576,7 @@ sys_ptrace(struct thread *td, struct ptrace_args *uap) struct ptrace_lwpinfo32 pl32; struct ptrace_vm_entry32 pve32; #endif - char args[nitems(td->td_sa.args) * sizeof(register_t)]; + char args[sizeof(td->td_sa.args)]; int ptevents; } r; void *addr; @@ -590,11 +593,17 @@ sys_ptrace(struct thread *td, struct ptrace_args *uap) addr = &r; switch (uap->req) { case PT_GET_EVENT_MASK: + case PT_LWPINFO: + case PT_GET_SC_ARGS: + break; case PT_GETREGS: + BZERO(&r.reg, sizeof r.reg); + break; case PT_GETFPREGS: + BZERO(&r.fpreg, sizeof r.fpreg); + break; case PT_GETDBREGS: - case PT_LWPINFO: - case PT_GET_SC_ARGS: + BZERO(&r.dbreg, sizeof r.dbreg); break; case PT_SETREGS: error = COPYIN(uap->addr, &r.reg, sizeof r.reg); @@ -662,6 +671,7 @@ sys_ptrace(struct thread *td, struct ptrace_args *uap) } #undef COPYIN #undef COPYOUT +#undef BZERO #ifdef COMPAT_FREEBSD32 /* Modified: head/sys/sparc64/sparc64/machdep.c ============================================================================== --- head/sys/sparc64/sparc64/machdep.c Mon Dec 3 20:03:43 2018 (r341441) +++ head/sys/sparc64/sparc64/machdep.c Mon Dec 3 20:54:17 2018 (r341442) @@ -1056,6 +1056,7 @@ fill_fpregs(struct thread *td, struct fpreg *fpregs) bcopy(pcb->pcb_ufp, fpregs->fr_regs, sizeof(fpregs->fr_regs)); fpregs->fr_fsr = tf->tf_fsr; fpregs->fr_gsr = tf->tf_gsr; + fpregs->fr_pad[0] = 0; return (0); } From owner-svn-src-head@freebsd.org Mon Dec 3 20:58:18 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8E35B130B941; Mon, 3 Dec 2018 20:58:18 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by mx1.freebsd.org (Postfix) with ESMTP id 889FC6EB2C; Mon, 3 Dec 2018 20:58:16 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id BE68143FEB4; Tue, 4 Dec 2018 07:58:14 +1100 (AEDT) Date: Tue, 4 Dec 2018 07:58:13 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Ian Lepore cc: Justin Hibbits , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r341103 - head/sys/powerpc/include In-Reply-To: <1543865260.1860.190.camel@freebsd.org> Message-ID: <20181204064443.F3470@besplex.bde.org> References: <201811280248.wAS2miqW055485@repo.freebsd.org> <20181128151148.X1660@besplex.bde.org> <20181203102007.4021aa32@ralga.knownspace> <20181204043712.F3059@besplex.bde.org> <1543865260.1860.190.camel@freebsd.org> MIME-Version: 1.0 X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=DZtnkrlW c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=nlC_4_pT8q9DhB4Ho9EA:9 a=X60SueohGfhK4wzaWbEA:9 a=TwM0Mj6SzhmnrwvA:21 a=_tgWLagAo8SVkydJ:21 a=45ClL6m2LaAA:10 X-Rspamd-Queue-Id: 889FC6EB2C X-Spamd-Result: default: False [-3.76 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:211.29.132.0/23]; FREEMAIL_FROM(0.00)[optusnet.com.au]; MIME_GOOD(-0.10)[multipart/mixed,text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DMARC_NA(0.00)[optusnet.com.au]; RCPT_COUNT_FIVE(0.00)[5]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; IP_SCORE(-1.51)[ipnet: 211.28.0.0/14(-4.16), asn: 4804(-3.33), country: AU(-0.04)]; MX_GOOD(-0.01)[cached: extmail.optusnet.com.au]; CTYPE_MIXED_BOGUS(1.00)[]; NEURAL_HAM_SHORT(-0.94)[-0.939,0]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[optusnet.com.au]; ASN(0.00)[asn:4804, ipnet:211.28.0.0/14, country:AU]; RCVD_COUNT_TWO(0.00)[2]; RCVD_IN_DNSWL_LOW(-0.10)[246.132.29.211.list.dnswl.org : 127.0.5.1] X-Rspamd-Server: mx1.freebsd.org Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed 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: Mon, 03 Dec 2018 20:58:18 -0000 On Mon, 3 Dec 2018, Ian Lepore wrote: > On Tue, 2018-12-04 at 05:56 +1100, Bruce Evans wrote: >> On Mon, 3 Dec 2018, Justin Hibbits wrote: >> >> [...] >> >> Please look at removing VM_KMEM_SIZE_SCALE completely.=A0 I'm now trying= to >> convince kib that it is bogus for all arches, but only know exactly what >> happens on x86. > ... > I know we had problems with the default scaling on armv7 at $work when > we tried to embed a large (150mb) mdrootfs into our kernel for a system > with 2gb ram. I had to chase down the meaning of the scale variable > (and I certainly could have misunderstood it to any degree), but here's > what I wrote about it after fiddling and finding a value that worked > for us. This was for early incarnations of 11-stable. i386 can now fit a 2GB malloc-backed disk in 2.7GB of RAM and its 4GB kva. This is sort of the opposite packing (allocate the md disk later). This requires a few more tweaks: - change the scale to 1. The bogus scale of 3 restricts kmem to 2.7GB/3 =3D 900MB - change vm.kmem_size to a few hundred MB above the desired md disk size. vm_kmem_size defaults to 1.7GB (was 420MB with 1GB kva). This leaves almost 2.3GB for non-kmem allocations, only 300-400MB is needed. I change some of these allocations, but the more interesting ones are in kmem. > # Tuning required to make the kernel work with a large > # embedded filesystem... > #=A0 > # Allocate one page of kmem_arena KVA for every > # VM_KMEM_SIZE_SCALE pages of ram.=A0=A0The default scale is 3, > # and with a huge (>100MB) embedded mdroot that doesn't leave > # enough virtual address space to allocate enough kernel > # stacks, mbufs, and other resources that come out of KVA. > options=A0=09VM_KMEM_SIZE_SCALE=3D5 You should probably use vm.kmem_size for this (VM_KMEM_SIZE_SCALE=3D5 can b= e done using a tunable too). But this is a hack. The large md allocation shows that some of resource calculations are wrong. kmem uses vm_cnt.v_page_count (pages) for the main resource size in most cases. The page count is variable and has already been reduced, but the kva limits are constants. 150MB is not very large compared with the memory size, so the reduction in the default kmem size based on page count is not large. The default kmem size might be larger than VM_KMEM_SIZE_MAX, as on i386 wit= h 1GB kva. Then the default is actually VM_KMEM_SIZE_MAX, but this is far to= o large after the md disk steals 150MB of kva. My version was originally to fix a related problem with PAE for i386. The page tables can be very large (448MB for 16GB RAM just for the main page table metadata). When the kva size is 1GB, not accounting for this throws all allocation sizes off by a factor of 2, and it is hard to fit everything in the remaining ~512MB even with non-sloppy calculations. When the kva size is 4GB as in -current, the error factor is closer to 1, so sloppy calculations have a chance of working. The md disk needs the same treatment. I think it can only be embedded in the kernel text+data+bss+etc. That is easy to handle, but I didn't notice the problem since my kernels are relatively small. Bruce From owner-svn-src-head@freebsd.org Mon Dec 3 21:07:11 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B1637130BD99; Mon, 3 Dec 2018 21:07:11 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4A0696F31D; Mon, 3 Dec 2018 21:07:11 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2A1B21B52F; Mon, 3 Dec 2018 21:07:11 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB3L7Ahn016453; Mon, 3 Dec 2018 21:07:10 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB3L7A44016452; Mon, 3 Dec 2018 21:07:10 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201812032107.wB3L7A44016452@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 3 Dec 2018 21:07:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341443 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 341443 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4A0696F31D X-Spamd-Result: default: False [-0.12 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.38)[-0.376,0]; NEURAL_SPAM_LONG(0.00)[0.005,0]; NEURAL_SPAM_SHORT(0.25)[0.250,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Dec 2018 21:07:11 -0000 Author: markj Date: Mon Dec 3 21:07:10 2018 New Revision: 341443 URL: https://svnweb.freebsd.org/changeset/base/341443 Log: Add a missing definition for the !COMPAT_FREEBSD32 case. Reported by: jenkins MFC with: r341442 Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/sys_process.c Modified: head/sys/kern/sys_process.c ============================================================================== --- head/sys/kern/sys_process.c Mon Dec 3 20:54:17 2018 (r341442) +++ head/sys/kern/sys_process.c Mon Dec 3 21:07:10 2018 (r341443) @@ -551,6 +551,7 @@ struct ptrace_args { copyout(k ## 32, u, s ## 32) : \ copyout(k, u, s) #else +#define BZERO(a, s) bzero(a, s) #define COPYIN(u, k, s) copyin(u, k, s) #define COPYOUT(k, u, s) copyout(k, u, s) #endif From owner-svn-src-head@freebsd.org Mon Dec 3 22:09:24 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 68485130D0EF; Mon, 3 Dec 2018 22:09:24 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0F83B7182A; Mon, 3 Dec 2018 22:09:24 +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 E1BCD1BF8F; Mon, 3 Dec 2018 22:09:23 +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 wB3M9NjU047868; Mon, 3 Dec 2018 22:09:23 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB3M9NP7047867; Mon, 3 Dec 2018 22:09:23 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201812032209.wB3M9NP7047867@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Mon, 3 Dec 2018 22:09:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341445 - head/lib/libthr/thread X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head/lib/libthr/thread X-SVN-Commit-Revision: 341445 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0F83B7182A X-Spamd-Result: default: False [-0.23 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.38)[-0.376,0]; NEURAL_SPAM_LONG(0.00)[0.005,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_SPAM_SHORT(0.15)[0.146,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Dec 2018 22:09:24 -0000 Author: brooks Date: Mon Dec 3 22:09:23 2018 New Revision: 341445 URL: https://svnweb.freebsd.org/changeset/base/341445 Log: Remove declarations of syscalls not used in libthr. Reviewed by: kib Sponsored by: DARPA, AFRL Modified: head/lib/libthr/thread/thr_private.h Modified: head/lib/libthr/thread/thr_private.h ============================================================================== --- head/lib/libthr/thread/thr_private.h Mon Dec 3 22:02:08 2018 (r341444) +++ head/lib/libthr/thread/thr_private.h Mon Dec 3 22:09:23 2018 (r341445) @@ -865,10 +865,6 @@ int __sys_openat(int, const char *, int, ...); /* #include */ #ifdef _SIGNAL_H_ -int __sys_kill(pid_t, int); -int __sys_sigaltstack(const struct sigaltstack *, struct sigaltstack *); -int __sys_sigpending(sigset_t *); -int __sys_sigreturn(const ucontext_t *); #ifndef _LIBC_PRIVATE_H_ int __sys_sigaction(int, const struct sigaction *, struct sigaction *); int __sys_sigprocmask(int, const sigset_t *, sigset_t *); @@ -899,8 +895,6 @@ int __sys_swapcontext(ucontext_t *oucp, const ucontext /* #include */ #ifdef _UNISTD_H_ -void __sys_exit(int); -pid_t __sys_getpid(void); #ifndef _LIBC_PRIVATE_H_ int __sys_close(int); int __sys_fork(void); From owner-svn-src-head@freebsd.org Mon Dec 3 22:31:58 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 66705130D8C9; Mon, 3 Dec 2018 22:31:58 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0C91172924; Mon, 3 Dec 2018 22:31:58 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E200B1C416; Mon, 3 Dec 2018 22:31:57 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB3MVvYV060932; Mon, 3 Dec 2018 22:31:57 GMT (envelope-from yuripv@FreeBSD.org) Received: (from yuripv@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB3MVvaD060931; Mon, 3 Dec 2018 22:31:57 GMT (envelope-from yuripv@FreeBSD.org) Message-Id: <201812032231.wB3MVvaD060931@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: yuripv set sender to yuripv@FreeBSD.org using -f From: Yuri Pankov Date: Mon, 3 Dec 2018 22:31:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341446 - head/release/amd64 X-SVN-Group: head X-SVN-Commit-Author: yuripv X-SVN-Commit-Paths: head/release/amd64 X-SVN-Commit-Revision: 341446 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0C91172924 X-Spamd-Result: default: False [-0.23 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.38)[-0.376,0]; NEURAL_SPAM_LONG(0.00)[0.005,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_SPAM_SHORT(0.15)[0.146,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Dec 2018 22:31:58 -0000 Author: yuripv Date: Mon Dec 3 22:31:57 2018 New Revision: 341446 URL: https://svnweb.freebsd.org/changeset/base/341446 Log: mkisoimages.sh: don't use -p flag when copying loader.efi to msdosfs. This fixes 'cdrom' target in the case when world was built by user, and not root. Reviewed by: imp Differential revision: https://reviews.freebsd.org/D18414 Modified: head/release/amd64/mkisoimages.sh Modified: head/release/amd64/mkisoimages.sh ============================================================================== --- head/release/amd64/mkisoimages.sh Mon Dec 3 22:09:23 2018 (r341445) +++ head/release/amd64/mkisoimages.sh Mon Dec 3 22:31:57 2018 (r341446) @@ -49,7 +49,7 @@ if [ "$1" = "-b" ]; then mkdir efi mount -t msdosfs /dev/$device efi mkdir -p efi/efi/boot - cp -p "$BASEBITSDIR/boot/loader.efi" efi/efi/boot/bootx64.efi + cp "$BASEBITSDIR/boot/loader.efi" efi/efi/boot/bootx64.efi umount efi rmdir efi mdconfig -d -u $device From owner-svn-src-head@freebsd.org Mon Dec 3 23:39:46 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9ACAD130EA76; Mon, 3 Dec 2018 23:39:46 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3BD8B74657; Mon, 3 Dec 2018 23:39:46 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 16EC01CE03; Mon, 3 Dec 2018 23:39:46 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB3Ndjfv094552; Mon, 3 Dec 2018 23:39:45 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB3Ndjuc094550; Mon, 3 Dec 2018 23:39:45 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201812032339.wB3Ndjuc094550@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 3 Dec 2018 23:39:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341447 - in head/sys: compat/linuxkpi/common/src sys X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: compat/linuxkpi/common/src sys X-SVN-Commit-Revision: 341447 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3BD8B74657 X-Spamd-Result: default: False [0.04 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.51)[-0.508,0]; NEURAL_SPAM_SHORT(0.54)[0.541,0]; NEURAL_SPAM_LONG(0.00)[0.005,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Dec 2018 23:39:46 -0000 Author: kib Date: Mon Dec 3 23:39:45 2018 New Revision: 341447 URL: https://svnweb.freebsd.org/changeset/base/341447 Log: Improve procstat reporting for the linux cdev file descriptors. If there is a vnode attached to the linux file, use it to fill kinfo_file. Otherwise, report a new KF_TYPE_DEV file type, without supplying any type-specific information. KF_TYPE_DEV is supposed to be used by most devfs-specific file types. Sponsored by: Mellanox Technologies MFC after: 1 week Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c head/sys/sys/user.h Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_compat.c Mon Dec 3 22:31:57 2018 (r341446) +++ head/sys/compat/linuxkpi/common/src/linux_compat.c Mon Dec 3 23:39:45 2018 (r341447) @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -1546,8 +1547,24 @@ static int linux_file_fill_kinfo(struct file *fp, struct kinfo_file *kif, struct filedesc *fdp) { + struct linux_file *filp; + struct vnode *vp; + int error; - return (0); + filp = fp->f_data; + vp = filp->f_vnode; + if (vp == NULL) { + error = 0; + kif->kf_type = KF_TYPE_DEV; + } else { + vref(vp); + FILEDESC_SUNLOCK(fdp); + error = vn_fill_kinfo_vnode(vp, kif); + vrele(vp); + kif->kf_type = KF_TYPE_VNODE; + FILEDESC_SLOCK(fdp); + } + return (error); } unsigned int Modified: head/sys/sys/user.h ============================================================================== --- head/sys/sys/user.h Mon Dec 3 22:31:57 2018 (r341446) +++ head/sys/sys/user.h Mon Dec 3 23:39:45 2018 (r341447) @@ -262,6 +262,7 @@ struct user { #define KF_TYPE_SEM 9 #define KF_TYPE_PTS 10 #define KF_TYPE_PROCDESC 11 +#define KF_TYPE_DEV 12 #define KF_TYPE_UNKNOWN 255 #define KF_VTYPE_VNON 0 From owner-svn-src-head@freebsd.org Mon Dec 3 23:42:06 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 16131130EB49; Mon, 3 Dec 2018 23:42:06 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B129A748DE; Mon, 3 Dec 2018 23:42:05 +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 782781CF72; Mon, 3 Dec 2018 23:42:05 +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 wB3Ng5SO099130; Mon, 3 Dec 2018 23:42:05 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB3Ng4jx099126; Mon, 3 Dec 2018 23:42:04 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201812032342.wB3Ng4jx099126@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 3 Dec 2018 23:42:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341448 - in head: lib/libprocstat usr.bin/fstat usr.bin/procstat X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head: lib/libprocstat usr.bin/fstat usr.bin/procstat X-SVN-Commit-Revision: 341448 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B129A748DE X-Spamd-Result: default: False [0.13 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.48)[-0.475,0]; NEURAL_SPAM_LONG(0.05)[0.050,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_SPAM_SHORT(0.55)[0.553,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Dec 2018 23:42:06 -0000 Author: kib Date: Mon Dec 3 23:42:04 2018 New Revision: 341448 URL: https://svnweb.freebsd.org/changeset/base/341448 Log: Print type designator 'D' for the KF_TYPE_DEV files. No type-specific data is provided by the kernel. Sponsored by: Mellanox Technologies MFC after: 1 week Modified: head/lib/libprocstat/libprocstat.c head/lib/libprocstat/libprocstat.h head/usr.bin/fstat/fstat.c head/usr.bin/procstat/procstat_files.c Modified: head/lib/libprocstat/libprocstat.c ============================================================================== --- head/lib/libprocstat/libprocstat.c Mon Dec 3 23:39:45 2018 (r341447) +++ head/lib/libprocstat/libprocstat.c Mon Dec 3 23:42:04 2018 (r341448) @@ -588,6 +588,10 @@ procstat_getfiles_kvm(struct procstat *procstat, struc type = PS_FST_TYPE_PROCDESC; data = file.f_data; break; + case DTYPE_DEV: + type = PS_FST_TYPE_DEV; + data = file.f_data; + break; default: continue; } @@ -673,6 +677,7 @@ kinfo_type2fst(int kftype) } kftypes2fst[] = { { KF_TYPE_PROCDESC, PS_FST_TYPE_PROCDESC }, { KF_TYPE_CRYPTO, PS_FST_TYPE_CRYPTO }, + { KF_TYPE_DEV, PS_FST_TYPE_DEV }, { KF_TYPE_FIFO, PS_FST_TYPE_FIFO }, { KF_TYPE_KQUEUE, PS_FST_TYPE_KQUEUE }, { KF_TYPE_MQUEUE, PS_FST_TYPE_MQUEUE }, Modified: head/lib/libprocstat/libprocstat.h ============================================================================== --- head/lib/libprocstat/libprocstat.h Mon Dec 3 23:39:45 2018 (r341447) +++ head/lib/libprocstat/libprocstat.h Mon Dec 3 23:42:04 2018 (r341448) @@ -71,6 +71,7 @@ #define PS_FST_TYPE_UNKNOWN 11 #define PS_FST_TYPE_NONE 12 #define PS_FST_TYPE_PROCDESC 13 +#define PS_FST_TYPE_DEV 14 /* * Special descriptor numbers. Modified: head/usr.bin/fstat/fstat.c ============================================================================== --- head/usr.bin/fstat/fstat.c Mon Dec 3 23:39:45 2018 (r341447) +++ head/usr.bin/fstat/fstat.c Mon Dec 3 23:42:04 2018 (r341448) @@ -301,6 +301,8 @@ print_file_info(struct procstat *procstat, struct file case PS_FST_TYPE_SEM: print_sem_info(procstat, fst); break; + case PS_FST_TYPE_DEV: + break; default: if (vflg) fprintf(stderr, Modified: head/usr.bin/procstat/procstat_files.c ============================================================================== --- head/usr.bin/procstat/procstat_files.c Mon Dec 3 23:39:45 2018 (r341447) +++ head/usr.bin/procstat/procstat_files.c Mon Dec 3 23:42:04 2018 (r341448) @@ -408,6 +408,11 @@ procstat_files(struct procstat *procstat, struct kinfo xo_emit("{eq:fd_type/procdesc}"); break; + case PS_FST_TYPE_DEV: + str = "D"; + xo_emit("{eq:fd_type/dev}"); + break; + case PS_FST_TYPE_NONE: str = "?"; xo_emit("{eq:fd_type/none}"); From owner-svn-src-head@freebsd.org Tue Dec 4 00:10:53 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1B855130F494 for ; Tue, 4 Dec 2018 00:10:53 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: from mail-yb1-xb2c.google.com (mail-yb1-xb2c.google.com [IPv6:2607:f8b0:4864:20::b2c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0DF257565E for ; Tue, 4 Dec 2018 00:10:52 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: by mail-yb1-xb2c.google.com with SMTP id j145so1190281ybg.11 for ; Mon, 03 Dec 2018 16:10:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=+AlCDDFh6dzbJ1WYUIvS6BNDwWA352fR4xwHvFdHUKQ=; b=OBhOQxJMDBRRn8KejoGpO/vULv4Je1NssxuBd5Fl97GRj4Xtn5eP7FovWY0LEQlMTB Sl2DLDnCiB3z1dUsikJpF/fmoHM2QS4wM8aU6WPDWCSSrNvbI2dnALQgbk/si1XEW4gc 0knFTSYtaQfFR3eNpPqWgCJOpwnd3aXtXpZgqmEeZpeqyq8QOYIf8t/xpz+qse9ItP1y Q8kRgK/756p37negoYvJUwRxU8JUW4grqkdhCr8lTyTtfZaarccfV0k3rKeRQDUC5XgO nYaip5+zW7+2YGrCNOMxFedDlRxdqjsGOWdVTpdYnQdllOqRPK+8Nm1k3GvujVLeR/Oj ISFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=+AlCDDFh6dzbJ1WYUIvS6BNDwWA352fR4xwHvFdHUKQ=; b=doaPJ9oNod8fWGenVfP+pR7TMUxC2swn1zn2nasLfMrBP9NtCB0nv+ZathQn6bQEXS 8Iaobe6HR7O+HJJIg7pLm8OEGvOx62FRNQ55PqlOA+lpB6q8sC77XIinz1B2iYISl17h UMRWcgfMwL2qNsNHUyIsNL/fklcr31eKV1sLLF40IQXm7JsZUprIdc/xRnWCeetOm/zO prK+0cNZgocefG/un3SJiScYILEabLkbqzv5ZLgyPQtqm6PYEYl9M1jwy6Dt8LTFUY0U DSMScwG+Gi9nQICpkMrd7PWCRHEDf8Us3gceOMaMHw0MNwU/Ql7Pk0e4l1iXwvSL87NF bnyw== X-Gm-Message-State: AA+aEWauTxqwiloIiDyXkfNK4MQ0BeVw7K7dGfROHwQnqyRGMItxy2gN ee7Qe2HJMGWSq5nbaJwDO4J2PK4z+QQKone3LJ63Jw== X-Google-Smtp-Source: AFSGD/UBOFmKhir2MKDZxV7ukElqVHutAD4aybNt/hNdNjoH07BmBE8nhfCSQUyuK0/e4Mh6j9ULkp2MZMpuPnpBOks= X-Received: by 2002:a25:c747:: with SMTP id w68-v6mr17088158ybe.158.1543882251304; Mon, 03 Dec 2018 16:10:51 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a25:84d2:0:0:0:0:0 with HTTP; Mon, 3 Dec 2018 16:10:50 -0800 (PST) In-Reply-To: <201812032231.wB3MVvaD060931@repo.freebsd.org> References: <201812032231.wB3MVvaD060931@repo.freebsd.org> From: Oliver Pinter Date: Tue, 4 Dec 2018 01:10:50 +0100 Message-ID: Subject: Re: svn commit: r341446 - head/release/amd64 To: Yuri Pankov Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" X-Rspamd-Queue-Id: 0DF257565E X-Spamd-Result: default: False [-3.90 / 15.00]; ARC_NA(0.00)[]; TO_DN_EQ_ADDR_SOME(0.00)[]; R_DKIM_ALLOW(-0.20)[hardenedbsd.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; NEURAL_HAM_LONG(-1.00)[-0.998,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[hardenedbsd.org]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[hardenedbsd.org:+]; MX_GOOD(-0.01)[cached: alt1.aspmx.l.google.com]; RCVD_IN_DNSWL_NONE(0.00)[c.2.b.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]; NEURAL_HAM_SHORT(-0.82)[-0.818,0]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; IP_SCORE(-0.58)[ipnet: 2607:f8b0::/32(-1.54), asn: 15169(-1.26), country: US(-0.09)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US] X-Rspamd-Server: mx1.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: Tue, 04 Dec 2018 00:10:53 -0000 On Monday, December 3, 2018, Yuri Pankov wrote: > Author: yuripv > Date: Mon Dec 3 22:31:57 2018 > New Revision: 341446 > URL: https://svnweb.freebsd.org/changeset/base/341446 > > Log: > mkisoimages.sh: don't use -p flag when copying loader.efi to msdosfs. > > This fixes 'cdrom' target in the case when world was built by user, > and not root. > > Reviewed by: imp > Differential revision: https://reviews.freebsd.org/D18414 > > This was a known issue : https://lists.freebsd.org/pipermail/svn-src-head/2018-November/119689.html > Modified: > head/release/amd64/mkisoimages.sh > > Modified: head/release/amd64/mkisoimages.sh > ============================================================ > ================== > --- head/release/amd64/mkisoimages.sh Mon Dec 3 22:09:23 2018 > (r341445) > +++ head/release/amd64/mkisoimages.sh Mon Dec 3 22:31:57 2018 > (r341446) > @@ -49,7 +49,7 @@ if [ "$1" = "-b" ]; then > mkdir efi > mount -t msdosfs /dev/$device efi > mkdir -p efi/efi/boot > - cp -p "$BASEBITSDIR/boot/loader.efi" efi/efi/boot/bootx64.efi > + cp "$BASEBITSDIR/boot/loader.efi" efi/efi/boot/bootx64.efi > umount efi > rmdir efi > mdconfig -d -u $device > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" > From owner-svn-src-head@freebsd.org Tue Dec 4 00:15:48 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 15558130F775; Tue, 4 Dec 2018 00:15:48 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ACA7175AA4; Tue, 4 Dec 2018 00:15:47 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8D77E1D4D0; Tue, 4 Dec 2018 00:15:47 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB40Fl2x015024; Tue, 4 Dec 2018 00:15:47 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB40Flla015023; Tue, 4 Dec 2018 00:15:47 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201812040015.wB40Flla015023@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Tue, 4 Dec 2018 00:15:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341449 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 341449 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: ACA7175AA4 X-Spamd-Result: default: False [0.13 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.48)[-0.475,0]; NEURAL_SPAM_SHORT(0.55)[0.553,0]; NEURAL_SPAM_LONG(0.05)[0.050,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Dec 2018 00:15:48 -0000 Author: brooks Date: Tue Dec 4 00:15:47 2018 New Revision: 341449 URL: https://svnweb.freebsd.org/changeset/base/341449 Log: Remove a needlessly clever hack to start init with sys_exec(). Construct a struct image_args with the help of new exec_args_*() helper functions and call kern_execve(). The previous code mapped a page in userspace, copied arguments out to it one at a time, and then constructed a struct execve_args all so that sys_execve() can call exec_copyin_args() to copy the data back in to a struct image_args. Opencode the part of pre_execve()/post_execve() that releases a reference to the initial vmspace. We don't need to stop threads like they do. Reviewed by: kib, jhb (prior version) Obtained from: CheriBSD Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D15469 Modified: head/sys/kern/init_main.c Modified: head/sys/kern/init_main.c ============================================================================== --- head/sys/kern/init_main.c Mon Dec 3 23:42:04 2018 (r341448) +++ head/sys/kern/init_main.c Tue Dec 4 00:15:47 2018 (r341449) @@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -716,15 +717,15 @@ SYSCTL_INT(_kern, OID_AUTO, init_shutdown_timeout, static void start_init(void *dummy) { - vm_offset_t addr; - struct execve_args args; + struct image_args args; int options, error; size_t pathlen; + char flags[8], *flagp; char *var, *path; char *free_init_path, *tmp_init_path; - char *ucp, **uap, *arg0, *arg1; struct thread *td; struct proc *p; + struct vmspace *oldvmspace; TSENTER(); /* Here so we don't overlap with mi_startup. */ @@ -736,16 +737,6 @@ start_init(void *dummy) /* Wipe GELI passphrase from the environment. */ kern_unsetenv("kern.geom.eli.passphrase"); - /* - * Need just enough stack to hold the faked-up "execve()" arguments. - */ - addr = p->p_sysent->sv_usrstack - PAGE_SIZE; - if (vm_map_find(&p->p_vmspace->vm_map, NULL, 0, &addr, PAGE_SIZE, 0, - VMFS_NO_SPACE, VM_PROT_ALL, VM_PROT_ALL, 0) != 0) - panic("init: couldn't allocate argument space"); - p->p_vmspace->vm_maxsaddr = (caddr_t)addr; - p->p_vmspace->vm_ssize = 1; - if ((var = kern_getenv("init_path")) != NULL) { strlcpy(init_path, var, sizeof(init_path)); freeenv(var); @@ -757,63 +748,65 @@ start_init(void *dummy) if (bootverbose) printf("start_init: trying %s\n", path); - /* - * Move out the boot flag argument. - */ + memset(&args, 0, sizeof(args)); + error = exec_alloc_args(&args); + if (error != 0) + panic("%s: Can't allocate space for init arguments %d", + __func__, error); + + error = exec_args_add_fname(&args, path, UIO_SYSSPACE); + if (error != 0) + panic("%s: Can't add fname %d", __func__, error); + + error = exec_args_add_arg(&args, path, UIO_SYSSPACE); + if (error != 0) + panic("%s: Can't add argv[0] %d", __func__, error); + options = 0; - ucp = (char *)p->p_sysent->sv_usrstack; - (void)subyte(--ucp, 0); /* trailing zero */ + flagp = &flags[0]; + *flagp++ = '-'; if (boothowto & RB_SINGLE) { - (void)subyte(--ucp, 's'); - options = 1; + *flagp++ = 's'; + options++; } #ifdef notyet if (boothowto & RB_FASTBOOT) { - (void)subyte(--ucp, 'f'); - options = 1; + *flagp++ = 'f'; + options++; } #endif - #ifdef BOOTCDROM - (void)subyte(--ucp, 'C'); - options = 1; + *flagp++ = 'C'; + options++; #endif - if (options == 0) - (void)subyte(--ucp, '-'); - (void)subyte(--ucp, '-'); /* leading hyphen */ - arg1 = ucp; + *flagp++ = '-'; + *flagp++ = 0; + KASSERT(flagp <= &flags[0] + sizeof(flags), ("Overran flags")); + error = exec_args_add_arg(&args, flags, UIO_SYSSPACE); + if (error != 0) + panic("%s: Can't add argv[0] %d", __func__, error); /* - * Move out the file name (also arg 0). - */ - ucp -= pathlen; - copyout(path, ucp, pathlen); - arg0 = ucp; - - /* - * Move out the arg pointers. - */ - uap = (char **)rounddown2((intptr_t)ucp, sizeof(intptr_t)); - (void)suword((caddr_t)--uap, (long)0); /* terminator */ - (void)suword((caddr_t)--uap, (long)(intptr_t)arg1); - (void)suword((caddr_t)--uap, (long)(intptr_t)arg0); - - /* - * Point at the arguments. - */ - args.fname = arg0; - args.argv = uap; - args.envv = NULL; - - /* * Now try to exec the program. If can't for any reason * other than it doesn't exist, complain. * * Otherwise, return via fork_trampoline() all the way * to user mode as init! */ - if ((error = sys_execve(td, &args)) == EJUSTRETURN) { + KASSERT((td->td_pflags & TDP_EXECVMSPC) == 0, + ("nested execve")); + oldvmspace = td->td_proc->p_vmspace; + error = kern_execve(td, &args, NULL); + KASSERT(error != 0, + ("kern_execve returned success, not EJUSTRETURN")); + if (error == EJUSTRETURN) { + if ((td->td_pflags & TDP_EXECVMSPC) != 0) { + KASSERT(p->p_vmspace != oldvmspace, + ("oldvmspace still used")); + vmspace_free(oldvmspace); + td->td_pflags &= ~TDP_EXECVMSPC; + } free(free_init_path, M_TEMP); TSEXIT(); return; From owner-svn-src-head@freebsd.org Tue Dec 4 00:18:57 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1EF11130F82E; Tue, 4 Dec 2018 00:18:57 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 66B4275C7A; Tue, 4 Dec 2018 00:18:56 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id EF51F220C6; Mon, 3 Dec 2018 19:18:55 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Mon, 03 Dec 2018 19:18:55 -0500 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=NbFLSE My6Gb9Iuqh6eTojCdVxT5gFdH90AiDI8GGn2k=; b=HqCZVI77ZO1zqUm+v8/GMn xUFsJIQqLLIdpzq+NLPOMV4xR8jQmnDFzRegVTn5nEUDTUqdN30gGoB27KVuXmZI FEOXv9JvMDYYHtEYsTc9lmVdyMky7Yzfpn6I8Wvpk+1OFyQPfOq/MzFV3FGff194 FiRP9rq6YpPrvHzpV3gun9wgFshqRMbFyGNs4JDuja+S2cWPw8vLR5z0qRiDaLJe qQjG50z8N1V7unZzxBJopr7yfoEOZ+mqQj0I0WsTRhXcBxwJEUAIZLEn5hWYujnP uBk8yUguLdKEiWGFZZ2/yx/vnC2T0M/uASPq+LaEWunVdf6Onhjx0P8Z86Osx6oA == X-ME-Sender: X-ME-Proxy: Received: from [192.168.1.2] (unknown [62.183.125.176]) by mail.messagingengine.com (Postfix) with ESMTPA id C550B10391; Mon, 3 Dec 2018 19:18:53 -0500 (EST) Subject: Re: svn commit: r341446 - head/release/amd64 To: Oliver Pinter Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" References: <201812032231.wB3MVvaD060931@repo.freebsd.org> From: Yuri Pankov Openpgp: preference=signencrypt Autocrypt: addr=yuripv@FreeBSD.org; keydata= xsBNBFu8u6IBCADB11gP0QwnorrHjqAtKLHKHNHskhy0s7jqJKfx0YqXgVBKGLJ9/mjLAz0F CBNvemHSDDTs0mEZ9cBKKi6cmsav6+UQgr//yai6hvXLBJqKchSFO4MhmdvBtsGFq1yKz5Zi uhjmimKyIpgBgvMdbgGbGq6cnSB2uEPmZuJr419SVRODOkXukU+F5WHgaHzDdHAIu1asCt2B +6msxqIqlFWcXyZyTGicTGGvC/PFIsVRUtD1dIJANTC876g7DTb7LZXWiWwJpSJ4GKMXMHVX Ct9BoQ4i3nhKbOxb6Io1wsy+NFyWsTJ9KYrxKKPJP3oG8BWb/cqlFqnE4eNSsiq2q7krABEB AAHNH1l1cmkgUGFua292IDx5dXJpcHZAeXVyaXB2Lm5ldD7CwJcEEwEIAEECGwMFCQWjmoAF CwkIBwMFFQoJCAsFFgMCAQACHgECF4AWIQT4arc+w94tPi0v/3CTi+B/sSrhbAUCW708wAIZ AQAKCRCTi+B/sSrhbPxBB/961alcU091O+yKT5/oReHVc/PX0Tz4sW3V44AcgLfYlrZavCro EFz90qmCrl0xqEwuAKcC4bjmL8SjPWAhSN6IH9nxdw+HeZnAPiHm/q679Bu47+nHBl3qD/9p +t1PkKeKZfaWToFMt1nq06ytSu6VLMCwLdlDNe6DReX0ex/afEqKsuaIZSKL4UYjRwklp8PU Uf98QkrfapyHB67hQMzfI4tPeJaYyv0cTgfq3kUWJx1V6Xi0b6Zxj4ZrB2TXvaMO5g7yhU9E E3WWAvoe4FgB3a7dHe8atnHhq5+Cuvm6+LD4Jh7jvMAE5UMN+xxQpnGpNghHjaCy4vXrLRBZ nhRYzsBNBFu8u6IBCADKih3Q933rDNj4ZA8FhBQ2RlmBgvwOLcDPIL3h0V7h38y3+HisgFSc XACDsdrTlYZ1bRXkD9FHENynBcv0l/3uGJDk8jaGIDE0TP8OQBRp+IaU9/BHnAqrKxTJGIol Dahy2m+yx2yhdc6B4ujWMDqCF1rWOD+ymOWw+VLllOkrHcZa5PJtX9UOGbApZl8ZTM8El4CA NN8F1bg9MWzUi+8LYoGWGc+BwsFS1OUB1c4SPgMu5fD4Wfsr9yRl06fdpEA2YT7B/j5/5RSC 0sE2Zs/tmJ/JRflHJ12ycj59ma2xQMfEJF40hZDpMFQmZvbVqgEg3ocQcltjbxlIKZ/mjC4z ABEBAAHCwHwEGAEKACYWIQT4arc+w94tPi0v/3CTi+B/sSrhbAUCW7y7ogIbDAUJBaOagAAK CRCTi+B/sSrhbIDcCACqAZMcoxUBLZa40a5b24j5i1jplvCYYb3h+Q5lt5+BFJ87kCb4dJuU D3kh2i29BrxWQWa9WNue9ozxeYkbkfXubQYXexVolRsnh64OdGsE8KvorBFBB3zdK/GRt2Jy +jsnTfUWuQllbzMP0MfhCDMk1Mo8WvDH2/cOEP/yLKf20a+cd6nLs7bidjmGXo9pyuBKAtV6 Kv+VRu54AL+A/UBYu/eB3Dtvzcnut+1Zq6KaP++kUwPwINLIk04OBDwN0zRNTiqMAFYYyz2v ZHBB6E1th/l//ZC5b9Dk0ZpFI1bYdL9ymnrZe1MqbGPnDCToQxu00T/pZCm6Z92YrZQYuNwl Message-ID: <7fd4cc67-52df-56e1-faa9-281d4ddf57e2@FreeBSD.org> Date: Tue, 4 Dec 2018 03:18:43 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:60.0) Gecko/20100101 Thunderbird/60.3.2 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="TxhaTWPRQJ2ksX0DpfHg7UT0rY26ln9TK" X-Rspamd-Queue-Id: 66B4275C7A X-Spamd-Result: default: False [0.51 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.35)[-0.349,0]; NEURAL_SPAM_SHORT(0.56)[0.563,0]; NEURAL_SPAM_LONG(0.30)[0.301,0]; ASN(0.00)[asn:11403, ipnet:66.111.4.0/24, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Dec 2018 00:18:57 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --TxhaTWPRQJ2ksX0DpfHg7UT0rY26ln9TK Content-Type: multipart/mixed; boundary="JBii87QMc7OvQB40DXOa5N5lnpm8VfgSC"; protected-headers="v1" From: Yuri Pankov To: Oliver Pinter Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Message-ID: <7fd4cc67-52df-56e1-faa9-281d4ddf57e2@FreeBSD.org> Subject: Re: svn commit: r341446 - head/release/amd64 References: <201812032231.wB3MVvaD060931@repo.freebsd.org> In-Reply-To: --JBii87QMc7OvQB40DXOa5N5lnpm8VfgSC Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable Oliver Pinter wrote: >=20 >=20 > On Monday, December 3, 2018, Yuri Pankov > wrote: >=20 > Author: yuripv > Date: Mon Dec=C2=A0 3 22:31:57 2018 > New Revision: 341446 > URL: https://svnweb.freebsd.org/changeset/base/341446 > >=20 > Log: > =C2=A0 mkisoimages.sh: don't use -p flag when copying loader.efi to= msdosfs. >=20 > =C2=A0 This fixes 'cdrom' target in the case when world was built b= y user, > =C2=A0 and not root. >=20 > =C2=A0 Reviewed by:=C2=A0 imp > =C2=A0 Differential revision:=C2=A0 =C2=A0 =C2=A0 =C2=A0 https://re= views.freebsd.org/D18414 > >=20 >=20 > This was a known issue > :=C2=A0https://lists.freebsd.org/pipermail/svn-src-head/2018-November/1= 19689.html Sorry, I missed that. Looking at the HBSD change, does chmod step have any significance? > Modified: > =C2=A0 head/release/amd64/mkisoimages.sh >=20 > Modified: head/release/amd64/mkisoimages.sh > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > --- head/release/amd64/mkisoimages.sh=C2=A0 =C2=A0Mon Dec=C2=A0 3 2= 2:09:23 2018=C2=A0 =C2=A0 > =C2=A0 =C2=A0 (r341445) > +++ head/release/amd64/mkisoimages.sh=C2=A0 =C2=A0Mon Dec=C2=A0 3 2= 2:31:57 2018=C2=A0 =C2=A0 > =C2=A0 =C2=A0 (r341446) > @@ -49,7 +49,7 @@ if [ "$1" =3D "-b" ]; then > =C2=A0 =C2=A0 =C2=A0 =C2=A0 mkdir efi > =C2=A0 =C2=A0 =C2=A0 =C2=A0 mount -t msdosfs /dev/$device efi > =C2=A0 =C2=A0 =C2=A0 =C2=A0 mkdir -p efi/efi/boot > -=C2=A0 =C2=A0 =C2=A0 =C2=A0cp -p "$BASEBITSDIR/boot/loader.efi" ef= i/efi/boot/bootx64.efi > +=C2=A0 =C2=A0 =C2=A0 =C2=A0cp "$BASEBITSDIR/boot/loader.efi" efi/e= fi/boot/bootx64.efi > =C2=A0 =C2=A0 =C2=A0 =C2=A0 umount efi > =C2=A0 =C2=A0 =C2=A0 =C2=A0 rmdir efi > =C2=A0 =C2=A0 =C2=A0 =C2=A0 mdconfig -d -u $device > _______________________________________________ > svn-src-head@freebsd.org =C2=A0mai= ling list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > > To unsubscribe, send any mail to > "svn-src-head-unsubscribe@freebsd.org > " >=20 --JBii87QMc7OvQB40DXOa5N5lnpm8VfgSC-- --TxhaTWPRQJ2ksX0DpfHg7UT0rY26ln9TK Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEE+Gq3PsPeLT4tL/9wk4vgf7Eq4WwFAlwFx+MACgkQk4vgf7Eq 4WzmPwgAuLgp2QNmYXLc+o6UPfKpwr/rTN+DWjmSclG9QIlMHcxXcIllgzHNV7qw v3cA/djw55rSxXcQy+YMiJIrC+Y5+6+pazruihkjv0dJkToeVJyQwHL+MFsTubWA OKIKXfaFWsX9Lr68yWT1UwkiUN4Y/dxjnTZhPLgazu7YkVZqUTCIhZH4ZIJXTIR7 qyd5wKyM/Oky8UTyO40+Ow00kKTmkoJL4q9kS06XYe3tiYnLhPfYzBdbbHOccb9d nzDbnDSfVXuU02ggccHSUm5kTIXbV2ROj4bdfmW+NgZmdr4gcvGjpoVvi31M3t/U 0pIGx8hrI3hxfBAVIHiW64LX1Km6VA== =VV2T -----END PGP SIGNATURE----- --TxhaTWPRQJ2ksX0DpfHg7UT0rY26ln9TK-- From owner-svn-src-head@freebsd.org Tue Dec 4 00:22:09 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0D848130F9FE; Tue, 4 Dec 2018 00:22:09 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A820C76021; Tue, 4 Dec 2018 00:22:08 +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 6F3C31D653; Tue, 4 Dec 2018 00:22:08 +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 wB40M8Pd019765; Tue, 4 Dec 2018 00:22:08 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB40M8fB019764; Tue, 4 Dec 2018 00:22:08 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201812040022.wB40M8fB019764@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Tue, 4 Dec 2018 00:22:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341450 - head/tools/KSE X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head/tools/KSE X-SVN-Commit-Revision: 341450 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A820C76021 X-Spamd-Result: default: False [-0.05 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.539,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_SPAM_SHORT(0.53)[0.529,0]; NEURAL_HAM_LONG(-0.04)[-0.041,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Dec 2018 00:22:09 -0000 Author: brooks Date: Tue Dec 4 00:22:08 2018 New Revision: 341450 URL: https://svnweb.freebsd.org/changeset/base/341450 Log: Remove test for KSE (removed in 2008). Approved by: julian Deleted: head/tools/KSE/ From owner-svn-src-head@freebsd.org Tue Dec 4 03:23:15 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3FB14132237D; Tue, 4 Dec 2018 03:23:15 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D1A99811F7; Tue, 4 Dec 2018 03:23:14 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B2A521F98F; Tue, 4 Dec 2018 03:23:14 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB43NEvr015338; Tue, 4 Dec 2018 03:23:14 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB43NE1l015336; Tue, 4 Dec 2018 03:23:14 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201812040323.wB43NE1l015336@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Tue, 4 Dec 2018 03:23:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341453 - head/lib/libarchive X-SVN-Group: head X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: head/lib/libarchive X-SVN-Commit-Revision: 341453 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D1A99811F7 X-Spamd-Result: default: False [0.08 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.51)[-0.508,0]; NEURAL_SPAM_LONG(0.00)[0.005,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_SPAM_SHORT(0.58)[0.579,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Dec 2018 03:23:15 -0000 Author: sbruno Date: Tue Dec 4 03:23:14 2018 New Revision: 341453 URL: https://svnweb.freebsd.org/changeset/base/341453 Log: Revert r340997 at the request of multiple users. - breaks ports-mgmt/pkg build for mips64, powerpc64 and i386 for some users. --- pkg-static --- /usr/lib/liblzma.a(stream_encoder_mt.o): In function `mythread_cond_init': /usr/local/poudriere/jails/ppc64/usr/src/contrib/xz/src/common/mythread.h:230: undefined reference to `pthread_condattr_init' Reported by: jhibbits zeising Modified: head/lib/libarchive/Makefile head/lib/libarchive/config_freebsd.h Modified: head/lib/libarchive/Makefile ============================================================================== --- head/lib/libarchive/Makefile Tue Dec 4 02:30:11 2018 (r341452) +++ head/lib/libarchive/Makefile Tue Dec 4 03:23:14 2018 (r341453) @@ -7,6 +7,7 @@ _LIBARCHIVEDIR= ${SRCTOP}/contrib/libarchive LIB= archive LIBADD= z bz2 lzma bsdxml +CFLAGS+= -DHAVE_BZLIB_H=1 -DHAVE_LIBLZMA=1 -DHAVE_LZMA_H=1 # FreeBSD SHLIB_MAJOR value is managed as part of the FreeBSD system. # It has no real relation to the libarchive version number. Modified: head/lib/libarchive/config_freebsd.h ============================================================================== --- head/lib/libarchive/config_freebsd.h Tue Dec 4 02:30:11 2018 (r341452) +++ head/lib/libarchive/config_freebsd.h Tue Dec 4 03:23:14 2018 (r341453) @@ -133,17 +133,14 @@ #define HAVE_LCHFLAGS 1 #define HAVE_LCHMOD 1 #define HAVE_LCHOWN 1 -#define HAVE_LIBLZMA 1 #define HAVE_LIBZ 1 #define HAVE_LIMITS_H 1 #define HAVE_LINK 1 -#define HAVE_LZMA_H 1 #define HAVE_LOCALE_H 1 #define HAVE_LOCALTIME_R 1 #define HAVE_LONG_LONG_INT 1 #define HAVE_LSTAT 1 #define HAVE_LUTIMES 1 -#define HAVE_LZMA_STREAM_ENCODER_MT 1 #define HAVE_MBRTOWC 1 #define HAVE_MEMMOVE 1 #define HAVE_MEMORY_H 1 From owner-svn-src-head@freebsd.org Tue Dec 4 03:24:39 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DA14A13223F6; Tue, 4 Dec 2018 03:24:38 +0000 (UTC) (envelope-from sbruno@freebsd.org) Received: from mail.ignoranthack.me (ignoranthack.me [199.102.79.106]) (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 3A04D81360; Tue, 4 Dec 2018 03:24:38 +0000 (UTC) (envelope-from sbruno@freebsd.org) Received: from [192.168.0.6] (97-123-16-122.albq.qwest.net [97.123.16.122]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: sbruno@ignoranthack.me) by mail.ignoranthack.me (Postfix) with ESMTPSA id 567941AFBD8; Mon, 3 Dec 2018 20:01:19 +0000 (UTC) Subject: Re: svn commit: r340997 - head/lib/libarchive To: Martin Matuska , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201811262145.wAQLjRwO048495@repo.freebsd.org> From: Sean Bruno Openpgp: preference=signencrypt Autocrypt: addr=sbruno@freebsd.org; prefer-encrypt=mutual; keydata= xsBNBFk+0UEBCADaf4bgxxKvMOhRV5NPoGWRCCGm49d6+1VFNlQ77WsY/+Zvf95TPULdRlnG w648KfxWt7+O3kdKhdRwnqlXWC7zA2Qt0dRE1yIqOGJ4jp4INvp/bcxWzgr0aoKOjrlnfxRV bh+s0rzdZt6TsNL3cVYxkC8oezjaUkHdW4mFJU249U1QJogkF8g0FeKNfEcjEkwJNX6lQJH+ EzCWT0NCk6J+Xyo+zOOljxPp1OUfdvZi3ulkU/qTZstGVWxFVsP8xQklV/y3AFcbIYx6iGJ4 5L7WuB0IWhO7Z4yHENr8wFaNYwpod9i4egX2BugbrM8pOfhN2/qqdeG1L5LMtXw3yyAhABEB AAHNN1NlYW4gQnJ1bm8gKEZyZWVCU0QgRGV2ZWxvcGVyIEtleSkgPHNicnVub0BmcmVlYnNk Lm9yZz7CwJQEEwEKAD4WIQToxOn4gDUE4eP0ujS95PX+ibX8tgUCWT7RQQIbAwUJBaOagAUL CQgHAwUVCgkICwUWAwIBAAIeAQIXgAAKCRC95PX+ibX8ttKTCACFKzRc56EBAlVotq02EjZP SfX+unlk6AuPBzShxqRxeK+bGYVCigrYd1M8nnskv0dEiZ5iYeND9HIxbpEyopqgpVTibA7w gBXaZ7SOEhNX1wXwg14JrralfSmPFMYni+sWegPMX/zwfAsn1z4mG1Nn44Xqo3o7CfpkMPy6 M5Bow2IDzIhEYISLR+urxs74/aHU35PLtBSDtu18914SEMDdva27MARN8mbeCDbuJVfGCPWy YHuy2t+9u2Zn5Dd+t3sBXLM9gpeaMm+4x6TNPpESygbVdh4tDdjVZ9DK/bWFg0kMgfZoaq6J l0jNsQXrZV3bzYNFbVw04pFcvA2GIJ7xzsBNBFk+0UEBCADIXBmQOaKMHGbc9vwjhV4Oj5aZ DdhNedn12FVeTdOXJvuTOusgxS29lla0RenHGDsgD08UiFpasBXWq/E+BhQ19d+iRbLLR17O KKc1ZGefoVbLARLXD68J5j4XAyK+6k2KqBLlqzAEpHTzsksM9naARkVXiEVcrt6ciw0FSm8n kuK3gDKKe93XfzfP+TQdbvvzJc7Fa+appLbXz61TM1aikaQlda8bWubDegwXbuoJdB34xU1m yjr/N4o+raL0x7QrzdH+wwgrTTo+H4S2c1972Skt5K5tbxLowfHicRl23V8itVQr3sBtlX4+ 66q+Apm7+R36bUS/k+G45Sp6iPpxABEBAAHCwHwEGAEKACYWIQToxOn4gDUE4eP0ujS95PX+ ibX8tgUCWT7RQQIbDAUJBaOagAAKCRC95PX+ibX8trrIB/9Pljqt/JGamD9tx4dOVmxSyFg9 z2xzgklTLuDgS73MM120mM7ao9AQUeWiSle/H0UCK7xPOzC/aeUC4oygDQKAfkkNbCNTo3+A qDjBRA8qx0e9a/QjDL+RFgD4L5kLT4tToY8T8HaBp8h03LBfk510IaI8oL/Jg7vpM3PDtJMW tUi2H+yNFmL3NfM2oBToWKLFsoP54f/eeeImrNnrlLjLHPzqS+/9apgYqX2Jwiv3tHBc4FTO GuY8VvF7BpixJs8Pc2RUuCfSyodrp1YG1kRGlXAH0cqwwr0Zmk4+7dZvtVQMCl6kS6q1+84q JwtItxS2eXSEA4NO0sQ3BXUywANh Message-ID: Date: Mon, 3 Dec 2018 20:24:27 -0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.3.2 MIME-Version: 1.0 In-Reply-To: <201811262145.wAQLjRwO048495@repo.freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="8s5ga0Z1pLJiAUmSMDhpsgVbjkp69kjID" X-Rspamd-Queue-Id: 3A04D81360 X-Spamd-Result: default: False [-0.73 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.92)[-0.917,0]; NEURAL_SPAM_SHORT(0.72)[0.724,0]; NEURAL_HAM_LONG(-0.54)[-0.538,0]; ASN(0.00)[asn:36236, ipnet:199.102.76.0/22, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Dec 2018 03:24:39 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --8s5ga0Z1pLJiAUmSMDhpsgVbjkp69kjID Content-Type: multipart/mixed; boundary="UzG3hWhQ9rZ0g5dwQYyh7eJTZ95McblDe"; protected-headers="v1" From: Sean Bruno To: Martin Matuska , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: Subject: Re: svn commit: r340997 - head/lib/libarchive References: <201811262145.wAQLjRwO048495@repo.freebsd.org> In-Reply-To: <201811262145.wAQLjRwO048495@repo.freebsd.org> --UzG3hWhQ9rZ0g5dwQYyh7eJTZ95McblDe Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable I have reverted this change from head. sean On 11/26/18 2:45 PM, Martin Matuska wrote: > Author: mm > Date: Mon Nov 26 21:45:27 2018 > New Revision: 340997 > URL: https://svnweb.freebsd.org/changeset/base/340997 >=20 > Log: > libarchive configuration changes > - move HAVE_BZLIB_H, HAVE_LIBLZMA and HAVE_LZMA_H to config_freebsd.h= > - activate support for multi-threaded lzma encoding [1] > =20 > PR: 233543 [1] > Reported by: cem > MFC after: 1 week >=20 > Modified: > head/lib/libarchive/Makefile > head/lib/libarchive/config_freebsd.h >=20 > Modified: head/lib/libarchive/Makefile > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libarchive/Makefile Mon Nov 26 20:56:05 2018 (r340996) > +++ head/lib/libarchive/Makefile Mon Nov 26 21:45:27 2018 (r340997) > @@ -7,7 +7,6 @@ _LIBARCHIVEDIR=3D ${SRCTOP}/contrib/libarchive > LIB=3D archive > =20 > LIBADD=3D z bz2 lzma bsdxml > -CFLAGS+=3D -DHAVE_BZLIB_H=3D1 -DHAVE_LIBLZMA=3D1 -DHAVE_LZMA_H=3D1 > =20 > # FreeBSD SHLIB_MAJOR value is managed as part of the FreeBSD system. > # It has no real relation to the libarchive version number. >=20 > Modified: head/lib/libarchive/config_freebsd.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libarchive/config_freebsd.h Mon Nov 26 20:56:05 2018 (r340= 996) > +++ head/lib/libarchive/config_freebsd.h Mon Nov 26 21:45:27 2018 (r340= 997) > @@ -133,14 +133,17 @@ > #define HAVE_LCHFLAGS 1 > #define HAVE_LCHMOD 1 > #define HAVE_LCHOWN 1 > +#define HAVE_LIBLZMA 1 > #define HAVE_LIBZ 1 > #define HAVE_LIMITS_H 1 > #define HAVE_LINK 1 > +#define HAVE_LZMA_H 1 > #define HAVE_LOCALE_H 1 > #define HAVE_LOCALTIME_R 1 > #define HAVE_LONG_LONG_INT 1 > #define HAVE_LSTAT 1 > #define HAVE_LUTIMES 1 > +#define HAVE_LZMA_STREAM_ENCODER_MT 1 > #define HAVE_MBRTOWC 1 > #define HAVE_MEMMOVE 1 > #define HAVE_MEMORY_H 1 >=20 >=20 --UzG3hWhQ9rZ0g5dwQYyh7eJTZ95McblDe-- --8s5ga0Z1pLJiAUmSMDhpsgVbjkp69kjID Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQGTBAEBCgB9FiEE6MTp+IA1BOHj9Lo0veT1/om1/LYFAlwF82tfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEU4 QzRFOUY4ODAzNTA0RTFFM0Y0QkEzNEJERTRGNUZFODlCNUZDQjYACgkQveT1/om1 /La7VQf+NMk7wYis0t4NlmYHiUAz6cAlMbFMIPhXqaGmEtYX+pDZrDfEJTYM3HrK QeYOA2E8kJIEdf4JtLnuHDWkVmSdkhjIXb3hk3h7tWS8gx8mwYjd4JJPXoTYFklO W2W4R+E0yuUP3G+ObX3nd/vwvDFxu/L28OFkHPT0JIhPy6HgciXAYdt81WUKWDN4 NyNywm/4WDxidhl68+LeTofvFuiBxpwua1g3pOzYwmazMe3HWh3Fr3/zSbWDfvhN z7v785nIvRAZj0QKoodCtjkI71978vc50mACWcXzOkejLS+Qr7KSFQtyFevnOf7e 1OgELm0UKqrO6EqfVT+5Rg+VzEQcsw== =q/k+ -----END PGP SIGNATURE----- --8s5ga0Z1pLJiAUmSMDhpsgVbjkp69kjID-- From owner-svn-src-head@freebsd.org Tue Dec 4 03:51:11 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1EB031322A0A; Tue, 4 Dec 2018 03:51:11 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B3CC4824CB; Tue, 4 Dec 2018 03:51:10 +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 94C601FE0B; Tue, 4 Dec 2018 03:51:10 +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 wB43pACo029525; Tue, 4 Dec 2018 03:51:10 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB43pAVv029524; Tue, 4 Dec 2018 03:51:10 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201812040351.wB43pAVv029524@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Tue, 4 Dec 2018 03:51:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341454 - 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: 341454 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B3CC4824CB X-Spamd-Result: default: False [0.08 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.51)[-0.508,0]; NEURAL_SPAM_LONG(0.00)[0.005,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_SPAM_SHORT(0.58)[0.579,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Dec 2018 03:51:11 -0000 Author: jhibbits Date: Tue Dec 4 03:51:10 2018 New Revision: 341454 URL: https://svnweb.freebsd.org/changeset/base/341454 Log: powerpc: preload_addr_relocate is no longer necessary for booke The same behavior was moved to machdep.c, paired with AIM's relocation, making this redundant. With this, it's now possible to boot FreeBSD with ubldr on a uboot Book-E platform, even with a KERNBASE != VM_MIN_KERNEL_ADDRESS. Modified: head/sys/powerpc/booke/pmap.c Modified: head/sys/powerpc/booke/pmap.c ============================================================================== --- head/sys/powerpc/booke/pmap.c Tue Dec 4 03:23:14 2018 (r341453) +++ head/sys/powerpc/booke/pmap.c Tue Dec 4 03:51:10 2018 (r341454) @@ -1753,13 +1753,6 @@ mmu_booke_bootstrap(mmu_t mmu, vm_offset_t start, vm_o data_start = round_page(kernelend); data_end = data_start; - /* - * Addresses of preloaded modules (like file systems) use - * physical addresses. Make sure we relocate those into - * virtual addresses. - */ - preload_addr_relocate = kernstart - kernload; - /* Allocate the dynamic per-cpu area. */ dpcpu = (void *)data_end; data_end += DPCPU_SIZE; From owner-svn-src-head@freebsd.org Tue Dec 4 04:55:53 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E048C1323C55; Tue, 4 Dec 2018 04:55:52 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 851EF83F1E; Tue, 4 Dec 2018 04:55:52 +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 61E6A20840; Tue, 4 Dec 2018 04:55:52 +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 wB44tqoe061340; Tue, 4 Dec 2018 04:55:52 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB44tnLg061328; Tue, 4 Dec 2018 04:55:49 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201812040455.wB44tnLg061328@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Tue, 4 Dec 2018 04:55:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341455 - in head/sys: dev/pci powerpc/ofw powerpc/powermac X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: in head/sys: dev/pci powerpc/ofw powerpc/powermac X-SVN-Commit-Revision: 341455 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 851EF83F1E X-Spamd-Result: default: False [-0.58 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.44)[-0.441,0]; NEURAL_HAM_SHORT(-0.23)[-0.234,0]; NEURAL_SPAM_LONG(0.10)[0.096,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Dec 2018 04:55:53 -0000 Author: jhibbits Date: Tue Dec 4 04:55:49 2018 New Revision: 341455 URL: https://svnweb.freebsd.org/changeset/base/341455 Log: Sprinkle EARLY_DRIVER_MODULE around the tree Mark some buses as BUS_PASS_BUS, and some resources as BUS_PASS_RESOURCE. This also decouples some resource attachment orderings from being races by device tree ordering, instead relying on the bus pass to provide the ordering. This was originally intended to support multipass suspend/resume, but it's also needed on PowerMacs when using fdt, as the device tree seems to get created in reverse of the OFW tree. Reviewed by: nwhitehorn (long ago) Differential Revision: https://reviews.freebsd.org/D918 Modified: head/sys/dev/pci/pci.c head/sys/dev/pci/pci_pci.c head/sys/powerpc/ofw/ofw_pcib_pci.c head/sys/powerpc/ofw/ofw_pcibus.c head/sys/powerpc/ofw/openpic_ofw.c head/sys/powerpc/powermac/cpcht.c head/sys/powerpc/powermac/macgpio.c head/sys/powerpc/powermac/macio.c head/sys/powerpc/powermac/pmu.c head/sys/powerpc/powermac/smu.c head/sys/powerpc/powermac/uninorth.c head/sys/powerpc/powermac/uninorthpci.c Modified: head/sys/dev/pci/pci.c ============================================================================== --- head/sys/dev/pci/pci.c Tue Dec 4 03:51:10 2018 (r341454) +++ head/sys/dev/pci/pci.c Tue Dec 4 04:55:49 2018 (r341455) @@ -214,7 +214,8 @@ static device_method_t pci_methods[] = { DEFINE_CLASS_0(pci, pci_driver, pci_methods, sizeof(struct pci_softc)); static devclass_t pci_devclass; -DRIVER_MODULE(pci, pcib, pci_driver, pci_devclass, pci_modevent, NULL); +EARLY_DRIVER_MODULE(pci, pcib, pci_driver, pci_devclass, pci_modevent, NULL, + BUS_PASS_BUS); MODULE_VERSION(pci, 1); static char *pci_vendordata; Modified: head/sys/dev/pci/pci_pci.c ============================================================================== --- head/sys/dev/pci/pci_pci.c Tue Dec 4 03:51:10 2018 (r341454) +++ head/sys/dev/pci/pci_pci.c Tue Dec 4 04:55:49 2018 (r341455) @@ -131,7 +131,8 @@ static device_method_t pcib_methods[] = { static devclass_t pcib_devclass; DEFINE_CLASS_0(pcib, pcib_driver, pcib_methods, sizeof(struct pcib_softc)); -DRIVER_MODULE(pcib, pci, pcib_driver, pcib_devclass, NULL, NULL); +EARLY_DRIVER_MODULE(pcib, pci, pcib_driver, pcib_devclass, NULL, NULL, + BUS_PASS_BUS); #if defined(NEW_PCIB) || defined(PCI_HP) SYSCTL_DECL(_hw_pci); Modified: head/sys/powerpc/ofw/ofw_pcib_pci.c ============================================================================== --- head/sys/powerpc/ofw/ofw_pcib_pci.c Tue Dec 4 03:51:10 2018 (r341454) +++ head/sys/powerpc/ofw/ofw_pcib_pci.c Tue Dec 4 04:55:49 2018 (r341455) @@ -86,7 +86,8 @@ struct ofw_pcib_softc { DEFINE_CLASS_1(pcib, ofw_pcib_pci_driver, ofw_pcib_pci_methods, sizeof(struct ofw_pcib_softc), pcib_driver); -DRIVER_MODULE(ofw_pcib, pci, ofw_pcib_pci_driver, pcib_devclass, 0, 0); +EARLY_DRIVER_MODULE(ofw_pcib, pci, ofw_pcib_pci_driver, pcib_devclass, 0, 0, + BUS_PASS_BUS); static int ofw_pcib_pci_probe(device_t dev) Modified: head/sys/powerpc/ofw/ofw_pcibus.c ============================================================================== --- head/sys/powerpc/ofw/ofw_pcibus.c Tue Dec 4 03:51:10 2018 (r341454) +++ head/sys/powerpc/ofw/ofw_pcibus.c Tue Dec 4 04:55:49 2018 (r341455) @@ -100,7 +100,8 @@ static devclass_t pci_devclass; DEFINE_CLASS_1(pci, ofw_pcibus_driver, ofw_pcibus_methods, sizeof(struct pci_softc), pci_driver); -DRIVER_MODULE(ofw_pcibus, pcib, ofw_pcibus_driver, pci_devclass, 0, 0); +EARLY_DRIVER_MODULE(ofw_pcibus, pcib, ofw_pcibus_driver, pci_devclass, 0, 0, + BUS_PASS_BUS); MODULE_VERSION(ofw_pcibus, 1); MODULE_DEPEND(ofw_pcibus, pci, 1, 1, 1); Modified: head/sys/powerpc/ofw/openpic_ofw.c ============================================================================== --- head/sys/powerpc/ofw/openpic_ofw.c Tue Dec 4 03:51:10 2018 (r341454) +++ head/sys/powerpc/ofw/openpic_ofw.c Tue Dec 4 04:55:49 2018 (r341455) @@ -95,9 +95,12 @@ static driver_t openpic_ofw_driver = { sizeof(struct openpic_softc), }; -DRIVER_MODULE(openpic, ofwbus, openpic_ofw_driver, openpic_devclass, 0, 0); -DRIVER_MODULE(openpic, simplebus, openpic_ofw_driver, openpic_devclass, 0, 0); -DRIVER_MODULE(openpic, macio, openpic_ofw_driver, openpic_devclass, 0, 0); +EARLY_DRIVER_MODULE(openpic, ofwbus, openpic_ofw_driver, openpic_devclass, + 0, 0, BUS_PASS_INTERRUPT); +EARLY_DRIVER_MODULE(openpic, simplebus, openpic_ofw_driver, openpic_devclass, + 0, 0, BUS_PASS_INTERRUPT); +EARLY_DRIVER_MODULE(openpic, macio, openpic_ofw_driver, openpic_devclass, 0, 0, + BUS_PASS_INTERRUPT); static int openpic_ofw_probe(device_t dev) Modified: head/sys/powerpc/powermac/cpcht.c ============================================================================== --- head/sys/powerpc/powermac/cpcht.c Tue Dec 4 03:51:10 2018 (r341454) +++ head/sys/powerpc/powermac/cpcht.c Tue Dec 4 04:55:49 2018 (r341455) @@ -139,7 +139,8 @@ struct cpcht_softc { static devclass_t cpcht_devclass; DEFINE_CLASS_1(pcib, cpcht_driver, cpcht_methods, sizeof(struct cpcht_softc), ofw_pci_driver); -DRIVER_MODULE(cpcht, ofwbus, cpcht_driver, cpcht_devclass, 0, 0); +EARLY_DRIVER_MODULE(cpcht, ofwbus, cpcht_driver, cpcht_devclass, 0, 0, + BUS_PASS_BUS); #define CPCHT_IOPORT_BASE 0xf4000000UL /* Hardwired */ #define CPCHT_IOPORT_SIZE 0x00400000UL @@ -545,7 +546,8 @@ static driver_t openpic_cpcht_driver = { sizeof(struct openpic_cpcht_softc), }; -DRIVER_MODULE(openpic, unin, openpic_cpcht_driver, openpic_devclass, 0, 0); +EARLY_DRIVER_MODULE(openpic, unin, openpic_cpcht_driver, openpic_devclass, + 0, 0, BUS_PASS_INTERRUPT); static int openpic_cpcht_probe(device_t dev) Modified: head/sys/powerpc/powermac/macgpio.c ============================================================================== --- head/sys/powerpc/powermac/macgpio.c Tue Dec 4 03:51:10 2018 (r341454) +++ head/sys/powerpc/powermac/macgpio.c Tue Dec 4 04:55:49 2018 (r341455) @@ -125,7 +125,8 @@ static driver_t macgpio_pci_driver = { devclass_t macgpio_devclass; -DRIVER_MODULE(macgpio, macio, macgpio_pci_driver, macgpio_devclass, 0, 0); +EARLY_DRIVER_MODULE(macgpio, macio, macgpio_pci_driver, macgpio_devclass, 0, 0, + BUS_PASS_BUS); struct macgpio_devinfo { struct ofw_bus_devinfo mdi_obdinfo; Modified: head/sys/powerpc/powermac/macio.c ============================================================================== --- head/sys/powerpc/powermac/macio.c Tue Dec 4 03:51:10 2018 (r341454) +++ head/sys/powerpc/powermac/macio.c Tue Dec 4 04:55:49 2018 (r341455) @@ -135,7 +135,8 @@ static driver_t macio_pci_driver = { devclass_t macio_devclass; -DRIVER_MODULE(macio, pci, macio_pci_driver, macio_devclass, 0, 0); +EARLY_DRIVER_MODULE(macio, pci, macio_pci_driver, macio_devclass, 0, 0, + BUS_PASS_BUS); /* * PCI ID search table Modified: head/sys/powerpc/powermac/pmu.c ============================================================================== --- head/sys/powerpc/powermac/pmu.c Tue Dec 4 03:51:10 2018 (r341454) +++ head/sys/powerpc/powermac/pmu.c Tue Dec 4 04:55:49 2018 (r341455) @@ -153,7 +153,8 @@ static driver_t pmu_driver = { static devclass_t pmu_devclass; -DRIVER_MODULE(pmu, macio, pmu_driver, pmu_devclass, 0, 0); +EARLY_DRIVER_MODULE(pmu, macio, pmu_driver, pmu_devclass, 0, 0, + BUS_PASS_RESOURCE); DRIVER_MODULE(adb, pmu, adb_driver, adb_devclass, 0, 0); static int pmuextint_probe(device_t); @@ -175,7 +176,8 @@ static driver_t pmuextint_driver = { static devclass_t pmuextint_devclass; -DRIVER_MODULE(pmuextint, macgpio, pmuextint_driver, pmuextint_devclass, 0, 0); +EARLY_DRIVER_MODULE(pmuextint, macgpio, pmuextint_driver, pmuextint_devclass, + 0, 0, BUS_PASS_RESOURCE); /* Make sure uhid is loaded, as it turns off some of the ADB emulation */ MODULE_DEPEND(pmu, usb, 1, 1, 1); Modified: head/sys/powerpc/powermac/smu.c ============================================================================== --- head/sys/powerpc/powermac/smu.c Tue Dec 4 03:51:10 2018 (r341454) +++ head/sys/powerpc/powermac/smu.c Tue Dec 4 04:55:49 2018 (r341455) @@ -630,7 +630,8 @@ static driver_t doorbell_driver = { static devclass_t doorbell_devclass; -DRIVER_MODULE(smudoorbell, macgpio, doorbell_driver, doorbell_devclass, 0, 0); +EARLY_DRIVER_MODULE(smudoorbell, macgpio, doorbell_driver, doorbell_devclass, + 0, 0, BUS_PASS_SUPPORTDEV); static int doorbell_probe(device_t dev) Modified: head/sys/powerpc/powermac/uninorth.c ============================================================================== --- head/sys/powerpc/powermac/uninorth.c Tue Dec 4 03:51:10 2018 (r341454) +++ head/sys/powerpc/powermac/uninorth.c Tue Dec 4 04:55:49 2018 (r341455) @@ -146,7 +146,8 @@ static devclass_t unin_chip_devclass; */ static device_t unin_chip; -DRIVER_MODULE(unin, ofwbus, unin_chip_driver, unin_chip_devclass, 0, 0); +EARLY_DRIVER_MODULE(unin, ofwbus, unin_chip_driver, unin_chip_devclass, 0, 0, + BUS_PASS_BUS); /* * Add an interrupt to the dev's resource list if present Modified: head/sys/powerpc/powermac/uninorthpci.c ============================================================================== --- head/sys/powerpc/powermac/uninorthpci.c Tue Dec 4 03:51:10 2018 (r341454) +++ head/sys/powerpc/powermac/uninorthpci.c Tue Dec 4 04:55:49 2018 (r341455) @@ -101,7 +101,8 @@ static devclass_t uninorth_devclass; DEFINE_CLASS_1(pcib, uninorth_driver, uninorth_methods, sizeof(struct uninorth_softc), ofw_pci_driver); -DRIVER_MODULE(uninorth, ofwbus, uninorth_driver, uninorth_devclass, 0, 0); +EARLY_DRIVER_MODULE(uninorth, ofwbus, uninorth_driver, uninorth_devclass, 0, 0, + BUS_PASS_BUS); static int uninorth_probe(device_t dev) From owner-svn-src-head@freebsd.org Tue Dec 4 06:11:05 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B85C413259DD; Tue, 4 Dec 2018 06:11:05 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5F50F8653B; Tue, 4 Dec 2018 06:11:05 +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 40B54213B0; Tue, 4 Dec 2018 06:11:05 +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 wB46B5UY097496; Tue, 4 Dec 2018 06:11:05 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB46B5ZR097495; Tue, 4 Dec 2018 06:11:05 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201812040611.wB46B5ZR097495@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Tue, 4 Dec 2018 06:11:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341456 - head/contrib/ipfilter X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/contrib/ipfilter X-SVN-Commit-Revision: 341456 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5F50F8653B X-Spamd-Result: default: False [-0.76 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.51)[-0.508,0]; NEURAL_SPAM_LONG(0.00)[0.005,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_SHORT(-0.26)[-0.260,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Dec 2018 06:11:05 -0000 Author: cy Date: Tue Dec 4 06:11:04 2018 New Revision: 341456 URL: https://svnweb.freebsd.org/changeset/base/341456 Log: As part of the general cleanup of the ipfilter code, special cases are committed separately to document fixing them separately from the general cleanup. In this case we don't want to hide the utter brokenness of what is being fixed. Clean up a discombobulated block of #if's, with one block unreachable. ip_fil.c is used in ipftest which is used to dry-run test ipfilter rules in userspace without loading them in the kernel. The call to (*ifp->if_output) matches that in the FreeBSD kernel. Further testing and work will be required to make ipftest fully functional. MFC after: 1 week Modified: head/contrib/ipfilter/ip_fil.c Modified: head/contrib/ipfilter/ip_fil.c ============================================================================== --- head/contrib/ipfilter/ip_fil.c Tue Dec 4 04:55:49 2018 (r341455) +++ head/contrib/ipfilter/ip_fil.c Tue Dec 4 06:11:04 2018 (r341456) @@ -482,14 +482,7 @@ ipf_fastroute(m, mpp, fin, fdp) m->mb_ifp = ifp; printpacket(fin->fin_out, m); -#if defined(__sgi) && (IRIX < 60500) - (*ifp->if_output)(ifp, (void *)ip, NULL); -# if TRU64 >= 1885 - (*ifp->if_output)(ifp, (void *)m, NULL, 0, 0); -# else (*ifp->if_output)(ifp, (void *)m, NULL, 0); -# endif -#endif done: fin->fin_ifp = sifp; fin->fin_out = sout; From owner-svn-src-head@freebsd.org Tue Dec 4 08:38:25 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8FF8C132933A for ; Tue, 4 Dec 2018 08:38:25 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: from mail-yw1-xc31.google.com (mail-yw1-xc31.google.com [IPv6:2607:f8b0:4864:20::c31]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9D3186D1DC for ; Tue, 4 Dec 2018 08:38:24 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: by mail-yw1-xc31.google.com with SMTP id y194so6623766ywg.3 for ; Tue, 04 Dec 2018 00:38:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=CwxtuKQ0bIUjV1rG8zFsI1jpwpTkvCHnqH1sTsh/lA8=; b=L6ukk3aKiizw7OXVRKDMuwB1hf2sO3qIt4wk7By5xPnrTvTZYSmLFdVEkS0lD4Wbwv H19WNYaw3NCwlfJy+Rio9dIyxsL4Aw2FVdVzQ9yPypjq6q83nRFAG/LCrNhEms9KkgU9 UJmB1K/oEIUPED9WyZTCRRUyDbu2IgKkTgcAlGK7NT3N9YjjKExItv70+lznLWjwZ/qy rWN003J5rZUqvX+PAnDHF9UzjK1uIe7iCTIY7lzagGYkr+8Otyx4MtpvDnTLNSgVsLB8 mw6qqSnUWbGgcWNMdeFcnbM2QTXwcv+ziwG4LUX1nlZiMzS9Dlplk9orB9QogKmZ/bOE 8nvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=CwxtuKQ0bIUjV1rG8zFsI1jpwpTkvCHnqH1sTsh/lA8=; b=H8bPjbqiy2a3WMFPI2DROyw9SIXG78td804Dm0XyS17EqnYUlKvLhuu55M7gYR7Ii0 lUJlMyKsiE1s4TwflYB+nWNMIhxLyjbv/qXYtLQiuZGCPGpcNHzP/QSvlGwHtX/O1b4p vVhSehtafSX+eW1s9ZxschjqXXqMBeOE8e0Zq/0P9DdTlKjlSRjQ5Pbk8zUbhEgsIoE5 mWfM4y4P9+rRR46XJ8MPmHqgyvxpf0hEEq1CNJ/0a8pfIsg1chQcqHv82+jyjlURDYet GFrSXYWt4ZdFJKmswHxXAY5Y2hCo0rZLcZE0qgz30jtI1NJ7hfotS/8mDaSeDgLtZ+Sc pzvQ== X-Gm-Message-State: AA+aEWbIK5ay3ikRAnGbGpQk0INzLumIEo2z5TDQ/fHvJYkiqNEZe7qw Ed5xwxxg/m8dvfWs5JH1aX53osevs0m40hmTB3ZBJw== X-Google-Smtp-Source: AFSGD/UA5vOe6CWRN5y76qIGUwUzfLeYC0Ym5vJZb/IPQ6De8uyVNgS+3NNnEDKI8DRflWJH5B+bE+XU1STKhl7zTUk= X-Received: by 2002:a81:56d7:: with SMTP id k206mr5051741ywb.167.1543912704145; Tue, 04 Dec 2018 00:38:24 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a25:84d2:0:0:0:0:0 with HTTP; Tue, 4 Dec 2018 00:38:23 -0800 (PST) In-Reply-To: <7fd4cc67-52df-56e1-faa9-281d4ddf57e2@FreeBSD.org> References: <201812032231.wB3MVvaD060931@repo.freebsd.org> <7fd4cc67-52df-56e1-faa9-281d4ddf57e2@FreeBSD.org> From: Oliver Pinter Date: Tue, 4 Dec 2018 09:38:23 +0100 Message-ID: Subject: Re: svn commit: r341446 - head/release/amd64 To: Yuri Pankov Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" X-Rspamd-Queue-Id: 9D3186D1DC X-Spamd-Result: default: False [-2.60 / 15.00]; ARC_NA(0.00)[]; TO_DN_EQ_ADDR_SOME(0.00)[]; R_DKIM_ALLOW(-0.20)[hardenedbsd.org]; NEURAL_HAM_MEDIUM(-0.97)[-0.974,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; NEURAL_HAM_LONG(-0.99)[-0.988,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[hardenedbsd.org]; TO_DN_SOME(0.00)[]; URI_COUNT_ODD(1.00)[15]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[hardenedbsd.org:+]; MX_GOOD(-0.01)[cached: alt1.aspmx.l.google.com]; RCVD_IN_DNSWL_NONE(0.00)[1.3.c.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_SHORT(-0.55)[-0.551,0]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; IP_SCORE(-0.58)[ipnet: 2607:f8b0::/32(-1.55), asn: 15169(-1.27), country: US(-0.09)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US] X-Rspamd-Server: mx1.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: Tue, 04 Dec 2018 08:38:25 -0000 On Tuesday, December 4, 2018, Yuri Pankov wrote: > Oliver Pinter wrote: > > > > > > On Monday, December 3, 2018, Yuri Pankov > > wrote: > > > > Author: yuripv > > Date: Mon Dec 3 22:31:57 2018 > > New Revision: 341446 > > URL: https://svnweb.freebsd.org/changeset/base/341446 > > > > > > Log: > > mkisoimages.sh: don't use -p flag when copying loader.efi to > msdosfs. > > > > This fixes 'cdrom' target in the case when world was built by user, > > and not root. > > > > Reviewed by: imp > > Differential revision: https://reviews.freebsd.org/D18414 > > > > > > > > This was a known issue > > : https://lists.freebsd.org/pipermail/svn-src-head/2018- > November/119689.html > > Sorry, I missed that. No problem. Ed was directly CCd and notified on IRC. > > Looking at the HBSD change, does chmod step have any significance? It just ensures the correct file permissions. > > Modified: > > head/release/amd64/mkisoimages.sh > > > > Modified: head/release/amd64/mkisoimages.sh > > ============================================================ > ================== > > --- head/release/amd64/mkisoimages.sh Mon Dec 3 22:09:23 2018 > > (r341445) > > +++ head/release/amd64/mkisoimages.sh Mon Dec 3 22:31:57 2018 > > (r341446) > > @@ -49,7 +49,7 @@ if [ "$1" = "-b" ]; then > > mkdir efi > > mount -t msdosfs /dev/$device efi > > mkdir -p efi/efi/boot > > - cp -p "$BASEBITSDIR/boot/loader.efi" efi/efi/boot/bootx64.efi > > + cp "$BASEBITSDIR/boot/loader.efi" efi/efi/boot/bootx64.efi > > umount efi > > rmdir efi > > mdconfig -d -u $device > > _______________________________________________ > > svn-src-head@freebsd.org mailing > list > > https://lists.freebsd.org/mailman/listinfo/svn-src-head > > > > To unsubscribe, send any mail to > > "svn-src-head-unsubscribe@freebsd.org > > " > > > > > From owner-svn-src-head@freebsd.org Tue Dec 4 08:41:23 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5508A132940C; Tue, 4 Dec 2018 08:41:23 +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)) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EF0BB6D521; Tue, 4 Dec 2018 08:41:22 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id DE932EC44; Tue, 4 Dec 2018 08:41:22 +0000 (UTC) Date: Tue, 4 Dec 2018 08:41:22 +0000 From: Alexey Dokuchaev To: Yuri Pankov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r341446 - head/release/amd64 Message-ID: <20181204084122.GB94570@FreeBSD.org> References: <201812032231.wB3MVvaD060931@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201812032231.wB3MVvaD060931@repo.freebsd.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Rspamd-Queue-Id: EF0BB6D521 X-Spamd-Result: default: False [0.07 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.05)[-0.053,0]; NEURAL_SPAM_LONG(0.34)[0.340,0]; ASN(0.00)[asn:11403, ipnet:96.47.64.0/20, country:US]; NEURAL_HAM_SHORT(-0.21)[-0.215,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Dec 2018 08:41:23 -0000 On Mon, Dec 03, 2018 at 10:31:57PM +0000, Yuri Pankov wrote: > New Revision: 341446 > URL: https://svnweb.freebsd.org/changeset/base/341446 > > Log: > mkisoimages.sh: don't use -p flag when copying loader.efi to msdosfs. > > This fixes 'cdrom' target in the case when world was built by user, > and not root. Could you please explain why -p should not have been used here? I fail to understand this from the commit log. I've always considered preserving various file metadata as a good thing to do, and this commit puzzles me. ./danfe From owner-svn-src-head@freebsd.org Tue Dec 4 08:52:51 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A67BE1329F51; Tue, 4 Dec 2018 08:52:51 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1E6AC6DEAF; Tue, 4 Dec 2018 08:52:51 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id DE81113B4; Tue, 4 Dec 2018 03:52:43 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Tue, 04 Dec 2018 03:52:44 -0500 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=/M3t95 nByqT/lP/gbI3vxjKBgFgpc7/O/sLHM66pfok=; b=jVOxqKXPaKrqtQVjebpmEG FngF/qxf6HGXJHObI6QB/HZ0T8F5O5vCrckBy7py2/RKnWkNnfzqvUdqK3LRb2SE ECRGE3khF7qtB44OGSpnvQI7IwNsr0MloXompgGjRJd91SWLZUT/ppBDxoxB6Xu+ gWKrDLPj73wo4y2eYyZdM7ENvBHbPdDnNE8VZjdRGMqnGfsk+luZiEduf86Zavsg rBgaPv/VCogA12OJxiBUYw+2OuGUDrfPz8eWjIWzKV+FqQEj+t//YQmIjeFq4wa5 SVqhEYRgm+R2Gcl5ch11XmMRBp0v+82YWUdYS/f827WUE47QSOnALJjdQzDIow9g == X-ME-Sender: X-ME-Proxy: Received: from [192.168.1.2] (unknown [62.183.125.176]) by mail.messagingengine.com (Postfix) with ESMTPA id A8DF410314; Tue, 4 Dec 2018 03:52:41 -0500 (EST) Subject: Re: svn commit: r341446 - head/release/amd64 To: Alexey Dokuchaev Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201812032231.wB3MVvaD060931@repo.freebsd.org> <20181204084122.GB94570@FreeBSD.org> From: Yuri Pankov Openpgp: preference=signencrypt Autocrypt: addr=yuripv@FreeBSD.org; keydata= xsBNBFu8u6IBCADB11gP0QwnorrHjqAtKLHKHNHskhy0s7jqJKfx0YqXgVBKGLJ9/mjLAz0F CBNvemHSDDTs0mEZ9cBKKi6cmsav6+UQgr//yai6hvXLBJqKchSFO4MhmdvBtsGFq1yKz5Zi uhjmimKyIpgBgvMdbgGbGq6cnSB2uEPmZuJr419SVRODOkXukU+F5WHgaHzDdHAIu1asCt2B +6msxqIqlFWcXyZyTGicTGGvC/PFIsVRUtD1dIJANTC876g7DTb7LZXWiWwJpSJ4GKMXMHVX Ct9BoQ4i3nhKbOxb6Io1wsy+NFyWsTJ9KYrxKKPJP3oG8BWb/cqlFqnE4eNSsiq2q7krABEB AAHNH1l1cmkgUGFua292IDx5dXJpcHZAeXVyaXB2Lm5ldD7CwJcEEwEIAEECGwMFCQWjmoAF CwkIBwMFFQoJCAsFFgMCAQACHgECF4AWIQT4arc+w94tPi0v/3CTi+B/sSrhbAUCW708wAIZ AQAKCRCTi+B/sSrhbPxBB/961alcU091O+yKT5/oReHVc/PX0Tz4sW3V44AcgLfYlrZavCro EFz90qmCrl0xqEwuAKcC4bjmL8SjPWAhSN6IH9nxdw+HeZnAPiHm/q679Bu47+nHBl3qD/9p +t1PkKeKZfaWToFMt1nq06ytSu6VLMCwLdlDNe6DReX0ex/afEqKsuaIZSKL4UYjRwklp8PU Uf98QkrfapyHB67hQMzfI4tPeJaYyv0cTgfq3kUWJx1V6Xi0b6Zxj4ZrB2TXvaMO5g7yhU9E E3WWAvoe4FgB3a7dHe8atnHhq5+Cuvm6+LD4Jh7jvMAE5UMN+xxQpnGpNghHjaCy4vXrLRBZ nhRYzsBNBFu8u6IBCADKih3Q933rDNj4ZA8FhBQ2RlmBgvwOLcDPIL3h0V7h38y3+HisgFSc XACDsdrTlYZ1bRXkD9FHENynBcv0l/3uGJDk8jaGIDE0TP8OQBRp+IaU9/BHnAqrKxTJGIol Dahy2m+yx2yhdc6B4ujWMDqCF1rWOD+ymOWw+VLllOkrHcZa5PJtX9UOGbApZl8ZTM8El4CA NN8F1bg9MWzUi+8LYoGWGc+BwsFS1OUB1c4SPgMu5fD4Wfsr9yRl06fdpEA2YT7B/j5/5RSC 0sE2Zs/tmJ/JRflHJ12ycj59ma2xQMfEJF40hZDpMFQmZvbVqgEg3ocQcltjbxlIKZ/mjC4z ABEBAAHCwHwEGAEKACYWIQT4arc+w94tPi0v/3CTi+B/sSrhbAUCW7y7ogIbDAUJBaOagAAK CRCTi+B/sSrhbIDcCACqAZMcoxUBLZa40a5b24j5i1jplvCYYb3h+Q5lt5+BFJ87kCb4dJuU D3kh2i29BrxWQWa9WNue9ozxeYkbkfXubQYXexVolRsnh64OdGsE8KvorBFBB3zdK/GRt2Jy +jsnTfUWuQllbzMP0MfhCDMk1Mo8WvDH2/cOEP/yLKf20a+cd6nLs7bidjmGXo9pyuBKAtV6 Kv+VRu54AL+A/UBYu/eB3Dtvzcnut+1Zq6KaP++kUwPwINLIk04OBDwN0zRNTiqMAFYYyz2v ZHBB6E1th/l//ZC5b9Dk0ZpFI1bYdL9ymnrZe1MqbGPnDCToQxu00T/pZCm6Z92YrZQYuNwl Message-ID: <05039715-2792-fdb2-735f-c5842f4d8087@FreeBSD.org> Date: Tue, 4 Dec 2018 11:52:34 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:60.0) Gecko/20100101 Thunderbird/60.3.2 MIME-Version: 1.0 In-Reply-To: <20181204084122.GB94570@FreeBSD.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="d6NLY095uvyd1s3pJMlq9wjdBFtITahdK" X-Rspamd-Queue-Id: 1E6AC6DEAF X-Spamd-Result: default: False [-0.56 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.44)[-0.443,0]; NEURAL_SPAM_LONG(0.20)[0.198,0]; ASN(0.00)[asn:11403, ipnet:64.147.123.0/24, country:US]; NEURAL_HAM_SHORT(-0.32)[-0.319,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Dec 2018 08:52:51 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --d6NLY095uvyd1s3pJMlq9wjdBFtITahdK Content-Type: multipart/mixed; boundary="vCshcU24NcBVZUOtjfnm9eo0IEpmMkVgd"; protected-headers="v1" From: Yuri Pankov To: Alexey Dokuchaev Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <05039715-2792-fdb2-735f-c5842f4d8087@FreeBSD.org> Subject: Re: svn commit: r341446 - head/release/amd64 References: <201812032231.wB3MVvaD060931@repo.freebsd.org> <20181204084122.GB94570@FreeBSD.org> In-Reply-To: <20181204084122.GB94570@FreeBSD.org> --vCshcU24NcBVZUOtjfnm9eo0IEpmMkVgd Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable Alexey Dokuchaev wrote: > On Mon, Dec 03, 2018 at 10:31:57PM +0000, Yuri Pankov wrote: >> New Revision: 341446 >> URL: https://svnweb.freebsd.org/changeset/base/341446 >> >> Log: >> mkisoimages.sh: don't use -p flag when copying loader.efi to msdosfs= =2E >> =20 >> This fixes 'cdrom' target in the case when world was built by user, >> and not root. >=20 > Could you please explain why -p should not have been used here? I fail= > to understand this from the commit log. I've always considered preserv= ing > various file metadata as a good thing to do, and this commit puzzles me= =2E Because the target is on msdosfs, and the only metadata that can be preserved is modification time which isn't that useful with the file being hidden in ESP. OTOH, 'cp -p' fails trying to preserve owner/group if source is not owned by root (as commit message says). Additional 'chmod' call done in HBSD doesn't do much as well -- it seems we can only set/unset owner's 'write' flag which corresponds to DOS 'readonly' attribute. --vCshcU24NcBVZUOtjfnm9eo0IEpmMkVgd-- --d6NLY095uvyd1s3pJMlq9wjdBFtITahdK Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEyBAEBCAAdFiEE+Gq3PsPeLT4tL/9wk4vgf7Eq4WwFAlwGQFIACgkQk4vgf7Eq 4WzZzAf3XCx2LCnKnnkp3y4o/ZeNKzQNBzokTiEEBRwK91rsAYpV4CpYv/0GtJAX xlK/vVgoIhnWc5F34ESdQSk2iek1LflVc+/Snnn7ZMx2oPyBz09fml7VgvxHOPiY LF9NCvA+HnpvAP7CLvydxGvdqQuUy3EGA2M2Z23dXY+1h9MqnxxZY0B/2dnNiDoB E7kyNGVsnQAED98ufOJvXBSzeRln3/KsTB8w7h3KSfiP+6LbJL7gqEQfKqGu13Qg pm6JJiJX1oOiNRh6VODeUp6sNrShEmVdBp/GVlNDg8krsGvSdEgExGQLfPIr0JqI REGZ857GxYfEExvYZCucqCJRFNAW =Bxkd -----END PGP SIGNATURE----- --d6NLY095uvyd1s3pJMlq9wjdBFtITahdK-- From owner-svn-src-head@freebsd.org Tue Dec 4 09:16:00 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0EFA7132B1B1; Tue, 4 Dec 2018 09:16:00 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AA7066EE1E; Tue, 4 Dec 2018 09:15:59 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id 98D73F763; Tue, 4 Dec 2018 09:15:59 +0000 (UTC) Date: Tue, 4 Dec 2018 09:15:59 +0000 From: Alexey Dokuchaev To: Yuri Pankov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r341446 - head/release/amd64 Message-ID: <20181204091559.GA38765@FreeBSD.org> References: <201812032231.wB3MVvaD060931@repo.freebsd.org> <20181204084122.GB94570@FreeBSD.org> <05039715-2792-fdb2-735f-c5842f4d8087@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <05039715-2792-fdb2-735f-c5842f4d8087@FreeBSD.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Rspamd-Queue-Id: AA7066EE1E X-Spamd-Result: default: False [0.17 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.01)[-0.010,0]; NEURAL_SPAM_LONG(0.38)[0.380,0]; NEURAL_HAM_SHORT(-0.20)[-0.196,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Dec 2018 09:16:00 -0000 On Tue, Dec 04, 2018 at 11:52:34AM +0300, Yuri Pankov wrote: > Alexey Dokuchaev wrote: > > On Mon, Dec 03, 2018 at 10:31:57PM +0000, Yuri Pankov wrote: > >> New Revision: 341446 > >> URL: https://svnweb.freebsd.org/changeset/base/341446 > >> > >> Log: > >> mkisoimages.sh: don't use -p flag when copying loader.efi to msdosfs. > >> > >> This fixes 'cdrom' target in the case when world was built by user, > >> and not root. > > > > Could you please explain why -p should not have been used here? I fail > > to understand this from the commit log. I've always considered preserving > > various file metadata as a good thing to do, and this commit puzzles me. > > Because the target is on msdosfs, and the only metadata that can be > preserved is modification time which isn't that useful with the file > being hidden in ESP. OTOH, 'cp -p' fails trying to preserve owner/group > if source is not owned by root (as commit message says). Additional > 'chmod' call done in HBSD doesn't do much as well -- it seems we can > only set/unset owner's 'write' flag which corresponds to DOS 'readonly' > attribute. Ah, I see now, so cp(1) was failing and that upset 'set -e'. Thanks for explanation. ./danfe From owner-svn-src-head@freebsd.org Tue Dec 4 12:34:23 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 23AD2130B376; Tue, 4 Dec 2018 12:34:23 +0000 (UTC) (envelope-from garga@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B1999770D6; Tue, 4 Dec 2018 12:34:22 +0000 (UTC) (envelope-from garga@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 92AEA254C8; Tue, 4 Dec 2018 12:34:22 +0000 (UTC) (envelope-from garga@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB4CYMvR096165; Tue, 4 Dec 2018 12:34:22 GMT (envelope-from garga@FreeBSD.org) Received: (from garga@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB4CYMTJ096164; Tue, 4 Dec 2018 12:34:22 GMT (envelope-from garga@FreeBSD.org) Message-Id: <201812041234.wB4CYMTJ096164@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: garga set sender to garga@FreeBSD.org using -f From: Renato Botelho Date: Tue, 4 Dec 2018 12:34:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341464 - head/sbin/savecore X-SVN-Group: head X-SVN-Commit-Author: garga X-SVN-Commit-Paths: head/sbin/savecore X-SVN-Commit-Revision: 341464 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B1999770D6 X-Spamd-Result: default: False [-0.17 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.51)[-0.508,0]; NEURAL_SPAM_SHORT(0.41)[0.407,0]; NEURAL_HAM_LONG(-0.07)[-0.072,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Dec 2018 12:34:23 -0000 Author: garga (ports committer) Date: Tue Dec 4 12:34:22 2018 New Revision: 341464 URL: https://svnweb.freebsd.org/changeset/base/341464 Log: Restore /var/crash permissions to 0750, as declared in mtree file. After r337337 it changed to 0755. Reviewed by: loos Approved by: loos MFC after: 3 days Sponsored by: Rubicon Communications, LLC (Netgate) Differential Revision: https://reviews.freebsd.org/D18355 Modified: head/sbin/savecore/Makefile Modified: head/sbin/savecore/Makefile ============================================================================== --- head/sbin/savecore/Makefile Tue Dec 4 10:30:31 2018 (r341463) +++ head/sbin/savecore/Makefile Tue Dec 4 12:34:22 2018 (r341464) @@ -2,7 +2,9 @@ PACKAGE=runtime CONFS= minfree -CONFSDIR= /var/crash +VAR_CRASH= /var/crash +VAR_CRASH_MODE= 0750 +CONFSDIR= VAR_CRASH PROG= savecore LIBADD= z xo MAN= savecore.8 From owner-svn-src-head@freebsd.org Tue Dec 4 15:12:29 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 17859130FA62; Tue, 4 Dec 2018 15:12:29 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AD4647D363; Tue, 4 Dec 2018 15:12:28 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8E5CA26E04; Tue, 4 Dec 2018 15:12:28 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB4FCSVh078739; Tue, 4 Dec 2018 15:12:28 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB4FCSHl078738; Tue, 4 Dec 2018 15:12:28 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201812041512.wB4FCSHl078738@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Tue, 4 Dec 2018 15:12:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341469 - head/sys/netpfil/ipfw X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: head/sys/netpfil/ipfw X-SVN-Commit-Revision: 341469 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: AD4647D363 X-Spamd-Result: default: False [-0.79 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.51)[-0.508,0]; NEURAL_HAM_SHORT(-0.21)[-0.207,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.07)[-0.072,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Dec 2018 15:12:29 -0000 Author: ae Date: Tue Dec 4 15:12:28 2018 New Revision: 341469 URL: https://svnweb.freebsd.org/changeset/base/341469 Log: Add assertion to check that named object has correct type. Obtained from: Yandex LLC MFC after: 1 week Modified: head/sys/netpfil/ipfw/ip_fw_dynamic.c Modified: head/sys/netpfil/ipfw/ip_fw_dynamic.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_dynamic.c Tue Dec 4 15:06:24 2018 (r341468) +++ head/sys/netpfil/ipfw/ip_fw_dynamic.c Tue Dec 4 15:12:28 2018 (r341469) @@ -708,6 +708,8 @@ dyn_destroy(struct ip_fw_chain *ch, struct named_objec IPFW_UH_WLOCK_ASSERT(ch); + KASSERT(no->etlv == IPFW_TLV_STATE_NAME, + ("%s: wrong object type %u", __func__, no->etlv)); KASSERT(no->refcnt == 1, ("Destroying object '%s' (type %u, idx %u) with refcnt %u", no->name, no->etlv, no->kidx, no->refcnt)); From owner-svn-src-head@freebsd.org Tue Dec 4 15:25:16 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F26B8130FF1F; Tue, 4 Dec 2018 15:25:15 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 95EFA7DB6D; Tue, 4 Dec 2018 15:25:15 +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 75B17270A6; Tue, 4 Dec 2018 15:25:15 +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 wB4FPFp4084306; Tue, 4 Dec 2018 15:25:15 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB4FPFgP084305; Tue, 4 Dec 2018 15:25:15 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201812041525.wB4FPFgP084305@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 4 Dec 2018 15:25:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341470 - head/sbin/ggate/ggated X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sbin/ggate/ggated X-SVN-Commit-Revision: 341470 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 95EFA7DB6D X-Spamd-Result: default: False [-0.79 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.51)[-0.508,0]; NEURAL_HAM_LONG(-0.07)[-0.072,0]; NEURAL_HAM_SHORT(-0.21)[-0.207,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Dec 2018 15:25:16 -0000 Author: emaste Date: Tue Dec 4 15:25:15 2018 New Revision: 341470 URL: https://svnweb.freebsd.org/changeset/base/341470 Log: ggated: do not expose stack data in sendfail() admbugs: 590 Submitted by: Fabian Keil Obtained from: ElectroBSD Modified: head/sbin/ggate/ggated/ggated.c Modified: head/sbin/ggate/ggated/ggated.c ============================================================================== --- head/sbin/ggate/ggated/ggated.c Tue Dec 4 15:12:28 2018 (r341469) +++ head/sbin/ggate/ggated/ggated.c Tue Dec 4 15:25:15 2018 (r341470) @@ -591,6 +591,7 @@ sendfail(int sfd, int error, const char *fmt, ...) va_list ap; ssize_t data; + memset(&sinit, 0, sizeof(sinit)); sinit.gs_error = error; g_gate_swap2n_sinit(&sinit); data = g_gate_send(sfd, &sinit, sizeof(sinit), 0); From owner-svn-src-head@freebsd.org Tue Dec 4 16:01:28 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1B56A13111BA; Tue, 4 Dec 2018 16:01:28 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8F2AA7F936; Tue, 4 Dec 2018 16:01:27 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6FF4C27631; Tue, 4 Dec 2018 16:01:27 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB4G1Ree001648; Tue, 4 Dec 2018 16:01:27 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB4G1QDT001641; Tue, 4 Dec 2018 16:01:26 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201812041601.wB4G1QDT001641@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Tue, 4 Dec 2018 16:01:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341471 - in head/sys/netpfil/ipfw: . nat64 nptv6 X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: in head/sys/netpfil/ipfw: . nat64 nptv6 X-SVN-Commit-Revision: 341471 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8F2AA7F936 X-Spamd-Result: default: False [-0.04 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.37)[-0.366,0]; NEURAL_SPAM_LONG(0.09)[0.092,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_SPAM_SHORT(0.23)[0.231,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Dec 2018 16:01:28 -0000 Author: ae Date: Tue Dec 4 16:01:25 2018 New Revision: 341471 URL: https://svnweb.freebsd.org/changeset/base/341471 Log: Reimplement how net.inet.ip.fw.dyn_keep_states works. Turning on of this feature allows to keep dynamic states when parent rule is deleted. But it works only when the default rule is "allow from any to any". Now when rule with dynamic opcode is going to be deleted, and net.inet.ip.fw.dyn_keep_states is enabled, existing states will reference named objects corresponding to this rule, and also reference the rule. And when ipfw_dyn_lookup_state() will find state for deleted parent rule, it will return the pointer to the deleted rule, that is still valid. This implementation doesn't support O_LIMIT_PARENT rules. The refcnt field was added to struct ip_fw to keep reference, also next pointer added to be able iterate rules and not damage the content when deleted rules are chained. Named objects are referenced only when states are going to be deleted to be able reuse kidx of named objects when new parent rules will be installed. ipfw_dyn_get_count() function was modified and now it also looks into dynamic states and constructs maps of existing named objects. This is needed to correctly export orphaned states into userland. ipfw_free_rule() was changed to be global, since now dynamic state can free rule, when it is expired and references counters becomes 1. External actions subsystem also modified, since external actions can be deregisterd and instances can be destroyed. In these cases deleted rules, that are referenced by orphaned states, must be modified to prevent access to freed memory. ipfw_dyn_reset_eaction(), ipfw_reset_eaction_instance() functions added for these purposes. Obtained from: Yandex LLC MFC after: 2 months Sponsored by: Yandex LLC Differential Revision: https://reviews.freebsd.org/D17532 Modified: head/sys/netpfil/ipfw/ip_fw_dynamic.c head/sys/netpfil/ipfw/ip_fw_eaction.c head/sys/netpfil/ipfw/ip_fw_private.h head/sys/netpfil/ipfw/ip_fw_sockopt.c head/sys/netpfil/ipfw/nat64/nat64lsn_control.c head/sys/netpfil/ipfw/nat64/nat64stl_control.c head/sys/netpfil/ipfw/nptv6/nptv6.c Modified: head/sys/netpfil/ipfw/ip_fw_dynamic.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_dynamic.c Tue Dec 4 15:25:15 2018 (r341470) +++ head/sys/netpfil/ipfw/ip_fw_dynamic.c Tue Dec 4 16:01:25 2018 (r341471) @@ -122,6 +122,12 @@ __FBSDID("$FreeBSD$"); (d)->bcnt_ ## dir += pktlen; \ } while (0) +#define DYN_REFERENCED 0x01 +/* + * DYN_REFERENCED flag is used to show that state keeps reference to named + * object, and this reference should be released when state becomes expired. + */ + struct dyn_data { void *parent; /* pointer to parent rule */ uint32_t chain_id; /* cached ruleset id */ @@ -129,7 +135,8 @@ struct dyn_data { uint32_t hashval; /* hash value used for hash resize */ uint16_t fibnum; /* fib used to send keepalives */ - uint8_t _pad[3]; + uint8_t _pad[2]; + uint8_t flags; /* internal flags */ uint8_t set; /* parent rule set number */ uint16_t rulenum; /* parent rule number */ uint32_t ruleid; /* parent rule id */ @@ -1399,20 +1406,29 @@ ipfw_dyn_lookup_state(const struct ip_fw_args *args, c * should be deleted by dyn_expire_states(). * * In case when dyn_keep_states is enabled, return - * pointer to default rule and corresponding f_pos - * value. - * XXX: In this case we lose the cache efficiency, - * since f_pos is not cached, because it seems - * there is no easy way to atomically switch - * all fields related to parent rule of given - * state. + * pointer to deleted rule and f_pos value + * corresponding to penultimate rule. + * When we have enabled V_dyn_keep_states, states + * that become orphaned will get the DYN_REFERENCED + * flag and rule will keep around. So we can return + * it. But since it is not in the rules map, we need + * return such f_pos value, so after the state + * handling if the search will continue, the next rule + * will be the last one - the default rule. */ if (V_layer3_chain.map[data->f_pos] == rule) { data->chain_id = V_layer3_chain.id; info->f_pos = data->f_pos; } else if (V_dyn_keep_states != 0) { - rule = V_layer3_chain.default_rule; - info->f_pos = V_layer3_chain.n_rules - 1; + /* + * The original rule pointer is still usable. + * So, we return it, but f_pos need to be + * changed to point to the penultimate rule. + */ + MPASS(V_layer3_chain.n_rules > 1); + data->chain_id = V_layer3_chain.id; + data->f_pos = V_layer3_chain.n_rules - 2; + info->f_pos = data->f_pos; } else { rule = NULL; info->direction = MATCH_NONE; @@ -2112,40 +2128,102 @@ dyn_match_range(uint16_t rulenum, uint8_t set, const i return (1); } +static void +dyn_acquire_rule(struct ip_fw_chain *ch, struct dyn_data *data, + struct ip_fw *rule, uint16_t kidx) +{ + struct dyn_state_obj *obj; + + /* + * Do not acquire reference twice. + * This can happen when rule deletion executed for + * the same range, but different ruleset id. + */ + if (data->flags & DYN_REFERENCED) + return; + + IPFW_UH_WLOCK_ASSERT(ch); + MPASS(kidx != 0); + + data->flags |= DYN_REFERENCED; + /* Reference the named object */ + obj = SRV_OBJECT(ch, kidx); + obj->no.refcnt++; + MPASS(obj->no.etlv == IPFW_TLV_STATE_NAME); + + /* Reference the parent rule */ + rule->refcnt++; +} + +static void +dyn_release_rule(struct ip_fw_chain *ch, struct dyn_data *data, + struct ip_fw *rule, uint16_t kidx) +{ + struct dyn_state_obj *obj; + + IPFW_UH_WLOCK_ASSERT(ch); + MPASS(kidx != 0); + + obj = SRV_OBJECT(ch, kidx); + if (obj->no.refcnt == 1) + dyn_destroy(ch, &obj->no); + else + obj->no.refcnt--; + + if (--rule->refcnt == 1) + ipfw_free_rule(rule); +} + +/* + * We do not keep O_LIMIT_PARENT states when V_dyn_keep_states is enabled. + * O_LIMIT state is created when new connection is going to be established + * and there is no matching state. So, since the old parent rule was deleted + * we can't create new states with old parent, and thus we can not account + * new connections with already established connections, and can not do + * proper limiting. + */ static int -dyn_match_ipv4_state(struct dyn_ipv4_state *s, const ipfw_range_tlv *rt) +dyn_match_ipv4_state(struct ip_fw_chain *ch, struct dyn_ipv4_state *s, + const ipfw_range_tlv *rt) { + struct ip_fw *rule; + int ret; if (s->type == O_LIMIT_PARENT) return (dyn_match_range(s->limit->rulenum, s->limit->set, rt)); - if (s->type == O_LIMIT) - return (dyn_match_range(s->data->rulenum, s->data->set, rt)); + ret = dyn_match_range(s->data->rulenum, s->data->set, rt); + if (ret == 0 || V_dyn_keep_states == 0) + return (ret); - if (V_dyn_keep_states == 0 && - dyn_match_range(s->data->rulenum, s->data->set, rt)) - return (1); - + rule = s->data->parent; + if (s->type == O_LIMIT) + rule = ((struct dyn_ipv4_state *)rule)->limit->parent; + dyn_acquire_rule(ch, s->data, rule, s->kidx); return (0); } #ifdef INET6 static int -dyn_match_ipv6_state(struct dyn_ipv6_state *s, const ipfw_range_tlv *rt) +dyn_match_ipv6_state(struct ip_fw_chain *ch, struct dyn_ipv6_state *s, + const ipfw_range_tlv *rt) { + struct ip_fw *rule; + int ret; if (s->type == O_LIMIT_PARENT) return (dyn_match_range(s->limit->rulenum, s->limit->set, rt)); - if (s->type == O_LIMIT) - return (dyn_match_range(s->data->rulenum, s->data->set, rt)); + ret = dyn_match_range(s->data->rulenum, s->data->set, rt); + if (ret == 0 || V_dyn_keep_states == 0) + return (ret); - if (V_dyn_keep_states == 0 && - dyn_match_range(s->data->rulenum, s->data->set, rt)) - return (1); - + rule = s->data->parent; + if (s->type == O_LIMIT) + rule = ((struct dyn_ipv6_state *)rule)->limit->parent; + dyn_acquire_rule(ch, s->data, rule, s->kidx); return (0); } #endif @@ -2155,7 +2233,7 @@ dyn_match_ipv6_state(struct dyn_ipv6_state *s, const i * @rt can be used to specify the range of states for deletion. */ static void -dyn_expire_states(struct ip_fw_chain *chain, ipfw_range_tlv *rt) +dyn_expire_states(struct ip_fw_chain *ch, ipfw_range_tlv *rt) { struct dyn_ipv4_slist expired_ipv4; #ifdef INET6 @@ -2163,8 +2241,11 @@ dyn_expire_states(struct ip_fw_chain *chain, ipfw_rang struct dyn_ipv6_state *s6, *s6n, *s6p; #endif struct dyn_ipv4_state *s4, *s4n, *s4p; + void *rule; int bucket, removed, length, max_length; + IPFW_UH_WLOCK_ASSERT(ch); + /* * Unlink expired states from each bucket. * With acquired bucket lock iterate entries of each lists: @@ -2189,7 +2270,8 @@ dyn_expire_states(struct ip_fw_chain *chain, ipfw_rang while (s != NULL) { \ next = CK_SLIST_NEXT(s, entry); \ if ((TIME_LEQ((s)->exp, time_uptime) && extra) || \ - (rt != NULL && dyn_match_ ## af ## _state(s, rt))) {\ + (rt != NULL && \ + dyn_match_ ## af ## _state(ch, s, rt))) { \ if (prev != NULL) \ CK_SLIST_REMOVE_AFTER(prev, entry); \ else \ @@ -2201,6 +2283,14 @@ dyn_expire_states(struct ip_fw_chain *chain, ipfw_rang DYN_COUNT_DEC(dyn_parent_count); \ else { \ DYN_COUNT_DEC(dyn_count); \ + if (s->data->flags & DYN_REFERENCED) { \ + rule = s->data->parent; \ + if (s->type == O_LIMIT) \ + rule = ((__typeof(s)) \ + rule)->limit->parent;\ + dyn_release_rule(ch, s->data, \ + rule, s->kidx); \ + } \ if (s->type == O_LIMIT) { \ s = s->data->parent; \ DPARENT_COUNT_DEC(s->limit); \ @@ -2685,6 +2775,42 @@ ipfw_expire_dyn_states(struct ip_fw_chain *chain, ipfw } /* + * Pass through all states and reset eaction for orphaned rules. + */ +void +ipfw_dyn_reset_eaction(struct ip_fw_chain *ch, uint16_t eaction_id, + uint16_t default_id, uint16_t instance_id) +{ +#ifdef INET6 + struct dyn_ipv6_state *s6; +#endif + struct dyn_ipv4_state *s4; + struct ip_fw *rule; + uint32_t bucket; + +#define DYN_RESET_EACTION(s, h, b) \ + CK_SLIST_FOREACH(s, &V_dyn_ ## h[b], entry) { \ + if ((s->data->flags & DYN_REFERENCED) == 0) \ + continue; \ + rule = s->data->parent; \ + if (s->type == O_LIMIT) \ + rule = ((__typeof(s))rule)->limit->parent; \ + ipfw_reset_eaction(ch, rule, eaction_id, \ + default_id, instance_id); \ + } + + IPFW_UH_WLOCK_ASSERT(ch); + if (V_dyn_count == 0) + return; + for (bucket = 0; bucket < V_curr_dyn_buckets; bucket++) { + DYN_RESET_EACTION(s4, ipv4, bucket); +#ifdef INET6 + DYN_RESET_EACTION(s6, ipv6, bucket); +#endif + } +} + +/* * Returns size of dynamic states in legacy format */ int @@ -2696,11 +2822,40 @@ ipfw_dyn_len(void) /* * Returns number of dynamic states. + * Marks every named object index used by dynamic states with bit in @bmask. + * Returns number of named objects accounted in bmask via @nocnt. * Used by dump format v1 (current). */ uint32_t -ipfw_dyn_get_count(void) +ipfw_dyn_get_count(uint32_t *bmask, int *nocnt) { +#ifdef INET6 + struct dyn_ipv6_state *s6; +#endif + struct dyn_ipv4_state *s4; + uint32_t bucket; + +#define DYN_COUNT_OBJECTS(s, h, b) \ + CK_SLIST_FOREACH(s, &V_dyn_ ## h[b], entry) { \ + MPASS(s->kidx != 0); \ + if (ipfw_mark_object_kidx(bmask, IPFW_TLV_STATE_NAME, \ + s->kidx) != 0) \ + (*nocnt)++; \ + } + + IPFW_UH_RLOCK_ASSERT(&V_layer3_chain); + + /* No need to pass through all the buckets. */ + *nocnt = 0; + if (V_dyn_count + V_dyn_parent_count == 0) + return (0); + + for (bucket = 0; bucket < V_curr_dyn_buckets; bucket++) { + DYN_COUNT_OBJECTS(s4, ipv4, bucket); +#ifdef INET6 + DYN_COUNT_OBJECTS(s6, ipv6, bucket); +#endif + } return (V_dyn_count + V_dyn_parent_count); } Modified: head/sys/netpfil/ipfw/ip_fw_eaction.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_eaction.c Tue Dec 4 15:25:15 2018 (r341470) +++ head/sys/netpfil/ipfw/ip_fw_eaction.c Tue Dec 4 16:01:25 2018 (r341471) @@ -252,11 +252,10 @@ destroy_eaction_obj(struct ip_fw_chain *ch, struct nam * Resets all eaction opcodes to default handlers. */ static void -reset_eaction_obj(struct ip_fw_chain *ch, uint16_t eaction_id) +reset_eaction_rules(struct ip_fw_chain *ch, uint16_t eaction_id, + uint16_t instance_id, bool reset_rules) { struct named_object *no; - struct ip_fw *rule; - ipfw_insn *cmd; int i; IPFW_UH_WLOCK_ASSERT(ch); @@ -267,35 +266,32 @@ reset_eaction_obj(struct ip_fw_chain *ch, uint16_t eac panic("Default external action handler is not found"); if (eaction_id == no->kidx) panic("Wrong eaction_id"); - EACTION_DEBUG("replace id %u with %u", eaction_id, no->kidx); + + EACTION_DEBUG("Going to replace id %u with %u", eaction_id, no->kidx); IPFW_WLOCK(ch); - for (i = 0; i < ch->n_rules; i++) { - rule = ch->map[i]; - cmd = ACTION_PTR(rule); - if (cmd->opcode != O_EXTERNAL_ACTION) - continue; - if (cmd->arg1 != eaction_id) - continue; - cmd->arg1 = no->kidx; /* Set to default id */ - /* - * XXX: we only bump refcount on default_eaction. - * Refcount on the original object will be just - * ignored on destroy. But on default_eaction it - * will be decremented on rule deletion. - */ - no->refcnt++; - /* - * Since named_object related to this instance will be - * also destroyed, truncate the chain of opcodes to - * remove the rest of cmd chain just after O_EXTERNAL_ACTION - * opcode. - */ - if (rule->act_ofs < rule->cmd_len - 1) { - EACTION_DEBUG("truncate rule %d: len %u -> %u", - rule->rulenum, rule->cmd_len, rule->act_ofs + 1); - rule->cmd_len = rule->act_ofs + 1; + /* + * Reset eaction objects only if it is referenced by rules. + * But always reset objects for orphaned dynamic states. + */ + if (reset_rules) { + for (i = 0; i < ch->n_rules; i++) { + /* + * Refcount on the original object will be just + * ignored on destroy. Refcount on default_eaction + * will be decremented on rule deletion, thus we + * need to reference default_eaction object. + */ + if (ipfw_reset_eaction(ch, ch->map[i], eaction_id, + no->kidx, instance_id) != 0) + no->refcnt++; } } + /* + * Reset eaction opcodes for orphaned dynamic states. + * Since parent rules are already deleted, we don't need to + * reference named object of default_eaction. + */ + ipfw_dyn_reset_eaction(ch, eaction_id, no->kidx, instance_id); IPFW_WUNLOCK(ch); } @@ -368,12 +364,71 @@ ipfw_del_eaction(struct ip_fw_chain *ch, uint16_t eact IPFW_UH_WUNLOCK(ch); return (EINVAL); } - if (no->refcnt > 1) - reset_eaction_obj(ch, eaction_id); + reset_eaction_rules(ch, eaction_id, 0, (no->refcnt > 1)); EACTION_DEBUG("External action '%s' with id %u unregistered", no->name, eaction_id); destroy_eaction_obj(ch, no); IPFW_UH_WUNLOCK(ch); + return (0); +} + +int +ipfw_reset_eaction(struct ip_fw_chain *ch, struct ip_fw *rule, + uint16_t eaction_id, uint16_t default_id, uint16_t instance_id) +{ + ipfw_insn *cmd, *icmd; + + IPFW_UH_WLOCK_ASSERT(ch); + IPFW_WLOCK_ASSERT(ch); + + cmd = ACTION_PTR(rule); + if (cmd->opcode != O_EXTERNAL_ACTION || + cmd->arg1 != eaction_id) + return (0); + + if (instance_id != 0 && rule->act_ofs < rule->cmd_len - 1) { + icmd = cmd + 1; + if (icmd->opcode != O_EXTERNAL_INSTANCE || + icmd->arg1 != instance_id) + return (0); + /* FALLTHROUGH */ + } + + cmd->arg1 = default_id; /* Set to default id */ + /* + * Since named_object related to this instance will be + * also destroyed, truncate the chain of opcodes to + * remove the rest of cmd chain just after O_EXTERNAL_ACTION + * opcode. + */ + if (rule->act_ofs < rule->cmd_len - 1) { + EACTION_DEBUG("truncate rule %d: len %u -> %u", + rule->rulenum, rule->cmd_len, rule->act_ofs + 1); + rule->cmd_len = rule->act_ofs + 1; + } + /* + * Return 1 when reset successfully happened. + */ + return (1); +} + +/* + * This function should be called before external action instance is + * destroyed. It will reset eaction_id to default_id for rules, where + * eaction has instance with id == kidx. + */ +int +ipfw_reset_eaction_instance(struct ip_fw_chain *ch, uint16_t eaction_id, + uint16_t kidx) +{ + struct named_object *no; + + IPFW_UH_WLOCK_ASSERT(ch); + no = ipfw_objhash_lookup_kidx(CHAIN_TO_SRV(ch), eaction_id); + if (no == NULL || no->etlv != IPFW_TLV_EACTION) + return (EINVAL); + + reset_eaction_rules(ch, eaction_id, kidx, 0); return (0); } Modified: head/sys/netpfil/ipfw/ip_fw_private.h ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_private.h Tue Dec 4 15:25:15 2018 (r341470) +++ head/sys/netpfil/ipfw/ip_fw_private.h Tue Dec 4 16:01:25 2018 (r341471) @@ -146,6 +146,9 @@ enum { /* * Function definitions. */ +int ipfw_chk(struct ip_fw_args *args); +struct mbuf *ipfw_send_pkt(struct mbuf *, struct ipfw_flow_id *, + u_int32_t, u_int32_t, int); /* attach (arg = 1) or detach (arg = 0) hooks */ int ipfw_attach_hooks(int); @@ -156,6 +159,7 @@ void ipfw_nat_destroy(void); /* In ip_fw_log.c */ struct ip; struct ip_fw_chain; + void ipfw_bpf_init(int); void ipfw_bpf_uninit(int); void ipfw_bpf_mtap2(void *, u_int, struct mbuf *); @@ -168,6 +172,7 @@ VNET_DECLARE(int, verbose_limit); #define V_verbose_limit VNET(verbose_limit) /* In ip_fw_dynamic.c */ +struct sockopt_data; enum { /* result for matching dynamic rules */ MATCH_REVERSE = 0, @@ -177,19 +182,6 @@ enum { /* result for matching dynamic rules */ }; /* - * The lock for dynamic rules is only used once outside the file, - * and only to release the result of lookup_dyn_rule(). - * Eventually we may implement it with a callback on the function. - */ -struct ip_fw_chain; -struct sockopt_data; -int ipfw_is_dyn_rule(struct ip_fw *rule); -void ipfw_expire_dyn_states(struct ip_fw_chain *, ipfw_range_tlv *); - -struct tcphdr; -struct mbuf *ipfw_send_pkt(struct mbuf *, struct ipfw_flow_id *, - u_int32_t, u_int32_t, int); -/* * Macro to determine that we need to do or redo dynamic state lookup. * direction == MATCH_UNKNOWN means that this is first lookup, then we need * to do lookup. @@ -219,13 +211,17 @@ struct ip_fw *ipfw_dyn_lookup_state(const struct ip_fw const void *ulp, int pktlen, const ipfw_insn *cmd, struct ipfw_dyn_info *info); +int ipfw_is_dyn_rule(struct ip_fw *rule); +void ipfw_expire_dyn_states(struct ip_fw_chain *, ipfw_range_tlv *); void ipfw_get_dynamic(struct ip_fw_chain *chain, char **bp, const char *ep); int ipfw_dump_states(struct ip_fw_chain *chain, struct sockopt_data *sd); void ipfw_dyn_init(struct ip_fw_chain *); /* per-vnet initialization */ void ipfw_dyn_uninit(int); /* per-vnet deinitialization */ int ipfw_dyn_len(void); -uint32_t ipfw_dyn_get_count(void); +uint32_t ipfw_dyn_get_count(uint32_t *, int *); +void ipfw_dyn_reset_eaction(struct ip_fw_chain *ch, uint16_t eaction_id, + uint16_t default_id, uint16_t instance_id); /* common variables */ VNET_DECLARE(int, fw_one_pass); @@ -280,7 +276,9 @@ struct ip_fw { uint32_t id; /* rule id */ uint32_t cached_id; /* used by jump_fast */ uint32_t cached_pos; /* used by jump_fast */ + uint32_t refcnt; /* number of references */ + struct ip_fw *next; /* linked list of deleted rules */ ipfw_insn cmd[1]; /* storage for commands */ }; @@ -650,7 +648,6 @@ void ipfw_init_skipto_cache(struct ip_fw_chain *chain) void ipfw_destroy_skipto_cache(struct ip_fw_chain *chain); int ipfw_find_rule(struct ip_fw_chain *chain, uint32_t key, uint32_t id); int ipfw_ctl3(struct sockopt *sopt); -int ipfw_chk(struct ip_fw_args *args); int ipfw_add_protected_rule(struct ip_fw_chain *chain, struct ip_fw *rule, int locked); void ipfw_reap_add(struct ip_fw_chain *chain, struct ip_fw **head, @@ -659,7 +656,9 @@ void ipfw_reap_rules(struct ip_fw *head); void ipfw_init_counters(void); void ipfw_destroy_counters(void); struct ip_fw *ipfw_alloc_rule(struct ip_fw_chain *chain, size_t rulesize); +void ipfw_free_rule(struct ip_fw *rule); int ipfw_match_range(struct ip_fw *rule, ipfw_range_tlv *rt); +int ipfw_mark_object_kidx(uint32_t *bmask, uint16_t etlv, uint16_t kidx); typedef int (sopt_handler_f)(struct ip_fw_chain *ch, ip_fw3_opheader *op3, struct sockopt_data *sd); @@ -758,6 +757,10 @@ uint16_t ipfw_add_eaction(struct ip_fw_chain *ch, ipfw int ipfw_del_eaction(struct ip_fw_chain *ch, uint16_t eaction_id); int ipfw_run_eaction(struct ip_fw_chain *ch, struct ip_fw_args *args, ipfw_insn *cmd, int *done); +int ipfw_reset_eaction(struct ip_fw_chain *ch, struct ip_fw *rule, + uint16_t eaction_id, uint16_t default_id, uint16_t instance_id); +int ipfw_reset_eaction_instance(struct ip_fw_chain *ch, uint16_t eaction_id, + uint16_t instance_id); /* In ip_fw_table.c */ struct table_info; Modified: head/sys/netpfil/ipfw/ip_fw_sockopt.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_sockopt.c Tue Dec 4 15:25:15 2018 (r341470) +++ head/sys/netpfil/ipfw/ip_fw_sockopt.c Tue Dec 4 16:01:25 2018 (r341471) @@ -161,8 +161,6 @@ static int set_legacy_obj_kidx(struct ip_fw_chain *ch, struct ip_fw_rule0 *rule); static struct opcode_obj_rewrite *find_op_rw(ipfw_insn *cmd, uint16_t *puidx, uint8_t *ptype); -static int mark_object_kidx(struct ip_fw_chain *ch, struct ip_fw *rule, - uint32_t *bmask); static int ref_rule_objects(struct ip_fw_chain *ch, struct ip_fw *rule, struct rule_check_info *ci, struct obj_idx *oib, struct tid_info *ti); static int ref_opcode_object(struct ip_fw_chain *ch, ipfw_insn *cmd, @@ -209,14 +207,23 @@ ipfw_alloc_rule(struct ip_fw_chain *chain, size_t rule rule = malloc(rulesize, M_IPFW, M_WAITOK | M_ZERO); rule->cntr = uma_zalloc_pcpu(V_ipfw_cntr_zone, M_WAITOK | M_ZERO); + rule->refcnt = 1; return (rule); } -static void -free_rule(struct ip_fw *rule) +void +ipfw_free_rule(struct ip_fw *rule) { + /* + * We don't release refcnt here, since this function + * can be called without any locks held. The caller + * must release reference under IPFW_UH_WLOCK, and then + * call this function if refcount becomes 1. + */ + if (rule->refcnt > 1) + return; uma_zfree_pcpu(V_ipfw_cntr_zone, rule->cntr); free(rule, M_IPFW); } @@ -827,7 +834,7 @@ ipfw_reap_add(struct ip_fw_chain *chain, struct ip_fw /* Unlink rule from everywhere */ unref_rule_objects(chain, rule); - *((struct ip_fw **)rule) = *head; + rule->next = *head; *head = rule; } @@ -842,8 +849,8 @@ ipfw_reap_rules(struct ip_fw *head) struct ip_fw *rule; while ((rule = head) != NULL) { - head = *((struct ip_fw **)head); - free_rule(rule); + head = head->next; + ipfw_free_rule(rule); } } @@ -2187,6 +2194,7 @@ struct dump_args { uint32_t rsize; /* rules size */ uint32_t tcount; /* number of tables */ int rcounters; /* counters */ + uint32_t *bmask; /* index bitmask of used named objects */ }; void @@ -2223,6 +2231,49 @@ export_objhash_ntlv(struct namedobj_instance *ni, uint return (0); } +static int +export_named_objects(struct namedobj_instance *ni, struct dump_args *da, + struct sockopt_data *sd) +{ + int error, i; + + for (i = 0; i < IPFW_TABLES_MAX && da->tcount > 0; i++) { + if ((da->bmask[i / 32] & (1 << (i % 32))) == 0) + continue; + if ((error = export_objhash_ntlv(ni, i, sd)) != 0) + return (error); + da->tcount--; + } + return (0); +} + +static int +dump_named_objects(struct ip_fw_chain *ch, struct dump_args *da, + struct sockopt_data *sd) +{ + ipfw_obj_ctlv *ctlv; + int error; + + MPASS(da->tcount > 0); + /* Header first */ + ctlv = (ipfw_obj_ctlv *)ipfw_get_sopt_space(sd, sizeof(*ctlv)); + if (ctlv == NULL) + return (ENOMEM); + ctlv->head.type = IPFW_TLV_TBLNAME_LIST; + ctlv->head.length = da->tcount * sizeof(ipfw_obj_ntlv) + + sizeof(*ctlv); + ctlv->count = da->tcount; + ctlv->objsize = sizeof(ipfw_obj_ntlv); + + /* Dump table names first (if any) */ + error = export_named_objects(ipfw_get_table_objhash(ch), da, sd); + if (error != 0) + return (error); + /* Then dump another named objects */ + da->bmask += IPFW_TABLES_MAX / 32; + return (export_named_objects(CHAIN_TO_SRV(ch), da, sd)); +} + /* * Dumps static rules with table TLVs in buffer @sd. * @@ -2230,52 +2281,13 @@ export_objhash_ntlv(struct namedobj_instance *ni, uint */ static int dump_static_rules(struct ip_fw_chain *chain, struct dump_args *da, - uint32_t *bmask, struct sockopt_data *sd) + struct sockopt_data *sd) { - int error; - int i, l; - uint32_t tcount; ipfw_obj_ctlv *ctlv; struct ip_fw *krule; - struct namedobj_instance *ni; caddr_t dst; + int i, l; - /* Dump table names first (if any) */ - if (da->tcount > 0) { - /* Header first */ - ctlv = (ipfw_obj_ctlv *)ipfw_get_sopt_space(sd, sizeof(*ctlv)); - if (ctlv == NULL) - return (ENOMEM); - ctlv->head.type = IPFW_TLV_TBLNAME_LIST; - ctlv->head.length = da->tcount * sizeof(ipfw_obj_ntlv) + - sizeof(*ctlv); - ctlv->count = da->tcount; - ctlv->objsize = sizeof(ipfw_obj_ntlv); - } - - i = 0; - tcount = da->tcount; - ni = ipfw_get_table_objhash(chain); - while (tcount > 0) { - if ((bmask[i / 32] & (1 << (i % 32))) == 0) { - i++; - continue; - } - - /* Jump to shared named object bitmask */ - if (i >= IPFW_TABLES_MAX) { - ni = CHAIN_TO_SRV(chain); - i -= IPFW_TABLES_MAX; - bmask += IPFW_TABLES_MAX / 32; - } - - if ((error = export_objhash_ntlv(ni, i, sd)) != 0) - return (error); - - i++; - tcount--; - } - /* Dump rules */ ctlv = (ipfw_obj_ctlv *)ipfw_get_sopt_space(sd, sizeof(*ctlv)); if (ctlv == NULL) @@ -2300,27 +2312,41 @@ dump_static_rules(struct ip_fw_chain *chain, struct du return (0); } +int +ipfw_mark_object_kidx(uint32_t *bmask, uint16_t etlv, uint16_t kidx) +{ + uint32_t bidx; + + /* + * Maintain separate bitmasks for table and non-table objects. + */ + bidx = (etlv == IPFW_TLV_TBL_NAME) ? 0: IPFW_TABLES_MAX / 32; + bidx += kidx / 32; + if ((bmask[bidx] & (1 << (kidx % 32))) != 0) + return (0); + + bmask[bidx] |= 1 << (kidx % 32); + return (1); +} + /* * Marks every object index used in @rule with bit in @bmask. * Used to generate bitmask of referenced tables/objects for given ruleset * or its part. - * - * Returns number of newly-referenced objects. */ -static int -mark_object_kidx(struct ip_fw_chain *ch, struct ip_fw *rule, - uint32_t *bmask) +static void +mark_rule_objects(struct ip_fw_chain *ch, struct ip_fw *rule, + struct dump_args *da) { struct opcode_obj_rewrite *rw; ipfw_insn *cmd; - int bidx, cmdlen, l, count; + int cmdlen, l; uint16_t kidx; uint8_t subtype; l = rule->cmd_len; cmd = rule->cmd; cmdlen = 0; - count = 0; for ( ; l > 0 ; l -= cmdlen, cmd += cmdlen) { cmdlen = F_LEN(cmd); @@ -2328,21 +2354,9 @@ mark_object_kidx(struct ip_fw_chain *ch, struct ip_fw if (rw == NULL) continue; - bidx = kidx / 32; - /* - * Maintain separate bitmasks for table and - * non-table objects. - */ - if (rw->etlv != IPFW_TLV_TBL_NAME) - bidx += IPFW_TABLES_MAX / 32; - - if ((bmask[bidx] & (1 << (kidx % 32))) == 0) - count++; - - bmask[bidx] |= 1 << (kidx % 32); + if (ipfw_mark_object_kidx(da->bmask, rw->etlv, kidx)) + da->tcount++; } - - return (count); } /* @@ -2366,13 +2380,12 @@ static int dump_config(struct ip_fw_chain *chain, ip_fw3_opheader *op3, struct sockopt_data *sd) { + struct dump_args da; ipfw_cfg_lheader *hdr; struct ip_fw *rule; size_t sz, rnum; - uint32_t hdr_flags; + uint32_t hdr_flags, *bmask; int error, i; - struct dump_args da; - uint32_t *bmask; hdr = (ipfw_cfg_lheader *)ipfw_get_sopt_header(sd, sizeof(*hdr)); if (hdr == NULL) @@ -2380,9 +2393,15 @@ dump_config(struct ip_fw_chain *chain, ip_fw3_opheader error = 0; bmask = NULL; - /* Allocate needed state. Note we allocate 2xspace mask, for table&srv */ - if (hdr->flags & IPFW_CFG_GET_STATIC) - bmask = malloc(IPFW_TABLES_MAX / 4, M_TEMP, M_WAITOK | M_ZERO); + memset(&da, 0, sizeof(da)); + /* + * Allocate needed state. + * Note we allocate 2xspace mask, for table & srv + */ + if (hdr->flags & (IPFW_CFG_GET_STATIC | IPFW_CFG_GET_STATES)) + da.bmask = bmask = malloc( + sizeof(uint32_t) * IPFW_TABLES_MAX * 2 / 32, M_TEMP, + M_WAITOK | M_ZERO); IPFW_UH_RLOCK(chain); @@ -2391,9 +2410,6 @@ dump_config(struct ip_fw_chain *chain, ip_fw3_opheader * Prepare used tables bitmask. */ sz = sizeof(ipfw_cfg_lheader); - memset(&da, 0, sizeof(da)); - - da.b = 0; da.e = chain->n_rules; if (hdr->end_rule != 0) { @@ -2412,24 +2428,25 @@ dump_config(struct ip_fw_chain *chain, ip_fw3_opheader da.rsize += RULEUSIZE1(rule) + sizeof(ipfw_obj_tlv); da.rcount++; /* Update bitmask of used objects for given range */ - da.tcount += mark_object_kidx(chain, rule, bmask); + mark_rule_objects(chain, rule, &da); } /* Add counters if requested */ if (hdr->flags & IPFW_CFG_GET_COUNTERS) { da.rsize += sizeof(struct ip_fw_bcounter) * da.rcount; da.rcounters = 1; } - - if (da.tcount > 0) - sz += da.tcount * sizeof(ipfw_obj_ntlv) + - sizeof(ipfw_obj_ctlv); sz += da.rsize + sizeof(ipfw_obj_ctlv); } - if (hdr->flags & IPFW_CFG_GET_STATES) - sz += ipfw_dyn_get_count() * sizeof(ipfw_obj_dyntlv) + - sizeof(ipfw_obj_ctlv); + if (hdr->flags & IPFW_CFG_GET_STATES) { + sz += sizeof(ipfw_obj_ctlv) + + ipfw_dyn_get_count(bmask, &i) * sizeof(ipfw_obj_dyntlv); + da.tcount += i; + } + if (da.tcount > 0) + sz += da.tcount * sizeof(ipfw_obj_ntlv) + + sizeof(ipfw_obj_ctlv); /* * Fill header anyway. @@ -2447,8 +2464,14 @@ dump_config(struct ip_fw_chain *chain, ip_fw3_opheader } /* STAGE2: Store actual data */ + if (da.tcount > 0) { + error = dump_named_objects(chain, &da, sd); + if (error != 0) + goto cleanup; + } + if (hdr_flags & IPFW_CFG_GET_STATIC) { - error = dump_static_rules(chain, &da, bmask, sd); + error = dump_static_rules(chain, &da, sd); if (error != 0) goto cleanup; } @@ -3027,7 +3050,7 @@ add_rules(struct ip_fw_chain *chain, ip_fw3_opheader * if ((error = commit_rules(chain, cbuf, rtlv->count)) != 0) { /* Free allocate krules */ for (i = 0, ci = cbuf; i < rtlv->count; i++, ci++) - free_rule(ci->krule); + ipfw_free_rule(ci->krule); } if (cbuf != NULL && cbuf != &rci) @@ -3851,7 +3874,7 @@ ipfw_ctl(struct sockopt *sopt) import_rule0(&ci); error = commit_rules(chain, &ci, 1); if (error != 0) - free_rule(ci.krule); + ipfw_free_rule(ci.krule); else if (sopt->sopt_dir == SOPT_GET) { if (is7) { error = convert_rule_to_7(rule); Modified: head/sys/netpfil/ipfw/nat64/nat64lsn_control.c ============================================================================== --- head/sys/netpfil/ipfw/nat64/nat64lsn_control.c Tue Dec 4 15:25:15 2018 (r341470) +++ head/sys/netpfil/ipfw/nat64/nat64lsn_control.c Tue Dec 4 16:01:25 2018 (r341471) @@ -256,6 +256,7 @@ nat64lsn_destroy(struct ip_fw_chain *ch, ip_fw3_ophead return (EBUSY); } + ipfw_reset_eaction_instance(ch, V_nat64lsn_eid, cfg->no.kidx); SRV_OBJECT(ch, cfg->no.kidx) = NULL; nat64lsn_detach_config(ch, cfg); IPFW_UH_WUNLOCK(ch); Modified: head/sys/netpfil/ipfw/nat64/nat64stl_control.c ============================================================================== --- head/sys/netpfil/ipfw/nat64/nat64stl_control.c Tue Dec 4 15:25:15 2018 (r341470) +++ head/sys/netpfil/ipfw/nat64/nat64stl_control.c Tue Dec 4 16:01:25 2018 (r341471) @@ -342,6 +342,7 @@ nat64stl_destroy(struct ip_fw_chain *ch, ip_fw3_ophead return (EBUSY); } + ipfw_reset_eaction_instance(ch, V_nat64stl_eid, cfg->no.kidx); SRV_OBJECT(ch, cfg->no.kidx) = NULL; nat64stl_detach_config(ch, cfg); IPFW_UH_WUNLOCK(ch); Modified: head/sys/netpfil/ipfw/nptv6/nptv6.c ============================================================================== --- head/sys/netpfil/ipfw/nptv6/nptv6.c Tue Dec 4 15:25:15 2018 (r341470) +++ head/sys/netpfil/ipfw/nptv6/nptv6.c Tue Dec 4 16:01:25 2018 (r341471) @@ -746,6 +746,7 @@ nptv6_destroy(struct ip_fw_chain *ch, ip_fw3_opheader return (EBUSY); } + ipfw_reset_eaction_instance(ch, V_nptv6_eid, cfg->no.kidx); SRV_OBJECT(ch, cfg->no.kidx) = NULL; ipfw_objhash_del(CHAIN_TO_SRV(ch), &cfg->no); ipfw_objhash_free_idx(CHAIN_TO_SRV(ch), cfg->no.kidx); From owner-svn-src-head@freebsd.org Tue Dec 4 16:12:45 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4612D1311792; Tue, 4 Dec 2018 16:12:45 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DE1BE80159; Tue, 4 Dec 2018 16:12:44 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C0AC72795C; Tue, 4 Dec 2018 16:12:44 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB4GCiaE010134; Tue, 4 Dec 2018 16:12:44 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB4GCh78010128; Tue, 4 Dec 2018 16:12:43 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201812041612.wB4GCh78010128@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Tue, 4 Dec 2018 16:12:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341472 - in head: sbin/ipfw sys/netinet sys/netpfil/ipfw X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: in head: sbin/ipfw sys/netinet sys/netpfil/ipfw X-SVN-Commit-Revision: 341472 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: DE1BE80159 X-Spamd-Result: default: False [-0.21 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.44)[-0.441,0]; NEURAL_SPAM_LONG(0.01)[0.010,0]; NEURAL_SPAM_SHORT(0.22)[0.220,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Dec 2018 16:12:45 -0000 Author: ae Date: Tue Dec 4 16:12:43 2018 New Revision: 341472 URL: https://svnweb.freebsd.org/changeset/base/341472 Log: Add ability to request listing and deleting only for dynamic states. This can be useful, when net.inet.ip.fw.dyn_keep_states is enabled, but after rules reloading some state must be deleted. Added new flag '-D' for such purpose. Retire '-e' flag, since there can not be expired states in the meaning that this flag historically had. Also add "verbose" mode for listing of dynamic states, it can be enabled with '-v' flag and adds additional information to states list. This can be useful for debugging. Obtained from: Yandex LLC MFC after: 2 months Sponsored by: Yandex LLC Modified: head/sbin/ipfw/ipfw.8 head/sbin/ipfw/ipfw2.c head/sbin/ipfw/ipfw2.h head/sbin/ipfw/main.c head/sys/netinet/ip_fw.h head/sys/netpfil/ipfw/ip_fw_dynamic.c head/sys/netpfil/ipfw/ip_fw_sockopt.c Modified: head/sbin/ipfw/ipfw.8 ============================================================================== --- head/sbin/ipfw/ipfw.8 Tue Dec 4 16:01:25 2018 (r341471) +++ head/sbin/ipfw/ipfw.8 Tue Dec 4 16:12:43 2018 (r341472) @@ -1,7 +1,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 13, 2018 +.Dd December 4, 2018 .Dt IPFW 8 .Os .Sh NAME @@ -310,10 +310,9 @@ i.e., omitting the "ip from any to any" string when this does not carry any additional information. .It Fl d When listing, show dynamic rules in addition to static ones. -.It Fl e -When listing and -.Fl d -is specified, also show expired dynamic rules. +.It Fl D +When listing, show only dynamic states. +When deleting, delete only dynamic states. .It Fl f Run without prompting for confirmation for commands that can cause problems if misused, i.e., Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Tue Dec 4 16:01:25 2018 (r341471) +++ head/sbin/ipfw/ipfw2.c Tue Dec 4 16:12:43 2018 (r341472) @@ -2247,10 +2247,9 @@ show_dyn_state(struct cmdline_opts *co, struct format_ uint16_t rulenum; char buf[INET6_ADDRSTRLEN]; - if (!co->do_expired) { - if (!d->expire && !(d->dyn_type == O_LIMIT_PARENT)) - return; - } + if (d->expire == 0 && d->dyn_type != O_LIMIT_PARENT) + return; + bcopy(&d->rule, &rulenum, sizeof(rulenum)); bprintf(bp, "%05d", rulenum); if (fo->pcwidth > 0 || fo->bcwidth > 0) { @@ -2292,6 +2291,33 @@ show_dyn_state(struct cmdline_opts *co, struct format_ if (d->kidx != 0) bprintf(bp, " :%s", object_search_ctlv(fo->tstate, d->kidx, IPFW_TLV_STATE_NAME)); + +#define BOTH_SYN (TH_SYN | (TH_SYN << 8)) +#define BOTH_FIN (TH_FIN | (TH_FIN << 8)) + if (co->verbose) { + bprintf(bp, " state 0x%08x%s", d->state, + d->state ? " ": ","); + if (d->state & IPFW_DYN_ORPHANED) + bprintf(bp, "ORPHANED,"); + if ((d->state & BOTH_SYN) == BOTH_SYN) + bprintf(bp, "BOTH_SYN,"); + else { + if (d->state & TH_SYN) + bprintf(bp, "F_SYN,"); + if (d->state & (TH_SYN << 8)) + bprintf(bp, "R_SYN,"); + } + if ((d->state & BOTH_FIN) == BOTH_FIN) + bprintf(bp, "BOTH_FIN,"); + else { + if (d->state & TH_FIN) + bprintf(bp, "F_FIN,"); + if (d->state & (TH_FIN << 8)) + bprintf(bp, "R_FIN,"); + } + bprintf(bp, " f_ack 0x%x, r_ack 0x%x", d->ack_fwd, + d->ack_rev); + } } static int @@ -2695,7 +2721,8 @@ ipfw_list(int ac, char *av[], int show_counters) cfg = NULL; sfo.show_counters = show_counters; sfo.show_time = co.do_time; - sfo.flags = IPFW_CFG_GET_STATIC; + if (co.do_dynamic != 2) + sfo.flags |= IPFW_CFG_GET_STATIC; if (co.do_dynamic != 0) sfo.flags |= IPFW_CFG_GET_STATES; if ((sfo.show_counters | sfo.show_time) != 0) @@ -2740,17 +2767,15 @@ ipfw_show_config(struct cmdline_opts *co, struct forma fo->set_mask = cfg->set_mask; ctlv = (ipfw_obj_ctlv *)(cfg + 1); + if (ctlv->head.type == IPFW_TLV_TBLNAME_LIST) { + object_sort_ctlv(ctlv); + fo->tstate = ctlv; + readsz += ctlv->head.length; + ctlv = (ipfw_obj_ctlv *)((caddr_t)ctlv + ctlv->head.length); + } if (cfg->flags & IPFW_CFG_GET_STATIC) { /* We've requested static rules */ - if (ctlv->head.type == IPFW_TLV_TBLNAME_LIST) { - object_sort_ctlv(ctlv); - fo->tstate = ctlv; - readsz += ctlv->head.length; - ctlv = (ipfw_obj_ctlv *)((caddr_t)ctlv + - ctlv->head.length); - } - if (ctlv->head.type == IPFW_TLV_RULE_LIST) { rbase = (ipfw_obj_tlv *)(ctlv + 1); rcnt = ctlv->count; @@ -2777,10 +2802,12 @@ ipfw_show_config(struct cmdline_opts *co, struct forma if (ac == 0) { fo->first = 0; fo->last = IPFW_DEFAULT_RULE; - list_static_range(co, fo, &bp, rbase, rcnt); + if (cfg->flags & IPFW_CFG_GET_STATIC) + list_static_range(co, fo, &bp, rbase, rcnt); if (co->do_dynamic && dynsz > 0) { - printf("## Dynamic rules (%d %zu):\n", fo->dcnt, dynsz); + printf("## Dynamic rules (%d %zu):\n", fo->dcnt, + dynsz); list_dyn_range(co, fo, &bp, dynbase, dynsz); } @@ -2800,6 +2827,9 @@ ipfw_show_config(struct cmdline_opts *co, struct forma continue; } + if ((cfg->flags & IPFW_CFG_GET_STATIC) == 0) + continue; + if (list_static_range(co, fo, &bp, rbase, rcnt) == 0) { /* give precedence to other error(s) */ if (exitval == EX_OK) @@ -3313,6 +3343,8 @@ ipfw_delete(char *av[]) rt.flags |= IPFW_RCFLAG_SET; } } + if (co.do_dynamic == 2) + rt.flags |= IPFW_RCFLAG_DYNAMIC; i = do_range_cmd(IP_FW_XDEL, &rt); if (i != 0) { exitval = EX_UNAVAILABLE; @@ -3320,7 +3352,8 @@ ipfw_delete(char *av[]) continue; warn("rule %u: setsockopt(IP_FW_XDEL)", rt.start_rule); - } else if (rt.new_set == 0 && do_set == 0) { + } else if (rt.new_set == 0 && do_set == 0 && + co.do_dynamic != 2) { exitval = EX_UNAVAILABLE; if (co.do_quiet) continue; Modified: head/sbin/ipfw/ipfw2.h ============================================================================== --- head/sbin/ipfw/ipfw2.h Tue Dec 4 16:01:25 2018 (r341471) +++ head/sbin/ipfw/ipfw2.h Tue Dec 4 16:12:43 2018 (r341472) @@ -37,8 +37,6 @@ struct cmdline_opts { int do_quiet; /* Be quiet in add and flush */ int do_pipe; /* this cmd refers to a pipe/queue/sched */ int do_nat; /* this cmd refers to a nat config */ - int do_dynamic; /* display dynamic rules */ - int do_expired; /* display expired dynamic rules */ int do_compact; /* show rules in compact mode */ int do_force; /* do not ask for confirmation */ int show_sets; /* display the set each rule belongs to */ @@ -48,6 +46,8 @@ struct cmdline_opts { /* The options below can have multiple values. */ + int do_dynamic; /* 1 - display dynamic rules */ + /* 2 - display/delete only dynamic rules */ int do_sort; /* field to sort results (0 = no) */ /* valid fields are 1 and above */ Modified: head/sbin/ipfw/main.c ============================================================================== --- head/sbin/ipfw/main.c Tue Dec 4 16:01:25 2018 (r341471) +++ head/sbin/ipfw/main.c Tue Dec 4 16:12:43 2018 (r341472) @@ -262,7 +262,7 @@ ipfw_main(int oldac, char **oldav) save_av = av; optind = optreset = 1; /* restart getopt() */ - while ((ch = getopt(ac, av, "abcdefhinNp:qs:STtv")) != -1) + while ((ch = getopt(ac, av, "abcdDefhinNp:qs:STtv")) != -1) switch (ch) { case 'a': do_acct = 1; @@ -281,8 +281,12 @@ ipfw_main(int oldac, char **oldav) co.do_dynamic = 1; break; + case 'D': + co.do_dynamic = 2; + break; + case 'e': - co.do_expired = 1; + /* nop for compatibility */ break; case 'f': Modified: head/sys/netinet/ip_fw.h ============================================================================== --- head/sys/netinet/ip_fw.h Tue Dec 4 16:01:25 2018 (r341471) +++ head/sys/netinet/ip_fw.h Tue Dec 4 16:12:43 2018 (r341472) @@ -708,6 +708,7 @@ struct _ipfw_dyn_rule { u_int32_t state; /* state of this rule (typically a * combination of TCP flags) */ +#define IPFW_DYN_ORPHANED 0x40000 /* state's parent rule was deleted */ u_int32_t ack_fwd; /* most recent ACKs in forward */ u_int32_t ack_rev; /* and reverse directions (used */ /* to generate keepalives) */ @@ -938,9 +939,10 @@ typedef struct _ipfw_range_tlv { #define IPFW_RCFLAG_RANGE 0x01 /* rule range is set */ #define IPFW_RCFLAG_ALL 0x02 /* match ALL rules */ #define IPFW_RCFLAG_SET 0x04 /* match rules in given set */ +#define IPFW_RCFLAG_DYNAMIC 0x08 /* match only dynamic states */ /* User-settable flags */ #define IPFW_RCFLAG_USER (IPFW_RCFLAG_RANGE | IPFW_RCFLAG_ALL | \ - IPFW_RCFLAG_SET) + IPFW_RCFLAG_SET | IPFW_RCFLAG_DYNAMIC) /* Internally used flags */ #define IPFW_RCFLAG_DEFAULT 0x0100 /* Do not skip defaul rule */ Modified: head/sys/netpfil/ipfw/ip_fw_dynamic.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_dynamic.c Tue Dec 4 16:01:25 2018 (r341471) +++ head/sys/netpfil/ipfw/ip_fw_dynamic.c Tue Dec 4 16:12:43 2018 (r341472) @@ -2110,7 +2110,11 @@ dyn_free_states(struct ip_fw_chain *chain) } /* - * Returns 1 when state is matched by specified range, otherwise returns 0. + * Returns: + * 0 when state is not matched by specified range; + * 1 when state is matched by specified range; + * 2 when state is matched by specified range and requested deletion of + * dynamic states. */ static int dyn_match_range(uint16_t rulenum, uint8_t set, const ipfw_range_tlv *rt) @@ -2118,13 +2122,18 @@ dyn_match_range(uint16_t rulenum, uint8_t set, const i MPASS(rt != NULL); /* flush all states */ - if (rt->flags & IPFW_RCFLAG_ALL) + if (rt->flags & IPFW_RCFLAG_ALL) { + if (rt->flags & IPFW_RCFLAG_DYNAMIC) + return (2); /* forced */ return (1); + } if ((rt->flags & IPFW_RCFLAG_SET) != 0 && set != rt->set) return (0); if ((rt->flags & IPFW_RCFLAG_RANGE) != 0 && (rulenum < rt->start_rule || rulenum > rt->end_rule)) return (0); + if (rt->flags & IPFW_RCFLAG_DYNAMIC) + return (2); return (1); } @@ -2194,7 +2203,7 @@ dyn_match_ipv4_state(struct ip_fw_chain *ch, struct dy s->limit->set, rt)); ret = dyn_match_range(s->data->rulenum, s->data->set, rt); - if (ret == 0 || V_dyn_keep_states == 0) + if (ret == 0 || V_dyn_keep_states == 0 || ret > 1) return (ret); rule = s->data->parent; @@ -2217,7 +2226,7 @@ dyn_match_ipv6_state(struct ip_fw_chain *ch, struct dy s->limit->set, rt)); ret = dyn_match_range(s->data->rulenum, s->data->set, rt); - if (ret == 0 || V_dyn_keep_states == 0) + if (ret == 0 || V_dyn_keep_states == 0 || ret > 1) return (ret); rule = s->data->parent; @@ -2939,9 +2948,12 @@ dyn_export_data(const struct dyn_data *data, uint16_t memcpy((char *)&dst->rule + sizeof(data->rulenum), &data->set, sizeof(data->set)); + dst->state = data->state; + if (data->flags & DYN_REFERENCED) + dst->state |= IPFW_DYN_ORPHANED; + /* unused fields */ dst->parent = NULL; - dst->state = data->state; dst->ack_fwd = data->ack_fwd; dst->ack_rev = data->ack_rev; dst->count = 0; Modified: head/sys/netpfil/ipfw/ip_fw_sockopt.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_sockopt.c Tue Dec 4 16:01:25 2018 (r341471) +++ head/sys/netpfil/ipfw/ip_fw_sockopt.c Tue Dec 4 16:12:43 2018 (r341472) @@ -1033,6 +1033,16 @@ delete_range(struct ip_fw_chain *chain, ipfw_range_tlv end = ipfw_find_rule(chain, rt->end_rule, UINT32_MAX); } + if (rt->flags & IPFW_RCFLAG_DYNAMIC) { + /* + * Requested deleting only for dynamic states. + */ + *ndel = 0; + ipfw_expire_dyn_states(chain, rt); + IPFW_UH_WUNLOCK(chain); + return (0); + } + /* Allocate new map of the same size */ map = get_map(chain, 0, 1 /* locked */); if (map == NULL) { @@ -2402,7 +2412,6 @@ dump_config(struct ip_fw_chain *chain, ip_fw3_opheader da.bmask = bmask = malloc( sizeof(uint32_t) * IPFW_TABLES_MAX * 2 / 32, M_TEMP, M_WAITOK | M_ZERO); - IPFW_UH_RLOCK(chain); /* From owner-svn-src-head@freebsd.org Tue Dec 4 16:43:51 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 994B913126DB; Tue, 4 Dec 2018 16:43:51 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3A62C81940; Tue, 4 Dec 2018 16:43:51 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1B5F627E66; Tue, 4 Dec 2018 16:43:51 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB4GhoEf025592; Tue, 4 Dec 2018 16:43:50 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB4GhoSV025590; Tue, 4 Dec 2018 16:43:50 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201812041643.wB4GhoSV025590@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Tue, 4 Dec 2018 16:43:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341473 - in head/stand/i386: common gptboot loader X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in head/stand/i386: common gptboot loader X-SVN-Commit-Revision: 341473 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3A62C81940 X-Spamd-Result: default: False [-0.32 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.45)[-0.447,0]; NEURAL_SPAM_SHORT(0.16)[0.163,0]; NEURAL_HAM_LONG(-0.03)[-0.031,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Dec 2018 16:43:51 -0000 Author: ian Date: Tue Dec 4 16:43:50 2018 New Revision: 341473 URL: https://svnweb.freebsd.org/changeset/base/341473 Log: Fix args cross-threading between gptboot(8) and loader(8) with zfs support. When loader(8) is built with zfs support enabled, it assumes that any extarg data present is a zfs_boot_args struct, but if the first-stage loader was gptboot(8) the extarg data is actually a geli_boot_args struct. Luckily, zfsboot(8) and gptzfsboot(8) have always passed KARGS_FLAGS_ZFS along with KARGS_FLAGS_EXTARG, so we can use KARGS_FLAGS_ZFS to decide whether the extarg data is a zfs_boot_args struct. To avoid similar problems in the future, gptboot(8) now passes a new KARGS_FLAGS_GELI to indicate that extarg data is geli_boot_args. In loader(8), if the neither KARGS_FLAGS_ZFS nor KARGS_FLAGS_GELI is set but extarg data is present (which will be the case for gptboot compiled before this change), we now check for the known size of the geli_boot_args struct passed by the older versions of gptboot as a way of confirming what type of extarg data is present. In a semi-related tidying up, since loader's main() has already decided what type of extarg data is present and set the global 'zargs' var accordingly, don't repeat the check in extract_currdev, just check whether zargs is NULL or not. X-MFC after: a few days, along with prior related changes. Modified: head/stand/i386/common/bootargs.h head/stand/i386/gptboot/gptboot.c head/stand/i386/loader/main.c Modified: head/stand/i386/common/bootargs.h ============================================================================== --- head/stand/i386/common/bootargs.h Tue Dec 4 16:12:43 2018 (r341472) +++ head/stand/i386/common/bootargs.h Tue Dec 4 16:43:50 2018 (r341473) @@ -18,10 +18,11 @@ #ifndef _BOOT_I386_ARGS_H_ #define _BOOT_I386_ARGS_H_ -#define KARGS_FLAGS_CD 0x1 -#define KARGS_FLAGS_PXE 0x2 -#define KARGS_FLAGS_ZFS 0x4 -#define KARGS_FLAGS_EXTARG 0x8 /* variably sized extended argument */ +#define KARGS_FLAGS_CD 0x0001 /* .bootdev is a bios CD dev */ +#define KARGS_FLAGS_PXE 0x0002 /* .pxeinfo is valid */ +#define KARGS_FLAGS_ZFS 0x0004 /* .zfspool is valid, EXTARG is zfs_boot_args */ +#define KARGS_FLAGS_EXTARG 0x0008 /* variably sized extended argument */ +#define KARGS_FLAGS_GELI 0x0010 /* EXTARG is geli_boot_args */ #define BOOTARGS_SIZE 24 /* sizeof(struct bootargs) */ #define BA_BOOTFLAGS 8 /* offsetof(struct bootargs, bootflags) */ Modified: head/stand/i386/gptboot/gptboot.c ============================================================================== --- head/stand/i386/gptboot/gptboot.c Tue Dec 4 16:12:43 2018 (r341472) +++ head/stand/i386/gptboot/gptboot.c Tue Dec 4 16:43:50 2018 (r341473) @@ -490,7 +490,7 @@ load(void) __exec((caddr_t)addr, RB_BOOTINFO | (opts & RBX_MASK), MAKEBOOTDEV(dev_maj[gdsk.dsk.type], gdsk.dsk.part + 1, gdsk.dsk.unit, 0xff), #ifdef LOADER_GELI_SUPPORT - KARGS_FLAGS_EXTARG, 0, 0, VTOP(&bootinfo), geliargs + KARGS_FLAGS_GELI | KARGS_FLAGS_EXTARG, 0, 0, VTOP(&bootinfo), geliargs #else 0, 0, 0, VTOP(&bootinfo) #endif Modified: head/stand/i386/loader/main.c ============================================================================== --- head/stand/i386/loader/main.c Tue Dec 4 16:12:43 2018 (r341472) +++ head/stand/i386/loader/main.c Tue Dec 4 16:43:50 2018 (r341473) @@ -73,6 +73,7 @@ void exit(int code); #ifdef LOADER_GELI_SUPPORT #include "geliboot.h" struct geli_boot_args *gargs; +struct geli_boot_data *gbdata; #endif #ifdef LOADER_ZFS_SUPPORT struct zfs_boot_args *zargs; @@ -169,24 +170,46 @@ main(void) #ifdef LOADER_ZFS_SUPPORT archsw.arch_zfs_probe = i386_zfs_probe; -#ifdef LOADER_GELI_SUPPORT - if ((kargs->bootflags & KARGS_FLAGS_EXTARG) != 0) { + /* + * zfsboot and gptzfsboot have always passed KARGS_FLAGS_ZFS, so if that is + * set along with KARGS_FLAGS_EXTARG we know we can interpret the extarg + * data as a struct zfs_boot_args. + */ +#define KARGS_EXTARGS_ZFS (KARGS_FLAGS_EXTARG | KARGS_FLAGS_ZFS) + + if ((kargs->bootflags & KARGS_EXTARGS_ZFS) == KARGS_EXTARGS_ZFS) { zargs = (struct zfs_boot_args *)(kargs + 1); - if (zargs->size > offsetof(struct zfs_boot_args, gelidata)) { - import_geli_boot_data(&zargs->gelidata); - } } -#endif /* LOADER_GELI_SUPPORT */ -#else /* !LOADER_ZFS_SUPPORT */ +#endif /* LOADER_ZFS_SUPPORT */ + #ifdef LOADER_GELI_SUPPORT - if ((kargs->bootflags & KARGS_FLAGS_EXTARG) != 0) { + /* + * If we decided earlier that we have zfs_boot_args extarg data, and it is + * big enough to contain the embedded geli data (the early zfs_boot_args + * structs weren't), then init the gbdata pointer accordingly. If there is + * extarg data which isn't zfs_boot_args data, determine whether it is + * geli_boot_args data. Recent versions of gptboot set KARGS_FLAGS_GELI to + * indicate that. Earlier versions didn't, but we presume that's what we + * have if the extarg size exactly matches the size of the geli_boot_args + * struct during that pre-flag era. + */ +#define LEGACY_GELI_ARGS_SIZE 260 /* This can never change */ + + if (zargs != NULL) { + if (zargs->size > offsetof(struct zfs_boot_args, gelidata)) { + gbdata = &zargs->gelidata; + } + } else if ((kargs->bootflags & KARGS_FLAGS_EXTARG) != 0) { gargs = (struct geli_boot_args *)(kargs + 1); - if (gargs->size >= offsetof(struct geli_boot_args, gelidata)) { - import_geli_boot_data(&gargs->gelidata); + if ((kargs->bootflags & KARGS_FLAGS_GELI) || + gargs->size == LEGACY_GELI_ARGS_SIZE) { + gbdata = &gargs->gelidata; } } + + if (gbdata != NULL) + import_geli_boot_data(gbdata); #endif /* LOADER_GELI_SUPPORT */ -#endif /* LOADER_ZFS_SUPPORT */ /* * March through the device switch probing for things. @@ -258,11 +281,7 @@ extract_currdev(void) } #ifdef LOADER_ZFS_SUPPORT } else if ((kargs->bootflags & KARGS_FLAGS_ZFS) != 0) { - zargs = NULL; - /* check for new style extended argument */ - if ((kargs->bootflags & KARGS_FLAGS_EXTARG) != 0) - zargs = (struct zfs_boot_args *)(kargs + 1); - + /* zargs was set in main() if we have new style extended argument */ if (zargs != NULL && zargs->size >= offsetof(struct zfs_boot_args, primary_pool)) { /* sufficient data is provided */ From owner-svn-src-head@freebsd.org Tue Dec 4 16:48:49 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0F481131286F; Tue, 4 Dec 2018 16:48:49 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A19C982482; Tue, 4 Dec 2018 16:48:48 +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 73B1B27E67; Tue, 4 Dec 2018 16:48:48 +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 wB4GmmFH025850; Tue, 4 Dec 2018 16:48:48 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB4Gml68025846; Tue, 4 Dec 2018 16:48:47 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201812041648.wB4Gml68025846@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Tue, 4 Dec 2018 16:48:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341474 - in head/sys: kern vm X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in head/sys: kern vm X-SVN-Commit-Revision: 341474 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A19C982482 X-Spamd-Result: default: False [-0.35 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.45)[-0.447,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_SPAM_SHORT(0.13)[0.130,0]; NEURAL_HAM_LONG(-0.03)[-0.031,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Dec 2018 16:48:49 -0000 Author: brooks Date: Tue Dec 4 16:48:47 2018 New Revision: 341474 URL: https://svnweb.freebsd.org/changeset/base/341474 Log: Normalize COMPAT_43 syscall declarations. Have ogetkerninfo, ogetpagesize, ogethostname, osethostname, and oaccept declare o_args structs rather than non-compat ones. Due to a failure to use NOARGS in most cases this adds only one new declaration. No changes required in freebsd32 as only ogetpagesize() is implemented and it has a 32-bit specific implementation. Reviewed by: kib Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D15816 Modified: head/sys/kern/kern_xxx.c head/sys/kern/syscalls.master head/sys/kern/uipc_syscalls.c head/sys/vm/vm_mmap.c Modified: head/sys/kern/kern_xxx.c ============================================================================== --- head/sys/kern/kern_xxx.c Tue Dec 4 16:43:50 2018 (r341473) +++ head/sys/kern/kern_xxx.c Tue Dec 4 16:48:47 2018 (r341474) @@ -50,15 +50,8 @@ __FBSDID("$FreeBSD$"); #if defined(COMPAT_43) -#ifndef _SYS_SYSPROTO_H_ -struct gethostname_args { - char *hostname; - u_int len; -}; -#endif -/* ARGSUSED */ int -ogethostname(struct thread *td, struct gethostname_args *uap) +ogethostname(struct thread *td, struct ogethostname_args *uap) { int name[2]; size_t len = uap->len; @@ -69,15 +62,8 @@ ogethostname(struct thread *td, struct gethostname_arg 1, 0, 0, 0, 0)); } -#ifndef _SYS_SYSPROTO_H_ -struct sethostname_args { - char *hostname; - u_int len; -}; -#endif -/* ARGSUSED */ int -osethostname(struct thread *td, struct sethostname_args *uap) +osethostname(struct thread *td, struct osethostname_args *uap) { int name[2]; @@ -104,15 +90,7 @@ ogethostid(struct thread *td, struct ogethostid_args * return (kernel_sysctl(td, name, 2, (long *)td->td_retval, &len, NULL, 0, NULL, 0)); } -#endif /* COMPAT_43 */ -#ifdef COMPAT_43 -#ifndef _SYS_SYSPROTO_H_ -struct osethostid_args { - long hostid; -}; -#endif -/* ARGSUSED */ int osethostid(struct thread *td, struct osethostid_args *uap) { @@ -187,16 +165,8 @@ static struct { */ static char bsdi_strings[80]; /* It had better be less than this! */ -#ifndef _SYS_SYSPROTO_H_ -struct getkerninfo_args { - int op; - char *where; - size_t *size; - int arg; -}; -#endif int -ogetkerninfo(struct thread *td, struct getkerninfo_args *uap) +ogetkerninfo(struct thread *td, struct ogetkerninfo_args *uap) { int error, name[6]; size_t size; Modified: head/sys/kern/syscalls.master ============================================================================== --- head/sys/kern/syscalls.master Tue Dec 4 16:43:50 2018 (r341473) +++ head/sys/kern/syscalls.master Tue Dec 4 16:48:47 2018 (r341474) @@ -453,10 +453,10 @@ _Inout_opt_ size_t *size, int arg ); - } getkerninfo getkerninfo_args int + } 64 AUE_NULL COMPAT { int getpagesize(void); - } getpagesize getpagesize_args int + } 65 AUE_MSYNC STD { int msync( _In_ void *addr, @@ -570,13 +570,13 @@ _Out_writes_z_(len) char *hostname, u_int len ); - } gethostname gethostname_args int + } 88 AUE_SYSCTL COMPAT { int sethostname( _In_reads_z_(len) char *hostname, u_int len ); - } sethostname sethostname_args int + } 89 AUE_GETDTABLESIZE STD { int getdtablesize(void); } @@ -638,7 +638,7 @@ _Out_writes_bytes_opt_(*anamelen) struct sockaddr *name, int *anamelen ); - } accept accept_args int + } 100 AUE_GETPRIORITY STD { int getpriority( int which, Modified: head/sys/kern/uipc_syscalls.c ============================================================================== --- head/sys/kern/uipc_syscalls.c Tue Dec 4 16:43:50 2018 (r341473) +++ head/sys/kern/uipc_syscalls.c Tue Dec 4 16:48:47 2018 (r341474) @@ -455,9 +455,7 @@ sys_accept4(td, uap) #ifdef COMPAT_OLDSOCK int -oaccept(td, uap) - struct thread *td; - struct accept_args *uap; +oaccept(struct thread *td, struct oaccept_args *uap) { return (accept1(td, uap->s, uap->name, uap->anamelen, Modified: head/sys/vm/vm_mmap.c ============================================================================== --- head/sys/vm/vm_mmap.c Tue Dec 4 16:43:50 2018 (r341473) +++ head/sys/vm/vm_mmap.c Tue Dec 4 16:48:47 2018 (r341474) @@ -129,14 +129,8 @@ sys_sstk(struct thread *td, struct sstk_args *uap) } #if defined(COMPAT_43) -#ifndef _SYS_SYSPROTO_H_ -struct getpagesize_args { - int dummy; -}; -#endif - int -ogetpagesize(struct thread *td, struct getpagesize_args *uap) +ogetpagesize(struct thread *td, struct ogetpagesize_args *uap) { td->td_retval[0] = PAGE_SIZE; From owner-svn-src-head@freebsd.org Tue Dec 4 16:49:15 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5A8EC13128A6; Tue, 4 Dec 2018 16:49:15 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 02D35825A8; Tue, 4 Dec 2018 16:49:15 +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 D8E3E27E69; Tue, 4 Dec 2018 16:49:14 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB4GnE9T025914; Tue, 4 Dec 2018 16:49:14 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB4GnEB8025913; Tue, 4 Dec 2018 16:49:14 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201812041649.wB4GnEB8025913@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Tue, 4 Dec 2018 16:49:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341475 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 341475 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 02D35825A8 X-Spamd-Result: default: False [-0.35 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.45)[-0.447,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_SPAM_SHORT(0.13)[0.130,0]; NEURAL_HAM_LONG(-0.03)[-0.031,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Dec 2018 16:49:15 -0000 Author: brooks Date: Tue Dec 4 16:49:14 2018 New Revision: 341475 URL: https://svnweb.freebsd.org/changeset/base/341475 Log: Regen after r341474: Normalize COMPAT_43 syscall declarations. Modified: head/sys/kern/init_sysent.c head/sys/sys/sysproto.h Modified: head/sys/kern/init_sysent.c ============================================================================== --- head/sys/kern/init_sysent.c Tue Dec 4 16:48:47 2018 (r341474) +++ head/sys/kern/init_sysent.c Tue Dec 4 16:49:14 2018 (r341475) @@ -112,7 +112,7 @@ struct sysent sysent[] = { { AS(umask_args), (sy_call_t *)sys_umask, AUE_UMASK, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 60 = umask */ { AS(chroot_args), (sy_call_t *)sys_chroot, AUE_CHROOT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 61 = chroot */ { compat(AS(ofstat_args),fstat), AUE_FSTAT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 62 = old fstat */ - { compat(AS(getkerninfo_args),getkerninfo), AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 63 = old getkerninfo */ + { compat(AS(ogetkerninfo_args),getkerninfo), AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 63 = old getkerninfo */ { compat(0,getpagesize), AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 64 = old getpagesize */ { AS(msync_args), (sy_call_t *)sys_msync, AUE_MSYNC, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 65 = msync */ { 0, (sy_call_t *)sys_vfork, AUE_VFORK, NULL, 0, 0, 0, SY_THR_STATIC }, /* 66 = vfork */ @@ -136,8 +136,8 @@ struct sysent sysent[] = { { compat(0,wait), AUE_WAIT4, NULL, 0, 0, 0, SY_THR_STATIC }, /* 84 = old wait */ { AS(swapon_args), (sy_call_t *)sys_swapon, AUE_SWAPON, NULL, 0, 0, 0, SY_THR_STATIC }, /* 85 = swapon */ { AS(getitimer_args), (sy_call_t *)sys_getitimer, AUE_GETITIMER, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 86 = getitimer */ - { compat(AS(gethostname_args),gethostname), AUE_SYSCTL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 87 = old gethostname */ - { compat(AS(sethostname_args),sethostname), AUE_SYSCTL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 88 = old sethostname */ + { compat(AS(ogethostname_args),gethostname), AUE_SYSCTL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 87 = old gethostname */ + { compat(AS(osethostname_args),sethostname), AUE_SYSCTL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 88 = old sethostname */ { 0, (sy_call_t *)sys_getdtablesize, AUE_GETDTABLESIZE, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 89 = getdtablesize */ { AS(dup2_args), (sy_call_t *)sys_dup2, AUE_DUP2, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 90 = dup2 */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 91 = getdopt */ @@ -148,7 +148,7 @@ struct sysent sysent[] = { { AS(setpriority_args), (sy_call_t *)sys_setpriority, AUE_SETPRIORITY, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 96 = setpriority */ { AS(socket_args), (sy_call_t *)sys_socket, AUE_SOCKET, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 97 = socket */ { AS(connect_args), (sy_call_t *)sys_connect, AUE_CONNECT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 98 = connect */ - { compat(AS(accept_args),accept), AUE_ACCEPT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 99 = old accept */ + { compat(AS(oaccept_args),accept), AUE_ACCEPT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 99 = old accept */ { AS(getpriority_args), (sy_call_t *)sys_getpriority, AUE_GETPRIORITY, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 100 = getpriority */ { compat(AS(osend_args),send), AUE_SEND, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 101 = old send */ { compat(AS(orecv_args),recv), AUE_RECV, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 102 = old recv */ Modified: head/sys/sys/sysproto.h ============================================================================== --- head/sys/sys/sysproto.h Tue Dec 4 16:48:47 2018 (r341474) +++ head/sys/sys/sysproto.h Tue Dec 4 16:49:14 2018 (r341475) @@ -247,7 +247,7 @@ struct umask_args { struct chroot_args { char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)]; }; -struct getpagesize_args { +struct ogetpagesize_args { register_t dummy; }; struct msync_args { @@ -2183,7 +2183,7 @@ struct ofstat_args { char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; char sb_l_[PADL_(struct ostat *)]; struct ostat * sb; char sb_r_[PADR_(struct ostat *)]; }; -struct getkerninfo_args { +struct ogetkerninfo_args { char op_l_[PADL_(int)]; int op; char op_r_[PADR_(int)]; char where_l_[PADL_(char *)]; char * where; char where_r_[PADR_(char *)]; char size_l_[PADL_(size_t *)]; size_t * size; char size_r_[PADR_(size_t *)]; @@ -2197,11 +2197,11 @@ struct ommap_args { char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; char pos_l_[PADL_(long)]; long pos; char pos_r_[PADR_(long)]; }; -struct gethostname_args { +struct ogethostname_args { char hostname_l_[PADL_(char *)]; char * hostname; char hostname_r_[PADR_(char *)]; char len_l_[PADL_(u_int)]; u_int len; char len_r_[PADR_(u_int)]; }; -struct sethostname_args { +struct osethostname_args { char hostname_l_[PADL_(char *)]; char * hostname; char hostname_r_[PADR_(char *)]; char len_l_[PADL_(u_int)]; u_int len; char len_r_[PADR_(u_int)]; }; @@ -2290,13 +2290,13 @@ int osigaction(struct thread *, struct osigaction_args int osigprocmask(struct thread *, struct osigprocmask_args *); int osigpending(struct thread *, struct osigpending_args *); int ofstat(struct thread *, struct ofstat_args *); -int ogetkerninfo(struct thread *, struct getkerninfo_args *); -int ogetpagesize(struct thread *, struct getpagesize_args *); +int ogetkerninfo(struct thread *, struct ogetkerninfo_args *); +int ogetpagesize(struct thread *, struct ogetpagesize_args *); int ommap(struct thread *, struct ommap_args *); int owait(struct thread *, struct owait_args *); -int ogethostname(struct thread *, struct gethostname_args *); -int osethostname(struct thread *, struct sethostname_args *); -int oaccept(struct thread *, struct accept_args *); +int ogethostname(struct thread *, struct ogethostname_args *); +int osethostname(struct thread *, struct osethostname_args *); +int oaccept(struct thread *, struct oaccept_args *); int osend(struct thread *, struct osend_args *); int orecv(struct thread *, struct orecv_args *); int osigreturn(struct thread *, struct osigreturn_args *); From owner-svn-src-head@freebsd.org Tue Dec 4 17:28:29 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5C5FC13138C7; Tue, 4 Dec 2018 17:28:29 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A036A83F08; Tue, 4 Dec 2018 17:28:28 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id wB4HSQhX037240; Tue, 4 Dec 2018 09:28:26 -0800 (PST) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id wB4HSPes037239; Tue, 4 Dec 2018 09:28:25 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201812041728.wB4HSPes037239@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r341464 - head/sbin/savecore In-Reply-To: <201812041234.wB4CYMTJ096164@repo.freebsd.org> To: Renato Botelho Date: Tue, 4 Dec 2018 09:28:25 -0800 (PST) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: A036A83F08 X-Spamd-Result: default: False [-0.22 / 15.00]; ARC_NA(0.00)[]; HAS_REPLYTO(0.00)[rgrimes@freebsd.org]; NEURAL_HAM_MEDIUM(-0.40)[-0.399,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-0.14)[-0.142,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[dnsmgr.net]; REPLYTO_DOM_NEQ_FROM_DOM(0.00)[]; TO_DN_SOME(0.00)[]; AUTH_NA(1.00)[]; RCVD_COUNT_THREE(0.00)[3]; IP_SCORE(-0.02)[country: US(-0.09)]; MX_GOOD(-0.01)[cached: pdx.rh.CN85.dnsmgr.net]; NEURAL_HAM_SHORT(-0.56)[-0.555,0]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:13868, ipnet:69.59.192.0/19, country:US]; MID_RHS_MATCH_FROM(0.00)[] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Dec 2018 17:28:29 -0000 > Author: garga (ports committer) > Date: Tue Dec 4 12:34:22 2018 > New Revision: 341464 > URL: https://svnweb.freebsd.org/changeset/base/341464 > > Log: > Restore /var/crash permissions to 0750, as declared in mtree file. After > r337337 it changed to 0755. > > Reviewed by: loos > Approved by: loos > MFC after: 3 days > Sponsored by: Rubicon Communications, LLC (Netgate) > Differential Revision: https://reviews.freebsd.org/D18355 This probably warrants an EN against 12.0 release. > Modified: > head/sbin/savecore/Makefile > > Modified: head/sbin/savecore/Makefile > ============================================================================== > --- head/sbin/savecore/Makefile Tue Dec 4 10:30:31 2018 (r341463) > +++ head/sbin/savecore/Makefile Tue Dec 4 12:34:22 2018 (r341464) > @@ -2,7 +2,9 @@ > > PACKAGE=runtime > CONFS= minfree > -CONFSDIR= /var/crash > +VAR_CRASH= /var/crash > +VAR_CRASH_MODE= 0750 > +CONFSDIR= VAR_CRASH > PROG= savecore > LIBADD= z xo > MAN= savecore.8 > > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Tue Dec 4 17:35:54 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 62EF61313AD6; Tue, 4 Dec 2018 17:35:54 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B87FE843B0; Tue, 4 Dec 2018 17:35:53 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id wB4HB77W037203; Tue, 4 Dec 2018 09:11:07 -0800 (PST) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id wB4HB7Fc037202; Tue, 4 Dec 2018 09:11:07 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201812041711.wB4HB7Fc037202@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r341446 - head/release/amd64 In-Reply-To: <05039715-2792-fdb2-735f-c5842f4d8087@FreeBSD.org> To: Yuri Pankov Date: Tue, 4 Dec 2018 09:11:07 -0800 (PST) CC: Alexey Dokuchaev , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: B87FE843B0 X-Spamd-Result: default: False [-0.37 / 15.00]; ARC_NA(0.00)[]; HAS_REPLYTO(0.00)[rgrimes@freebsd.org]; NEURAL_HAM_MEDIUM(-0.36)[-0.365,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-0.23)[-0.231,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[dnsmgr.net]; REPLYTO_DOM_NEQ_FROM_DOM(0.00)[]; AUTH_NA(1.00)[]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[3]; IP_SCORE(-0.02)[country: US(-0.09)]; MX_GOOD(-0.01)[cached: pdx.rh.CN85.dnsmgr.net]; NEURAL_HAM_SHORT(-0.64)[-0.642,0]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:13868, ipnet:69.59.192.0/19, country:US]; MID_RHS_MATCH_FROM(0.00)[] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Dec 2018 17:35:54 -0000 > Alexey Dokuchaev wrote: > > On Mon, Dec 03, 2018 at 10:31:57PM +0000, Yuri Pankov wrote: > >> New Revision: 341446 > >> URL: https://svnweb.freebsd.org/changeset/base/341446 > >> > >> Log: > >> mkisoimages.sh: don't use -p flag when copying loader.efi to msdosfs. > >> > >> This fixes 'cdrom' target in the case when world was built by user, > >> and not root. > > > > Could you please explain why -p should not have been used here? I fail > > to understand this from the commit log. I've always considered preserving > > various file metadata as a good thing to do, and this commit puzzles me. > > Because the target is on msdosfs, and the only metadata that can be > preserved is modification time which isn't that useful with the file > being hidden in ESP. OTOH, 'cp -p' fails trying to preserve owner/group > if source is not owned by root (as commit message says). Additional > 'chmod' call done in HBSD doesn't do much as well -- it seems we can > only set/unset owner's 'write' flag which corresponds to DOS 'readonly' > attribute. > I agree with this assesment, and the present state of the script, besides cp followed by chmod is usually spelled ${INSTALL}. -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Tue Dec 4 17:57:04 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0D76C1314A6D; Tue, 4 Dec 2018 17:57:04 +0000 (UTC) (envelope-from delphij@gmail.com) Received: from mail-io1-xd2f.google.com (mail-io1-xd2f.google.com [IPv6:2607:f8b0:4864:20::d2f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3AC42860D8; Tue, 4 Dec 2018 17:57:03 +0000 (UTC) (envelope-from delphij@gmail.com) Received: by mail-io1-xd2f.google.com with SMTP id m19so14370832ioh.3; Tue, 04 Dec 2018 09:57:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=0SIeMwCYXgcyULOCGfSCEAa56aMMJ8rVo0UCZ2O/8g8=; b=T3YAIbD48yKdA/O2lGrwT+6S4iebI+9I9jvlobkGJpk7Fj8xEbmZqqcjotaL7hVnXM DXVnfl7NT8YpUIAgKWWVyZvP5pFGuBBpLcGklmKsbYulKR2WXUZZcthHpRf0de70+36X 7rPu/hpclJL003IuEHVZIdPkx+FyxzbwBGOh0x5GGX0QIN5JVmlOXX4KTi9TlK+EZ7eK 19yyC+kaol4oKAB37QhcC8Qm5Jw3l13+KCPhjN72SELuJaPQ5dXV4P92ab6BeufioHi9 U7e/mV3AW/tRkIZ2GeWXcKb8T5mmlWBvEu5/LR+WWW7d6+K09294vcdWjlIXdYvL+dus l3wA== 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=0SIeMwCYXgcyULOCGfSCEAa56aMMJ8rVo0UCZ2O/8g8=; b=s3GRk5fj9ZDUqJGFNszB2zg0Aw0vEhK5PAjOq6OAGE9PlAQQFKYlb1tRIBCmx/0KHS keEhB5JDmCLkh/Z8etGxI/1IxuWw/fBg32FqMcyY3Lj2QgSLMY08JoubOA2r79VStW2/ 9oSipHSjUleCLn7bOSPD2doHo27PksOdkGFrKza9EhoVRtAWBG6cKpjEmIas2O9q74uF rgbWrr4HLcRoZmImFtjETp531C9oLA9mPs99Wv7s7kR5mUUREdxCwHtX9mgYGmXP6nWQ +nPZ23IXkBI/N0kp6Stov2LQkRzriWiFo0pWbZDlMrPEFO7Y24Ax3a6G+bT7ZczhlLKP Xncw== X-Gm-Message-State: AA+aEWareXHJxbFqcr35b2tMxo/TxPU8aTn/VXT7q4LBibMTGwogK20z hgb/vOJMiVFS6usNaEkVpyQ3VFTaAu/POWutFX7+sw== X-Google-Smtp-Source: AFSGD/XrBpHsDw94G/3zEz493cn7e/vxkWuNl90iMj5aQAyPVBTppVosxC5AxXJP91b592qqrrx6BFK5WikGnuWK1xQ= X-Received: by 2002:a6b:8e43:: with SMTP id q64mr17500267iod.197.1543946222018; Tue, 04 Dec 2018 09:57:02 -0800 (PST) MIME-Version: 1.0 References: <201812041234.wB4CYMTJ096164@repo.freebsd.org> <201812041728.wB4HSPes037239@pdx.rh.CN85.dnsmgr.net> In-Reply-To: <201812041728.wB4HSPes037239@pdx.rh.CN85.dnsmgr.net> From: Xin LI Date: Tue, 4 Dec 2018 09:56:50 -0800 Message-ID: Subject: Re: svn commit: r341464 - head/sbin/savecore To: rgrimes@freebsd.org Cc: Renato Botelho do Couto , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 3AC42860D8 X-Spamd-Result: default: False [-6.06 / 15.00]; ARC_NA(0.00)[]; TO_DN_EQ_ADDR_SOME(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; FREEMAIL_FROM(0.00)[gmail.com]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCPT_COUNT_FIVE(0.00)[5]; IP_SCORE(-2.05)[ip: (-7.36), ipnet: 2607:f8b0::/32(-1.54), asn: 15169(-1.28), country: US(-0.09)]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[f.2.d.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]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; NEURAL_HAM_SHORT(-0.99)[-0.992,0]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_COUNT_TWO(0.00)[2] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Dec 2018 17:57:04 -0000 On Tue, Dec 4, 2018 at 9:28 AM Rodney W. Grimes wrote: > > > Author: garga (ports committer) > > Date: Tue Dec 4 12:34:22 2018 > > New Revision: 341464 > > URL: https://svnweb.freebsd.org/changeset/base/341464 > > > > Log: > > Restore /var/crash permissions to 0750, as declared in mtree file. After > > r337337 it changed to 0755. > > > > Reviewed by: loos > > Approved by: loos > > MFC after: 3 days > > Sponsored by: Rubicon Communications, LLC (Netgate) > > Differential Revision: https://reviews.freebsd.org/D18355 > > This probably warrants an EN against 12.0 release. Can we just fix it before 12.0-RELEASE builds starts? It would be much more robust compared to delivering a "fixit" script though freebsd-update... Cheers, > > > Modified: > > head/sbin/savecore/Makefile > > > > Modified: head/sbin/savecore/Makefile > > ============================================================================== > > --- head/sbin/savecore/Makefile Tue Dec 4 10:30:31 2018 (r341463) > > +++ head/sbin/savecore/Makefile Tue Dec 4 12:34:22 2018 (r341464) > > @@ -2,7 +2,9 @@ > > > > PACKAGE=runtime > > CONFS= minfree > > -CONFSDIR= /var/crash > > +VAR_CRASH= /var/crash > > +VAR_CRASH_MODE= 0750 > > +CONFSDIR= VAR_CRASH > > PROG= savecore > > LIBADD= z xo > > MAN= savecore.8 > > > > > > -- > Rod Grimes rgrimes@freebsd.org > From owner-svn-src-head@freebsd.org Tue Dec 4 18:13:48 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D40D31315819; Tue, 4 Dec 2018 18:13:48 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 63A6E871A6; Tue, 4 Dec 2018 18:13:46 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id wB4IDhtg037434; Tue, 4 Dec 2018 10:13:43 -0800 (PST) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id wB4IDhd1037433; Tue, 4 Dec 2018 10:13:43 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201812041813.wB4IDhd1037433@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r341464 - head/sbin/savecore In-Reply-To: To: Xin LI Date: Tue, 4 Dec 2018 10:13:43 -0800 (PST) CC: rgrimes@freebsd.org, Renato Botelho do Couto , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 63A6E871A6 X-Spamd-Result: default: False [-1.08 / 15.00]; ARC_NA(0.00)[]; TO_DN_EQ_ADDR_SOME(0.00)[]; HAS_REPLYTO(0.00)[rgrimes@freebsd.org]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_MEDIUM(-0.60)[-0.604,0]; IP_SCORE(-0.02)[country: US(-0.09)]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[dnsmgr.net]; REPLYTO_DOM_NEQ_FROM_DOM(0.00)[]; AUTH_NA(1.00)[]; RCPT_COUNT_FIVE(0.00)[6]; NEURAL_HAM_LONG(-0.53)[-0.526,0]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MX_GOOD(-0.01)[cached: pdx.rh.CN85.dnsmgr.net]; NEURAL_HAM_SHORT(-0.82)[-0.822,0]; R_SPF_NA(0.00)[]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:13868, ipnet:69.59.192.0/19, country:US]; FORGED_RECIPIENTS(0.00)[delphij@gmail.com ..,src-committers@freebsd.org ...]; MID_RHS_MATCH_FROM(0.00)[] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Dec 2018 18:13:49 -0000 > On Tue, Dec 4, 2018 at 9:28 AM Rodney W. Grimes > > > > > Author: garga (ports committer) > > > Date: Tue Dec 4 12:34:22 2018 > > > New Revision: 341464 > > > URL: https://svnweb.freebsd.org/changeset/base/341464 > > > > > > Log: > > > Restore /var/crash permissions to 0750, as declared in mtree file. After > > > r337337 it changed to 0755. > > > > > > Reviewed by: loos > > > Approved by: loos > > > MFC after: 3 days > > > Sponsored by: Rubicon Communications, LLC (Netgate) > > > Differential Revision: https://reviews.freebsd.org/D18355 > > > > This probably warrants an EN against 12.0 release. > > Can we just fix it before 12.0-RELEASE builds starts? It would be > much more robust compared to delivering a "fixit" script though > freebsd-update... Thats Glens call, but normal procedure is 0 change between last RC and release. (Bcc:'ed to gjb@, and trimmed a bit) Rod > > > +++ head/sbin/savecore/Makefile Tue Dec 4 12:34:22 2018 (r341464) > > > @@ -2,7 +2,9 @@ > > > > > > PACKAGE=runtime > > > CONFS= minfree > > > -CONFSDIR= /var/crash > > > +VAR_CRASH= /var/crash > > > +VAR_CRASH_MODE= 0750 > > > +CONFSDIR= VAR_CRASH > > > PROG= savecore > > > LIBADD= z xo > > > MAN= savecore.8 -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Tue Dec 4 18:28:27 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EA1851316179; Tue, 4 Dec 2018 18:28:26 +0000 (UTC) (envelope-from gordon@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 928686A1B9; Tue, 4 Dec 2018 18:28:26 +0000 (UTC) (envelope-from gordon@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5B996F37; Tue, 4 Dec 2018 18:28:26 +0000 (UTC) (envelope-from gordon@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB4ISQE8079501; Tue, 4 Dec 2018 18:28:26 GMT (envelope-from gordon@FreeBSD.org) Received: (from gordon@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB4ISQoc079500; Tue, 4 Dec 2018 18:28:26 GMT (envelope-from gordon@FreeBSD.org) Message-Id: <201812041828.wB4ISQoc079500@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gordon set sender to gordon@FreeBSD.org using -f From: Gordon Tetlow Date: Tue, 4 Dec 2018 18:28:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341484 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: gordon X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 341484 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 928686A1B9 X-Spamd-Result: default: False [-0.33 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.45)[-0.447,0]; NEURAL_SPAM_SHORT(0.14)[0.144,0]; NEURAL_HAM_LONG(-0.03)[-0.031,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Dec 2018 18:28:27 -0000 Author: gordon Date: Tue Dec 4 18:28:25 2018 New Revision: 341484 URL: https://svnweb.freebsd.org/changeset/base/341484 Log: Always treat firmware request and response sizes as unsigned. This fixes an incomplete bounds check on the guest-supplied request size where a very large request size could be interpreted as a negative value and not be caught by the bounds check. Submitted by: jhb Reported by: Reno Robert Approved by: so Security: FreeBSD-SA-18:14.bhyve Security: CVE-2018-17160 Modified: head/usr.sbin/bhyve/fwctl.c Modified: head/usr.sbin/bhyve/fwctl.c ============================================================================== --- head/usr.sbin/bhyve/fwctl.c Tue Dec 4 17:57:01 2018 (r341483) +++ head/usr.sbin/bhyve/fwctl.c Tue Dec 4 18:28:25 2018 (r341484) @@ -79,8 +79,8 @@ static u_int ident_idx; struct op_info { int op; - int (*op_start)(int len); - void (*op_data)(uint32_t data, int len); + int (*op_start)(uint32_t len); + void (*op_data)(uint32_t data, uint32_t len); int (*op_result)(struct iovec **data); void (*op_done)(struct iovec *data); }; @@ -119,7 +119,7 @@ errop_set(int err) } static int -errop_start(int len) +errop_start(uint32_t len) { errop_code = ENOENT; @@ -128,7 +128,7 @@ errop_start(int len) } static void -errop_data(uint32_t data, int len) +errop_data(uint32_t data, uint32_t len) { /* ignore */ @@ -188,7 +188,7 @@ static int fget_cnt; static size_t fget_size; static int -fget_start(int len) +fget_start(uint32_t len) { if (len > FGET_STRSZ) @@ -200,7 +200,7 @@ fget_start(int len) } static void -fget_data(uint32_t data, int len) +fget_data(uint32_t data, uint32_t len) { *((uint32_t *) &fget_str[fget_cnt]) = data; @@ -285,8 +285,8 @@ static struct req_info { struct op_info *req_op; int resp_error; int resp_count; - int resp_size; - int resp_off; + size_t resp_size; + size_t resp_off; struct iovec *resp_biov; } rinfo; @@ -346,13 +346,14 @@ fwctl_request_start(void) static int fwctl_request_data(uint32_t value) { - int remlen; /* Make sure remaining size is >= 0 */ - rinfo.req_size -= sizeof(uint32_t); - remlen = MAX(rinfo.req_size, 0); + if (rinfo.req_size <= sizeof(uint32_t)) + rinfo.req_size = 0; + else + rinfo.req_size -= sizeof(uint32_t); - (*rinfo.req_op->op_data)(value, remlen); + (*rinfo.req_op->op_data)(value, rinfo.req_size); if (rinfo.req_size < sizeof(uint32_t)) { fwctl_request_done(); @@ -401,7 +402,7 @@ static int fwctl_response(uint32_t *retval) { uint32_t *dp; - int remlen; + ssize_t remlen; switch(rinfo.resp_count) { case 0: @@ -436,7 +437,7 @@ fwctl_response(uint32_t *retval) } if (rinfo.resp_count > 3 && - rinfo.resp_size - rinfo.resp_off <= 0) { + rinfo.resp_off >= rinfo.resp_size) { fwctl_response_done(); return (1); } From owner-svn-src-head@freebsd.org Tue Dec 4 18:45:58 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E1F321317032; Tue, 4 Dec 2018 18:45:58 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-it1-f178.google.com (mail-it1-f178.google.com [209.85.166.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4A98F6BB06; Tue, 4 Dec 2018 18:45:58 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-it1-f178.google.com with SMTP id z7so17150696iti.0; Tue, 04 Dec 2018 10:45:58 -0800 (PST) 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=ZRmVK1de3tEAASzQlwnMTbSCj3QaAbPdlTsjSB336Bs=; b=cMepcFsEAIhV/c4j2CTGS7pvNZKuByQBCOPcFOMEDc7mt6MrZY8OTvN1KyTEJ7LM7J SbnLU6SQgdARHcbKYeDsT0Qt32bImaWOLAzkpgULu4RhYBT2q1q2CvS6jMBsX///8WGo sqh64dKp5iazU+L6ouZLe2rcUSNTzEWZGF4iBZtOMXBblesvh8r6kENjiBC5HGTAFPKe FAVCRYyaWz51CwNjnCdiTmVGTZU4mNPiK4d2o5EE33iOKQa72Kedr0/ujdUZlYbGQAEu WcfotYF1jtmv7ID905RAktwveULJPV+6namL6GWTWKXN0G2MxO+EfTLxQIiekLALnBzi Unyw== X-Gm-Message-State: AA+aEWYPWU2fSRGBwu842HkSic+uuBgPHfkkXyozJAUQMOpLLIYvG3g6 9YKlqqF4306uB10TqP9rJomgdU5ws3GSJ2f32RsBxA== X-Google-Smtp-Source: AFSGD/Wp55sHinmEYcLswsmgx1dpfycZySLIl5Bk7qx2d9k471IavD40kdBHVo8sx3iBnYr0/6dHpirUMG+H654Pr/0= X-Received: by 2002:a24:f5c1:: with SMTP id k184mr12204803ith.87.1543949157564; Tue, 04 Dec 2018 10:45:57 -0800 (PST) MIME-Version: 1.0 References: <201812032231.wB3MVvaD060931@repo.freebsd.org> <7fd4cc67-52df-56e1-faa9-281d4ddf57e2@FreeBSD.org> In-Reply-To: From: Ed Maste Date: Tue, 4 Dec 2018 13:45:44 -0500 Message-ID: Subject: Re: svn commit: r341446 - head/release/amd64 To: Oliver Pinter Cc: yuripv@freebsd.org, src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4A98F6BB06 X-Spamd-Result: default: False [-5.83 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[freebsd.org]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; NEURAL_HAM_SHORT(-0.96)[-0.965,0]; RCVD_IN_DNSWL_NONE(0.00)[178.166.85.209.list.dnswl.org : 127.0.5.0]; IP_SCORE(-2.86)[ip: (-9.44), ipnet: 209.85.128.0/17(-3.48), asn: 15169(-1.28), country: US(-0.09)]; FORGED_SENDER(0.30)[emaste@freebsd.org,carpeddiem@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[178.166.85.209.rep.mailspike.net : 127.0.0.17]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[emaste@freebsd.org,carpeddiem@gmail.com]; RCVD_COUNT_TWO(0.00)[2] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Dec 2018 18:45:59 -0000 On Tue, 4 Dec 2018 at 03:38, Oliver Pinter wrote: > > No problem. Ed was directly CCd and notified on IRC. Sorry for losing track of this one. (If there's anything else that you expect I'm looking at but haven't seen an update in a while please feel free to ping me.) From owner-svn-src-head@freebsd.org Tue Dec 4 18:51:29 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 166E71317494; Tue, 4 Dec 2018 18:51:29 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B1BA46C26A; Tue, 4 Dec 2018 18:51:28 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 92C7012DE; Tue, 4 Dec 2018 18:51:28 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB4IpSHE092671; Tue, 4 Dec 2018 18:51:28 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB4IpSSl092670; Tue, 4 Dec 2018 18:51:28 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201812041851.wB4IpSSl092670@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 4 Dec 2018 18:51:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341489 - head X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 341489 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B1BA46C26A X-Spamd-Result: default: False [-0.42 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.48)[-0.476,0]; NEURAL_SPAM_SHORT(0.13)[0.128,0]; NEURAL_HAM_LONG(-0.07)[-0.072,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Dec 2018 18:51:29 -0000 Author: andrew Date: Tue Dec 4 18:51:28 2018 New Revision: 341489 URL: https://svnweb.freebsd.org/changeset/base/341489 Log: Only gnu/lib/csu when MK_BSD_CRTBEGIN is off. We were still building it from Makefile.inc1. Disable it there so we don't try to build the GNU crtbegin/crtend when the BSD version was asked for. PR: 233733 Reported by: lwhsu Reviewed by: emaste MFC with: r339738 Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D18428 Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Tue Dec 4 18:38:32 2018 (r341488) +++ head/Makefile.inc1 Tue Dec 4 18:51:28 2018 (r341489) @@ -2689,8 +2689,10 @@ _prereq_libs+= gnu/lib/libssp/libssp_nonshared # gnu/lib/csu, gnu/lib/libgcc, lib/csu and lib/libc must be built before # all shared libraries for ELF. # -_startup_libs= gnu/lib/csu -_startup_libs+= lib/csu +_startup_libs= lib/csu +.if ${MK_BSD_CRTBEGIN} == "no" +_startup_libs+= gnu/lib/csu +.endif _startup_libs+= lib/libcompiler_rt _startup_libs+= lib/libc _startup_libs+= lib/libc_nonshared From owner-svn-src-head@freebsd.org Tue Dec 4 18:55:36 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 62A7113178E6 for ; Tue, 4 Dec 2018 18:55:36 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x833.google.com (mail-qt1-x833.google.com [IPv6:2607:f8b0:4864:20::833]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BBDA56C7DA for ; Tue, 4 Dec 2018 18:55:35 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x833.google.com with SMTP id k12so19310144qtf.7 for ; Tue, 04 Dec 2018 10:55:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=U8YvndzuXh6k400Ms+mu8FpyyqUhYo9yQEexUde/Fdw=; b=f7tapGdnjf4vbzvceDevl997qQa9MzzOt4ifWRBNDBxVudKzGGyq19noyIcrPBJU/w aQOHiqDlSAyDxbGfH2dQjlbQy2+1nJHn6vT6qkVFPkMiOA+p5waFwGwBnmpghksWBVVY CAiVD9nNkoIJEa047kKFe5PWPb5Y7+i4vhmw0zOMe8KUA+UIEhWVtTyasmQNji9D46/b Rv/ZtIaCmOxbZ6jyHlXbHlcg6BvfCbxxDFTli8Ghe1sHXwi36yhFTkW96NK6okbsdBgf 1vMq2rA74qDU7oKKJr+nNZgbUp9NgyQsayYy3lT/FWBojyTklMKkKaKAyC6prnRQSb94 PtDw== 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=U8YvndzuXh6k400Ms+mu8FpyyqUhYo9yQEexUde/Fdw=; b=g+WH+takeIuj8OUbgWT3l30E88qgJBTphwmhvEU/FUkBT3bBtL/uuLE0WJ4SEt/BzL jAsAmsm9cVZxjhS3lL3RX8KhYzeIRVjm7mJACSqXV3iJn4Fw5/4/xP141cm+pdoZqItU eLIqlSDTiY8WeiI0JT30g8JxjVMZN3HeB6W3bBZn6AyXYhI8eZZ5ZgEXXzdGS1rYSmSf 0taDzVeq53R15kIM3glMsq0vt4+So1WJ6duHF9U3cNanYf+x4QK7E1IUnW5a323Lb9R8 i9eqbIzOcZielvIbYUhyOH7KpDGTqGwqNtzGphLykxr5EikBwTAP+4ModGbLwDWUyVO5 eSuQ== X-Gm-Message-State: AA+aEWYguAIw5HdyCdnK6/qqZB9x59EUMTEmn+rVFBVJpsd7KEG9FYqD qf5/cz5ocBz+uoFC76UyoKBiQ4R4qF6/9fxpOoYeSw== X-Google-Smtp-Source: AFSGD/UE3TT28EW7TGpKOBNR4/w8s9iOCBnW/4Q0TXxPPO5R6fgQH6tBcOerd9V/ONsBMhbC6S7bVKxJ9p90Y5mgkus= X-Received: by 2002:ac8:3f2d:: with SMTP id c42mr20655400qtk.33.1543949735063; Tue, 04 Dec 2018 10:55:35 -0800 (PST) MIME-Version: 1.0 References: <201812041813.wB4IDhd1037433@pdx.rh.CN85.dnsmgr.net> In-Reply-To: <201812041813.wB4IDhd1037433@pdx.rh.CN85.dnsmgr.net> From: Warner Losh Date: Tue, 4 Dec 2018 11:55:23 -0700 Message-ID: Subject: Re: svn commit: r341464 - head/sbin/savecore To: "Rodney W. Grimes" Cc: Xin LI , Renato Botelho do Couto , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org X-Rspamd-Queue-Id: BBDA56C7DA X-Spamd-Result: default: False [-3.42 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.995,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; NEURAL_HAM_LONG(-0.99)[-0.992,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; RCPT_COUNT_FIVE(0.00)[6]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; MX_GOOD(-0.01)[cached: ALT1.aspmx.l.google.com]; RCVD_IN_DNSWL_NONE(0.00)[3.3.8.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_SHORT(-0.84)[-0.841,0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_LAST(0.00)[]; IP_SCORE(-0.58)[ipnet: 2607:f8b0::/32(-1.54), asn: 15169(-1.28), country: US(-0.09)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; FREEMAIL_CC(0.00)[gmail.com] X-Rspamd-Server: mx1.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: Tue, 04 Dec 2018 18:55:36 -0000 On Tue, Dec 4, 2018 at 11:14 AM Rodney W. Grimes < freebsd@pdx.rh.cn85.dnsmgr.net> wrote: > > On Tue, Dec 4, 2018 at 9:28 AM Rodney W. Grimes > > > > > > > Author: garga (ports committer) > > > > Date: Tue Dec 4 12:34:22 2018 > > > > New Revision: 341464 > > > > URL: https://svnweb.freebsd.org/changeset/base/341464 > > > > > > > > Log: > > > > Restore /var/crash permissions to 0750, as declared in mtree file. > After > > > > r337337 it changed to 0755. > > > > > > > > Reviewed by: loos > > > > Approved by: loos > > > > MFC after: 3 days > > > > Sponsored by: Rubicon Communications, LLC (Netgate) > > > > Differential Revision: https://reviews.freebsd.org/D18355 > > > > > > This probably warrants an EN against 12.0 release. > > > > Can we just fix it before 12.0-RELEASE builds starts? It would be > > much more robust compared to delivering a "fixit" script though > > freebsd-update... > > Thats Glens call, but normal procedure is 0 change between > last RC and release. > Let's not be too pedantic here: This is a security issue and let's not let our process get in the way of fixing a simple security issue. Warner > (Bcc:'ed to gjb@, and trimmed a bit) > > Rod > > > > +++ head/sbin/savecore/Makefile Tue Dec 4 12:34:22 2018 > (r341464) > > > > @@ -2,7 +2,9 @@ > > > > > > > > PACKAGE=runtime > > > > CONFS= minfree > > > > -CONFSDIR= /var/crash > > > > +VAR_CRASH= /var/crash > > > > +VAR_CRASH_MODE= 0750 > > > > +CONFSDIR= VAR_CRASH > > > > PROG= savecore > > > > LIBADD= z xo > > > > MAN= savecore.8 > -- > Rod Grimes > rgrimes@freebsd.org > > From owner-svn-src-head@freebsd.org Tue Dec 4 19:59:34 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2C3DC131A51A; Tue, 4 Dec 2018 19:59:34 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-it1-f177.google.com (mail-it1-f177.google.com [209.85.166.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8B50C6FBE2; Tue, 4 Dec 2018 19:59:33 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-it1-f177.google.com with SMTP id b5so16448456iti.2; Tue, 04 Dec 2018 11:59:33 -0800 (PST) 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=bhU7FOE2p1pBmu6X5/jSrh0Q/U6AX+fogbqsq2bZxBA=; b=TIxHwGwFi+bXnu5VvNVSKEk3J4UxYTYQ90TDFxqNEfKmCLsWJZvf/QTScRlPCbwLDQ MTcLoWfdHWy42gidxf3uy65Xj9LG7uLV22FVUJfA/IWRQR8tuL602Wd8GwTXrVPUAtVO g6n5IwzUXA9Nm8unONs5eN4GyQLdq2H2iC8Xa5Dlbp8EuiR9y7pIAsIZ//G+s8TT+s6r 1cuY3jVT+BZBIwqHdrrAAMoOHw3gNjbTWN3YErZyToH7B71qQLHQY001QvAzH9VOldZ0 WPCoHhLkwZCuLQVa9Sm8RCYaY/B6MEnDCdsrwuiM0Ox71LEpLuWWghnMvTTu361Im9sq ltTw== X-Gm-Message-State: AA+aEWbFtCLYt0ugxTlu06vs3S7lscT4AkEpCLElYPdEUllxqP92JrSX Dc7VTJH1xzo/l/d5tEUsrC/XnQLSHbOt+r3ttlnZkQ== X-Google-Smtp-Source: AFSGD/VaOdOUyspsP6VVuLML/fyZXQpBMZp5LIsnzAnoTLC9LYvzShTvxAndVtqQANYMR9BxAdKCCkxApNR0xuA0fsU= X-Received: by 2002:a24:1389:: with SMTP id 131mr12403522itz.33.1543953572215; Tue, 04 Dec 2018 11:59:32 -0800 (PST) MIME-Version: 1.0 References: <201812041234.wB4CYMTJ096164@repo.freebsd.org> In-Reply-To: <201812041234.wB4CYMTJ096164@repo.freebsd.org> From: Ed Maste Date: Tue, 4 Dec 2018 14:59:19 -0500 Message-ID: Subject: Re: svn commit: r341464 - head/sbin/savecore To: Renato Botelho Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 8B50C6FBE2 X-Spamd-Result: default: False [-5.85 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[freebsd.org]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; IP_SCORE(-2.89)[ip: (-9.60), ipnet: 209.85.128.0/17(-3.47), asn: 15169(-1.28), country: US(-0.09)]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; NEURAL_HAM_SHORT(-0.95)[-0.949,0]; RCVD_IN_DNSWL_NONE(0.00)[177.166.85.209.list.dnswl.org : 127.0.5.0]; FORGED_SENDER(0.30)[emaste@freebsd.org,carpeddiem@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[177.166.85.209.rep.mailspike.net : 127.0.0.17]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[emaste@freebsd.org,carpeddiem@gmail.com]; RCVD_COUNT_TWO(0.00)[2] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Dec 2018 19:59:34 -0000 On Tue, 4 Dec 2018 at 07:34, Renato Botelho wrote: > > Author: garga (ports committer) > Date: Tue Dec 4 12:34:22 2018 > New Revision: 341464 > URL: https://svnweb.freebsd.org/changeset/base/341464 > > Log: > Restore /var/crash permissions to 0750, as declared in mtree file. After > r337337 it changed to 0755. > > Reviewed by: loos > Approved by: loos > MFC after: 3 days > Sponsored by: Rubicon Communications, LLC (Netgate) > Differential Revision: https://reviews.freebsd.org/D18355 Please insta-MFC this to stable/12 (while folks sort out the 12.0 question). From owner-svn-src-head@freebsd.org Tue Dec 4 20:36:09 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F396B131BDE2; Tue, 4 Dec 2018 20:36:08 +0000 (UTC) (envelope-from garga.bsd@gmail.com) Received: from mail-qt1-x82c.google.com (mail-qt1-x82c.google.com [IPv6:2607:f8b0:4864:20::82c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4A0B571808; Tue, 4 Dec 2018 20:36:08 +0000 (UTC) (envelope-from garga.bsd@gmail.com) Received: by mail-qt1-x82c.google.com with SMTP id p17so19716390qtl.5; Tue, 04 Dec 2018 12:36:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:openpgp:autocrypt:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=HWVeRiWCN+HfTQ3N9VAKSn53k3NzqaA7Fm3yntcmxx4=; b=CQrhGlzmqXTPfurc2dNqQxC27QnSJwW1DHL73JVlXm9Gsavz4BX+jB6tQzs+mZ3q4k Dk6BnReOExTu+OUk/V65lyNBDoqNTcmQRQvtM7dg4ZEKOIUsSjUh+sz5nfu7E/NvH5Uh YqrbCiykwWKRMWTW/+CIqoURM9m6DMxOtbWWipxouMV/A11Oc0dLlIfnFT90YNJ30rHN wtK5VAQDQJSP//OJKXaS54c8G9i1DQ9wI/Q0e+RTY1IKQet7SPWnKT4M4maexhcgM7sy mYX36TJfA2Z4tB9o+T5p92ZJX3UNNt5LnnZIm3hYZ63uJNO1bZe0EMPxP+AFTnj1jHQo zEMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:openpgp :autocrypt:message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=HWVeRiWCN+HfTQ3N9VAKSn53k3NzqaA7Fm3yntcmxx4=; b=B0cG+CiNm+lefRxjis9TcHeo3hONQ/x6j6DBFb4qrmqfPwE7VSmZOvvl4sLKk9z5pf eW4lNnPgE/eYqVZ7Ottvw/y7NYceuUEdeWQiWxrH4rZggChDOAGNCoAW2LcDg7gXaaF0 AmRcta+hQBcdoYpJmX4RPPPZrtaeiKZbJQMDkmmQeoBsfNCPfPnWU1BUjaWG9Rhir4sD zw18ttyCRO5mJbmabBtCuTcbX+aPmSGUQZ8tgd+yaRjDOhPz2vz3/xpWosaWQQ1Y0FfZ eKT/uhelpESmIHGNE7B3wuspzEou1jW6Gr7C1aaTDkim4rAWNGPOz4now6iXCLgDBhty Dg2Q== X-Gm-Message-State: AA+aEWaAAfNJjoeNIZ+Sp4+C+WJNVQQ6RU22P92SQMltC4ryU81gLT/L a82zGzTrLeZITwslX3GeI4fmlrEF X-Google-Smtp-Source: AFSGD/Xm3D21eSpwHfkovL2uH+W3Ifiybmf4lHdUS+K0V0NjYjPXYpx3z+FgtBVHz1HyANWHJttQ0A== X-Received: by 2002:a0c:d6c4:: with SMTP id l4mr21777671qvi.103.1543955767507; Tue, 04 Dec 2018 12:36:07 -0800 (PST) Received: from mbp.home ([2804:f1c:800:e00:44bb:d3a:ba10:40c5]) by smtp.gmail.com with ESMTPSA id p47sm12312341qta.36.2018.12.04.12.36.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Dec 2018 12:36:06 -0800 (PST) Sender: Renato Botelho Subject: Re: svn commit: r341464 - head/sbin/savecore To: Ed Maste Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201812041234.wB4CYMTJ096164@repo.freebsd.org> From: Renato Botelho Openpgp: preference=signencrypt Autocrypt: addr=garga@FreeBSD.org; prefer-encrypt=mutual; keydata= xsBNBFn4ZqUBCACxJRWi57JkmsCrSU0gZd/CwB+B90OTUeXmF63lDPETOQ+pBA4+vJgzjW1C pv7rR25wxvESJKphxZJOOk9AXTXsg5QrhdP3+KQG/zNcKd2ukbt3ezkhdMx8q81wn4wY2oTl WXdGIVdDKvC8sCp1fc6pPKJin71/skb9wg6ThtlRFlv9en4f8QSVmRuzRKQ6VjCbl+yIpiye /I5BQ4I99uouPzPhzf9ya3cvp4xbiw5wSo1F3nLsThBT2osYy/nRNz2ciuCYyyX87dGhio0T 8Pxl37eBbGQvCGwPQBApCcfoiZBN/5F65Tt4p72gIqT+AYuqq5G7Bhj+fGTC7q0QotL/ABEB AAHNLFJlbmF0byBCb3RlbGhvIChGcmVlQlNEKSA8Z2FyZ2FARnJlZUJTRC5vcmc+wsCXBBMB CgBBAhsDBQkFo5qABQsJCAcDBRUKCQgLBRYDAgEAAh4BAheAFiEExxiLNMqsn7yXmTy7W54E w5ZrhhoFAln4aeUCGQEACgkQW54Ew5ZrhhpTIwf+OS+Gv/ITOy7+8D+8SKXNmkfczsTO+Uqz 6SraXcq32j1C4QcRQCwGPhVJJgKnFSvPm3kbNPFXaQh1zD+mTQ4r/Loc78Rz+fZljYcgNx7n aQKhd9pdpXaELOe+Y10jvGUrT0SE06Y10BP/NmQaLplt9qG8VgLAAB9ZcsuZ9pzbBbQjd9In OK5VcXQzHT/EBBQ1rHsl1Aq8TYdmjbKl+HKc1c8dJ5OfXrgnTIUwQdN1rauXbmH/YW/CKN7z zF59v/sPBTaWfFl2CS/BORhWhe1PBudrVZWFT0oJGNuG6k8dlnssoL/0ojFaN5w5xm8mvMAf uAuixGf4bK6C7hcE34D/UM7ATQRZ+GalAQgApiTibUM0OpeCcxf5YUep4F4y853ClU4TMqZO +ho38sz0GdshQWuBEBqahOtxapHUMtlmC+wJNCBAav5JYjHHrXXE9pgRm5EgVssDpMvplLB4 5CFdx5jBu02Bt9Wp5bD21TPH3rsYJUB3rYmxWfVmdRhNBERrCJu49OIsBSKAlIinx8altYrh Z7bO2C1hKOG6QHWRr4ml4HTD/gZ6TTfsrR+sktBNv/5ZRkcJNDVM+eOGagXkEUOVFe9KXynD 3KcZBbBKpwoaW5GK8OglKJt8ggUfc78CG1xk4b5nL8QCk0CBrC6VPPOYvXTpYSTHmx1QkElm 1iNu1Tc5ccvcyAwTswARAQABwsB8BBgBCgAmFiEExxiLNMqsn7yXmTy7W54Ew5ZrhhoFAln4 ZqUCGwwFCQWjmoAACgkQW54Ew5ZrhhoH3wf+KuIeDyvIJOui+0C5FD5r44Bwkj/SAUVUerfp 0qtRktc+BZoSifPs3Rqjh/PpwRvLTuJnSsiqWLz8NCTThogRzVqEcQHqZR3vOjtYM60sjYJ+ BGQl/bjm1C/YtWEEmKs7mJc+02U8qJA4rbNKSRRRoz6XngnuN6YC0fkeD7c7rxRhOg6OWasZ JinB9+dO1IH7eZ5c97v518qSaLRp0T7I+FpEGOp7tTFHaepZWEnuojr5D6jI1MOEywy0EWJu 3m0TYlh935I8o7gLABqoHEmUeW7JK7r91SZaFnr8zQ6XOAxkPh50uFMTNtNZTnM7k1pRv5Ov fms0VzARITYzTwmpDQ== Message-ID: Date: Tue, 4 Dec 2018 18:36:02 -0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.3.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4A0B571808 X-Spamd-Result: default: False [-3.43 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[FreeBSD.org]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; IP_SCORE(-0.58)[ipnet: 2607:f8b0::/32(-1.53), asn: 15169(-1.28), country: US(-0.09)]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; DKIM_TRACE(0.00)[gmail.com:+]; RCVD_IN_DNSWL_NONE(0.00)[c.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]; NEURAL_HAM_SHORT(-0.65)[-0.647,0]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FORGED_SENDER(0.30)[garga@FreeBSD.org,gargabsd@gmail.com]; RCVD_TLS_LAST(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; TAGGED_FROM(0.00)[]; FROM_NEQ_ENVFROM(0.00)[garga@FreeBSD.org,gargabsd@gmail.com] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Dec 2018 20:36:09 -0000 On 04/12/18 17:59, Ed Maste wrote: > On Tue, 4 Dec 2018 at 07:34, Renato Botelho wrote: >> >> Author: garga (ports committer) >> Date: Tue Dec 4 12:34:22 2018 >> New Revision: 341464 >> URL: https://svnweb.freebsd.org/changeset/base/341464 >> >> Log: >> Restore /var/crash permissions to 0750, as declared in mtree file. After >> r337337 it changed to 0755. >> >> Reviewed by: loos >> Approved by: loos >> MFC after: 3 days >> Sponsored by: Rubicon Communications, LLC (Netgate) >> Differential Revision: https://reviews.freebsd.org/D18355 > > Please insta-MFC this to stable/12 (while folks sort out the 12.0 question). Sure. I'll just do it. -- Renato Botelho From owner-svn-src-head@freebsd.org Tue Dec 4 20:41:01 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1E2781321111; Tue, 4 Dec 2018 20:41:01 +0000 (UTC) (envelope-from garga.bsd@gmail.com) Received: from mail-qt1-x836.google.com (mail-qt1-x836.google.com [IPv6:2607:f8b0:4864:20::836]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B41571C25; Tue, 4 Dec 2018 20:41:00 +0000 (UTC) (envelope-from garga.bsd@gmail.com) Received: by mail-qt1-x836.google.com with SMTP id d19so19728136qtq.9; Tue, 04 Dec 2018 12:41:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:openpgp:autocrypt:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Z/gbOrajuO6JnZeU/11cw2RSEi56b+kE+Fsw4jRtbjY=; b=cg1V2JWIdpkoGgU74fIWqPX3Xy5bXFhQE/oPav6Fu8Q9LO+19vBuottvEHZ8SWV5PW k7okhxxwXX1X/XbE66oGcTIqfXVCtjyz9Se9+WKcSSar/95Rsqd6Imxr64y2vHQ+3Lx3 hMDzKX+BE5hBh5Cp/bFkRWbNTUU+ny0vYlRAQswRRFMuW65XlZWcaohshqeFTtTqpAU1 sYaVMf+tDAer8vEp2xIFxyrBnCL6JMLFUe7HokIGhsG60wCpvXj9XvNuD27JcWAf6bWx yv+kS7HbqO9MbfzBLUkJd1vmrECsnvG0HBh9ulqgdnz0MljcLVP5wdhrfWV++gLKlLTv rPFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:openpgp :autocrypt:message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=Z/gbOrajuO6JnZeU/11cw2RSEi56b+kE+Fsw4jRtbjY=; b=s9kukgMu3hghSwfNr7Alu921ztV6BKMAhaimEN70P+p5E0tQHOzZrBjbG3oKFXmg7N kJxk40r/36dQaHxRAtt5n6EapFO0vvCHYhA5js2HM8CHcqa7zKgSe2zRExYBD3xCVp09 qvAMZg9F6aNyLfvgQjwe7m9hHAV3Rk3Zhd9XkqyP3v9ijYaOEqsTu/vkQCR7/yOYS9p0 KNagECczbovcNSRpOzFCrTLUnjnEgCgVuz/GLAodL46ND1PTyP7aSLa4IIQpaSeO8jHa tMYqFyYZPuqh+oDVDO7ftQsUvPJwpspmaiOEb2swUNjA6RsNU7Thir5ZWoCAh3elnZM7 uKbA== X-Gm-Message-State: AA+aEWar1eS8yMafkp0uZB53XQgTpGgdmBOQgHnB0uWP26mlDV6LgYR0 mq7JM1/JwzVv8KnzIBc64UNKp5gz X-Google-Smtp-Source: AFSGD/UNtxFaC4duOF+swymFyw1prPplGlJD6aEWROGGQKhTfnJWB0t4juD2j1gJnf1GONDJCJ4bcg== X-Received: by 2002:aed:2b85:: with SMTP id e5mr20501364qtd.150.1543956059667; Tue, 04 Dec 2018 12:40:59 -0800 (PST) Received: from mbp.home ([2804:f1c:800:e00:44bb:d3a:ba10:40c5]) by smtp.gmail.com with ESMTPSA id q15sm10551856qkl.81.2018.12.04.12.40.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Dec 2018 12:40:59 -0800 (PST) Sender: Renato Botelho Subject: Re: svn commit: r341464 - head/sbin/savecore To: Ed Maste Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201812041234.wB4CYMTJ096164@repo.freebsd.org> From: Renato Botelho Openpgp: preference=signencrypt Autocrypt: addr=garga@FreeBSD.org; prefer-encrypt=mutual; keydata= xsBNBFn4ZqUBCACxJRWi57JkmsCrSU0gZd/CwB+B90OTUeXmF63lDPETOQ+pBA4+vJgzjW1C pv7rR25wxvESJKphxZJOOk9AXTXsg5QrhdP3+KQG/zNcKd2ukbt3ezkhdMx8q81wn4wY2oTl WXdGIVdDKvC8sCp1fc6pPKJin71/skb9wg6ThtlRFlv9en4f8QSVmRuzRKQ6VjCbl+yIpiye /I5BQ4I99uouPzPhzf9ya3cvp4xbiw5wSo1F3nLsThBT2osYy/nRNz2ciuCYyyX87dGhio0T 8Pxl37eBbGQvCGwPQBApCcfoiZBN/5F65Tt4p72gIqT+AYuqq5G7Bhj+fGTC7q0QotL/ABEB AAHNLFJlbmF0byBCb3RlbGhvIChGcmVlQlNEKSA8Z2FyZ2FARnJlZUJTRC5vcmc+wsCXBBMB CgBBAhsDBQkFo5qABQsJCAcDBRUKCQgLBRYDAgEAAh4BAheAFiEExxiLNMqsn7yXmTy7W54E w5ZrhhoFAln4aeUCGQEACgkQW54Ew5ZrhhpTIwf+OS+Gv/ITOy7+8D+8SKXNmkfczsTO+Uqz 6SraXcq32j1C4QcRQCwGPhVJJgKnFSvPm3kbNPFXaQh1zD+mTQ4r/Loc78Rz+fZljYcgNx7n aQKhd9pdpXaELOe+Y10jvGUrT0SE06Y10BP/NmQaLplt9qG8VgLAAB9ZcsuZ9pzbBbQjd9In OK5VcXQzHT/EBBQ1rHsl1Aq8TYdmjbKl+HKc1c8dJ5OfXrgnTIUwQdN1rauXbmH/YW/CKN7z zF59v/sPBTaWfFl2CS/BORhWhe1PBudrVZWFT0oJGNuG6k8dlnssoL/0ojFaN5w5xm8mvMAf uAuixGf4bK6C7hcE34D/UM7ATQRZ+GalAQgApiTibUM0OpeCcxf5YUep4F4y853ClU4TMqZO +ho38sz0GdshQWuBEBqahOtxapHUMtlmC+wJNCBAav5JYjHHrXXE9pgRm5EgVssDpMvplLB4 5CFdx5jBu02Bt9Wp5bD21TPH3rsYJUB3rYmxWfVmdRhNBERrCJu49OIsBSKAlIinx8altYrh Z7bO2C1hKOG6QHWRr4ml4HTD/gZ6TTfsrR+sktBNv/5ZRkcJNDVM+eOGagXkEUOVFe9KXynD 3KcZBbBKpwoaW5GK8OglKJt8ggUfc78CG1xk4b5nL8QCk0CBrC6VPPOYvXTpYSTHmx1QkElm 1iNu1Tc5ccvcyAwTswARAQABwsB8BBgBCgAmFiEExxiLNMqsn7yXmTy7W54Ew5ZrhhoFAln4 ZqUCGwwFCQWjmoAACgkQW54Ew5ZrhhoH3wf+KuIeDyvIJOui+0C5FD5r44Bwkj/SAUVUerfp 0qtRktc+BZoSifPs3Rqjh/PpwRvLTuJnSsiqWLz8NCTThogRzVqEcQHqZR3vOjtYM60sjYJ+ BGQl/bjm1C/YtWEEmKs7mJc+02U8qJA4rbNKSRRRoz6XngnuN6YC0fkeD7c7rxRhOg6OWasZ JinB9+dO1IH7eZ5c97v518qSaLRp0T7I+FpEGOp7tTFHaepZWEnuojr5D6jI1MOEywy0EWJu 3m0TYlh935I8o7gLABqoHEmUeW7JK7r91SZaFnr8zQ6XOAxkPh50uFMTNtNZTnM7k1pRv5Ov fms0VzARITYzTwmpDQ== Message-ID: <5d9b6e15-24af-460a-e774-f048aa08d48b@FreeBSD.org> Date: Tue, 4 Dec 2018 18:40:54 -0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.3.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4B41571C25 X-Spamd-Result: default: False [-5.21 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com]; FROM_NEQ_ENVFROM(0.00)[garga@FreeBSD.org,gargabsd@gmail.com]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[FreeBSD.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; IP_SCORE(-2.01)[ip: (-7.18), ipnet: 2607:f8b0::/32(-1.53), asn: 15169(-1.28), country: US(-0.09)]; DKIM_TRACE(0.00)[gmail.com:+]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; RCVD_IN_DNSWL_NONE(0.00)[6.3.8.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_SHORT(-0.98)[-0.985,0]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FORGED_SENDER(0.30)[garga@FreeBSD.org,gargabsd@gmail.com]; RCVD_TLS_LAST(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; MID_RHS_MATCH_FROM(0.00)[]; TAGGED_FROM(0.00)[] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Dec 2018 20:41:01 -0000 On 04/12/18 17:59, Ed Maste wrote: > On Tue, 4 Dec 2018 at 07:34, Renato Botelho wrote: >> >> Author: garga (ports committer) >> Date: Tue Dec 4 12:34:22 2018 >> New Revision: 341464 >> URL: https://svnweb.freebsd.org/changeset/base/341464 >> >> Log: >> Restore /var/crash permissions to 0750, as declared in mtree file. After >> r337337 it changed to 0755. >> >> Reviewed by: loos >> Approved by: loos >> MFC after: 3 days >> Sponsored by: Rubicon Communications, LLC (Netgate) >> Differential Revision: https://reviews.freebsd.org/D18355 > > Please insta-MFC this to stable/12 (while folks sort out the 12.0 question). Done in r341493 -- Renato Botelho From owner-svn-src-head@freebsd.org Tue Dec 4 21:48:57 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 397B31322A4C; Tue, 4 Dec 2018 21:48:57 +0000 (UTC) (envelope-from sobomax@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D3BC873C21; Tue, 4 Dec 2018 21:48:56 +0000 (UTC) (envelope-from sobomax@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AC23C2FA0; Tue, 4 Dec 2018 21:48:56 +0000 (UTC) (envelope-from sobomax@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB4LmuaQ083136; Tue, 4 Dec 2018 21:48:56 GMT (envelope-from sobomax@FreeBSD.org) Received: (from sobomax@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB4Lmuao083135; Tue, 4 Dec 2018 21:48:56 GMT (envelope-from sobomax@FreeBSD.org) Message-Id: <201812042148.wB4Lmuao083135@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sobomax set sender to sobomax@FreeBSD.org using -f From: Maxim Sobolev Date: Tue, 4 Dec 2018 21:48:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341494 - head/sys/geom X-SVN-Group: head X-SVN-Commit-Author: sobomax X-SVN-Commit-Paths: head/sys/geom X-SVN-Commit-Revision: 341494 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D3BC873C21 X-Spamd-Result: default: False [-0.03 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.48)[-0.476,0]; NEURAL_SPAM_SHORT(0.52)[0.516,0]; NEURAL_HAM_LONG(-0.07)[-0.072,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Dec 2018 21:48:57 -0000 Author: sobomax Date: Tue Dec 4 21:48:56 2018 New Revision: 341494 URL: https://svnweb.freebsd.org/changeset/base/341494 Log: Another attempt to fix issue with the DIOCGDELETE ioctl(2) not handling slightly out-of-bound requests properly (r340187). Perform range check here rather then rely on g_delete_data() to DTRT. The g_delete_data() would always return success for requests starting just the next byte after providers media boundary. MFC after: 4 weeks Modified: head/sys/geom/geom_dev.c Modified: head/sys/geom/geom_dev.c ============================================================================== --- head/sys/geom/geom_dev.c Tue Dec 4 20:40:28 2018 (r341493) +++ head/sys/geom/geom_dev.c Tue Dec 4 21:48:56 2018 (r341494) @@ -583,6 +583,20 @@ g_dev_ioctl(struct cdev *dev, u_long cmd, caddr_t data error = EINVAL; break; } + if ((cp->provider->mediasize > 0) && + (offset >= cp->provider->mediasize)) { + /* + * Catch out-of-bounds requests here. The problem is + * that due to historical GEOM I/O implementation + * peculatities, g_delete_data() would always return + * success for requests starting just the next byte + * after providers media boundary. Condition check on + * non-zero media size, since that condition would + * (most likely) cause ENXIO instead. + */ + error = EIO; + break; + } while (length > 0) { chunk = length; if (g_dev_del_max_sectors != 0 && chunk > From owner-svn-src-head@freebsd.org Tue Dec 4 21:56:46 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6E88C1322CE1; Tue, 4 Dec 2018 21:56:46 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 140F574109; Tue, 4 Dec 2018 21:56:46 +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 E92563134; Tue, 4 Dec 2018 21:56:45 +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 wB4Lujq5088190; Tue, 4 Dec 2018 21:56:45 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB4Luj3q088189; Tue, 4 Dec 2018 21:56:45 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201812042156.wB4Luj3q088189@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Tue, 4 Dec 2018 21:56:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341495 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 341495 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 140F574109 X-Spamd-Result: default: False [-0.03 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.48)[-0.476,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_SPAM_SHORT(0.52)[0.516,0]; NEURAL_HAM_LONG(-0.07)[-0.072,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Dec 2018 21:56:46 -0000 Author: brooks Date: Tue Dec 4 21:56:45 2018 New Revision: 341495 URL: https://svnweb.freebsd.org/changeset/base/341495 Log: Remove NOARGS from oaccept. This was in the orignal patch, but lost in a rebase. Reported by: andrew Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D15816 Modified: head/sys/kern/syscalls.master Modified: head/sys/kern/syscalls.master ============================================================================== --- head/sys/kern/syscalls.master Tue Dec 4 21:48:56 2018 (r341494) +++ head/sys/kern/syscalls.master Tue Dec 4 21:56:45 2018 (r341495) @@ -632,7 +632,7 @@ int namelen ); } -99 AUE_ACCEPT COMPAT|NOARGS { +99 AUE_ACCEPT COMPAT { int accept( int s, _Out_writes_bytes_opt_(*anamelen) struct sockaddr *name, From owner-svn-src-head@freebsd.org Tue Dec 4 21:57:27 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 81B601322D36; Tue, 4 Dec 2018 21:57:27 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 284D074252; Tue, 4 Dec 2018 21:57:27 +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 095DB3135; Tue, 4 Dec 2018 21:57:27 +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 wB4LvQfk088265; Tue, 4 Dec 2018 21:57:26 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB4LvQgF088264; Tue, 4 Dec 2018 21:57:26 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201812042157.wB4LvQgF088264@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Tue, 4 Dec 2018 21:57:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341496 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 341496 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 284D074252 X-Spamd-Result: default: False [-0.03 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.48)[-0.476,0]; NEURAL_SPAM_SHORT(0.52)[0.516,0]; NEURAL_HAM_LONG(-0.07)[-0.072,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Dec 2018 21:57:27 -0000 Author: brooks Date: Tue Dec 4 21:57:26 2018 New Revision: 341496 URL: https://svnweb.freebsd.org/changeset/base/341496 Log: Regen after r341495: Remove NOARGS from oaccept. Modified: head/sys/sys/sysproto.h Modified: head/sys/sys/sysproto.h ============================================================================== --- head/sys/sys/sysproto.h Tue Dec 4 21:56:45 2018 (r341495) +++ head/sys/sys/sysproto.h Tue Dec 4 21:57:26 2018 (r341496) @@ -2205,6 +2205,11 @@ struct osethostname_args { char hostname_l_[PADL_(char *)]; char * hostname; char hostname_r_[PADR_(char *)]; char len_l_[PADL_(u_int)]; u_int len; char len_r_[PADR_(u_int)]; }; +struct oaccept_args { + char s_l_[PADL_(int)]; int s; char s_r_[PADR_(int)]; + char name_l_[PADL_(struct sockaddr *)]; struct sockaddr * name; char name_r_[PADR_(struct sockaddr *)]; + char anamelen_l_[PADL_(int *)]; int * anamelen; char anamelen_r_[PADR_(int *)]; +}; struct osend_args { char s_l_[PADL_(int)]; int s; char s_r_[PADR_(int)]; char buf_l_[PADL_(const void *)]; const void * buf; char buf_r_[PADR_(const void *)]; From owner-svn-src-head@freebsd.org Tue Dec 4 22:51:14 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D62F7132446E; Tue, 4 Dec 2018 22:51:14 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7595A76E97; Tue, 4 Dec 2018 22:51:14 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 569E73EF3; Tue, 4 Dec 2018 22:51:14 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB4MpEoC018783; Tue, 4 Dec 2018 22:51:14 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB4MpE2m018782; Tue, 4 Dec 2018 22:51:14 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201812042251.wB4MpE2m018782@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Tue, 4 Dec 2018 22:51:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341505 - head/share/man/man5 X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/share/man/man5 X-SVN-Commit-Revision: 341505 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7595A76E97 X-Spamd-Result: default: False [-0.03 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.48)[-0.476,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_SPAM_SHORT(0.52)[0.516,0]; NEURAL_HAM_LONG(-0.07)[-0.072,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Dec 2018 22:51:15 -0000 Author: pfg Date: Tue Dec 4 22:51:13 2018 New Revision: 341505 URL: https://svnweb.freebsd.org/changeset/base/341505 Log: ext2fs.4: basic updates. Starting with FreeBSD 12 we fully support writing ext4 filesystems. Mention some features that we don't support while here. MFC after: 3 days Modified: head/share/man/man5/ext2fs.5 Modified: head/share/man/man5/ext2fs.5 ============================================================================== --- head/share/man/man5/ext2fs.5 Tue Dec 4 22:46:58 2018 (r341504) +++ head/share/man/man5/ext2fs.5 Tue Dec 4 22:51:13 2018 (r341505) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 23, 2016 +.Dd December 4, 2018 .Dt EXT2FS 5 .Os .Sh NAME @@ -52,9 +52,10 @@ kernel to access and .Tn ext4 file systems. -The +Support for Extended Attributes in .Tn ext4 -support is read-only. +is experimental. +Journalling and encryption are currently not supported. .Sh EXAMPLES To mount a .Nm From owner-svn-src-head@freebsd.org Tue Dec 4 23:46:45 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C11171325B63; Tue, 4 Dec 2018 23:46:44 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 754C279320; Tue, 4 Dec 2018 23:46:44 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 562AF47CB; Tue, 4 Dec 2018 23:46:44 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB4Nkinj045746; Tue, 4 Dec 2018 23:46:44 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB4Nkh1h045741; Tue, 4 Dec 2018 23:46:43 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201812042346.wB4Nkh1h045741@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Tue, 4 Dec 2018 23:46:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341507 - head/sys/net/altq X-SVN-Group: head X-SVN-Commit-Author: vangyzen X-SVN-Commit-Paths: head/sys/net/altq X-SVN-Commit-Revision: 341507 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 754C279320 X-Spamd-Result: default: False [-0.01 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.35)[-0.351,0]; NEURAL_SPAM_LONG(0.09)[0.092,0]; NEURAL_SPAM_SHORT(0.25)[0.245,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Dec 2018 23:46:45 -0000 Author: vangyzen Date: Tue Dec 4 23:46:43 2018 New Revision: 341507 URL: https://svnweb.freebsd.org/changeset/base/341507 Log: altq: remove ALTQ3_COMPAT code This code has apparently never compiled on FreeBSD since its introduction in 2004 (r130365). It has certainly not compiled since 2006, when r164033 added #elsif [sic] preprocessor directives. The code was left in the tree to reduce the diff from upstream (KAME). Since that upstream is no longer relevant, remove the long-dead code. This commit is the direct result of: unifdef -m -UALTQ3_COMPAT sys/net/altq/* A later commit will do some manual cleanup. I do not plan to MFC this. If that would help you, go for it. Modified: head/sys/net/altq/altq.h head/sys/net/altq/altq_cbq.c head/sys/net/altq/altq_cbq.h head/sys/net/altq/altq_cdnr.c head/sys/net/altq/altq_hfsc.c head/sys/net/altq/altq_hfsc.h head/sys/net/altq/altq_priq.c head/sys/net/altq/altq_priq.h head/sys/net/altq/altq_red.c head/sys/net/altq/altq_red.h head/sys/net/altq/altq_rio.c head/sys/net/altq/altq_rio.h head/sys/net/altq/altq_rmclass.c head/sys/net/altq/altq_subr.c Modified: head/sys/net/altq/altq.h ============================================================================== --- head/sys/net/altq/altq.h Tue Dec 4 22:52:15 2018 (r341506) +++ head/sys/net/altq/altq.h Tue Dec 4 23:46:43 2018 (r341507) @@ -38,17 +38,7 @@ #define ALTQ3_CLFIER_COMPAT /* for compatibility with altq-3 classifier */ #endif -#ifdef ALTQ3_COMPAT -#include -#include -#include -#include -#ifndef IFNAMSIZ -#define IFNAMSIZ 16 -#endif -#endif /* ALTQ3_COMPAT */ - /* altq discipline type */ #define ALTQT_NONE 0 /* reserved */ #define ALTQT_CBQ 1 /* cbq */ @@ -67,12 +57,6 @@ #define ALTQT_CODEL 14 /* CoDel */ #define ALTQT_MAX 15 /* should be max discipline type + 1 */ -#ifdef ALTQ3_COMPAT -struct altqreq { - char ifname[IFNAMSIZ]; /* if name, e.g. "en0" */ - u_long arg; /* request-specific argument */ -}; -#endif /* simple token backet meter profile */ struct tb_profile { @@ -80,87 +64,8 @@ struct tb_profile { u_int32_t depth; /* depth in bytes */ }; -#ifdef ALTQ3_COMPAT -struct tbrreq { - char ifname[IFNAMSIZ]; /* if name, e.g. "en0" */ - struct tb_profile tb_prof; /* token bucket profile */ -}; -#ifdef ALTQ3_CLFIER_COMPAT /* - * common network flow info structure - */ -struct flowinfo { - u_char fi_len; /* total length */ - u_char fi_family; /* address family */ - u_int8_t fi_data[46]; /* actually longer; address family - specific flow info. */ -}; - -/* - * flow info structure for internet protocol family. - * (currently this is the only protocol family supported) - */ -struct flowinfo_in { - u_char fi_len; /* sizeof(struct flowinfo_in) */ - u_char fi_family; /* AF_INET */ - u_int8_t fi_proto; /* IPPROTO_XXX */ - u_int8_t fi_tos; /* type-of-service */ - struct in_addr fi_dst; /* dest address */ - struct in_addr fi_src; /* src address */ - u_int16_t fi_dport; /* dest port */ - u_int16_t fi_sport; /* src port */ - u_int32_t fi_gpi; /* generalized port id for ipsec */ - u_int8_t _pad[28]; /* make the size equal to - flowinfo_in6 */ -}; - -#ifdef SIN6_LEN -struct flowinfo_in6 { - u_char fi6_len; /* sizeof(struct flowinfo_in6) */ - u_char fi6_family; /* AF_INET6 */ - u_int8_t fi6_proto; /* IPPROTO_XXX */ - u_int8_t fi6_tclass; /* traffic class */ - u_int32_t fi6_flowlabel; /* ipv6 flowlabel */ - u_int16_t fi6_dport; /* dest port */ - u_int16_t fi6_sport; /* src port */ - u_int32_t fi6_gpi; /* generalized port id */ - struct in6_addr fi6_dst; /* dest address */ - struct in6_addr fi6_src; /* src address */ -}; -#endif /* INET6 */ - -/* - * flow filters for AF_INET and AF_INET6 - */ -struct flow_filter { - int ff_ruleno; - struct flowinfo_in ff_flow; - struct { - struct in_addr mask_dst; - struct in_addr mask_src; - u_int8_t mask_tos; - u_int8_t _pad[3]; - } ff_mask; - u_int8_t _pad2[24]; /* make the size equal to flow_filter6 */ -}; - -#ifdef SIN6_LEN -struct flow_filter6 { - int ff_ruleno; - struct flowinfo_in6 ff_flow6; - struct { - struct in6_addr mask6_dst; - struct in6_addr mask6_src; - u_int8_t mask6_tclass; - u_int8_t _pad[3]; - } ff_mask6; -}; -#endif /* INET6 */ -#endif /* ALTQ3_CLFIER_COMPAT */ -#endif /* ALTQ3_COMPAT */ - -/* * generic packet counter */ struct pktcntr { @@ -171,33 +76,6 @@ struct pktcntr { #define PKTCNTR_ADD(cntr, len) \ do { (cntr)->packets++; (cntr)->bytes += len; } while (/*CONSTCOND*/ 0) -#ifdef ALTQ3_COMPAT -/* - * altq related ioctls - */ -#define ALTQGTYPE _IOWR('q', 0, struct altqreq) /* get queue type */ -#if 0 -/* - * these ioctls are currently discipline-specific but could be shared - * in the future. - */ -#define ALTQATTACH _IOW('q', 1, struct altqreq) /* attach discipline */ -#define ALTQDETACH _IOW('q', 2, struct altqreq) /* detach discipline */ -#define ALTQENABLE _IOW('q', 3, struct altqreq) /* enable discipline */ -#define ALTQDISABLE _IOW('q', 4, struct altqreq) /* disable discipline*/ -#define ALTQCLEAR _IOW('q', 5, struct altqreq) /* (re)initialize */ -#define ALTQCONFIG _IOWR('q', 6, struct altqreq) /* set config params */ -#define ALTQADDCLASS _IOWR('q', 7, struct altqreq) /* add a class */ -#define ALTQMODCLASS _IOWR('q', 8, struct altqreq) /* modify a class */ -#define ALTQDELCLASS _IOWR('q', 9, struct altqreq) /* delete a class */ -#define ALTQADDFILTER _IOWR('q', 10, struct altqreq) /* add a filter */ -#define ALTQDELFILTER _IOWR('q', 11, struct altqreq) /* delete a filter */ -#define ALTQGETSTATS _IOWR('q', 12, struct altqreq) /* get statistics */ -#define ALTQGETCNTR _IOWR('q', 13, struct altqreq) /* get a pkt counter */ -#endif /* 0 */ -#define ALTQTBRSET _IOW('q', 14, struct tbrreq) /* set tb regulator */ -#define ALTQTBRGET _IOWR('q', 15, struct tbrreq) /* get tb regulator */ -#endif /* ALTQ3_COMPAT */ #ifdef _KERNEL #include Modified: head/sys/net/altq/altq_cbq.c ============================================================================== --- head/sys/net/altq/altq_cbq.c Tue Dec 4 22:52:15 2018 (r341506) +++ head/sys/net/altq/altq_cbq.c Tue Dec 4 23:46:43 2018 (r341507) @@ -44,10 +44,6 @@ #include #include #include -#ifdef ALTQ3_COMPAT -#include -#include -#endif #include #include @@ -58,16 +54,7 @@ #include #include #include -#ifdef ALTQ3_COMPAT -#include -#endif -#ifdef ALTQ3_COMPAT -/* - * Local Data structures. - */ -static cbq_state_t *cbq_list = NULL; -#endif /* * Forward Declarations. @@ -82,22 +69,7 @@ static struct mbuf *cbq_dequeue(struct ifaltq *, int); static void cbqrestart(struct ifaltq *); static void get_class_stats(class_stats_t *, struct rm_class *); static void cbq_purge(cbq_state_t *); -#ifdef ALTQ3_COMPAT -static int cbq_add_class(struct cbq_add_class *); -static int cbq_delete_class(struct cbq_delete_class *); -static int cbq_modify_class(struct cbq_modify_class *); -static int cbq_class_create(cbq_state_t *, struct cbq_add_class *, - struct rm_class *, struct rm_class *); -static int cbq_clear_hierarchy(struct cbq_interface *); -static int cbq_set_enable(struct cbq_interface *, int); -static int cbq_ifattach(struct cbq_interface *); -static int cbq_ifdetach(struct cbq_interface *); -static int cbq_getstats(struct cbq_getstats *); -static int cbq_add_filter(struct cbq_add_filter *); -static int cbq_delete_filter(struct cbq_delete_filter *); -#endif /* ALTQ3_COMPAT */ - /* * int * cbq_class_destroy(cbq_mod_state_t *, struct rm_class *) - This @@ -123,10 +95,6 @@ cbq_class_destroy(cbq_state_t *cbqp, struct rm_class * cbqp->ifnp.root_ = NULL; if (cl == cbqp->ifnp.default_) cbqp->ifnp.default_ = NULL; -#ifdef ALTQ3_COMPAT - if (cl == cbqp->ifnp.ctl_) - cbqp->ifnp.ctl_ = NULL; -#endif return (0); } @@ -179,10 +147,6 @@ cbq_clear_interface(cbq_state_t *cbqp) cbqp->ifnp.root_ = NULL; if (cl == cbqp->ifnp.default_) cbqp->ifnp.default_ = NULL; -#ifdef ALTQ3_COMPAT - if (cl == cbqp->ifnp.ctl_) - cbqp->ifnp.ctl_ = NULL; -#endif } } } @@ -512,10 +476,6 @@ cbq_enqueue(struct ifaltq *ifq, struct mbuf *m, struct cl = NULL; if ((t = pf_find_mtag(m)) != NULL) cl = clh_to_clp(cbqp, t->qid); -#ifdef ALTQ3_COMPAT - else if ((ifq->altq_flags & ALTQF_CLASSIFY) && pktattr != NULL) - cl = pktattr->pattr_class; -#endif if (cl == NULL) { cl = cbqp->ifnp.default_; if (cl == NULL) { @@ -523,11 +483,6 @@ cbq_enqueue(struct ifaltq *ifq, struct mbuf *m, struct return (ENOBUFS); } } -#ifdef ALTQ3_COMPAT - if (pktattr != NULL) - cl->pktattr_ = pktattr; /* save proto hdr used by ECN */ - else -#endif cl->pktattr_ = NULL; len = m_pktlen(m); if (rmc_queue_packet(cl, m) != 0) { @@ -606,564 +561,5 @@ static void cbq_purge(cbq_state_t *cbqp) if (ALTQ_IS_ENABLED(cbqp->ifnp.ifq_)) cbqp->ifnp.ifq_->ifq_len = 0; } -#ifdef ALTQ3_COMPAT - -static int -cbq_add_class(acp) - struct cbq_add_class *acp; -{ - char *ifacename; - struct rm_class *borrow, *parent; - cbq_state_t *cbqp; - - ifacename = acp->cbq_iface.cbq_ifacename; - if ((cbqp = altq_lookup(ifacename, ALTQT_CBQ)) == NULL) - return (EBADF); - - /* check parameters */ - if (acp->cbq_class.priority >= CBQ_MAXPRI || - acp->cbq_class.maxq > CBQ_MAXQSIZE) - return (EINVAL); - - /* Get pointers to parent and borrow classes. */ - parent = clh_to_clp(cbqp, acp->cbq_class.parent_class_handle); - borrow = clh_to_clp(cbqp, acp->cbq_class.borrow_class_handle); - - /* - * A class must borrow from it's parent or it can not - * borrow at all. Hence, borrow can be null. - */ - if (parent == NULL && (acp->cbq_class.flags & CBQCLF_ROOTCLASS) == 0) { - printf("cbq_add_class: no parent class!\n"); - return (EINVAL); - } - - if ((borrow != parent) && (borrow != NULL)) { - printf("cbq_add_class: borrow class != parent\n"); - return (EINVAL); - } - - return cbq_class_create(cbqp, acp, parent, borrow); -} - -static int -cbq_delete_class(dcp) - struct cbq_delete_class *dcp; -{ - char *ifacename; - struct rm_class *cl; - cbq_state_t *cbqp; - - ifacename = dcp->cbq_iface.cbq_ifacename; - if ((cbqp = altq_lookup(ifacename, ALTQT_CBQ)) == NULL) - return (EBADF); - - if ((cl = clh_to_clp(cbqp, dcp->cbq_class_handle)) == NULL) - return (EINVAL); - - /* if we are a parent class, then return an error. */ - if (is_a_parent_class(cl)) - return (EINVAL); - - /* if a filter has a reference to this class delete the filter */ - acc_discard_filters(&cbqp->cbq_classifier, cl, 0); - - return cbq_class_destroy(cbqp, cl); -} - -static int -cbq_modify_class(acp) - struct cbq_modify_class *acp; -{ - char *ifacename; - struct rm_class *cl; - cbq_state_t *cbqp; - - ifacename = acp->cbq_iface.cbq_ifacename; - if ((cbqp = altq_lookup(ifacename, ALTQT_CBQ)) == NULL) - return (EBADF); - - /* Get pointer to this class */ - if ((cl = clh_to_clp(cbqp, acp->cbq_class_handle)) == NULL) - return (EINVAL); - - if (rmc_modclass(cl, acp->cbq_class.nano_sec_per_byte, - acp->cbq_class.maxq, acp->cbq_class.maxidle, - acp->cbq_class.minidle, acp->cbq_class.offtime, - acp->cbq_class.pktsize) < 0) - return (EINVAL); - return (0); -} - -/* - * struct rm_class * - * cbq_class_create(cbq_mod_state_t *cbqp, struct cbq_add_class *acp, - * struct rm_class *parent, struct rm_class *borrow) - * - * This function create a new traffic class in the CBQ class hierarchy of - * given parameters. The class that created is either the root, default, - * or a new dynamic class. If CBQ is not initilaized, the root class - * will be created. - */ -static int -cbq_class_create(cbqp, acp, parent, borrow) - cbq_state_t *cbqp; - struct cbq_add_class *acp; - struct rm_class *parent, *borrow; -{ - struct rm_class *cl; - cbq_class_spec_t *spec = &acp->cbq_class; - u_int32_t chandle; - int i; - - /* - * allocate class handle - */ - for (i = 1; i < CBQ_MAX_CLASSES; i++) - if (cbqp->cbq_class_tbl[i] == NULL) - break; - if (i == CBQ_MAX_CLASSES) - return (EINVAL); - chandle = i; /* use the slot number as class handle */ - - /* - * create a class. if this is a root class, initialize the - * interface. - */ - if ((spec->flags & CBQCLF_CLASSMASK) == CBQCLF_ROOTCLASS) { - rmc_init(cbqp->ifnp.ifq_, &cbqp->ifnp, spec->nano_sec_per_byte, - cbqrestart, spec->maxq, RM_MAXQUEUED, - spec->maxidle, spec->minidle, spec->offtime, - spec->flags); - cl = cbqp->ifnp.root_; - } else { - cl = rmc_newclass(spec->priority, - &cbqp->ifnp, spec->nano_sec_per_byte, - rmc_delay_action, spec->maxq, parent, borrow, - spec->maxidle, spec->minidle, spec->offtime, - spec->pktsize, spec->flags); - } - if (cl == NULL) - return (ENOMEM); - - /* return handle to user space. */ - acp->cbq_class_handle = chandle; - - cl->stats_.handle = chandle; - cl->stats_.depth = cl->depth_; - - /* save the allocated class */ - cbqp->cbq_class_tbl[i] = cl; - - if ((spec->flags & CBQCLF_CLASSMASK) == CBQCLF_DEFCLASS) - cbqp->ifnp.default_ = cl; - if ((spec->flags & CBQCLF_CLASSMASK) == CBQCLF_CTLCLASS) - cbqp->ifnp.ctl_ = cl; - - return (0); -} - -static int -cbq_add_filter(afp) - struct cbq_add_filter *afp; -{ - char *ifacename; - cbq_state_t *cbqp; - struct rm_class *cl; - - ifacename = afp->cbq_iface.cbq_ifacename; - if ((cbqp = altq_lookup(ifacename, ALTQT_CBQ)) == NULL) - return (EBADF); - - /* Get the pointer to class. */ - if ((cl = clh_to_clp(cbqp, afp->cbq_class_handle)) == NULL) - return (EINVAL); - - return acc_add_filter(&cbqp->cbq_classifier, &afp->cbq_filter, - cl, &afp->cbq_filter_handle); -} - -static int -cbq_delete_filter(dfp) - struct cbq_delete_filter *dfp; -{ - char *ifacename; - cbq_state_t *cbqp; - - ifacename = dfp->cbq_iface.cbq_ifacename; - if ((cbqp = altq_lookup(ifacename, ALTQT_CBQ)) == NULL) - return (EBADF); - - return acc_delete_filter(&cbqp->cbq_classifier, - dfp->cbq_filter_handle); -} - -/* - * cbq_clear_hierarchy deletes all classes and their filters on the - * given interface. - */ -static int -cbq_clear_hierarchy(ifacep) - struct cbq_interface *ifacep; -{ - char *ifacename; - cbq_state_t *cbqp; - - ifacename = ifacep->cbq_ifacename; - if ((cbqp = altq_lookup(ifacename, ALTQT_CBQ)) == NULL) - return (EBADF); - - return cbq_clear_interface(cbqp); -} - -/* - * static int - * cbq_set_enable(struct cbq_enable *ep) - this function processed the - * ioctl request to enable class based queueing. It searches the list - * of interfaces for the specified interface and then enables CBQ on - * that interface. - * - * Returns: 0, for no error. - * EBADF, for specified inteface not found. - */ - -static int -cbq_set_enable(ep, enable) - struct cbq_interface *ep; - int enable; -{ - int error = 0; - cbq_state_t *cbqp; - char *ifacename; - - ifacename = ep->cbq_ifacename; - if ((cbqp = altq_lookup(ifacename, ALTQT_CBQ)) == NULL) - return (EBADF); - - switch (enable) { - case ENABLE: - if (cbqp->ifnp.root_ == NULL || cbqp->ifnp.default_ == NULL || - cbqp->ifnp.ctl_ == NULL) { - if (cbqp->ifnp.root_ == NULL) - printf("No Root Class for %s\n", ifacename); - if (cbqp->ifnp.default_ == NULL) - printf("No Default Class for %s\n", ifacename); - if (cbqp->ifnp.ctl_ == NULL) - printf("No Control Class for %s\n", ifacename); - error = EINVAL; - } else if ((error = altq_enable(cbqp->ifnp.ifq_)) == 0) { - cbqp->cbq_qlen = 0; - } - break; - - case DISABLE: - error = altq_disable(cbqp->ifnp.ifq_); - break; - } - return (error); -} - -static int -cbq_getstats(gsp) - struct cbq_getstats *gsp; -{ - char *ifacename; - int i, n, nclasses; - cbq_state_t *cbqp; - struct rm_class *cl; - class_stats_t stats, *usp; - int error = 0; - - ifacename = gsp->iface.cbq_ifacename; - nclasses = gsp->nclasses; - usp = gsp->stats; - - if ((cbqp = altq_lookup(ifacename, ALTQT_CBQ)) == NULL) - return (EBADF); - if (nclasses <= 0) - return (EINVAL); - - for (n = 0, i = 0; n < nclasses && i < CBQ_MAX_CLASSES; n++, i++) { - while ((cl = cbqp->cbq_class_tbl[i]) == NULL) - if (++i >= CBQ_MAX_CLASSES) - goto out; - - get_class_stats(&stats, cl); - stats.handle = cl->stats_.handle; - - if ((error = copyout((caddr_t)&stats, (caddr_t)usp++, - sizeof(stats))) != 0) - return (error); - } - - out: - gsp->nclasses = n; - return (error); -} - -static int -cbq_ifattach(ifacep) - struct cbq_interface *ifacep; -{ - int error = 0; - char *ifacename; - cbq_state_t *new_cbqp; - struct ifnet *ifp; - - ifacename = ifacep->cbq_ifacename; - if ((ifp = ifunit(ifacename)) == NULL) - return (ENXIO); - if (!ALTQ_IS_READY(&ifp->if_snd)) - return (ENXIO); - - /* allocate and initialize cbq_state_t */ - new_cbqp = malloc(sizeof(cbq_state_t), M_DEVBUF, M_WAITOK); - if (new_cbqp == NULL) - return (ENOMEM); - bzero(new_cbqp, sizeof(cbq_state_t)); - CALLOUT_INIT(&new_cbqp->cbq_callout); - - new_cbqp->cbq_qlen = 0; - new_cbqp->ifnp.ifq_ = &ifp->if_snd; /* keep the ifq */ - - /* - * set CBQ to this ifnet structure. - */ - error = altq_attach(&ifp->if_snd, ALTQT_CBQ, new_cbqp, - cbq_enqueue, cbq_dequeue, cbq_request, - &new_cbqp->cbq_classifier, acc_classify); - if (error) { - free(new_cbqp, M_DEVBUF); - return (error); - } - - /* prepend to the list of cbq_state_t's. */ - new_cbqp->cbq_next = cbq_list; - cbq_list = new_cbqp; - - return (0); -} - -static int -cbq_ifdetach(ifacep) - struct cbq_interface *ifacep; -{ - char *ifacename; - cbq_state_t *cbqp; - - ifacename = ifacep->cbq_ifacename; - if ((cbqp = altq_lookup(ifacename, ALTQT_CBQ)) == NULL) - return (EBADF); - - (void)cbq_set_enable(ifacep, DISABLE); - - cbq_clear_interface(cbqp); - - /* remove CBQ from the ifnet structure. */ - (void)altq_detach(cbqp->ifnp.ifq_); - - /* remove from the list of cbq_state_t's. */ - if (cbq_list == cbqp) - cbq_list = cbqp->cbq_next; - else { - cbq_state_t *cp; - - for (cp = cbq_list; cp != NULL; cp = cp->cbq_next) - if (cp->cbq_next == cbqp) { - cp->cbq_next = cbqp->cbq_next; - break; - } - ASSERT(cp != NULL); - } - - /* deallocate cbq_state_t */ - free(cbqp, M_DEVBUF); - - return (0); -} - -/* - * cbq device interface - */ - -altqdev_decl(cbq); - -int -cbqopen(dev, flag, fmt, p) - dev_t dev; - int flag, fmt; -#if (__FreeBSD_version > 500000) - struct thread *p; -#else - struct proc *p; -#endif -{ - return (0); -} - -int -cbqclose(dev, flag, fmt, p) - dev_t dev; - int flag, fmt; -#if (__FreeBSD_version > 500000) - struct thread *p; -#else - struct proc *p; -#endif -{ - struct ifnet *ifp; - struct cbq_interface iface; - int err, error = 0; - - while (cbq_list) { - ifp = cbq_list->ifnp.ifq_->altq_ifp; - sprintf(iface.cbq_ifacename, "%s", ifp->if_xname); - err = cbq_ifdetach(&iface); - if (err != 0 && error == 0) - error = err; - } - - return (error); -} - -int -cbqioctl(dev, cmd, addr, flag, p) - dev_t dev; - ioctlcmd_t cmd; - caddr_t addr; - int flag; -#if (__FreeBSD_version > 500000) - struct thread *p; -#else - struct proc *p; -#endif -{ - int error = 0; - - /* check cmd for superuser only */ - switch (cmd) { - case CBQ_GETSTATS: - /* currently only command that an ordinary user can call */ - break; - default: -#if (__FreeBSD_version > 700000) - error = priv_check(p, PRIV_ALTQ_MANAGE); -#elsif (__FreeBSD_version > 400000) - error = suser(p); -#else - error = suser(p->p_ucred, &p->p_acflag); -#endif - if (error) - return (error); - break; - } - - switch (cmd) { - - case CBQ_ENABLE: - error = cbq_set_enable((struct cbq_interface *)addr, ENABLE); - break; - - case CBQ_DISABLE: - error = cbq_set_enable((struct cbq_interface *)addr, DISABLE); - break; - - case CBQ_ADD_FILTER: - error = cbq_add_filter((struct cbq_add_filter *)addr); - break; - - case CBQ_DEL_FILTER: - error = cbq_delete_filter((struct cbq_delete_filter *)addr); - break; - - case CBQ_ADD_CLASS: - error = cbq_add_class((struct cbq_add_class *)addr); - break; - - case CBQ_DEL_CLASS: - error = cbq_delete_class((struct cbq_delete_class *)addr); - break; - - case CBQ_MODIFY_CLASS: - error = cbq_modify_class((struct cbq_modify_class *)addr); - break; - - case CBQ_CLEAR_HIERARCHY: - error = cbq_clear_hierarchy((struct cbq_interface *)addr); - break; - - case CBQ_IF_ATTACH: - error = cbq_ifattach((struct cbq_interface *)addr); - break; - - case CBQ_IF_DETACH: - error = cbq_ifdetach((struct cbq_interface *)addr); - break; - - case CBQ_GETSTATS: - error = cbq_getstats((struct cbq_getstats *)addr); - break; - - default: - error = EINVAL; - break; - } - - return error; -} - -#if 0 -/* for debug */ -static void cbq_class_dump(int); - -static void cbq_class_dump(i) - int i; -{ - struct rm_class *cl; - rm_class_stats_t *s; - struct _class_queue_ *q; - - if (cbq_list == NULL) { - printf("cbq_class_dump: no cbq_state found\n"); - return; - } - cl = cbq_list->cbq_class_tbl[i]; - - printf("class %d cl=%p\n", i, cl); - if (cl != NULL) { - s = &cl->stats_; - q = cl->q_; - - printf("pri=%d, depth=%d, maxrate=%d, allotment=%d\n", - cl->pri_, cl->depth_, cl->maxrate_, cl->allotment_); - printf("w_allotment=%d, bytes_alloc=%d, avgidle=%d, maxidle=%d\n", - cl->w_allotment_, cl->bytes_alloc_, cl->avgidle_, - cl->maxidle_); - printf("minidle=%d, offtime=%d, sleeping=%d, leaf=%d\n", - cl->minidle_, cl->offtime_, cl->sleeping_, cl->leaf_); - printf("handle=%d, depth=%d, packets=%d, bytes=%d\n", - s->handle, s->depth, - (int)s->xmit_cnt.packets, (int)s->xmit_cnt.bytes); - printf("over=%d\n, borrows=%d, drops=%d, overactions=%d, delays=%d\n", - s->over, s->borrows, (int)s->drop_cnt.packets, - s->overactions, s->delays); - printf("tail=%p, head=%p, qlen=%d, qlim=%d, qthresh=%d,qtype=%d\n", - q->tail_, q->head_, q->qlen_, q->qlim_, - q->qthresh_, q->qtype_); - } -} -#endif /* 0 */ - -#ifdef KLD_MODULE - -static struct altqsw cbq_sw = - {"cbq", cbqopen, cbqclose, cbqioctl}; - -ALTQ_MODULE(altq_cbq, ALTQT_CBQ, &cbq_sw); -MODULE_DEPEND(altq_cbq, altq_red, 1, 1, 1); -MODULE_DEPEND(altq_cbq, altq_rio, 1, 1, 1); - -#endif /* KLD_MODULE */ -#endif /* ALTQ3_COMPAT */ #endif /* ALTQ_CBQ */ Modified: head/sys/net/altq/altq_cbq.h ============================================================================== --- head/sys/net/altq/altq_cbq.h Tue Dec 4 22:52:15 2018 (r341506) +++ head/sys/net/altq/altq_cbq.h Tue Dec 4 23:46:43 2018 (r341507) @@ -71,9 +71,6 @@ CTASSERT(CBQCLF_CODEL == RMCF_CODEL); /* class flags for special classes */ #define CBQCLF_ROOTCLASS 0x1000 /* root class */ #define CBQCLF_DEFCLASS 0x2000 /* default class */ -#ifdef ALTQ3_COMPAT -#define CBQCLF_CTLCLASS 0x4000 /* control class */ -#endif #define CBQCLF_CLASSMASK 0xf000 /* class mask */ #define CBQ_MAXQSIZE 200 @@ -114,89 +111,7 @@ typedef struct _cbq_class_stats_ { * header. */ -#ifdef ALTQ3_COMPAT -/* - * Define structures associated with IOCTLS for cbq. - */ -/* - * Define the CBQ interface structure. This must be included in all - * IOCTL's such that the CBQ driver may find the appropriate CBQ module - * associated with the network interface to be affected. - */ -struct cbq_interface { - char cbq_ifacename[IFNAMSIZ]; -}; - -typedef struct cbq_class_spec { - u_int priority; - u_int nano_sec_per_byte; - u_int maxq; - u_int maxidle; - int minidle; - u_int offtime; - u_int32_t parent_class_handle; - u_int32_t borrow_class_handle; - - u_int pktsize; - int flags; -} cbq_class_spec_t; - -struct cbq_add_class { - struct cbq_interface cbq_iface; - - cbq_class_spec_t cbq_class; - u_int32_t cbq_class_handle; -}; - -struct cbq_delete_class { - struct cbq_interface cbq_iface; - u_int32_t cbq_class_handle; -}; - -struct cbq_modify_class { - struct cbq_interface cbq_iface; - - cbq_class_spec_t cbq_class; - u_int32_t cbq_class_handle; -}; - -struct cbq_add_filter { - struct cbq_interface cbq_iface; - u_int32_t cbq_class_handle; - struct flow_filter cbq_filter; - - u_long cbq_filter_handle; -}; - -struct cbq_delete_filter { - struct cbq_interface cbq_iface; - u_long cbq_filter_handle; -}; - -/* number of classes are returned in nclasses field */ -struct cbq_getstats { - struct cbq_interface iface; - int nclasses; - class_stats_t *stats; -}; - -/* - * Define IOCTLs for CBQ. - */ -#define CBQ_IF_ATTACH _IOW('Q', 1, struct cbq_interface) -#define CBQ_IF_DETACH _IOW('Q', 2, struct cbq_interface) -#define CBQ_ENABLE _IOW('Q', 3, struct cbq_interface) -#define CBQ_DISABLE _IOW('Q', 4, struct cbq_interface) -#define CBQ_CLEAR_HIERARCHY _IOW('Q', 5, struct cbq_interface) -#define CBQ_ADD_CLASS _IOWR('Q', 7, struct cbq_add_class) -#define CBQ_DEL_CLASS _IOW('Q', 8, struct cbq_delete_class) -#define CBQ_MODIFY_CLASS _IOWR('Q', 9, struct cbq_modify_class) -#define CBQ_ADD_FILTER _IOWR('Q', 10, struct cbq_add_filter) -#define CBQ_DEL_FILTER _IOW('Q', 11, struct cbq_delete_filter) -#define CBQ_GETSTATS _IOWR('Q', 12, struct cbq_getstats) -#endif /* ALTQ3_COMPAT */ - #ifdef _KERNEL /* * Define macros only good for kernel drivers and modules. @@ -207,20 +122,11 @@ struct cbq_getstats { #define CBQ_MAX_CLASSES 256 -#ifdef ALTQ3_COMPAT -#define CBQ_MAX_FILTERS 256 -#define DISABLE 0x00 -#define ENABLE 0x01 -#endif /* ALTQ3_COMPAT */ - /* * Define State structures. */ typedef struct cbqstate { -#ifdef ALTQ3_COMPAT - struct cbqstate *cbq_next; -#endif int cbq_qlen; /* # of packets in cbq */ struct rm_class *cbq_class_tbl[CBQ_MAX_CLASSES]; Modified: head/sys/net/altq/altq_cdnr.c ============================================================================== --- head/sys/net/altq/altq_cdnr.c Tue Dec 4 22:52:15 2018 (r341506) +++ head/sys/net/altq/altq_cdnr.c Tue Dec 4 23:46:43 2018 (r341507) @@ -53,1330 +53,5 @@ #include #include -#ifdef ALTQ3_COMPAT -#include -#endif #include -#ifdef ALTQ3_COMPAT -/* - * diffserv traffic conditioning module - */ - -int altq_cdnr_enabled = 0; - -/* traffic conditioner is enabled by ALTQ_CDNR option in opt_altq.h */ -#ifdef ALTQ_CDNR - -/* cdnr_list keeps all cdnr's allocated. */ -static LIST_HEAD(, top_cdnr) tcb_list; - -static int altq_cdnr_input(struct mbuf *, int); -static struct top_cdnr *tcb_lookup(char *ifname); -static struct cdnr_block *cdnr_handle2cb(u_long); -static u_long cdnr_cb2handle(struct cdnr_block *); -static void *cdnr_cballoc(struct top_cdnr *, int, - struct tc_action *(*)(struct cdnr_block *, struct cdnr_pktinfo *)); -static void cdnr_cbdestroy(void *); -static int tca_verify_action(struct tc_action *); -static void tca_import_action(struct tc_action *, struct tc_action *); -static void tca_invalidate_action(struct tc_action *); - -static int generic_element_destroy(struct cdnr_block *); -static struct top_cdnr *top_create(struct ifaltq *); -static int top_destroy(struct top_cdnr *); -static struct cdnr_block *element_create(struct top_cdnr *, struct tc_action *); -static int element_destroy(struct cdnr_block *); -static void tb_import_profile(struct tbe *, struct tb_profile *); -static struct tbmeter *tbm_create(struct top_cdnr *, struct tb_profile *, - struct tc_action *, struct tc_action *); -static int tbm_destroy(struct tbmeter *); -static struct tc_action *tbm_input(struct cdnr_block *, struct cdnr_pktinfo *); -static struct trtcm *trtcm_create(struct top_cdnr *, - struct tb_profile *, struct tb_profile *, - struct tc_action *, struct tc_action *, struct tc_action *, - int); -static int trtcm_destroy(struct trtcm *); -static struct tc_action *trtcm_input(struct cdnr_block *, struct cdnr_pktinfo *); -static struct tswtcm *tswtcm_create(struct top_cdnr *, - u_int32_t, u_int32_t, u_int32_t, - struct tc_action *, struct tc_action *, struct tc_action *); -static int tswtcm_destroy(struct tswtcm *); -static struct tc_action *tswtcm_input(struct cdnr_block *, struct cdnr_pktinfo *); - -static int cdnrcmd_if_attach(char *); -static int cdnrcmd_if_detach(char *); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Tue Dec 4 23:53:44 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1BD61132605A; Tue, 4 Dec 2018 23:53:44 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B58B379A34; Tue, 4 Dec 2018 23:53:43 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9214F4976; Tue, 4 Dec 2018 23:53:43 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB4NrhP6050736; Tue, 4 Dec 2018 23:53:43 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB4NrgqG050731; Tue, 4 Dec 2018 23:53:42 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201812042353.wB4NrgqG050731@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Tue, 4 Dec 2018 23:53:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341508 - in head/sys: conf net/altq X-SVN-Group: head X-SVN-Commit-Author: vangyzen X-SVN-Commit-Paths: in head/sys: conf net/altq X-SVN-Commit-Revision: 341508 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B58B379A34 X-Spamd-Result: default: False [-0.25 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.45)[-0.447,0]; NEURAL_SPAM_SHORT(0.23)[0.228,0]; NEURAL_HAM_LONG(-0.03)[-0.031,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Dec 2018 23:53:44 -0000 Author: vangyzen Date: Tue Dec 4 23:53:42 2018 New Revision: 341508 URL: https://svnweb.freebsd.org/changeset/base/341508 Log: altq: manual cleanup after r341507 Remove a file that became practically empty. Fix indentation. Like r341507, I do not plan to MFC, but anyone else can. Deleted: head/sys/net/altq/altq_cdnr.c Modified: head/sys/conf/files head/sys/net/altq/altq_cbq.c head/sys/net/altq/altq_hfsc.c head/sys/net/altq/altq_priq.c Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Tue Dec 4 23:46:43 2018 (r341507) +++ head/sys/conf/files Tue Dec 4 23:53:42 2018 (r341508) @@ -4058,7 +4058,6 @@ libkern/timingsafe_bcmp.c standard libkern/zlib.c optional crypto | geom_uzip | ipsec | \ ipsec_support | mxge | netgraph_deflate | ddb_ctf | gzio net/altq/altq_cbq.c optional altq -net/altq/altq_cdnr.c optional altq net/altq/altq_codel.c optional altq net/altq/altq_hfsc.c optional altq net/altq/altq_fairq.c optional altq Modified: head/sys/net/altq/altq_cbq.c ============================================================================== --- head/sys/net/altq/altq_cbq.c Tue Dec 4 23:46:43 2018 (r341507) +++ head/sys/net/altq/altq_cbq.c Tue Dec 4 23:53:42 2018 (r341508) @@ -483,7 +483,7 @@ cbq_enqueue(struct ifaltq *ifq, struct mbuf *m, struct return (ENOBUFS); } } - cl->pktattr_ = NULL; + cl->pktattr_ = NULL; len = m_pktlen(m); if (rmc_queue_packet(cl, m) != 0) { /* drop occurred. some mbuf was freed in rmc_queue_packet. */ Modified: head/sys/net/altq/altq_hfsc.c ============================================================================== --- head/sys/net/altq/altq_hfsc.c Tue Dec 4 23:46:43 2018 (r341507) +++ head/sys/net/altq/altq_hfsc.c Tue Dec 4 23:53:42 2018 (r341508) @@ -689,7 +689,7 @@ hfsc_enqueue(struct ifaltq *ifq, struct mbuf *m, struc return (ENOBUFS); } } - cl->cl_pktattr = NULL; + cl->cl_pktattr = NULL; len = m_pktlen(m); if (hfsc_addq(cl, m) != 0) { /* drop occurred. mbuf was freed in hfsc_addq. */ Modified: head/sys/net/altq/altq_priq.c ============================================================================== --- head/sys/net/altq/altq_priq.c Tue Dec 4 23:46:43 2018 (r341507) +++ head/sys/net/altq/altq_priq.c Tue Dec 4 23:53:42 2018 (r341508) @@ -473,7 +473,7 @@ priq_enqueue(struct ifaltq *ifq, struct mbuf *m, struc return (ENOBUFS); } } - cl->cl_pktattr = NULL; + cl->cl_pktattr = NULL; len = m_pktlen(m); if (priq_addq(cl, m) != 0) { /* drop occurred. mbuf was freed in priq_addq. */ From owner-svn-src-head@freebsd.org Wed Dec 5 00:46:12 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B697F1327821; Wed, 5 Dec 2018 00:46:11 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 56B8C7B658; Wed, 5 Dec 2018 00:46:11 +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 302AF51B8; Wed, 5 Dec 2018 00:46:11 +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 wB50kBHw077344; Wed, 5 Dec 2018 00:46:11 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB50k9L6077336; Wed, 5 Dec 2018 00:46:09 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201812050046.wB50k9L6077336@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 5 Dec 2018 00:46:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341509 - in head/lib/libc: amd64 arm i386 mips powerpc powerpc64 sparc64 X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in head/lib/libc: amd64 arm i386 mips powerpc powerpc64 sparc64 X-SVN-Commit-Revision: 341509 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 56B8C7B658 X-Spamd-Result: default: False [-0.04 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.45)[-0.447,0]; NEURAL_SPAM_SHORT(0.44)[0.442,0]; NEURAL_HAM_LONG(-0.03)[-0.031,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 00:46:12 -0000 Author: brooks Date: Wed Dec 5 00:46:09 2018 New Revision: 341509 URL: https://svnweb.freebsd.org/changeset/base/341509 Log: Remove MD __sys_* private symbols. No references to any of these exist in the tree. The list was also erratic with different architectures exporting different things (arm64 and riscv exported none). Reviewed by: kib Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D18425 Modified: head/lib/libc/amd64/Symbol.map head/lib/libc/arm/Symbol.map head/lib/libc/i386/Symbol.map head/lib/libc/mips/Symbol.map head/lib/libc/powerpc/Symbol.map head/lib/libc/powerpc64/Symbol.map head/lib/libc/sparc64/Symbol.map Modified: head/lib/libc/amd64/Symbol.map ============================================================================== --- head/lib/libc/amd64/Symbol.map Tue Dec 4 23:53:42 2018 (r341508) +++ head/lib/libc/amd64/Symbol.map Wed Dec 5 00:46:09 2018 (r341509) @@ -51,9 +51,7 @@ FBSD_1.0 { */ FBSDprivate_1.0 { /* PSEUDO syscalls */ - __sys_getlogin; _getlogin; - __sys_exit; _set_tp; ___longjmp; @@ -63,6 +61,5 @@ FBSDprivate_1.0 { signalcontext; __siglongjmp; _brk; - __sys_vfork; _vfork; }; Modified: head/lib/libc/arm/Symbol.map ============================================================================== --- head/lib/libc/arm/Symbol.map Tue Dec 4 23:53:42 2018 (r341508) +++ head/lib/libc/arm/Symbol.map Wed Dec 5 00:46:09 2018 (r341509) @@ -43,9 +43,7 @@ FBSD_1.4 { FBSDprivate_1.0 { /* PSEUDO syscalls */ - __sys_getlogin; _getlogin; - __sys_exit; _set_tp; __aeabi_read_tp; @@ -55,7 +53,6 @@ FBSDprivate_1.0 { signalcontext; _signalcontext; __siglongjmp; - __sys_vfork; _vfork; _brk; _sbrk; Modified: head/lib/libc/i386/Symbol.map ============================================================================== --- head/lib/libc/i386/Symbol.map Tue Dec 4 23:53:42 2018 (r341508) +++ head/lib/libc/i386/Symbol.map Wed Dec 5 00:46:09 2018 (r341509) @@ -48,9 +48,7 @@ FBSD_1.0 { FBSDprivate_1.0 { /* PSEUDO syscalls */ - __sys_getlogin; _getlogin; - __sys_exit; _set_tp; ___longjmp; @@ -59,7 +57,6 @@ FBSDprivate_1.0 { __signalcontext; signalcontext; __siglongjmp; - __sys_vfork; _vfork; _brk; }; Modified: head/lib/libc/mips/Symbol.map ============================================================================== --- head/lib/libc/mips/Symbol.map Tue Dec 4 23:53:42 2018 (r341508) +++ head/lib/libc/mips/Symbol.map Wed Dec 5 00:46:09 2018 (r341509) @@ -37,9 +37,7 @@ FBSD_1.3 { FBSDprivate_1.0 { /* PSEUDO syscalls */ - __sys_getlogin; _getlogin; - __sys_exit; _set_tp; ___longjmp; @@ -48,7 +46,6 @@ FBSDprivate_1.0 { signalcontext; _signalcontext; __siglongjmp; - __sys_vfork; _vfork; _brk; _sbrk; Modified: head/lib/libc/powerpc/Symbol.map ============================================================================== --- head/lib/libc/powerpc/Symbol.map Tue Dec 4 23:53:42 2018 (r341508) +++ head/lib/libc/powerpc/Symbol.map Wed Dec 5 00:46:09 2018 (r341509) @@ -43,9 +43,7 @@ FBSD_1.3 { FBSDprivate_1.0 { /* PSEUDO syscalls */ - __sys_getlogin; _getlogin; - __sys_exit; _set_tp; _fpgetsticky; Modified: head/lib/libc/powerpc64/Symbol.map ============================================================================== --- head/lib/libc/powerpc64/Symbol.map Tue Dec 4 23:53:42 2018 (r341508) +++ head/lib/libc/powerpc64/Symbol.map Wed Dec 5 00:46:09 2018 (r341509) @@ -39,9 +39,7 @@ FBSD_1.0 { FBSDprivate_1.0 { /* PSEUDO syscalls */ - __sys_getlogin; _getlogin; - __sys_exit; _set_tp; _fpgetsticky; Modified: head/lib/libc/sparc64/Symbol.map ============================================================================== --- head/lib/libc/sparc64/Symbol.map Tue Dec 4 23:53:42 2018 (r341508) +++ head/lib/libc/sparc64/Symbol.map Wed Dec 5 00:46:09 2018 (r341509) @@ -68,9 +68,7 @@ FBSD_1.0 { FBSDprivate_1.0 { /* PSEUDO syscalls */ - __sys_getlogin; _getlogin; - __sys_exit; _set_tp; ___longjmp; @@ -79,11 +77,8 @@ FBSDprivate_1.0 { signalcontext; __signalcontext; __siglongjmp; - __sys_brk; _brk; - __sys_sbrk; _sbrk; - __sys_vfork; _vfork; /* used in src/lib/csu/sparc64/crt1.c */ From owner-svn-src-head@freebsd.org Wed Dec 5 05:06:19 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 40D5B132DDFE; Wed, 5 Dec 2018 05:06:19 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 671B983FE8; Wed, 5 Dec 2018 05:06:18 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: by mail-pg1-x52d.google.com with SMTP id 80so8442682pge.4; Tue, 04 Dec 2018 21:06:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:reply-to:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=CtbvgiGgGB0pA4uQykXz8VWsWs7MfeVSZgXL8Wnr4U8=; b=illsPhlxRR/HdLAzdDhx+Y7Y73W7sxenM+bGFwjkJLxMZwCuJcwLHmsBtL9iYTZONz aAPB4B7rFD5UVFeQ474myIO1mWVwj9qgLO8mCMmBySPzqQ3EcI5Kue9HZ+bkWa9Eg88q KfmT34ZlItqz36yfI/gV49DE7YWQPDRAyaZRw7v2S/1m0kiRSXs2dOiMbbAn8Dksf0P0 PgLThA/12WEs9tTQ3M6dei93SavPjJRirtTeBVvKoYyfa7J/T0jkhX7DUSGkiQATbWQQ hwlVUC3eL3y1L8O5Ki8Ly31Fuu5wxdmeEx5F+DYJPBs6obS2vrQ0q4tgWb2A6ogQej2O Oh7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:reply-to:subject:to:references:from :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=CtbvgiGgGB0pA4uQykXz8VWsWs7MfeVSZgXL8Wnr4U8=; b=O7XuagYu0wd4BVq2eSZjrfS/Sc4OxdcBEWvrvSpNHuXTsRFkDv+OTTweegg5cjZypE Yu0lPKnFPWVSKb5411jFHgzpdxCclL6kpG1io+SmbgyO7UA4Q1Zwzr6d4C2/StoGbBrt WQknYXtTR2vK/XH/QEO8A3lPGaBSYfTem4BODqrab4sNkRaHEJGY9KbtZe0S1hlJFbNb dqCFt6LoihcgpEpRhWBb9PRUX8pXW2iS3ynERzKtCDPNFV0qzJ5H6o973Ofp83cJY7s3 xi1OoG5LJX+GQ34X75a8x/bCJ620g3GI9119zp9dOggPfrV2xPO1aBjEVrbBhXp10KNG ILUw== X-Gm-Message-State: AA+aEWYVZL/f9GVwi+7VxoHQsxkPawfTQGfUhBPOqpr+IiZ15okaijc/ nhFd3LvarbgjIBT79gbPRE0syJnX X-Google-Smtp-Source: AFSGD/VhIudv8j9Hdpq1rRO52Bdz9d7cBDqI7EiXIoa3Sj1pW+L9sYYgdvMSKdfryLVmjR4ZVY0aCA== X-Received: by 2002:a63:ce50:: with SMTP id r16mr19206374pgi.217.1543986376813; Tue, 04 Dec 2018 21:06:16 -0800 (PST) Received: from ?IPv6:2403:5800:7100:5d01:64f6:ea52:aa7:a2b3? (2403-5800-7100-5d01-64f6-ea52-aa7-a2b3.ip6.aussiebb.net. [2403:5800:7100:5d01:64f6:ea52:aa7:a2b3]) by smtp.gmail.com with ESMTPSA id n70sm26440480pfi.185.2018.12.04.21.06.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Dec 2018 21:06:16 -0800 (PST) Sender: Kubilay Kocak Reply-To: koobs@FreeBSD.org Subject: Re: svn commit: r341505 - head/share/man/man5 To: "Pedro F. Giffuni" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201812042251.wB4MpE2m018782@repo.freebsd.org> From: Kubilay Kocak Message-ID: <343a2f70-fb4c-bc5c-d32c-789e7797a628@FreeBSD.org> Date: Wed, 5 Dec 2018 16:06:12 +1100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:64.0) Gecko/20100101 Thunderbird/64.0 MIME-Version: 1.0 In-Reply-To: <201812042251.wB4MpE2m018782@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 671B983FE8 X-Spamd-Result: default: False [-3.57 / 15.00]; HAS_REPLYTO(0.00)[koobs@FreeBSD.org]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; REPLYTO_ADDR_EQ_FROM(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; NEURAL_HAM_SHORT(-0.79)[-0.792,0]; FORGED_SENDER(0.30)[koobs@FreeBSD.org,koobsfreebsd@gmail.com]; IP_SCORE(-0.58)[ipnet: 2607:f8b0::/32(-1.54), asn: 15169(-1.29), country: US(-0.09)]; RCVD_TLS_LAST(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; MID_RHS_MATCH_FROM(0.00)[]; TAGGED_FROM(0.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; R_DKIM_ALLOW(-0.20)[gmail.com]; FROM_NEQ_ENVFROM(0.00)[koobs@FreeBSD.org,koobsfreebsd@gmail.com]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-0.99)[-0.992,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[FreeBSD.org]; RCVD_IN_DNSWL_NONE(0.00)[d.2.5.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] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 05:06:19 -0000 On 5/12/2018 9:51 am, Pedro F. Giffuni wrote: > Starting with FreeBSD 12 we fully support writing ext4 filesystems Can we remove '2' from the module/man/etc name if (since) it supports multiple extXfs versions? Is there anything serious preventing it? Seems minor but I think worth it for discovery/pola/obviousness, and a good time (early in the 13.0 cycle). We get a lot of user questions about ext*fs support on FreeBSD and pointing to an ext2fs man page also feels a bit weird. Happy to get/organise a !committer contributor to take care of this if no-one wants to pick it up. ./koobs From owner-svn-src-head@freebsd.org Wed Dec 5 06:31:52 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A00DD132FE80; Wed, 5 Dec 2018 06:31:52 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46F78866DC; Wed, 5 Dec 2018 06:31:52 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 27A4610BD5; Wed, 5 Dec 2018 06:31:52 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB56VqPe055817; Wed, 5 Dec 2018 06:31:52 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB56VoiL055810; Wed, 5 Dec 2018 06:31:50 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201812050631.wB56VoiL055810@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Wed, 5 Dec 2018 06:31:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341510 - head/sbin/fsck_ffs X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: head/sbin/fsck_ffs X-SVN-Commit-Revision: 341510 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 46F78866DC X-Spamd-Result: default: False [-0.80 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.45)[-0.447,0]; NEURAL_HAM_SHORT(-0.32)[-0.324,0]; NEURAL_HAM_LONG(-0.03)[-0.031,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 06:31:52 -0000 Author: mckusick Date: Wed Dec 5 06:31:50 2018 New Revision: 341510 URL: https://svnweb.freebsd.org/changeset/base/341510 Log: Ensure that cylinder-group check-hashes are properly updated when first creating them and when correcting them when they are found to be corrupted. Reported by: Don Lewis (truckman@) Sponsored by: Netflix Modified: head/sbin/fsck_ffs/fsck.h head/sbin/fsck_ffs/fsutil.c head/sbin/fsck_ffs/inode.c head/sbin/fsck_ffs/pass1.c head/sbin/fsck_ffs/pass5.c head/sbin/fsck_ffs/setup.c Modified: head/sbin/fsck_ffs/fsck.h ============================================================================== --- head/sbin/fsck_ffs/fsck.h Wed Dec 5 00:46:09 2018 (r341509) +++ head/sbin/fsck_ffs/fsck.h Wed Dec 5 06:31:50 2018 (r341510) @@ -417,6 +417,7 @@ void blzero(int fd, ufs2_daddr_t blk, long size); void cacheino(union dinode *dp, ino_t inumber); void catch(int); void catchquit(int); +void cgdirty(struct bufarea *); int changeino(ino_t dir, const char *name, ino_t newnum); int check_cgmagic(int cg, struct bufarea *cgbp); int chkrange(ufs2_daddr_t blk, int cnt); Modified: head/sbin/fsck_ffs/fsutil.c ============================================================================== --- head/sbin/fsck_ffs/fsutil.c Wed Dec 5 00:46:09 2018 (r341509) +++ head/sbin/fsck_ffs/fsutil.c Wed Dec 5 06:31:50 2018 (r341510) @@ -249,6 +249,24 @@ cglookup(int cg) } /* + * Mark a cylinder group buffer as dirty. + * Update its check-hash if they are enabled. + */ +void +cgdirty(struct bufarea *cgbp) +{ + struct cg *cg; + + cg = cgbp->b_un.b_cg; + if ((sblock.fs_metackhash & CK_CYLGRP) != 0) { + cg->cg_ckhash = 0; + cg->cg_ckhash = + calculate_crc32c(~0L, (void *)cg, sblock.fs_cgsize); + } + dirty(cgbp); +} + +/* * Attempt to flush a cylinder group cache entry. * Return whether the flush was successful. */ @@ -348,11 +366,11 @@ flush(int fd, struct bufarea *bp) if (bp != &sblk) pfatal("BUFFER %p DOES NOT MATCH SBLK %p\n", bp, &sblk); - if (sbput(fd, (struct fs *)bp->b_un.b_buf, 0) == 0) + if (sbput(fd, bp->b_un.b_fs, 0) == 0) fsmodified = 1; break; case BT_CYLGRP: - if (cgput(&disk, (struct cg *)bp->b_un.b_buf) == 0) + if (cgput(&disk, bp->b_un.b_cg) == 0) fsmodified = 1; break; default: @@ -740,7 +758,7 @@ check_cgmagic(int cg, struct bufarea *cgbp) cgp->cg_nextfreeoff = cgp->cg_clusteroff + howmany(fragstoblks(&sblock, sblock.fs_fpg), CHAR_BIT); } - dirty(cgbp); + cgdirty(cgbp); return (0); } @@ -782,7 +800,7 @@ allocblk(long frags) cgp->cg_cs.cs_nbfree--; else cgp->cg_cs.cs_nffree -= frags; - dirty(cgbp); + cgdirty(cgbp); return (i + j); } } Modified: head/sbin/fsck_ffs/inode.c ============================================================================== --- head/sbin/fsck_ffs/inode.c Wed Dec 5 00:46:09 2018 (r341509) +++ head/sbin/fsck_ffs/inode.c Wed Dec 5 06:31:50 2018 (r341510) @@ -692,7 +692,7 @@ allocino(ino_t request, int type) default: return (0); } - dirty(cgbp); + cgdirty(cgbp); dp = ginode(ino); DIP_SET(dp, di_db[0], allocblk((long)1)); if (DIP(dp, di_db[0]) == 0) { Modified: head/sbin/fsck_ffs/pass1.c ============================================================================== --- head/sbin/fsck_ffs/pass1.c Wed Dec 5 00:46:09 2018 (r341509) +++ head/sbin/fsck_ffs/pass1.c Wed Dec 5 06:31:50 2018 (r341510) @@ -200,7 +200,7 @@ pass1(void) cgp->cg_initediblk = mininos; pwarn("CYLINDER GROUP %d: RESET FROM %ju TO %d %s\n", c, i, cgp->cg_initediblk, "VALID INODES"); - dirty(cgbp); + cgdirty(cgbp); } if (inosused < sblock.fs_ipg) continue; Modified: head/sbin/fsck_ffs/pass5.c ============================================================================== --- head/sbin/fsck_ffs/pass5.c Wed Dec 5 00:46:09 2018 (r341509) +++ head/sbin/fsck_ffs/pass5.c Wed Dec 5 06:31:50 2018 (r341510) @@ -182,14 +182,19 @@ pass5(void) ckhash = cg->cg_ckhash; cg->cg_ckhash = 0; thishash = calculate_crc32c(~0L, cg, fs->fs_cgsize); - if (ckhash != thishash) + if (ckhash == thishash) { + cg->cg_ckhash = ckhash; + } else { pwarn("CG %d: BAD CHECK-HASH %#x vs %#x\n", c, ckhash, thishash); - cg->cg_ckhash = ckhash; + cg->cg_ckhash = thishash; + cgdirty(cgbp); + } } newcg->cg_time = cg->cg_time; newcg->cg_old_time = cg->cg_old_time; newcg->cg_unrefs = cg->cg_unrefs; + newcg->cg_ckhash = cg->cg_ckhash; newcg->cg_cgx = c; dbase = cgbase(fs, c); dmax = dbase + fs->fs_fpg; @@ -326,11 +331,6 @@ pass5(void) sump[run]++; } } - if ((fs->fs_metackhash & CK_CYLGRP) != 0) { - newcg->cg_ckhash = 0; - newcg->cg_ckhash = - calculate_crc32c(~0L, (void *)newcg, fs->fs_cgsize); - } if (bkgrdflag != 0) { cstotal.cs_nffree += cg->cg_cs.cs_nffree; @@ -352,14 +352,14 @@ pass5(void) } if (rewritecg) { memmove(cg, newcg, (size_t)fs->fs_cgsize); - dirty(cgbp); + cgdirty(cgbp); continue; } if (cursnapshot == 0 && memcmp(newcg, cg, basesize) != 0 && dofix(&idesc[2], "SUMMARY INFORMATION BAD")) { memmove(cg, newcg, (size_t)basesize); - dirty(cgbp); + cgdirty(cgbp); } if (bkgrdflag != 0 || usedsoftdep || debug) update_maps(cg, newcg, bkgrdflag); @@ -368,7 +368,7 @@ pass5(void) dofix(&idesc[1], "BLK(S) MISSING IN BIT MAPS")) { memmove(cg_inosused(cg), cg_inosused(newcg), (size_t)mapsize); - dirty(cgbp); + cgdirty(cgbp); } } if (cursnapshot == 0 && Modified: head/sbin/fsck_ffs/setup.c ============================================================================== --- head/sbin/fsck_ffs/setup.c Wed Dec 5 00:46:09 2018 (r341509) +++ head/sbin/fsck_ffs/setup.c Wed Dec 5 06:31:50 2018 (r341510) @@ -208,6 +208,13 @@ setup(char *dev) pwarn("USING ALTERNATE SUPERBLOCK AT %jd\n", bflag); bflag = 0; } + /* Save copy of things needed by libufs */ + memcpy(&disk.d_fs, &sblock, sblock.fs_sbsize); + disk.d_ufs = (sblock.fs_magic == FS_UFS1_MAGIC) ? 1 : 2; + disk.d_bsize = sblock.fs_fsize / fsbtodb(&sblock, 1); + disk.d_sblock = sblock.fs_sblockloc / disk.d_bsize; + disk.d_sbcsum = sblock.fs_csp; + if (skipclean && ckclean && sblock.fs_clean) { pwarn("FILE SYSTEM CLEAN; SKIPPING CHECKS\n"); return (-1); From owner-svn-src-head@freebsd.org Wed Dec 5 10:22:16 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0D381130DACA; Wed, 5 Dec 2018 10:22:16 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A7B6F8E6B1; Wed, 5 Dec 2018 10:22:15 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 88A3F13176; Wed, 5 Dec 2018 10:22:15 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5AMF45076660; Wed, 5 Dec 2018 10:22:15 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5AMF0x076658; Wed, 5 Dec 2018 10:22:15 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201812051022.wB5AMF0x076658@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Wed, 5 Dec 2018 10:22:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341511 - head/libexec/rtld-elf/aarch64 X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: head/libexec/rtld-elf/aarch64 X-SVN-Commit-Revision: 341511 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A7B6F8E6B1 X-Spamd-Result: default: False [-0.13 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_SPAM_SHORT(0.49)[0.489,0]; NEURAL_HAM_LONG(-0.07)[-0.072,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 10:22:16 -0000 Author: mmel Date: Wed Dec 5 10:22:14 2018 New Revision: 341511 URL: https://svnweb.freebsd.org/changeset/base/341511 Log: Fix style(9). Not a functional change. MFC after: 1 week Modified: head/libexec/rtld-elf/aarch64/reloc.c head/libexec/rtld-elf/aarch64/rtld_start.S Modified: head/libexec/rtld-elf/aarch64/reloc.c ============================================================================== --- head/libexec/rtld-elf/aarch64/reloc.c Wed Dec 5 06:31:50 2018 (r341510) +++ head/libexec/rtld-elf/aarch64/reloc.c Wed Dec 5 10:22:14 2018 (r341511) @@ -109,9 +109,8 @@ do_copy_relocations(Obj_Entry *dstobj) } } if (srcobj == NULL) { - _rtld_error( -"Undefined symbol \"%s\" referenced from COPY relocation in %s", - name, dstobj->path); + _rtld_error("Undefined symbol \"%s\" referenced from " + "COPY relocation in %s", name, dstobj->path); return (-1); } @@ -207,7 +206,8 @@ reloc_plt(Obj_Entry *obj) const Elf_Rela *relalim; const Elf_Rela *rela; - relalim = (const Elf_Rela *)((const char *)obj->pltrela + obj->pltrelasize); + relalim = (const Elf_Rela *)((const char *)obj->pltrela + + obj->pltrelasize); for (rela = obj->pltrela; rela < relalim; rela++) { Elf_Addr *where; @@ -245,7 +245,8 @@ reloc_jmpslots(Obj_Entry *obj, int flags, RtldLockStat const Elf_Sym *def; struct tls_data *tlsdesc; - relalim = (const Elf_Rela *)((const char *)obj->pltrela + obj->pltrelasize); + relalim = (const Elf_Rela *)((const char *)obj->pltrela + + obj->pltrelasize); for (rela = obj->pltrela; rela < relalim; rela++) { Elf_Addr *where, target; Modified: head/libexec/rtld-elf/aarch64/rtld_start.S ============================================================================== --- head/libexec/rtld-elf/aarch64/rtld_start.S Wed Dec 5 06:31:50 2018 (r341510) +++ head/libexec/rtld-elf/aarch64/rtld_start.S Wed Dec 5 10:22:14 2018 (r341511) @@ -57,7 +57,7 @@ END(.rtld_start) ENTRY(_rtld_bind_start) .cfi_startproc mov x17, sp - + /* Save frame pointer and SP */ stp x29, x30, [sp, #-16]! mov x29, sp From owner-svn-src-head@freebsd.org Wed Dec 5 10:23:39 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8553A130DB5C; Wed, 5 Dec 2018 10:23:39 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2E95A8E866; Wed, 5 Dec 2018 10:23:39 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0E5301318F; Wed, 5 Dec 2018 10:23:39 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5ANc6n076757; Wed, 5 Dec 2018 10:23:38 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5ANc3O076756; Wed, 5 Dec 2018 10:23:38 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201812051023.wB5ANc3O076756@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Wed, 5 Dec 2018 10:23:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341512 - head/libexec/rtld-elf/aarch64 X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: head/libexec/rtld-elf/aarch64 X-SVN-Commit-Revision: 341512 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2E95A8E866 X-Spamd-Result: default: False [-0.13 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; NEURAL_SPAM_SHORT(0.49)[0.489,0]; NEURAL_HAM_LONG(-0.07)[-0.072,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 10:23:39 -0000 Author: mmel Date: Wed Dec 5 10:23:38 2018 New Revision: 341512 URL: https://svnweb.freebsd.org/changeset/base/341512 Log: Implement arm64 version of __tls_get_addr(). MFC after: 1 week Modified: head/libexec/rtld-elf/aarch64/reloc.c Modified: head/libexec/rtld-elf/aarch64/reloc.c ============================================================================== --- head/libexec/rtld-elf/aarch64/reloc.c Wed Dec 5 10:22:14 2018 (r341511) +++ head/libexec/rtld-elf/aarch64/reloc.c Wed Dec 5 10:23:38 2018 (r341512) @@ -517,3 +517,15 @@ allocate_initial_tls(Obj_Entry *objs) asm volatile("msr tpidr_el0, %0" : : "r"(tp)); } + +void * +__tls_get_addr(tls_index* ti) +{ + char *p; + void *_tp; + + __asm __volatile("mrs %0, tpidr_el0" : "=r" (_tp)); + p = tls_get_addr_common((Elf_Addr **)(_tp), ti->ti_module, ti->ti_offset); + + return (p); +} From owner-svn-src-head@freebsd.org Wed Dec 5 10:30:54 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 41419130DC7D; Wed, 5 Dec 2018 10:30:54 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DAD008EAA3; Wed, 5 Dec 2018 10:30:53 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B80C3131AD; Wed, 5 Dec 2018 10:30:53 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5AUr30077926; Wed, 5 Dec 2018 10:30:53 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5AUrr7077925; Wed, 5 Dec 2018 10:30:53 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201812051030.wB5AUrr7077925@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Wed, 5 Dec 2018 10:30:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341513 - head/libexec/rtld-elf/aarch64 X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: head/libexec/rtld-elf/aarch64 X-SVN-Commit-Revision: 341513 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: DAD008EAA3 X-Spamd-Result: default: False [-0.13 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_SPAM_SHORT(0.49)[0.489,0]; NEURAL_HAM_LONG(-0.07)[-0.072,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 10:30:54 -0000 Author: mmel Date: Wed Dec 5 10:30:53 2018 New Revision: 341513 URL: https://svnweb.freebsd.org/changeset/base/341513 Log: Tidy up arm64 reloc_jmpslots() implementation. - don't relocate jump slots multiple times (if LD_BIND_NOW is defined). - process only R_AARCH64_JUMP_SLOT here, other relocation types are handled by reloc_plt(). MFC after: 1 week Modified: head/libexec/rtld-elf/aarch64/reloc.c Modified: head/libexec/rtld-elf/aarch64/reloc.c ============================================================================== --- head/libexec/rtld-elf/aarch64/reloc.c Wed Dec 5 10:23:38 2018 (r341512) +++ head/libexec/rtld-elf/aarch64/reloc.c Wed Dec 5 10:30:53 2018 (r341513) @@ -243,8 +243,10 @@ reloc_jmpslots(Obj_Entry *obj, int flags, RtldLockStat const Elf_Rela *relalim; const Elf_Rela *rela; const Elf_Sym *def; - struct tls_data *tlsdesc; + if (obj->jmpslots_done) + return (0); + relalim = (const Elf_Rela *)((const char *)obj->pltrela + obj->pltrelasize); for (rela = obj->pltrela; rela < relalim; rela++) { @@ -265,20 +267,9 @@ reloc_jmpslots(Obj_Entry *obj, int flags, RtldLockStat reloc_jmpslot(where, target, defobj, obj, (const Elf_Rel *)rela); break; - case R_AARCH64_TLSDESC: - if (ELF_R_SYM(rela->r_info) != 0) { - tlsdesc = (struct tls_data *)where[1]; - if (tlsdesc->index == -1) - rtld_tlsdesc_handle_locked(tlsdesc, - SYMLOOK_IN_PLT | flags, lockstate); - } - break; - default: - _rtld_error("Unknown relocation type %x in jmpslot", - (unsigned int)ELF_R_TYPE(rela->r_info)); - return (-1); } } + obj->jmpslots_done = true; return (0); } From owner-svn-src-head@freebsd.org Wed Dec 5 10:57:58 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 41A97130E484; Wed, 5 Dec 2018 10:57:58 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DD1798F68B; Wed, 5 Dec 2018 10:57:57 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B93F5136B6; Wed, 5 Dec 2018 10:57:57 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5AvvcK092359; Wed, 5 Dec 2018 10:57:57 GMT (envelope-from arichardson@FreeBSD.org) Received: (from arichardson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5AvvWK092357; Wed, 5 Dec 2018 10:57:57 GMT (envelope-from arichardson@FreeBSD.org) Message-Id: <201812051057.wB5AvvWK092357@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arichardson set sender to arichardson@FreeBSD.org using -f From: Alex Richardson Date: Wed, 5 Dec 2018 10:57:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341514 - in head: . sys/conf X-SVN-Group: head X-SVN-Commit-Author: arichardson X-SVN-Commit-Paths: in head: . sys/conf X-SVN-Commit-Revision: 341514 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: DD1798F68B X-Spamd-Result: default: False [-0.13 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; NEURAL_SPAM_SHORT(0.49)[0.489,0]; NEURAL_HAM_LONG(-0.07)[-0.072,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 10:57:58 -0000 Author: arichardson Date: Wed Dec 5 10:57:57 2018 New Revision: 341514 URL: https://svnweb.freebsd.org/changeset/base/341514 Log: Fix newvers.sh with BUILD_WITH_STRICT_TMPPATH=1 newvers.sh runs mkfifo which did not exist before this change. However, I didn't notice before because it is run from a function where a missing command does cause a noticeable failure. Reviewed By: emaste, markj Differential Revision: https://reviews.freebsd.org/D18377 Modified: head/Makefile.inc1 head/sys/conf/newvers.sh Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Wed Dec 5 10:30:53 2018 (r341513) +++ head/Makefile.inc1 Wed Dec 5 10:57:57 2018 (r341514) @@ -2215,6 +2215,8 @@ _basic_bootstrap_tools+=usr.bin/ldd _basic_bootstrap_tools+=usr.sbin/services_mkdb usr.sbin/pwd_mkdb # sysctl/chflags are required for installkernel: _basic_bootstrap_tools+=sbin/sysctl bin/chflags +# mkfifo is used by sys/conf/newvers.sh +_basic_bootstrap_tools+=usr.bin/mkfifo .if ${MK_AMD} != "no" # unifdef is only used by usr.sbin/amd/libamu/Makefile Modified: head/sys/conf/newvers.sh ============================================================================== --- head/sys/conf/newvers.sh Wed Dec 5 10:30:53 2018 (r341513) +++ head/sys/conf/newvers.sh Wed Dec 5 10:57:57 2018 (r341514) @@ -86,7 +86,7 @@ git_tree_modified() local fifo fifo=$(mktemp -u) - mkfifo -m 600 $fifo + mkfifo -m 600 $fifo || exit 1 $git_cmd --work-tree=${VCSTOP} diff-index HEAD > $fifo & while read smode dmode ssha dsha status file; do if ! expr $dsha : '^00*$' >/dev/null; then From owner-svn-src-head@freebsd.org Wed Dec 5 10:58:04 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 076C3130E4A6; Wed, 5 Dec 2018 10:58:04 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9F6D18F6BE; Wed, 5 Dec 2018 10:58:03 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C0C23136B7; Wed, 5 Dec 2018 10:58:02 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5Aw2xU092417; Wed, 5 Dec 2018 10:58:02 GMT (envelope-from arichardson@FreeBSD.org) Received: (from arichardson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5Aw2XW092416; Wed, 5 Dec 2018 10:58:02 GMT (envelope-from arichardson@FreeBSD.org) Message-Id: <201812051058.wB5Aw2XW092416@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arichardson set sender to arichardson@FreeBSD.org using -f From: Alex Richardson Date: Wed, 5 Dec 2018 10:58:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341515 - head/lib/libopenbsd X-SVN-Group: head X-SVN-Commit-Author: arichardson X-SVN-Commit-Paths: head/lib/libopenbsd X-SVN-Commit-Revision: 341515 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9F6D18F6BE X-Spamd-Result: default: False [-0.13 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_SPAM_SHORT(0.49)[0.489,0]; NEURAL_HAM_LONG(-0.07)[-0.072,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 10:58:04 -0000 Author: arichardson Date: Wed Dec 5 10:58:02 2018 New Revision: 341515 URL: https://svnweb.freebsd.org/changeset/base/341515 Log: Allow bootstrapping libopenbsd on Linux The getdtablecount.c file won't compile on Linux but it seems like none of the bootstrap tools actually need it. Reviewed By: emaste, brooks Differential Revision: https://reviews.freebsd.org/D14244 Modified: head/lib/libopenbsd/Makefile Modified: head/lib/libopenbsd/Makefile ============================================================================== --- head/lib/libopenbsd/Makefile Wed Dec 5 10:57:57 2018 (r341514) +++ head/lib/libopenbsd/Makefile Wed Dec 5 10:58:02 2018 (r341515) @@ -2,10 +2,15 @@ PACKAGE=lib${LIB} LIB= openbsd -SRCS= getdtablecount.c \ - imsg-buffer.c \ +SRCS= imsg-buffer.c \ imsg.c \ ohash.c +.if !defined(BOOTSTRAPPING) +# Skip getdtablecount.c when bootstrapping since it doesn't compile for Linux +# and is not used by any of the bootstrap tools +SRCS+= getdtablecount.c +.endif + INTERNALLIB= CFLAGS+= -I${.CURDIR} From owner-svn-src-head@freebsd.org Wed Dec 5 11:57:18 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EBEE3130F74C; Wed, 5 Dec 2018 11:57:17 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 96FA36AC21; Wed, 5 Dec 2018 11:57:17 +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 5BFF71406D; Wed, 5 Dec 2018 11:57:17 +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 wB5BvHjn022821; Wed, 5 Dec 2018 11:57:17 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5BvG3F022815; Wed, 5 Dec 2018 11:57:16 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201812051157.wB5BvG3F022815@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Wed, 5 Dec 2018 11:57:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341516 - in head/sys: conf dev/netmap modules/netmap net X-SVN-Group: head X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: in head/sys: conf dev/netmap modules/netmap net X-SVN-Commit-Revision: 341516 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 96FA36AC21 X-Spamd-Result: default: False [-0.23 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.45)[-0.446,0]; NEURAL_SPAM_SHORT(0.13)[0.126,0]; NEURAL_SPAM_LONG(0.09)[0.092,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 11:57:18 -0000 Author: vmaffione Date: Wed Dec 5 11:57:16 2018 New Revision: 341516 URL: https://svnweb.freebsd.org/changeset/base/341516 Log: netmap: align codebase to the current upstream (760279cfb2730a585) Changelist: - Replace netmap passthrough host support with a more general mechanism to call TXSYNC/RXSYNC from an in-kernel event-loop. No kernel threads are used to use this feature: the application is required to spawn a thread (or a process) and issue a SYNC_KLOOP_START (NIOCCTRL) command in the thread body. The kernel loop is executed by the ioctl implementation, which returns to userspace only when a different thread calls SYNC_KLOOP_STOP or the netmap file descriptor is closed. - Update the if_ptnet driver to cope with the new data structures, and prune all the obsolete ptnetmap code. - Add support for "null" netmap ports, useful to allocate netmap_if, netmap_ring and netmap buffers to be used by specialized applications (e.g. hypervisors). TXSYNC/RXSYNC on these ports have no effect. - Various fixes and code refactoring. Sponsored by: Sunny Valley Networks Differential Revision: https://reviews.freebsd.org/D18015 Added: head/sys/dev/netmap/netmap_kloop.c (contents, props changed) head/sys/dev/netmap/netmap_null.c (contents, props changed) Modified: head/sys/conf/files head/sys/dev/netmap/if_ixl_netmap.h head/sys/dev/netmap/if_ptnet.c head/sys/dev/netmap/if_vtnet_netmap.h head/sys/dev/netmap/netmap.c head/sys/dev/netmap/netmap_bdg.c head/sys/dev/netmap/netmap_bdg.h head/sys/dev/netmap/netmap_freebsd.c head/sys/dev/netmap/netmap_generic.c head/sys/dev/netmap/netmap_kern.h head/sys/dev/netmap/netmap_legacy.c head/sys/dev/netmap/netmap_mem2.c head/sys/dev/netmap/netmap_mem2.h head/sys/dev/netmap/netmap_pipe.c head/sys/dev/netmap/netmap_vale.c head/sys/modules/netmap/Makefile head/sys/net/netmap.h head/sys/net/netmap_user.h head/sys/net/netmap_virt.h Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Wed Dec 5 10:58:02 2018 (r341515) +++ head/sys/conf/files Wed Dec 5 11:57:16 2018 (r341516) @@ -2517,17 +2517,19 @@ dev/nand/nandsim_swap.c optional nandsim nand dev/nand/nfc_if.m optional nand dev/netmap/if_ptnet.c optional netmap inet dev/netmap/netmap.c optional netmap +dev/netmap/netmap_bdg.c optional netmap dev/netmap/netmap_freebsd.c optional netmap dev/netmap/netmap_generic.c optional netmap +dev/netmap/netmap_kloop.c optional netmap +dev/netmap/netmap_legacy.c optional netmap dev/netmap/netmap_mbq.c optional netmap dev/netmap/netmap_mem2.c optional netmap dev/netmap/netmap_monitor.c optional netmap +dev/netmap/netmap_null.c optional netmap dev/netmap/netmap_offloadings.c optional netmap dev/netmap/netmap_pipe.c optional netmap dev/netmap/netmap_pt.c optional netmap dev/netmap/netmap_vale.c optional netmap -dev/netmap/netmap_legacy.c optional netmap -dev/netmap/netmap_bdg.c optional netmap # compile-with "${NORMAL_C} -Wconversion -Wextra" dev/nfsmb/nfsmb.c optional nfsmb pci dev/nge/if_nge.c optional nge Modified: head/sys/dev/netmap/if_ixl_netmap.h ============================================================================== --- head/sys/dev/netmap/if_ixl_netmap.h Wed Dec 5 10:58:02 2018 (r341515) +++ head/sys/dev/netmap/if_ixl_netmap.h Wed Dec 5 11:57:16 2018 (r341516) @@ -129,7 +129,7 @@ ixl_netmap_attach(struct ixl_vsi *vsi) na.ifp = vsi->ifp; na.na_flags = NAF_BDG_MAYSLEEP; // XXX check that queues is set. - nm_prinf("queues is %p\n", vsi->queues); + nm_prinf("queues is %p", vsi->queues); if (vsi->queues) { na.num_tx_desc = vsi->queues[0].num_desc; na.num_rx_desc = vsi->queues[0].num_desc; Modified: head/sys/dev/netmap/if_ptnet.c ============================================================================== --- head/sys/dev/netmap/if_ptnet.c Wed Dec 5 10:58:02 2018 (r341515) +++ head/sys/dev/netmap/if_ptnet.c Wed Dec 5 11:57:16 2018 (r341516) @@ -128,8 +128,8 @@ struct ptnet_queue { struct resource *irq; void *cookie; int kring_id; - struct ptnet_csb_gh *ptgh; - struct ptnet_csb_hg *pthg; + struct nm_csb_atok *atok; + struct nm_csb_ktoa *ktoa; unsigned int kick; struct mtx lock; struct buf_ring *bufring; /* for TX queues */ @@ -166,8 +166,8 @@ struct ptnet_softc { unsigned int num_tx_rings; struct ptnet_queue *queues; struct ptnet_queue *rxqueues; - struct ptnet_csb_gh *csb_gh; - struct ptnet_csb_hg *csb_hg; + struct nm_csb_atok *csb_gh; + struct nm_csb_ktoa *csb_hg; unsigned int min_tx_space; @@ -209,7 +209,7 @@ static void ptnet_tick(void *opaque); static int ptnet_irqs_init(struct ptnet_softc *sc); static void ptnet_irqs_fini(struct ptnet_softc *sc); -static uint32_t ptnet_nm_ptctl(if_t ifp, uint32_t cmd); +static uint32_t ptnet_nm_ptctl(struct ptnet_softc *sc, uint32_t cmd); static int ptnet_nm_config(struct netmap_adapter *na, struct nm_config_info *info); static void ptnet_update_vnet_hdr(struct ptnet_softc *sc); @@ -327,7 +327,7 @@ ptnet_attach(device_t dev) sc->num_rings = num_tx_rings + num_rx_rings; sc->num_tx_rings = num_tx_rings; - if (sc->num_rings * sizeof(struct ptnet_csb_gh) > PAGE_SIZE) { + if (sc->num_rings * sizeof(struct nm_csb_atok) > PAGE_SIZE) { device_printf(dev, "CSB cannot handle that many rings (%u)\n", sc->num_rings); err = ENOMEM; @@ -342,7 +342,7 @@ ptnet_attach(device_t dev) err = ENOMEM; goto err_path; } - sc->csb_hg = (struct ptnet_csb_hg *)(((char *)sc->csb_gh) + PAGE_SIZE); + sc->csb_hg = (struct nm_csb_ktoa *)(((char *)sc->csb_gh) + PAGE_SIZE); { /* @@ -379,8 +379,8 @@ ptnet_attach(device_t dev) pq->sc = sc; pq->kring_id = i; pq->kick = PTNET_IO_KICK_BASE + 4 * i; - pq->ptgh = sc->csb_gh + i; - pq->pthg = sc->csb_hg + i; + pq->atok = sc->csb_gh + i; + pq->ktoa = sc->csb_hg + i; snprintf(pq->lock_name, sizeof(pq->lock_name), "%s-%d", device_get_nameunit(dev), i); mtx_init(&pq->lock, pq->lock_name, NULL, MTX_DEF); @@ -505,12 +505,25 @@ err_path: return err; } +/* Stop host sync-kloop if it was running. */ +static void +ptnet_device_shutdown(struct ptnet_softc *sc) +{ + ptnet_nm_ptctl(sc, PTNETMAP_PTCTL_DELETE); + bus_write_4(sc->iomem, PTNET_IO_CSB_GH_BAH, 0); + bus_write_4(sc->iomem, PTNET_IO_CSB_GH_BAL, 0); + bus_write_4(sc->iomem, PTNET_IO_CSB_HG_BAH, 0); + bus_write_4(sc->iomem, PTNET_IO_CSB_HG_BAL, 0); +} + static int ptnet_detach(device_t dev) { struct ptnet_softc *sc = device_get_softc(dev); int i; + ptnet_device_shutdown(sc); + #ifdef DEVICE_POLLING if (sc->ifp->if_capenable & IFCAP_POLLING) { ether_poll_deregister(sc->ifp); @@ -543,10 +556,6 @@ ptnet_detach(device_t dev) ptnet_irqs_fini(sc); if (sc->csb_gh) { - bus_write_4(sc->iomem, PTNET_IO_CSB_GH_BAH, 0); - bus_write_4(sc->iomem, PTNET_IO_CSB_GH_BAL, 0); - bus_write_4(sc->iomem, PTNET_IO_CSB_HG_BAH, 0); - bus_write_4(sc->iomem, PTNET_IO_CSB_HG_BAL, 0); contigfree(sc->csb_gh, 2*PAGE_SIZE, M_DEVBUF); sc->csb_gh = NULL; sc->csb_hg = NULL; @@ -583,9 +592,8 @@ ptnet_detach(device_t dev) static int ptnet_suspend(device_t dev) { - struct ptnet_softc *sc; + struct ptnet_softc *sc = device_get_softc(dev); - sc = device_get_softc(dev); (void)sc; return (0); @@ -594,9 +602,8 @@ ptnet_suspend(device_t dev) static int ptnet_resume(device_t dev) { - struct ptnet_softc *sc; + struct ptnet_softc *sc = device_get_softc(dev); - sc = device_get_softc(dev); (void)sc; return (0); @@ -605,11 +612,11 @@ ptnet_resume(device_t dev) static int ptnet_shutdown(device_t dev) { - /* - * Suspend already does all of what we need to - * do here; we just never expect to be resumed. - */ - return (ptnet_suspend(dev)); + struct ptnet_softc *sc = device_get_softc(dev); + + ptnet_device_shutdown(sc); + + return (0); } static int @@ -796,7 +803,7 @@ ptnet_ioctl(if_t ifp, u_long cmd, caddr_t data) /* Make sure the worker sees the * IFF_DRV_RUNNING down. */ PTNET_Q_LOCK(pq); - pq->ptgh->guest_need_kick = 0; + pq->atok->appl_need_kick = 0; PTNET_Q_UNLOCK(pq); /* Wait for rescheduling to finish. */ if (pq->taskq) { @@ -810,7 +817,7 @@ ptnet_ioctl(if_t ifp, u_long cmd, caddr_t data) for (i = 0; i < sc->num_rings; i++) { pq = sc-> queues + i; PTNET_Q_LOCK(pq); - pq->ptgh->guest_need_kick = 1; + pq->atok->appl_need_kick = 1; PTNET_Q_UNLOCK(pq); } } @@ -881,7 +888,7 @@ ptnet_init_locked(struct ptnet_softc *sc) return ret; } - if (sc->ptna->backend_regifs == 0) { + if (sc->ptna->backend_users == 0) { ret = ptnet_nm_krings_create(na_nm); if (ret) { device_printf(sc->dev, "ptnet_nm_krings_create() " @@ -962,7 +969,7 @@ ptnet_stop(struct ptnet_softc *sc) ptnet_nm_register(na_dr, 0 /* off */); - if (sc->ptna->backend_regifs == 0) { + if (sc->ptna->backend_users == 0) { netmap_mem_rings_delete(na_dr); ptnet_nm_krings_delete(na_nm); } @@ -1092,9 +1099,8 @@ ptnet_media_status(if_t ifp, struct ifmediareq *ifmr) } static uint32_t -ptnet_nm_ptctl(if_t ifp, uint32_t cmd) +ptnet_nm_ptctl(struct ptnet_softc *sc, uint32_t cmd) { - struct ptnet_softc *sc = if_getsoftc(ifp); /* * Write a command and read back error status, * with zero meaning success. @@ -1130,8 +1136,8 @@ ptnet_sync_from_csb(struct ptnet_softc *sc, struct net /* Sync krings from the host, reading from * CSB. */ for (i = 0; i < sc->num_rings; i++) { - struct ptnet_csb_gh *ptgh = sc->queues[i].ptgh; - struct ptnet_csb_hg *pthg = sc->queues[i].pthg; + struct nm_csb_atok *atok = sc->queues[i].atok; + struct nm_csb_ktoa *ktoa = sc->queues[i].ktoa; struct netmap_kring *kring; if (i < na->num_tx_rings) { @@ -1139,15 +1145,15 @@ ptnet_sync_from_csb(struct ptnet_softc *sc, struct net } else { kring = na->rx_rings[i - na->num_tx_rings]; } - kring->rhead = kring->ring->head = ptgh->head; - kring->rcur = kring->ring->cur = ptgh->cur; - kring->nr_hwcur = pthg->hwcur; + kring->rhead = kring->ring->head = atok->head; + kring->rcur = kring->ring->cur = atok->cur; + kring->nr_hwcur = ktoa->hwcur; kring->nr_hwtail = kring->rtail = - kring->ring->tail = pthg->hwtail; + kring->ring->tail = ktoa->hwtail; ND("%d,%d: csb {hc %u h %u c %u ht %u}", t, i, - pthg->hwcur, ptgh->head, ptgh->cur, - pthg->hwtail); + ktoa->hwcur, atok->head, atok->cur, + ktoa->hwtail); ND("%d,%d: kring {hc %u rh %u rc %u h %u c %u ht %u rt %u t %u}", t, i, kring->nr_hwcur, kring->rhead, kring->rcur, kring->ring->head, kring->ring->cur, kring->nr_hwtail, @@ -1178,7 +1184,7 @@ ptnet_nm_register(struct netmap_adapter *na, int onoff int i; if (!onoff) { - sc->ptna->backend_regifs--; + sc->ptna->backend_users--; } /* If this is the last netmap client, guest interrupt enable flags may @@ -1191,17 +1197,17 @@ ptnet_nm_register(struct netmap_adapter *na, int onoff D("Exit netmap mode, re-enable interrupts"); for (i = 0; i < sc->num_rings; i++) { pq = sc->queues + i; - pq->ptgh->guest_need_kick = 1; + pq->atok->appl_need_kick = 1; } } if (onoff) { - if (sc->ptna->backend_regifs == 0) { + if (sc->ptna->backend_users == 0) { /* Initialize notification enable fields in the CSB. */ for (i = 0; i < sc->num_rings; i++) { pq = sc->queues + i; - pq->pthg->host_need_kick = 1; - pq->ptgh->guest_need_kick = + pq->ktoa->kern_need_kick = 1; + pq->atok->appl_need_kick = (!(ifp->if_capenable & IFCAP_POLLING) && i >= sc->num_tx_rings); } @@ -1211,17 +1217,13 @@ ptnet_nm_register(struct netmap_adapter *na, int onoff /* Make sure the host adapter passed through is ready * for txsync/rxsync. */ - ret = ptnet_nm_ptctl(ifp, PTNETMAP_PTCTL_CREATE); + ret = ptnet_nm_ptctl(sc, PTNETMAP_PTCTL_CREATE); if (ret) { return ret; } - } - /* Sync from CSB must be done after REGIF PTCTL. Skip this - * step only if this is a netmap client and it is not the - * first one. */ - if ((!native && sc->ptna->backend_regifs == 0) || - (native && na->active_fds == 0)) { + /* Align the guest krings and rings to the state stored + * in the CSB. */ ptnet_sync_from_csb(sc, na); } @@ -1254,19 +1256,13 @@ ptnet_nm_register(struct netmap_adapter *na, int onoff } } - /* Sync from CSB must be done before UNREGIF PTCTL, on the last - * netmap client. */ - if (native && na->active_fds == 0) { - ptnet_sync_from_csb(sc, na); + if (sc->ptna->backend_users == 0) { + ret = ptnet_nm_ptctl(sc, PTNETMAP_PTCTL_DELETE); } - - if (sc->ptna->backend_regifs == 0) { - ret = ptnet_nm_ptctl(ifp, PTNETMAP_PTCTL_DELETE); - } } if (onoff) { - sc->ptna->backend_regifs++; + sc->ptna->backend_users++; } return ret; @@ -1279,7 +1275,7 @@ ptnet_nm_txsync(struct netmap_kring *kring, int flags) struct ptnet_queue *pq = sc->queues + kring->ring_id; bool notify; - notify = netmap_pt_guest_txsync(pq->ptgh, pq->pthg, kring, flags); + notify = netmap_pt_guest_txsync(pq->atok, pq->ktoa, kring, flags); if (notify) { ptnet_kick(pq); } @@ -1294,7 +1290,7 @@ ptnet_nm_rxsync(struct netmap_kring *kring, int flags) struct ptnet_queue *pq = sc->rxqueues + kring->ring_id; bool notify; - notify = netmap_pt_guest_rxsync(pq->ptgh, pq->pthg, kring, flags); + notify = netmap_pt_guest_rxsync(pq->atok, pq->ktoa, kring, flags); if (notify) { ptnet_kick(pq); } @@ -1310,7 +1306,7 @@ ptnet_nm_intr(struct netmap_adapter *na, int onoff) for (i = 0; i < sc->num_rings; i++) { struct ptnet_queue *pq = sc->queues + i; - pq->ptgh->guest_need_kick = onoff; + pq->atok->appl_need_kick = onoff; } } @@ -1676,25 +1672,13 @@ ptnet_rx_csum(struct mbuf *m, struct virtio_net_hdr *h } /* End of offloading-related functions to be shared with vtnet. */ -static inline void -ptnet_sync_tail(struct ptnet_csb_hg *pthg, struct netmap_kring *kring) -{ - struct netmap_ring *ring = kring->ring; - - /* Update hwcur and hwtail as known by the host. */ - ptnetmap_guest_read_kring_csb(pthg, kring); - - /* nm_sync_finalize */ - ring->tail = kring->rtail = kring->nr_hwtail; -} - static void ptnet_ring_update(struct ptnet_queue *pq, struct netmap_kring *kring, unsigned int head, unsigned int sync_flags) { struct netmap_ring *ring = kring->ring; - struct ptnet_csb_gh *ptgh = pq->ptgh; - struct ptnet_csb_hg *pthg = pq->pthg; + struct nm_csb_atok *atok = pq->atok; + struct nm_csb_ktoa *ktoa = pq->ktoa; /* Some packets have been pushed to the netmap ring. We have * to tell the host to process the new packets, updating cur @@ -1704,11 +1688,11 @@ ptnet_ring_update(struct ptnet_queue *pq, struct netma /* Mimic nm_txsync_prologue/nm_rxsync_prologue. */ kring->rcur = kring->rhead = head; - ptnetmap_guest_write_kring_csb(ptgh, kring->rcur, kring->rhead); + ptnetmap_guest_write_kring_csb(atok, kring->rcur, kring->rhead); /* Kick the host if needed. */ - if (NM_ACCESS_ONCE(pthg->host_need_kick)) { - ptgh->sync_flags = sync_flags; + if (NM_ACCESS_ONCE(ktoa->kern_need_kick)) { + atok->sync_flags = sync_flags; ptnet_kick(pq); } } @@ -1728,8 +1712,8 @@ ptnet_drain_transmit_queue(struct ptnet_queue *pq, uns struct netmap_adapter *na = &sc->ptna->dr.up; if_t ifp = sc->ifp; unsigned int batch_count = 0; - struct ptnet_csb_gh *ptgh; - struct ptnet_csb_hg *pthg; + struct nm_csb_atok *atok; + struct nm_csb_ktoa *ktoa; struct netmap_kring *kring; struct netmap_ring *ring; struct netmap_slot *slot; @@ -1758,8 +1742,8 @@ ptnet_drain_transmit_queue(struct ptnet_queue *pq, uns return ENETDOWN; } - ptgh = pq->ptgh; - pthg = pq->pthg; + atok = pq->atok; + ktoa = pq->ktoa; kring = na->tx_rings[pq->kring_id]; ring = kring->ring; lim = kring->nkr_num_slots - 1; @@ -1771,17 +1755,17 @@ ptnet_drain_transmit_queue(struct ptnet_queue *pq, uns /* We ran out of slot, let's see if the host has * freed up some, by reading hwcur and hwtail from * the CSB. */ - ptnet_sync_tail(pthg, kring); + ptnet_sync_tail(ktoa, kring); if (PTNET_TX_NOSPACE(head, kring, minspace)) { /* Still no slots available. Reactivate the * interrupts so that we can be notified * when some free slots are made available by * the host. */ - ptgh->guest_need_kick = 1; + atok->appl_need_kick = 1; /* Double-check. */ - ptnet_sync_tail(pthg, kring); + ptnet_sync_tail(ktoa, kring); if (likely(PTNET_TX_NOSPACE(head, kring, minspace))) { break; @@ -1790,7 +1774,7 @@ ptnet_drain_transmit_queue(struct ptnet_queue *pq, uns RD(1, "Found more slots by doublecheck"); /* More slots were freed before reactivating * the interrupts. */ - ptgh->guest_need_kick = 0; + atok->appl_need_kick = 0; } } @@ -2020,8 +2004,8 @@ ptnet_rx_eof(struct ptnet_queue *pq, unsigned int budg { struct ptnet_softc *sc = pq->sc; bool have_vnet_hdr = sc->vnet_hdr_len; - struct ptnet_csb_gh *ptgh = pq->ptgh; - struct ptnet_csb_hg *pthg = pq->pthg; + struct nm_csb_atok *atok = pq->atok; + struct nm_csb_ktoa *ktoa = pq->ktoa; struct netmap_adapter *na = &sc->ptna->dr.up; struct netmap_kring *kring = na->rx_rings[pq->kring_id]; struct netmap_ring *ring = kring->ring; @@ -2053,21 +2037,21 @@ host_sync: /* We ran out of slot, let's see if the host has * added some, by reading hwcur and hwtail from * the CSB. */ - ptnet_sync_tail(pthg, kring); + ptnet_sync_tail(ktoa, kring); if (head == ring->tail) { /* Still no slots available. Reactivate * interrupts as they were disabled by the * host thread right before issuing the * last interrupt. */ - ptgh->guest_need_kick = 1; + atok->appl_need_kick = 1; /* Double-check. */ - ptnet_sync_tail(pthg, kring); + ptnet_sync_tail(ktoa, kring); if (likely(head == ring->tail)) { break; } - ptgh->guest_need_kick = 0; + atok->appl_need_kick = 0; } } Modified: head/sys/dev/netmap/if_vtnet_netmap.h ============================================================================== --- head/sys/dev/netmap/if_vtnet_netmap.h Wed Dec 5 10:58:02 2018 (r341515) +++ head/sys/dev/netmap/if_vtnet_netmap.h Wed Dec 5 11:57:16 2018 (r341516) @@ -79,7 +79,7 @@ vtnet_free_used(struct virtqueue *vq, int netmap_bufs, } if (deq) - nm_prinf("%d sgs dequeued from %s-%d (netmap=%d)\n", + nm_prinf("%d sgs dequeued from %s-%d (netmap=%d)", deq, nm_txrx2str(t), idx, netmap_bufs); } @@ -230,7 +230,7 @@ vtnet_netmap_txsync(struct netmap_kring *kring, int fl /*writeable=*/0); if (unlikely(err)) { if (err != ENOSPC) - nm_prerr("virtqueue_enqueue(%s) failed: %d\n", + nm_prerr("virtqueue_enqueue(%s) failed: %d", kring->name, err); break; } @@ -251,7 +251,7 @@ vtnet_netmap_txsync(struct netmap_kring *kring, int fl if (token == NULL) break; if (unlikely(token != (void *)txq)) - nm_prerr("BUG: TX token mismatch\n"); + nm_prerr("BUG: TX token mismatch"); else n++; } @@ -307,7 +307,7 @@ vtnet_netmap_kring_refill(struct netmap_kring *kring, /*readable=*/0, /*writeable=*/sg.sg_nseg); if (unlikely(err)) { if (err != ENOSPC) - nm_prerr("virtqueue_enqueue(%s) failed: %d\n", + nm_prerr("virtqueue_enqueue(%s) failed: %d", kring->name, err); break; } @@ -391,7 +391,7 @@ vtnet_netmap_rxsync(struct netmap_kring *kring, int fl break; } if (unlikely(token != (void *)rxq)) { - nm_prerr("BUG: RX token mismatch\n"); + nm_prerr("BUG: RX token mismatch"); } else { /* Skip the virtio-net header. */ len -= sc->vtnet_hdr_size; @@ -533,7 +533,7 @@ vtnet_netmap_attach(struct vtnet_softc *sc) netmap_attach(&na); - nm_prinf("vtnet attached txq=%d, txd=%d rxq=%d, rxd=%d\n", + nm_prinf("vtnet attached txq=%d, txd=%d rxq=%d, rxd=%d", na.num_tx_rings, na.num_tx_desc, na.num_tx_rings, na.num_rx_desc); } Modified: head/sys/dev/netmap/netmap.c ============================================================================== --- head/sys/dev/netmap/netmap.c Wed Dec 5 10:58:02 2018 (r341515) +++ head/sys/dev/netmap/netmap.c Wed Dec 5 11:57:16 2018 (r341516) @@ -480,6 +480,9 @@ ports attached to the switch) /* user-controlled variables */ int netmap_verbose; +#ifdef CONFIG_NETMAP_DEBUG +int netmap_debug; +#endif /* CONFIG_NETMAP_DEBUG */ static int netmap_no_timestamp; /* don't timestamp on rxsync */ int netmap_no_pendintr = 1; @@ -527,9 +530,6 @@ int netmap_generic_hwcsum = 0; /* Non-zero if ptnet devices are allowed to use virtio-net headers. */ int ptnet_vnet_hdr = 1; -/* 0 if ptnetmap should not use worker threads for TX processing */ -int ptnetmap_tx_workers = 1; - /* * SYSCTL calls are grouped between SYSBEGIN and SYSEND to be emulated * in some other operating systems @@ -540,6 +540,10 @@ SYSCTL_DECL(_dev_netmap); SYSCTL_NODE(_dev, OID_AUTO, netmap, CTLFLAG_RW, 0, "Netmap args"); SYSCTL_INT(_dev_netmap, OID_AUTO, verbose, CTLFLAG_RW, &netmap_verbose, 0, "Verbose mode"); +#ifdef CONFIG_NETMAP_DEBUG +SYSCTL_INT(_dev_netmap, OID_AUTO, debug, + CTLFLAG_RW, &netmap_debug, 0, "Debug messages"); +#endif /* CONFIG_NETMAP_DEBUG */ SYSCTL_INT(_dev_netmap, OID_AUTO, no_timestamp, CTLFLAG_RW, &netmap_no_timestamp, 0, "no_timestamp"); SYSCTL_INT(_dev_netmap, OID_AUTO, no_pendintr, CTLFLAG_RW, &netmap_no_pendintr, @@ -569,8 +573,6 @@ SYSCTL_INT(_dev_netmap, OID_AUTO, generic_txqdisc, CTL #endif SYSCTL_INT(_dev_netmap, OID_AUTO, ptnet_vnet_hdr, CTLFLAG_RW, &ptnet_vnet_hdr, 0, "Allow ptnet devices to use virtio-net headers"); -SYSCTL_INT(_dev_netmap, OID_AUTO, ptnetmap_tx_workers, CTLFLAG_RW, - &ptnetmap_tx_workers, 0, "Use worker threads for pnetmap TX processing"); SYSEND; @@ -692,7 +694,7 @@ nm_bound_var(u_int *v, u_int dflt, u_int lo, u_int hi, op = "Clamp"; } if (op && msg) - nm_prinf("%s %s to %d (was %d)\n", op, msg, *v, oldv); + nm_prinf("%s %s to %d (was %d)", op, msg, *v, oldv); return *v; } @@ -776,13 +778,14 @@ netmap_update_config(struct netmap_adapter *na) na->num_rx_rings = info.num_rx_rings; na->num_rx_desc = info.num_rx_descs; na->rx_buf_maxsize = info.rx_buf_maxsize; - D("configuration changed for %s: txring %d x %d, " - "rxring %d x %d, rxbufsz %d", - na->name, na->num_tx_rings, na->num_tx_desc, - na->num_rx_rings, na->num_rx_desc, na->rx_buf_maxsize); + if (netmap_verbose) + nm_prinf("configuration changed for %s: txring %d x %d, " + "rxring %d x %d, rxbufsz %d", + na->name, na->num_tx_rings, na->num_tx_desc, + na->num_rx_rings, na->num_rx_desc, na->rx_buf_maxsize); return 0; } - D("WARNING: configuration changed for %s while active: " + nm_prerr("WARNING: configuration changed for %s while active: " "txring %d x %d, rxring %d x %d, rxbufsz %d", na->name, info.num_tx_rings, info.num_tx_descs, info.num_rx_rings, info.num_rx_descs, @@ -828,7 +831,8 @@ netmap_krings_create(struct netmap_adapter *na, u_int enum txrx t; if (na->tx_rings != NULL) { - D("warning: krings were already created"); + if (netmap_debug & NM_DEBUG_ON) + nm_prerr("warning: krings were already created"); return 0; } @@ -842,7 +846,7 @@ netmap_krings_create(struct netmap_adapter *na, u_int na->tx_rings = nm_os_malloc((size_t)len); if (na->tx_rings == NULL) { - D("Cannot allocate krings"); + nm_prerr("Cannot allocate krings"); return ENOMEM; } na->rx_rings = na->tx_rings + n[NR_TX]; @@ -910,7 +914,8 @@ netmap_krings_delete(struct netmap_adapter *na) enum txrx t; if (na->tx_rings == NULL) { - D("warning: krings were already deleted"); + if (netmap_debug & NM_DEBUG_ON) + nm_prerr("warning: krings were already deleted"); return; } @@ -1012,11 +1017,11 @@ netmap_do_unregif(struct netmap_priv_d *priv) * happens if the close() occurs while a concurrent * syscall is running. */ - if (netmap_verbose) - D("deleting last instance for %s", na->name); + if (netmap_debug & NM_DEBUG_ON) + nm_prinf("deleting last instance for %s", na->name); if (nm_netmap_on(na)) { - D("BUG: netmap on while going to delete the krings"); + nm_prerr("BUG: netmap on while going to delete the krings"); } na->nm_krings_delete(na); @@ -1033,14 +1038,6 @@ netmap_do_unregif(struct netmap_priv_d *priv) priv->np_nifp = NULL; } -/* call with NMG_LOCK held */ -static __inline int -nm_si_user(struct netmap_priv_d *priv, enum txrx t) -{ - return (priv->np_na != NULL && - (priv->np_qlast[t] - priv->np_qfirst[t] > 1)); -} - struct netmap_priv_d* netmap_priv_new(void) { @@ -1136,8 +1133,8 @@ netmap_send_up(struct ifnet *dst, struct mbq *q) /* Send packets up, outside the lock; head/prev machinery * is only useful for Windows. */ while ((m = mbq_dequeue(q)) != NULL) { - if (netmap_verbose & NM_VERB_HOST) - D("sending up pkt %p size %d", m, MBUF_LEN(m)); + if (netmap_debug & NM_DEBUG_HOST) + nm_prinf("sending up pkt %p size %d", m, MBUF_LEN(m)); prev = nm_os_send_up(dst, m, prev); if (head == NULL) head = prev; @@ -1332,8 +1329,8 @@ netmap_rxsync_from_host(struct netmap_kring *kring, in m_copydata(m, 0, len, NMB(na, slot)); ND("nm %d len %d", nm_i, len); - if (netmap_verbose) - D("%s", nm_dump_buf(NMB(na, slot),len, 128, NULL)); + if (netmap_debug & NM_DEBUG_HOST) + nm_prinf("%s", nm_dump_buf(NMB(na, slot),len, 128, NULL)); slot->len = len; slot->flags = 0; @@ -1500,7 +1497,7 @@ netmap_get_na(struct nmreq_header *hdr, if (req->nr_mode == NR_REG_PIPE_MASTER || req->nr_mode == NR_REG_PIPE_SLAVE) { /* Do not accept deprecated pipe modes. */ - D("Deprecated pipe nr_mode, use xx{yy or xx}yy syntax"); + nm_prerr("Deprecated pipe nr_mode, use xx{yy or xx}yy syntax"); return EINVAL; } @@ -1527,9 +1524,7 @@ netmap_get_na(struct nmreq_header *hdr, * 0 !NULL type matches and na created/found * !0 !NULL impossible */ - - /* try to see if this is a ptnetmap port */ - error = netmap_get_pt_host_na(hdr, na, nmd, create); + error = netmap_get_null_na(hdr, na, nmd, create); if (error || *na != NULL) goto out; @@ -1739,7 +1734,7 @@ nm_rxsync_prologue(struct netmap_kring *kring, struct /* * Error routine called when txsync/rxsync detects an error. - * Can't do much more than resetting head =cur = hwcur, tail = hwtail + * Can't do much more than resetting head = cur = hwcur, tail = hwtail * Return 1 on reinit. * * This routine is only called by the upper half of the kernel. @@ -1810,12 +1805,6 @@ netmap_interp_ringid(struct netmap_priv_d *priv, uint3 enum txrx t; u_int j; - if ((nr_flags & NR_PTNETMAP_HOST) && ((nr_mode != NR_REG_ALL_NIC) || - nr_flags & (NR_RX_RINGS_ONLY|NR_TX_RINGS_ONLY))) { - D("Error: only NR_REG_ALL_NIC supported with netmap passthrough"); - return EINVAL; - } - for_rx_tx(t) { if (nr_flags & excluded_direction[t]) { priv->np_qfirst[t] = priv->np_qlast[t] = 0; @@ -1823,6 +1812,7 @@ netmap_interp_ringid(struct netmap_priv_d *priv, uint3 } switch (nr_mode) { case NR_REG_ALL_NIC: + case NR_REG_NULL: priv->np_qfirst[t] = 0; priv->np_qlast[t] = nma_get_nrings(na, t); ND("ALL/PIPE: %s %d %d", nm_txrx2str(t), @@ -1831,7 +1821,7 @@ netmap_interp_ringid(struct netmap_priv_d *priv, uint3 case NR_REG_SW: case NR_REG_NIC_SW: if (!(na->na_flags & NAF_HOST_RINGS)) { - D("host rings not supported"); + nm_prerr("host rings not supported"); return EINVAL; } priv->np_qfirst[t] = (nr_mode == NR_REG_SW ? @@ -1844,7 +1834,7 @@ netmap_interp_ringid(struct netmap_priv_d *priv, uint3 case NR_REG_ONE_NIC: if (nr_ringid >= na->num_tx_rings && nr_ringid >= na->num_rx_rings) { - D("invalid ring id %d", nr_ringid); + nm_prerr("invalid ring id %d", nr_ringid); return EINVAL; } /* if not enough rings, use the first one */ @@ -1857,11 +1847,11 @@ netmap_interp_ringid(struct netmap_priv_d *priv, uint3 priv->np_qfirst[t], priv->np_qlast[t]); break; default: - D("invalid regif type %d", nr_mode); + nm_prerr("invalid regif type %d", nr_mode); return EINVAL; } } - priv->np_flags = nr_flags | nr_mode; // TODO + priv->np_flags = nr_flags; /* Allow transparent forwarding mode in the host --> nic * direction only if all the TX hw rings have been opened. */ @@ -1871,7 +1861,7 @@ netmap_interp_ringid(struct netmap_priv_d *priv, uint3 } if (netmap_verbose) { - D("%s: tx [%d,%d) rx [%d,%d) id %d", + nm_prinf("%s: tx [%d,%d) rx [%d,%d) id %d", na->name, priv->np_qfirst[NR_TX], priv->np_qlast[NR_TX], @@ -1927,6 +1917,7 @@ netmap_unset_ringid(struct netmap_priv_d *priv) } priv->np_flags = 0; priv->np_txpoll = 0; + priv->np_kloop_state = 0; } @@ -1943,8 +1934,8 @@ netmap_krings_get(struct netmap_priv_d *priv) int excl = (priv->np_flags & NR_EXCLUSIVE); enum txrx t; - if (netmap_verbose) - D("%s: grabbing tx [%d, %d) rx [%d, %d)", + if (netmap_debug & NM_DEBUG_ON) + nm_prinf("%s: grabbing tx [%d, %d) rx [%d, %d)", na->name, priv->np_qfirst[NR_TX], priv->np_qlast[NR_TX], @@ -2021,6 +2012,110 @@ nm_priv_rx_enabled(struct netmap_priv_d *priv) return (priv->np_qfirst[NR_RX] != priv->np_qlast[NR_RX]); } +/* Validate the CSB entries for both directions (atok and ktoa). + * To be called under NMG_LOCK(). */ +static int +netmap_csb_validate(struct netmap_priv_d *priv, struct nmreq_opt_csb *csbo) +{ + struct nm_csb_atok *csb_atok_base = + (struct nm_csb_atok *)(uintptr_t)csbo->csb_atok; + struct nm_csb_ktoa *csb_ktoa_base = + (struct nm_csb_ktoa *)(uintptr_t)csbo->csb_ktoa; + enum txrx t; + int num_rings[NR_TXRX], tot_rings; + size_t entry_size[2]; + void *csb_start[2]; + int i; + + if (priv->np_kloop_state & NM_SYNC_KLOOP_RUNNING) { + nm_prerr("Cannot update CSB while kloop is running"); + return EBUSY; + } + + tot_rings = 0; + for_rx_tx(t) { + num_rings[t] = priv->np_qlast[t] - priv->np_qfirst[t]; + tot_rings += num_rings[t]; + } + if (tot_rings <= 0) + return 0; + + if (!(priv->np_flags & NR_EXCLUSIVE)) { + nm_prerr("CSB mode requires NR_EXCLUSIVE"); + return EINVAL; + } + + entry_size[0] = sizeof(*csb_atok_base); + entry_size[1] = sizeof(*csb_ktoa_base); + csb_start[0] = (void *)csb_atok_base; + csb_start[1] = (void *)csb_ktoa_base; + + for (i = 0; i < 2; i++) { + /* On Linux we could use access_ok() to simplify + * the validation. However, the advantage of + * this approach is that it works also on + * FreeBSD. */ + size_t csb_size = tot_rings * entry_size[i]; + void *tmp; + int err; + + if ((uintptr_t)csb_start[i] & (entry_size[i]-1)) { + nm_prerr("Unaligned CSB address"); + return EINVAL; + } + + tmp = nm_os_malloc(csb_size); + if (!tmp) + return ENOMEM; + if (i == 0) { + /* Application --> kernel direction. */ + err = copyin(csb_start[i], tmp, csb_size); + } else { + /* Kernel --> application direction. */ + memset(tmp, 0, csb_size); + err = copyout(tmp, csb_start[i], csb_size); + } + nm_os_free(tmp); + if (err) { + nm_prerr("Invalid CSB address"); + return err; + } + } + + priv->np_csb_atok_base = csb_atok_base; + priv->np_csb_ktoa_base = csb_ktoa_base; + + /* Initialize the CSB. */ + for_rx_tx(t) { + for (i = 0; i < num_rings[t]; i++) { + struct netmap_kring *kring = + NMR(priv->np_na, t)[i + priv->np_qfirst[t]]; + struct nm_csb_atok *csb_atok = csb_atok_base + i; + struct nm_csb_ktoa *csb_ktoa = csb_ktoa_base + i; + + if (t == NR_RX) { + csb_atok += num_rings[NR_TX]; + csb_ktoa += num_rings[NR_TX]; + } + + CSB_WRITE(csb_atok, head, kring->rhead); + CSB_WRITE(csb_atok, cur, kring->rcur); + CSB_WRITE(csb_atok, appl_need_kick, 1); + CSB_WRITE(csb_atok, sync_flags, 1); + CSB_WRITE(csb_ktoa, hwcur, kring->nr_hwcur); + CSB_WRITE(csb_ktoa, hwtail, kring->nr_hwtail); + CSB_WRITE(csb_ktoa, kern_need_kick, 1); + + nm_prinf("csb_init for kring %s: head %u, cur %u, " + "hwcur %u, hwtail %u", kring->name, + kring->rhead, kring->rcur, kring->nr_hwcur, + kring->nr_hwtail); + } + } + + return 0; +} + /* * possibly move the interface to netmap-mode. * If success it returns a pointer to netmap_if, otherwise NULL. @@ -2137,7 +2232,7 @@ netmap_do_regif(struct netmap_priv_d *priv, struct net na->name, mtu, na->rx_buf_maxsize, nbs); if (na->rx_buf_maxsize == 0) { - D("%s: error: rx_buf_maxsize == 0", na->name); + nm_prerr("%s: error: rx_buf_maxsize == 0", na->name); error = EIO; goto err_drop_mem; } @@ -2149,7 +2244,7 @@ netmap_do_regif(struct netmap_priv_d *priv, struct net * cannot be used in this case. */ if (nbs < mtu) { nm_prerr("error: netmap buf size (%u) " - "< device MTU (%u)\n", nbs, mtu); + "< device MTU (%u)", nbs, mtu); error = EINVAL; goto err_drop_mem; } @@ -2162,14 +2257,14 @@ netmap_do_regif(struct netmap_priv_d *priv, struct net if (!(na->na_flags & NAF_MOREFRAG)) { nm_prerr("error: large MTU (%d) needed " "but %s does not support " - "NS_MOREFRAG\n", mtu, + "NS_MOREFRAG", mtu, na->ifp->if_xname); error = EINVAL; goto err_drop_mem; } else if (nbs < na->rx_buf_maxsize) { nm_prerr("error: using NS_MOREFRAG on " "%s requires netmap buf size " - ">= %u\n", na->ifp->if_xname, + ">= %u", na->ifp->if_xname, na->rx_buf_maxsize); error = EINVAL; goto err_drop_mem; @@ -2177,7 +2272,7 @@ netmap_do_regif(struct netmap_priv_d *priv, struct net nm_prinf("info: netmap application on " "%s needs to support " "NS_MOREFRAG " - "(MTU=%u,netmap_buf_size=%u)\n", + "(MTU=%u,netmap_buf_size=%u)", na->ifp->if_xname, mtu, nbs); } } @@ -2307,7 +2402,6 @@ netmap_ioctl(struct netmap_priv_d *priv, u_long cmd, c struct ifnet *ifp = NULL; int error = 0; u_int i, qfirst, qlast; - struct netmap_if *nifp; struct netmap_kring **krings; int sync_flags; enum txrx t; @@ -2316,14 +2410,10 @@ netmap_ioctl(struct netmap_priv_d *priv, u_long cmd, c case NIOCCTRL: { struct nmreq_header *hdr = (struct nmreq_header *)data; - if (hdr->nr_version != NETMAP_API) { - D("API mismatch for reqtype %d: got %d need %d", - hdr->nr_version, - hdr->nr_version, NETMAP_API); - hdr->nr_version = NETMAP_API; - } if (hdr->nr_version < NETMAP_MIN_API || hdr->nr_version > NETMAP_MAX_API) { + nm_prerr("API mismatch: got %d need %d", + hdr->nr_version, NETMAP_API); return EINVAL; } @@ -2345,13 +2435,13 @@ netmap_ioctl(struct netmap_priv_d *priv, u_long cmd, c case NETMAP_REQ_REGISTER: { struct nmreq_register *req = (struct nmreq_register *)(uintptr_t)hdr->nr_body; + struct netmap_if *nifp; + /* Protect access to priv from concurrent requests. */ NMG_LOCK(); do { - u_int memflags; -#ifdef WITH_EXTMEM struct nmreq_option *opt; -#endif /* WITH_EXTMEM */ + u_int memflags; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Wed Dec 5 13:15:58 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CE0991311E71; Wed, 5 Dec 2018 13:15:58 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A9F3F6D666; Wed, 5 Dec 2018 13:15:57 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8AADC14D5B; Wed, 5 Dec 2018 13:15:57 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5DFvOT063805; Wed, 5 Dec 2018 13:15:57 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5DFvUJ063804; Wed, 5 Dec 2018 13:15:57 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051315.wB5DFvUJ063804@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:15:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341517 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 341517 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A9F3F6D666 X-Spamd-Result: default: False [-0.71 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; NEURAL_HAM_SHORT(-0.09)[-0.091,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.07)[-0.072,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:15:59 -0000 Author: slavash Date: Wed Dec 5 13:15:57 2018 New Revision: 341517 URL: https://svnweb.freebsd.org/changeset/base/341517 Log: linuxkpi: implement idr_is_empty() and ida_is_empty(). Submitted by: kib@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/idr.h Modified: head/sys/compat/linuxkpi/common/include/linux/idr.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/idr.h Wed Dec 5 11:57:16 2018 (r341516) +++ head/sys/compat/linuxkpi/common/include/linux/idr.h Wed Dec 5 13:15:57 2018 (r341517) @@ -91,6 +91,7 @@ void idr_init(struct idr *idp); int idr_alloc(struct idr *idp, void *ptr, int start, int end, gfp_t); int idr_alloc_cyclic(struct idr *idp, void *ptr, int start, int end, gfp_t); int idr_for_each(struct idr *idp, int (*fn)(int id, void *p, void *data), void *data); +bool idr_is_empty(struct idr *idp); #define idr_for_each_entry(idp, entry, id) \ for ((id) = 0; ((entry) = idr_get_next(idp, &(id))) != NULL; ++(id)) @@ -122,7 +123,15 @@ void ida_simple_remove(struct ida *ida, unsigned int i static inline int ida_get_new(struct ida *ida, int *p_id) { + return (ida_get_new_above(ida, 0, p_id)); +} + +static inline bool +ida_is_empty(struct ida *ida) +{ + + return (idr_is_empty(&ida->idr)); } #endif /* _LINUX_IDR_H_ */ From owner-svn-src-head@freebsd.org Wed Dec 5 13:16:40 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C6E6F1311EC9; Wed, 5 Dec 2018 13:16:40 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 656E16D7BB; Wed, 5 Dec 2018 13:16:40 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4680514D5C; Wed, 5 Dec 2018 13:16:40 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5DGeXe063883; Wed, 5 Dec 2018 13:16:40 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5DGdXo063881; Wed, 5 Dec 2018 13:16:39 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051316.wB5DGdXo063881@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:16:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341518 - in head/sys/compat/linuxkpi/common: include/linux src X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: in head/sys/compat/linuxkpi/common: include/linux src X-SVN-Commit-Revision: 341518 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 656E16D7BB X-Spamd-Result: default: False [-0.64 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.52)[-0.521,0]; NEURAL_HAM_LONG(-0.03)[-0.031,0]; NEURAL_HAM_SHORT(-0.09)[-0.090,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:16:41 -0000 Author: slavash Date: Wed Dec 5 13:16:39 2018 New Revision: 341518 URL: https://svnweb.freebsd.org/changeset/base/341518 Log: linuxkpi: Fix for use-after-free when tearing down character devices. Make sure we hold a reference on the character device for every opened file to prevent the character device to be freed prematurely. Submitted by: hselasky@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/cdev.h head/sys/compat/linuxkpi/common/include/linux/fs.h head/sys/compat/linuxkpi/common/src/linux_compat.c Modified: head/sys/compat/linuxkpi/common/include/linux/cdev.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/cdev.h Wed Dec 5 13:15:57 2018 (r341517) +++ head/sys/compat/linuxkpi/common/include/linux/cdev.h Wed Dec 5 13:16:39 2018 (r341518) @@ -36,6 +36,8 @@ #include #include +#include + struct file_operations; struct inode; struct module; @@ -50,6 +52,7 @@ struct linux_cdev { struct cdev *cdev; dev_t dev; const struct file_operations *ops; + atomic_long_t refs; }; static inline void @@ -58,6 +61,7 @@ cdev_init(struct linux_cdev *cdev, const struct file_o kobject_init(&cdev->kobj, &linux_cdev_static_ktype); cdev->ops = ops; + atomic_long_set(&cdev->refs, 0); } static inline struct linux_cdev * @@ -130,13 +134,13 @@ cdev_add_ext(struct linux_cdev *cdev, dev_t dev, uid_t return (0); } +void linux_destroy_dev(struct linux_cdev *); + static inline void cdev_del(struct linux_cdev *cdev) { - if (cdev->cdev) { - destroy_dev(cdev->cdev); - cdev->cdev = NULL; - } + + linux_destroy_dev(cdev); kobject_put(&cdev->kobj); } Modified: head/sys/compat/linuxkpi/common/include/linux/fs.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/fs.h Wed Dec 5 13:15:57 2018 (r341517) +++ head/sys/compat/linuxkpi/common/include/linux/fs.h Wed Dec 5 13:16:39 2018 (r341518) @@ -2,7 +2,7 @@ * Copyright (c) 2010 Isilon Systems, Inc. * Copyright (c) 2010 iX Systems, Inc. * Copyright (c) 2010 Panasas, Inc. - * Copyright (c) 2013-2017 Mellanox Technologies, Ltd. + * Copyright (c) 2013-2018 Mellanox Technologies, Ltd. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -55,6 +55,7 @@ struct vm_area_struct; struct poll_table_struct; struct files_struct; struct pfs_node; +struct linux_cdev; #define inode vnode #define i_cdev v_rdev @@ -105,6 +106,9 @@ struct linux_file { /* protects f_selinfo.si_note */ spinlock_t f_kqlock; struct linux_file_wait_queue f_wait_queue; + + /* pointer to associated character device, if any */ + struct linux_cdev *f_cdev; }; #define file linux_file Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_compat.c Wed Dec 5 13:15:57 2018 (r341517) +++ head/sys/compat/linuxkpi/common/src/linux_compat.c Wed Dec 5 13:16:39 2018 (r341518) @@ -699,12 +699,20 @@ linux_dev_fdopen(struct cdev *dev, int fflags, struct filp->f_flags = file->f_flag; filp->f_vnode = file->f_vnode; filp->_file = file; + filp->f_cdev = ldev; linux_set_current(td); + /* get a reference on the Linux character device */ + if (atomic_long_add_unless(&ldev->refs, 1, -1L) == 0) { + kfree(filp); + return (EINVAL); + } + if (filp->f_op->open) { error = -filp->f_op->open(file->f_vnode, filp); if (error) { + atomic_long_dec(&ldev->refs); kfree(filp); return (error); } @@ -1396,6 +1404,10 @@ linux_file_close(struct file *file, struct thread *td) funsetown(&filp->f_sigio); if (filp->f_vnode != NULL) vdrop(filp->f_vnode); + if (filp->f_cdev != NULL) { + /* put a reference on the Linux character device */ + atomic_long_dec(&filp->f_cdev->refs); + } kfree(filp); return (error); @@ -1947,8 +1959,7 @@ linux_cdev_release(struct kobject *kobj) cdev = container_of(kobj, struct linux_cdev, kobj); parent = kobj->parent; - if (cdev->cdev) - destroy_dev(cdev->cdev); + linux_destroy_dev(cdev); kfree(cdev); kobject_put(parent); } @@ -1961,9 +1972,25 @@ linux_cdev_static_release(struct kobject *kobj) cdev = container_of(kobj, struct linux_cdev, kobj); parent = kobj->parent; - if (cdev->cdev) - destroy_dev(cdev->cdev); + linux_destroy_dev(cdev); kobject_put(parent); +} + +void +linux_destroy_dev(struct linux_cdev *cdev) +{ + + if (cdev->cdev == NULL) + return; + + atomic_long_dec(&cdev->refs); + + /* wait for all open files to be closed */ + while (atomic_long_read(&cdev->refs) != -1L) + pause("ldevdrn", hz); + + destroy_dev(cdev->cdev); + cdev->cdev = NULL; } const struct kobj_type linux_cdev_ktype = { From owner-svn-src-head@freebsd.org Wed Dec 5 13:17:16 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3E8EF1311F2B; Wed, 5 Dec 2018 13:17:16 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DB9B16D939; Wed, 5 Dec 2018 13:17:15 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BD0EF14D5D; Wed, 5 Dec 2018 13:17:15 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5DHFc4063959; Wed, 5 Dec 2018 13:17:15 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5DHFhm063958; Wed, 5 Dec 2018 13:17:15 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051317.wB5DHFhm063958@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:17:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341519 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 341519 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: DB9B16D939 X-Spamd-Result: default: False [-0.71 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; NEURAL_HAM_LONG(-0.07)[-0.072,0]; NEURAL_HAM_SHORT(-0.09)[-0.091,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:17:16 -0000 Author: slavash Date: Wed Dec 5 13:17:15 2018 New Revision: 341519 URL: https://svnweb.freebsd.org/changeset/base/341519 Log: linuxkpi: properly implement netif_carrier_ok(). Submitted by: kib@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/netdevice.h Modified: head/sys/compat/linuxkpi/common/include/linux/netdevice.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/netdevice.h Wed Dec 5 13:16:39 2018 (r341518) +++ head/sys/compat/linuxkpi/common/include/linux/netdevice.h Wed Dec 5 13:17:15 2018 (r341519) @@ -77,7 +77,7 @@ dev_get_by_index(struct vnet *vnet, int if_index) #define netif_running(dev) !!((dev)->if_drv_flags & IFF_DRV_RUNNING) #define netif_oper_up(dev) !!((dev)->if_flags & IFF_UP) -#define netif_carrier_ok(dev) netif_running(dev) +#define netif_carrier_ok(dev) ((dev)->if_link_state == LINK_STATE_UP) static inline void * netdev_priv(const struct net_device *dev) From owner-svn-src-head@freebsd.org Wed Dec 5 13:17:47 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 38F821311FAE; Wed, 5 Dec 2018 13:17:47 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7CCD96DA96; Wed, 5 Dec 2018 13:17:46 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5DEB514D5F; Wed, 5 Dec 2018 13:17:46 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5DHkG0064025; Wed, 5 Dec 2018 13:17:46 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5DHkZ9064024; Wed, 5 Dec 2018 13:17:46 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051317.wB5DHkZ9064024@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:17:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341520 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 341520 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7CCD96DA96 X-Spamd-Result: default: False [-0.71 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; NEURAL_HAM_LONG(-0.07)[-0.072,0]; NEURAL_HAM_SHORT(-0.09)[-0.091,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:17:47 -0000 Author: slavash Date: Wed Dec 5 13:17:45 2018 New Revision: 341520 URL: https://svnweb.freebsd.org/changeset/base/341520 Log: linuxkpi: Really check if PCI is offline Currently we always return false if for PCI offline query. Try to read PCI config, if the return value if 0xffff probably the PCI is offline. Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/pci.h Modified: head/sys/compat/linuxkpi/common/include/linux/pci.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/pci.h Wed Dec 5 13:17:15 2018 (r341519) +++ head/sys/compat/linuxkpi/common/include/linux/pci.h Wed Dec 5 13:17:45 2018 (r341520) @@ -601,9 +601,11 @@ pci_enable_msix_range(struct pci_dev *dev, struct msix return (nvec); } -static inline int pci_channel_offline(struct pci_dev *pdev) +static inline int +pci_channel_offline(struct pci_dev *pdev) { - return false; + + return (pci_get_vendor(pdev->dev.bsddev) == 0xffff); } static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn) From owner-svn-src-head@freebsd.org Wed Dec 5 13:18:21 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5151A1312047; Wed, 5 Dec 2018 13:18:21 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E51EA6DC18; Wed, 5 Dec 2018 13:18:20 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C624114D62; Wed, 5 Dec 2018 13:18:20 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5DIKPC064098; Wed, 5 Dec 2018 13:18:20 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5DIKIE064097; Wed, 5 Dec 2018 13:18:20 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051318.wB5DIKIE064097@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:18:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341521 - head/sys/ofed/drivers/infiniband/core X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 341521 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E51EA6DC18 X-Spamd-Result: default: False [-0.71 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; NEURAL_HAM_SHORT(-0.09)[-0.091,0]; NEURAL_HAM_LONG(-0.07)[-0.072,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:18:21 -0000 Author: slavash Date: Wed Dec 5 13:18:20 2018 New Revision: 341521 URL: https://svnweb.freebsd.org/changeset/base/341521 Log: ibcore: Make sure GID index variable gets initialized. Submitted by: hselasky@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/ofed/drivers/infiniband/core/ib_verbs.c Modified: head/sys/ofed/drivers/infiniband/core/ib_verbs.c ============================================================================== --- head/sys/ofed/drivers/infiniband/core/ib_verbs.c Wed Dec 5 13:17:45 2018 (r341520) +++ head/sys/ofed/drivers/infiniband/core/ib_verbs.c Wed Dec 5 13:18:20 2018 (r341521) @@ -458,7 +458,7 @@ int ib_init_ah_from_wc(struct ib_device *device, u8 po struct ib_ah_attr *ah_attr) { u32 flow_class; - u16 gid_index; + u16 gid_index = 0; int ret; enum rdma_network_type net_type = RDMA_NETWORK_IB; enum ib_gid_type gid_type = IB_GID_TYPE_IB; @@ -524,8 +524,6 @@ int ib_init_ah_from_wc(struct ib_device *device, u8 po &gid_index); if (ret) return ret; - } else { - gid_index = 0; } } From owner-svn-src-head@freebsd.org Wed Dec 5 13:18:51 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CAC9E13120DA; Wed, 5 Dec 2018 13:18:51 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6E1556DD68; Wed, 5 Dec 2018 13:18:51 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4E9AC14D64; Wed, 5 Dec 2018 13:18:51 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5DIpBx064269; Wed, 5 Dec 2018 13:18:51 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5DIpc6064268; Wed, 5 Dec 2018 13:18:51 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051318.wB5DIpc6064268@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:18:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341522 - head/sys/ofed/drivers/infiniband/core X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 341522 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6E1556DD68 X-Spamd-Result: default: False [-0.71 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; NEURAL_HAM_LONG(-0.07)[-0.072,0]; NEURAL_HAM_SHORT(-0.09)[-0.091,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:18:52 -0000 Author: slavash Date: Wed Dec 5 13:18:50 2018 New Revision: 341522 URL: https://svnweb.freebsd.org/changeset/base/341522 Log: ibcore: Discard unused error codes. Submitted by: hselasky@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/ofed/drivers/infiniband/core/ib_iwcm.c Modified: head/sys/ofed/drivers/infiniband/core/ib_iwcm.c ============================================================================== --- head/sys/ofed/drivers/infiniband/core/ib_iwcm.c Wed Dec 5 13:18:20 2018 (r341521) +++ head/sys/ofed/drivers/infiniband/core/ib_iwcm.c Wed Dec 5 13:18:50 2018 (r341522) @@ -308,9 +308,9 @@ int iw_cm_disconnect(struct iw_cm_id *cm_id, int abrup if (qp) { if (abrupt) - ret = iwcm_modify_qp_err(qp); + (void) iwcm_modify_qp_err(qp); else - ret = iwcm_modify_qp_sqd(qp); + (void) iwcm_modify_qp_sqd(qp); /* * If both sides are disconnecting the QP could From owner-svn-src-head@freebsd.org Wed Dec 5 13:19:22 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4C2A1131216C; Wed, 5 Dec 2018 13:19:22 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E3D906DFA6; Wed, 5 Dec 2018 13:19:21 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C56AD14D66; Wed, 5 Dec 2018 13:19:21 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5DJLW1064358; Wed, 5 Dec 2018 13:19:21 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5DJL0d064357; Wed, 5 Dec 2018 13:19:21 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051319.wB5DJL0d064357@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:19:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341523 - head/sys/ofed/drivers/infiniband/core X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 341523 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E3D906DFA6 X-Spamd-Result: default: False [-0.71 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; NEURAL_HAM_SHORT(-0.09)[-0.091,0]; NEURAL_HAM_LONG(-0.07)[-0.072,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:19:22 -0000 Author: slavash Date: Wed Dec 5 13:19:21 2018 New Revision: 341523 URL: https://svnweb.freebsd.org/changeset/base/341523 Log: ibcore: Don't access invalid port. The port number in the listen_id_priv has been observed to be zero which means no port has been selected. The current code lacks a check for invalid port number. Submitted by: hselasky@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/ofed/drivers/infiniband/core/ib_cma.c Modified: head/sys/ofed/drivers/infiniband/core/ib_cma.c ============================================================================== --- head/sys/ofed/drivers/infiniband/core/ib_cma.c Wed Dec 5 13:18:50 2018 (r341522) +++ head/sys/ofed/drivers/infiniband/core/ib_cma.c Wed Dec 5 13:19:21 2018 (r341523) @@ -621,16 +621,19 @@ static int cma_acquire_dev(struct rdma_id_private *id_ if (listen_id_priv) { cma_dev = listen_id_priv->cma_dev; port = listen_id_priv->id.port_num; - gidp = rdma_protocol_roce(cma_dev->device, port) ? - &iboe_gid : &gid; - ret = cma_validate_port(cma_dev->device, port, - rdma_protocol_ib(cma_dev->device, port) ? - IB_GID_TYPE_IB : - listen_id_priv->gid_type, gidp, dev_addr); - if (!ret) { - id_priv->id.port_num = port; - goto out; + if (rdma_is_port_valid(cma_dev->device, port)) { + gidp = rdma_protocol_roce(cma_dev->device, port) ? + &iboe_gid : &gid; + + ret = cma_validate_port(cma_dev->device, port, + rdma_protocol_ib(cma_dev->device, port) ? + IB_GID_TYPE_IB : + listen_id_priv->gid_type, gidp, dev_addr); + if (!ret) { + id_priv->id.port_num = port; + goto out; + } } } From owner-svn-src-head@freebsd.org Wed Dec 5 13:19:53 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 50A501312205; Wed, 5 Dec 2018 13:19:53 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9853D6E115; Wed, 5 Dec 2018 13:19:52 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7A62214D67; Wed, 5 Dec 2018 13:19:52 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5DJq0p064426; Wed, 5 Dec 2018 13:19:52 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5DJqUf064425; Wed, 5 Dec 2018 13:19:52 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051319.wB5DJqUf064425@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:19:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341524 - head/sys/ofed/drivers/infiniband/core X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 341524 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9853D6E115 X-Spamd-Result: default: False [-0.71 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; NEURAL_HAM_LONG(-0.07)[-0.072,0]; NEURAL_HAM_SHORT(-0.09)[-0.091,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:19:53 -0000 Author: slavash Date: Wed Dec 5 13:19:52 2018 New Revision: 341524 URL: https://svnweb.freebsd.org/changeset/base/341524 Log: ibcore: Add support for IB_SPEED_HDR in sysfs rate printout. Submitted by: hselasky@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/ofed/drivers/infiniband/core/ib_sysfs.c Modified: head/sys/ofed/drivers/infiniband/core/ib_sysfs.c ============================================================================== --- head/sys/ofed/drivers/infiniband/core/ib_sysfs.c Wed Dec 5 13:19:21 2018 (r341523) +++ head/sys/ofed/drivers/infiniband/core/ib_sysfs.c Wed Dec 5 13:19:52 2018 (r341524) @@ -258,8 +258,13 @@ static ssize_t rate_show(struct ib_port *p, struct por speed = " EDR"; rate = 250; break; + case IB_SPEED_HDR: + speed = " HDR"; + rate = 500; + break; case IB_SPEED_SDR: default: /* default to SDR for invalid rates */ + speed = " SDR"; rate = 25; break; } From owner-svn-src-head@freebsd.org Wed Dec 5 13:20:23 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AE7BB1312285; Wed, 5 Dec 2018 13:20:23 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 566D76E271; Wed, 5 Dec 2018 13:20:23 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 37B2E14D6B; Wed, 5 Dec 2018 13:20:23 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5DKNen064526; Wed, 5 Dec 2018 13:20:23 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5DKNSK064525; Wed, 5 Dec 2018 13:20:23 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051320.wB5DKNSK064525@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:20:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341525 - head/sys/ofed/drivers/infiniband/core X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 341525 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 566D76E271 X-Spamd-Result: default: False [-0.71 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; NEURAL_HAM_SHORT(-0.09)[-0.091,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.07)[-0.072,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:20:23 -0000 Author: slavash Date: Wed Dec 5 13:20:22 2018 New Revision: 341525 URL: https://svnweb.freebsd.org/changeset/base/341525 Log: ibcore: Check ib_find_pkey() return value. Linux commit: d3a2418ee36a59bc02e9d454723f3175dcf4bfd9 Submitted by: hselasky@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/ofed/drivers/infiniband/core/ib_multicast.c Modified: head/sys/ofed/drivers/infiniband/core/ib_multicast.c ============================================================================== --- head/sys/ofed/drivers/infiniband/core/ib_multicast.c Wed Dec 5 13:19:52 2018 (r341524) +++ head/sys/ofed/drivers/infiniband/core/ib_multicast.c Wed Dec 5 13:20:22 2018 (r341525) @@ -525,8 +525,9 @@ static void join_handler(int status, struct ib_sa_mcme process_join_error(group, status); else { int mgids_changed, is_mgid0; - ib_find_pkey(group->port->dev->device, group->port->port_num, - be16_to_cpu(rec->pkey), &pkey_index); + if (ib_find_pkey(group->port->dev->device, group->port->port_num, + be16_to_cpu(rec->pkey), &pkey_index)) + pkey_index = MCAST_INVALID_PKEY_INDEX; spin_lock_irq(&group->port->lock); if (group->state == MCAST_BUSY && From owner-svn-src-head@freebsd.org Wed Dec 5 13:20:52 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6BBA91312302; Wed, 5 Dec 2018 13:20:52 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 104AE6E414; Wed, 5 Dec 2018 13:20:52 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E70A614D81; Wed, 5 Dec 2018 13:20:51 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5DKpNJ065519; Wed, 5 Dec 2018 13:20:51 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5DKpBP065518; Wed, 5 Dec 2018 13:20:51 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051320.wB5DKpBP065518@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:20:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341526 - head/sys/ofed/drivers/infiniband/core X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 341526 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 104AE6E414 X-Spamd-Result: default: False [-0.76 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; NEURAL_HAM_SHORT(-0.15)[-0.149,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.07)[-0.072,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:20:52 -0000 Author: slavash Date: Wed Dec 5 13:20:51 2018 New Revision: 341526 URL: https://svnweb.freebsd.org/changeset/base/341526 Log: ibcore: Fix an array index check The array ib_mad_mgmt_class_table.method_table has MAX_MGMT_CLASS (80) elements. Hence compare the array index with that value instead of with IB_MGMT_MAX_METHODS (128). This patch avoids that Coverity reports the following: Overrunning array class->method_table of 80 8-byte elements at element index 127 (byte offset 1016) using index convert_mgmt_class(mad_hdr->mgmt_class) (which evaluates to 127). Linux commit: 2fe2f378dd45847d2643638c07a7658822087836 Submitted by: hselasky@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/ofed/drivers/infiniband/core/ib_mad.c Modified: head/sys/ofed/drivers/infiniband/core/ib_mad.c ============================================================================== --- head/sys/ofed/drivers/infiniband/core/ib_mad.c Wed Dec 5 13:20:22 2018 (r341525) +++ head/sys/ofed/drivers/infiniband/core/ib_mad.c Wed Dec 5 13:20:51 2018 (r341526) @@ -1753,7 +1753,7 @@ find_mad_agent(struct ib_mad_port_private *port_priv, if (!class) goto out; if (convert_mgmt_class(mad_hdr->mgmt_class) >= - IB_MGMT_MAX_METHODS) + ARRAY_SIZE(class->method_table)) goto out; method = class->method_table[convert_mgmt_class( mad_hdr->mgmt_class)]; From owner-svn-src-head@freebsd.org Wed Dec 5 13:21:21 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 988C31312362; Wed, 5 Dec 2018 13:21:21 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 40D496E5E6; Wed, 5 Dec 2018 13:21:21 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 234F514E96; Wed, 5 Dec 2018 13:21:21 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5DLLYE065587; Wed, 5 Dec 2018 13:21:21 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5DLLsW065586; Wed, 5 Dec 2018 13:21:21 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051321.wB5DLLsW065586@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:21:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341527 - head/sys/ofed/drivers/infiniband/core X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 341527 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 40D496E5E6 X-Spamd-Result: default: False [-0.76 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; NEURAL_HAM_SHORT(-0.15)[-0.149,0]; NEURAL_HAM_LONG(-0.07)[-0.072,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:21:21 -0000 Author: slavash Date: Wed Dec 5 13:21:20 2018 New Revision: 341527 URL: https://svnweb.freebsd.org/changeset/base/341527 Log: ibcore: Add missing check for failure. Submitted by: hselasky@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/ofed/drivers/infiniband/core/ib_cm.c Modified: head/sys/ofed/drivers/infiniband/core/ib_cm.c ============================================================================== --- head/sys/ofed/drivers/infiniband/core/ib_cm.c Wed Dec 5 13:20:51 2018 (r341526) +++ head/sys/ofed/drivers/infiniband/core/ib_cm.c Wed Dec 5 13:21:20 2018 (r341527) @@ -2908,8 +2908,10 @@ static int cm_lap_handler(struct cm_work *work) cm_init_av_for_response(work->port, work->mad_recv_wc->wc, work->mad_recv_wc->recv_buf.grh, &cm_id_priv->av); - cm_init_av_by_path(param->alternate_path, &cm_id_priv->alt_av, - cm_id_priv); + ret = cm_init_av_by_path(param->alternate_path, &cm_id_priv->alt_av, + cm_id_priv); + if (ret) + goto unlock; ret = atomic_inc_and_test(&cm_id_priv->work_count); if (!ret) list_add_tail(&work->list, &cm_id_priv->work_list); From owner-svn-src-head@freebsd.org Wed Dec 5 13:22:08 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A44321312571; Wed, 5 Dec 2018 13:22:08 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4C47E6E95A; Wed, 5 Dec 2018 13:22:08 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2DCCF14ED6; Wed, 5 Dec 2018 13:22:08 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5DM88f069703; Wed, 5 Dec 2018 13:22:08 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5DM7qP069701; Wed, 5 Dec 2018 13:22:07 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051322.wB5DM7qP069701@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:22:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341528 - head/sys/ofed/drivers/infiniband/core X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 341528 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4C47E6E95A X-Spamd-Result: default: False [-0.69 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.52)[-0.521,0]; NEURAL_HAM_SHORT(-0.14)[-0.143,0]; NEURAL_HAM_LONG(-0.03)[-0.031,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:22:08 -0000 Author: slavash Date: Wed Dec 5 13:22:07 2018 New Revision: 341528 URL: https://svnweb.freebsd.org/changeset/base/341528 Log: ibcore: Always check return value from ib_init_ah_from_wc(). This prevents code from accepting RoCEv1 connections when only ROCEv2 is enabled and vice versa. Linux commit: 0c4386ec77cfcd0ccbdbe8c2e67dd3a49b2a4c7f Submitted by: hselasky@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/ofed/drivers/infiniband/core/ib_cm.c head/sys/ofed/drivers/infiniband/core/ib_user_mad.c Modified: head/sys/ofed/drivers/infiniband/core/ib_cm.c ============================================================================== --- head/sys/ofed/drivers/infiniband/core/ib_cm.c Wed Dec 5 13:21:20 2018 (r341527) +++ head/sys/ofed/drivers/infiniband/core/ib_cm.c Wed Dec 5 13:22:07 2018 (r341528) @@ -390,13 +390,13 @@ static void cm_set_private_data(struct cm_id_private * cm_id_priv->private_data_len = private_data_len; } -static void cm_init_av_for_response(struct cm_port *port, struct ib_wc *wc, - struct ib_grh *grh, struct cm_av *av) +static int cm_init_av_for_response(struct cm_port *port, struct ib_wc *wc, + struct ib_grh *grh, struct cm_av *av) { av->port = port; av->pkey_index = wc->pkey_index; - ib_init_ah_from_wc(port->cm_dev->ib_device, port->port_num, wc, - grh, &av->ah_attr); + return ib_init_ah_from_wc(port->cm_dev->ib_device, port->port_num, wc, + grh, &av->ah_attr); } static int cm_init_av_by_path(struct ib_sa_path_rec *path, struct cm_av *av, @@ -1678,9 +1678,11 @@ static int cm_req_handler(struct cm_work *work) cm_id_priv = container_of(cm_id, struct cm_id_private, id); cm_id_priv->id.remote_id = req_msg->local_comm_id; - cm_init_av_for_response(work->port, work->mad_recv_wc->wc, - work->mad_recv_wc->recv_buf.grh, - &cm_id_priv->av); + ret = cm_init_av_for_response(work->port, work->mad_recv_wc->wc, + work->mad_recv_wc->recv_buf.grh, + &cm_id_priv->av); + if (ret) + goto destroy; cm_id_priv->timewait_info = cm_create_timewait_info(cm_id_priv-> id.local_id); if (IS_ERR(cm_id_priv->timewait_info)) { @@ -2905,9 +2907,11 @@ static int cm_lap_handler(struct cm_work *work) cm_id_priv->id.lap_state = IB_CM_LAP_RCVD; cm_id_priv->tid = lap_msg->hdr.tid; - cm_init_av_for_response(work->port, work->mad_recv_wc->wc, - work->mad_recv_wc->recv_buf.grh, - &cm_id_priv->av); + ret = cm_init_av_for_response(work->port, work->mad_recv_wc->wc, + work->mad_recv_wc->recv_buf.grh, + &cm_id_priv->av); + if (ret) + goto unlock; ret = cm_init_av_by_path(param->alternate_path, &cm_id_priv->alt_av, cm_id_priv); if (ret) @@ -3164,6 +3168,7 @@ static int cm_sidr_req_handler(struct cm_work *work) struct cm_id_private *cm_id_priv, *cur_cm_id_priv; struct cm_sidr_req_msg *sidr_req_msg; struct ib_wc *wc; + int ret; cm_id = ib_create_cm_id(work->port->cm_dev->ib_device, NULL, NULL); if (IS_ERR(cm_id)) @@ -3176,9 +3181,11 @@ static int cm_sidr_req_handler(struct cm_work *work) wc = work->mad_recv_wc->wc; cm_id_priv->av.dgid.global.subnet_prefix = cpu_to_be64(wc->slid); cm_id_priv->av.dgid.global.interface_id = 0; - cm_init_av_for_response(work->port, work->mad_recv_wc->wc, - work->mad_recv_wc->recv_buf.grh, - &cm_id_priv->av); + ret = cm_init_av_for_response(work->port, work->mad_recv_wc->wc, + work->mad_recv_wc->recv_buf.grh, + &cm_id_priv->av); + if (ret) + goto out; cm_id_priv->id.remote_id = sidr_req_msg->request_id; cm_id_priv->tid = sidr_req_msg->hdr.tid; atomic_inc(&cm_id_priv->work_count); Modified: head/sys/ofed/drivers/infiniband/core/ib_user_mad.c ============================================================================== --- head/sys/ofed/drivers/infiniband/core/ib_user_mad.c Wed Dec 5 13:21:20 2018 (r341527) +++ head/sys/ofed/drivers/infiniband/core/ib_user_mad.c Wed Dec 5 13:22:07 2018 (r341528) @@ -240,10 +240,13 @@ static void recv_handler(struct ib_mad_agent *agent, packet->mad.hdr.grh_present = !!(mad_recv_wc->wc->wc_flags & IB_WC_GRH); if (packet->mad.hdr.grh_present) { struct ib_ah_attr ah_attr; + int ret; - ib_init_ah_from_wc(agent->device, agent->port_num, - mad_recv_wc->wc, mad_recv_wc->recv_buf.grh, - &ah_attr); + ret = ib_init_ah_from_wc(agent->device, agent->port_num, + mad_recv_wc->wc, mad_recv_wc->recv_buf.grh, + &ah_attr); + if (ret) + goto err2; packet->mad.hdr.gid_index = ah_attr.grh.sgid_index; packet->mad.hdr.hop_limit = ah_attr.grh.hop_limit; From owner-svn-src-head@freebsd.org Wed Dec 5 13:22:44 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B5C631312616; Wed, 5 Dec 2018 13:22:44 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5CE206EB4C; Wed, 5 Dec 2018 13:22:44 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3F7A014EFC; Wed, 5 Dec 2018 13:22:44 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5DMiJG069772; Wed, 5 Dec 2018 13:22:44 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5DMiUO069771; Wed, 5 Dec 2018 13:22:44 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051322.wB5DMiUO069771@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:22:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341529 - head/sys/ofed/drivers/infiniband/core X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 341529 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5CE206EB4C X-Spamd-Result: default: False [-0.76 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; NEURAL_HAM_LONG(-0.07)[-0.072,0]; NEURAL_HAM_SHORT(-0.15)[-0.149,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:22:44 -0000 Author: slavash Date: Wed Dec 5 13:22:43 2018 New Revision: 341529 URL: https://svnweb.freebsd.org/changeset/base/341529 Log: ibcore: Make sure all VNETs are scanned for VLAN interfaces. The master network interface and the VLANs may reside in different VNETs. Make sure that all VNETs are searched when scanning for GID entries. Submitted by: netapp Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/ofed/drivers/infiniband/core/ib_roce_gid_mgmt.c Modified: head/sys/ofed/drivers/infiniband/core/ib_roce_gid_mgmt.c ============================================================================== --- head/sys/ofed/drivers/infiniband/core/ib_roce_gid_mgmt.c Wed Dec 5 13:22:07 2018 (r341528) +++ head/sys/ofed/drivers/infiniband/core/ib_roce_gid_mgmt.c Wed Dec 5 13:22:43 2018 (r341529) @@ -167,6 +167,7 @@ roce_gid_update_addr_callback(struct ib_device *device #if defined(INET) || defined(INET6) struct ifaddr *ifa; #endif + VNET_ITERATOR_DECL(vnet_iter); struct ib_gid_attr gid_attr; union ib_gid gid; int default_gids; @@ -180,9 +181,11 @@ roce_gid_update_addr_callback(struct ib_device *device /* make sure default GIDs are in */ default_gids = roce_gid_enum_netdev_default(device, port, ndev); - CURVNET_SET(ndev->if_vnet); - IFNET_RLOCK(); - CK_STAILQ_FOREACH(idev, &V_ifnet, if_link) { + VNET_LIST_RLOCK(); + VNET_FOREACH(vnet_iter) { + CURVNET_SET(vnet_iter); + IFNET_RLOCK(); + CK_STAILQ_FOREACH(idev, &V_ifnet, if_link) { if (idev != ndev) { if (idev->if_type != IFT_L2VLAN) continue; @@ -230,9 +233,11 @@ roce_gid_update_addr_callback(struct ib_device *device } #endif IF_ADDR_RUNLOCK(idev); + } + IFNET_RUNLOCK(); + CURVNET_RESTORE(); } - IFNET_RUNLOCK(); - CURVNET_RESTORE(); + VNET_LIST_RUNLOCK(); /* add missing GIDs, if any */ STAILQ_FOREACH(entry, &ipx_head, entry) { From owner-svn-src-head@freebsd.org Wed Dec 5 13:23:15 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 52EAC1312677; Wed, 5 Dec 2018 13:23:15 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ED9BD6EC96; Wed, 5 Dec 2018 13:23:14 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CFD5714EFD; Wed, 5 Dec 2018 13:23:14 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5DNEWp069843; Wed, 5 Dec 2018 13:23:14 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5DNEW0069842; Wed, 5 Dec 2018 13:23:14 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051323.wB5DNEW0069842@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:23:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341530 - head/sys/ofed/drivers/infiniband/core X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 341530 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: ED9BD6EC96 X-Spamd-Result: default: False [-0.69 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.52)[-0.521,0]; NEURAL_HAM_SHORT(-0.14)[-0.143,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.03)[-0.031,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:23:15 -0000 Author: slavash Date: Wed Dec 5 13:23:14 2018 New Revision: 341530 URL: https://svnweb.freebsd.org/changeset/base/341530 Log: ibcore: Fix loopback with rdma-cm. Trying to validate loopback fails because rtalloc1() resolves system local addresses to the loopback network interface, lo0. Fix this by explicitly checking for loopback during validation of the source and destination network address. If the source address belongs to a local network interface and is equal to the destination address, there is no need to run the destination address through rtalloc1(). Submitted by: hselasky@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/ofed/drivers/infiniband/core/ib_cma.c Modified: head/sys/ofed/drivers/infiniband/core/ib_cma.c ============================================================================== --- head/sys/ofed/drivers/infiniband/core/ib_cma.c Wed Dec 5 13:22:43 2018 (r341529) +++ head/sys/ofed/drivers/infiniband/core/ib_cma.c Wed Dec 5 13:23:14 2018 (r341530) @@ -1292,6 +1292,12 @@ static bool validate_ipv4_net_dev(struct net_device *n dev_put(dst_dev); /* + * Check for loopback. + */ + if (saddr == daddr) + return true; + + /* * Make sure the socket address length field * is set, else rtalloc1() will fail. */ @@ -1318,12 +1324,12 @@ static bool validate_ipv6_net_dev(struct net_device *n { #ifdef INET6 struct sockaddr_in6 src_tmp = *src_addr; - struct in6_addr in6_addr = dst_addr->sin6_addr; + struct sockaddr_in6 dst_tmp = *dst_addr; struct net_device *dst_dev; struct rtentry *rte; bool ret; - dst_dev = ip6_dev_find(net_dev->if_vnet, in6_addr); + dst_dev = ip6_dev_find(net_dev->if_vnet, dst_tmp.sin6_addr); if (dst_dev != net_dev) { if (dst_dev != NULL) dev_put(dst_dev); @@ -1345,12 +1351,25 @@ static bool validate_ipv6_net_dev(struct net_device *n src_tmp.sin6_scope_id = net_dev->if_index; sa6_embedscope(&src_tmp, 0); - rte = rtalloc1((struct sockaddr *)&src_tmp, 1, 0); - if (rte != NULL) { - ret = (rte->rt_ifp == net_dev); - RTFREE_LOCKED(rte); + dst_tmp.sin6_scope_id = net_dev->if_index; + sa6_embedscope(&dst_tmp, 0); + + /* + * Check for loopback after scope ID + * has been embedded: + */ + if (memcmp(&src_tmp.sin6_addr, &dst_tmp.sin6_addr, + sizeof(dst_tmp.sin6_addr)) == 0) { + ret = true; } else { - ret = false; + /* non-loopback case */ + rte = rtalloc1((struct sockaddr *)&src_tmp, 1, 0); + if (rte != NULL) { + ret = (rte->rt_ifp == net_dev); + RTFREE_LOCKED(rte); + } else { + ret = false; + } } CURVNET_RESTORE(); return ret; From owner-svn-src-head@freebsd.org Wed Dec 5 13:23:45 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 52C531312713; Wed, 5 Dec 2018 13:23:45 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EDFE36EDC8; Wed, 5 Dec 2018 13:23:44 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D0C7414EFF; Wed, 5 Dec 2018 13:23:44 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5DNiIe069910; Wed, 5 Dec 2018 13:23:44 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5DNiga069909; Wed, 5 Dec 2018 13:23:44 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051323.wB5DNiga069909@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:23:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341531 - head/sys/ofed/drivers/infiniband/core X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 341531 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: EDFE36EDC8 X-Spamd-Result: default: False [-0.76 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; NEURAL_HAM_SHORT(-0.15)[-0.149,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.07)[-0.072,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:23:45 -0000 Author: slavash Date: Wed Dec 5 13:23:44 2018 New Revision: 341531 URL: https://svnweb.freebsd.org/changeset/base/341531 Log: ibcore: Add missing unref of netdevice. Submitted by: hselasky@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/ofed/drivers/infiniband/core/ib_cma.c Modified: head/sys/ofed/drivers/infiniband/core/ib_cma.c ============================================================================== --- head/sys/ofed/drivers/infiniband/core/ib_cma.c Wed Dec 5 13:23:14 2018 (r341530) +++ head/sys/ofed/drivers/infiniband/core/ib_cma.c Wed Dec 5 13:23:44 2018 (r341531) @@ -1335,6 +1335,7 @@ static bool validate_ipv6_net_dev(struct net_device *n dev_put(dst_dev); return false; } + dev_put(dst_dev); CURVNET_SET(net_dev->if_vnet); From owner-svn-src-head@freebsd.org Wed Dec 5 13:24:14 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DEC261312766; Wed, 5 Dec 2018 13:24:13 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 82D046EF0E; Wed, 5 Dec 2018 13:24:13 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4F83214F04; Wed, 5 Dec 2018 13:24:13 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5DODRS070124; Wed, 5 Dec 2018 13:24:13 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5DODRL070123; Wed, 5 Dec 2018 13:24:13 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051324.wB5DODRL070123@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:24:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341532 - head/sys/ofed/drivers/infiniband/core X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 341532 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 82D046EF0E X-Spamd-Result: default: False [-0.69 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.52)[-0.521,0]; NEURAL_HAM_SHORT(-0.14)[-0.143,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.03)[-0.031,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:24:14 -0000 Author: slavash Date: Wed Dec 5 13:24:12 2018 New Revision: 341532 URL: https://svnweb.freebsd.org/changeset/base/341532 Log: ibcore: Fix sleeping in atomic when RoCE is used A couple of places in the CM do spin_lock_irq(&cm_id_priv->lock); ... if (cm_alloc_response_msg(work->port, work->mad_recv_wc, &msg)) However when the underlying transport is RoCE, this leads to a sleeping function being called with the lock held - the callchain is cm_alloc_response_msg() -> ib_create_ah_from_wc() -> ib_init_ah_from_wc() -> rdma_addr_find_l2_eth_by_grh() -> rdma_resolve_ip() and rdma_resolve_ip() starts out by doing req = kzalloc(sizeof *req, GFP_KERNEL); not to mention rdma_addr_find_l2_eth_by_grh() doing wait_for_completion(&ctx.comp); to wait for the task that rdma_resolve_ip() queues up. Fix this by moving the AH creation out of the lock. Linux commit: c76161181193985087cd716fdf69b5cb6cf9ee85 Submitted by: hselasky@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/ofed/drivers/infiniband/core/ib_cm.c Modified: head/sys/ofed/drivers/infiniband/core/ib_cm.c ============================================================================== --- head/sys/ofed/drivers/infiniband/core/ib_cm.c Wed Dec 5 13:23:44 2018 (r341531) +++ head/sys/ofed/drivers/infiniband/core/ib_cm.c Wed Dec 5 13:24:12 2018 (r341532) @@ -332,11 +332,19 @@ out: return ret; } -static int cm_alloc_response_msg(struct cm_port *port, - struct ib_mad_recv_wc *mad_recv_wc, - struct ib_mad_send_buf **msg) +static struct ib_mad_send_buf *cm_alloc_response_msg_no_ah(struct cm_port *port, + struct ib_mad_recv_wc *mad_recv_wc) { - struct ib_mad_send_buf *m; + return ib_create_send_mad(port->mad_agent, 1, mad_recv_wc->wc->pkey_index, + 0, IB_MGMT_MAD_HDR, IB_MGMT_MAD_DATA, + GFP_ATOMIC, + IB_MGMT_BASE_VERSION); +} + +static int cm_create_response_msg_ah(struct cm_port *port, + struct ib_mad_recv_wc *mad_recv_wc, + struct ib_mad_send_buf *msg) +{ struct ib_ah *ah; ah = ib_create_ah_from_wc(port->mad_agent->qp->pd, mad_recv_wc->wc, @@ -344,27 +352,40 @@ static int cm_alloc_response_msg(struct cm_port *port, if (IS_ERR(ah)) return PTR_ERR(ah); - m = ib_create_send_mad(port->mad_agent, 1, mad_recv_wc->wc->pkey_index, - 0, IB_MGMT_MAD_HDR, IB_MGMT_MAD_DATA, - GFP_ATOMIC, - IB_MGMT_BASE_VERSION); - if (IS_ERR(m)) { - ib_destroy_ah(ah); - return PTR_ERR(m); - } - m->ah = ah; - *msg = m; + msg->ah = ah; return 0; } static void cm_free_msg(struct ib_mad_send_buf *msg) { - ib_destroy_ah(msg->ah); + if (msg->ah) + ib_destroy_ah(msg->ah); if (msg->context[0]) cm_deref_id(msg->context[0]); ib_free_send_mad(msg); } +static int cm_alloc_response_msg(struct cm_port *port, + struct ib_mad_recv_wc *mad_recv_wc, + struct ib_mad_send_buf **msg) +{ + struct ib_mad_send_buf *m; + int ret; + + m = cm_alloc_response_msg_no_ah(port, mad_recv_wc); + if (IS_ERR(m)) + return PTR_ERR(m); + + ret = cm_create_response_msg_ah(port, mad_recv_wc, m); + if (ret) { + cm_free_msg(m); + return ret; + } + + *msg = m; + return 0; +} + static void * cm_copy_private_data(const void *private_data, u8 private_data_len) { @@ -2331,7 +2352,8 @@ static int cm_dreq_handler(struct cm_work *work) case IB_CM_TIMEWAIT: atomic_long_inc(&work->port->counter_group[CM_RECV_DUPLICATES]. counter[CM_DREQ_COUNTER]); - if (cm_alloc_response_msg(work->port, work->mad_recv_wc, &msg)) + msg = cm_alloc_response_msg_no_ah(work->port, work->mad_recv_wc); + if (IS_ERR(msg)) goto unlock; cm_format_drep((struct cm_drep_msg *) msg->mad, cm_id_priv, @@ -2339,7 +2361,8 @@ static int cm_dreq_handler(struct cm_work *work) cm_id_priv->private_data_len); spin_unlock_irq(&cm_id_priv->lock); - if (ib_post_send_mad(msg, NULL)) + if (cm_create_response_msg_ah(work->port, work->mad_recv_wc, msg) || + ib_post_send_mad(msg, NULL)) cm_free_msg(msg); goto deref; case IB_CM_DREQ_RCVD: @@ -2884,7 +2907,8 @@ static int cm_lap_handler(struct cm_work *work) case IB_CM_MRA_LAP_SENT: atomic_long_inc(&work->port->counter_group[CM_RECV_DUPLICATES]. counter[CM_LAP_COUNTER]); - if (cm_alloc_response_msg(work->port, work->mad_recv_wc, &msg)) + msg = cm_alloc_response_msg_no_ah(work->port, work->mad_recv_wc); + if (IS_ERR(msg)) goto unlock; cm_format_mra((struct cm_mra_msg *) msg->mad, cm_id_priv, @@ -2894,7 +2918,8 @@ static int cm_lap_handler(struct cm_work *work) cm_id_priv->private_data_len); spin_unlock_irq(&cm_id_priv->lock); - if (ib_post_send_mad(msg, NULL)) + if (cm_create_response_msg_ah(work->port, work->mad_recv_wc, msg) || + ib_post_send_mad(msg, NULL)) cm_free_msg(msg); goto deref; case IB_CM_LAP_RCVD: From owner-svn-src-head@freebsd.org Wed Dec 5 13:24:44 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 931F013127F2; Wed, 5 Dec 2018 13:24:44 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 354716F0FA; Wed, 5 Dec 2018 13:24:44 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 163EE14F05; Wed, 5 Dec 2018 13:24:44 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5DOhau070192; Wed, 5 Dec 2018 13:24:43 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5DOhla070190; Wed, 5 Dec 2018 13:24:43 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051324.wB5DOhla070190@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:24:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341533 - in head/sys: compat/linuxkpi/common/include/linux ofed/drivers/infiniband/core X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: in head/sys: compat/linuxkpi/common/include/linux ofed/drivers/infiniband/core X-SVN-Commit-Revision: 341533 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 354716F0FA X-Spamd-Result: default: False [-0.69 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.52)[-0.521,0]; NEURAL_HAM_SHORT(-0.14)[-0.143,0]; NEURAL_HAM_LONG(-0.03)[-0.031,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:24:44 -0000 Author: slavash Date: Wed Dec 5 13:24:43 2018 New Revision: 341533 URL: https://svnweb.freebsd.org/changeset/base/341533 Log: ibcore: ip6_dev_find() needs to know the scope ID. Else the wrong network device can be returned for link-local addresses. Submitted by: hselasky@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/inetdevice.h head/sys/ofed/drivers/infiniband/core/ib_addr.c head/sys/ofed/drivers/infiniband/core/ib_cma.c Modified: head/sys/compat/linuxkpi/common/include/linux/inetdevice.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/inetdevice.h Wed Dec 5 13:24:12 2018 (r341532) +++ head/sys/compat/linuxkpi/common/include/linux/inetdevice.h Wed Dec 5 13:24:43 2018 (r341533) @@ -59,37 +59,32 @@ ip_dev_find(struct vnet *vnet, uint32_t addr) } static inline struct net_device * -ip6_dev_find(struct vnet *vnet, struct in6_addr addr) +ip6_dev_find(struct vnet *vnet, struct in6_addr addr, uint16_t scope_id) { struct sockaddr_in6 sin6; - struct ifaddr *ifa = NULL; - struct ifnet *ifp = NULL; - int x; + struct ifaddr *ifa; + struct ifnet *ifp; memset(&sin6, 0, sizeof(sin6)); sin6.sin6_addr = addr; sin6.sin6_len = sizeof(sin6); sin6.sin6_family = AF_INET6; - NET_EPOCH_ENTER(); - CURVNET_SET_QUIET(vnet); if (IN6_IS_SCOPE_LINKLOCAL(&addr) || IN6_IS_ADDR_MC_INTFACELOCAL(&addr)) { - /* XXX need to search all scope ID's */ - for (x = 0; x <= V_if_index && x < 65536; x++) { - sin6.sin6_addr.s6_addr16[1] = htons(x); - ifa = ifa_ifwithaddr((struct sockaddr *)&sin6); - if (ifa != NULL) - break; - } - } else { - ifa = ifa_ifwithaddr((struct sockaddr *)&sin6); + /* embed the IPv6 scope ID */ + sin6.sin6_addr.s6_addr16[1] = htons(scope_id); } + NET_EPOCH_ENTER(); + CURVNET_SET_QUIET(vnet); + ifa = ifa_ifwithaddr((struct sockaddr *)&sin6); + CURVNET_RESTORE(); if (ifa != NULL) { ifp = ifa->ifa_ifp; if_ref(ifp); + } else { + ifp = NULL; } NET_EPOCH_EXIT(); - CURVNET_RESTORE(); return (ifp); } Modified: head/sys/ofed/drivers/infiniband/core/ib_addr.c ============================================================================== --- head/sys/ofed/drivers/infiniband/core/ib_addr.c Wed Dec 5 13:24:12 2018 (r341532) +++ head/sys/ofed/drivers/infiniband/core/ib_addr.c Wed Dec 5 13:24:43 2018 (r341533) @@ -185,7 +185,7 @@ int rdma_translate_ip(const struct sockaddr *addr, #ifdef INET6 case AF_INET6: dev = ip6_dev_find(dev_addr->net, - ((const struct sockaddr_in6 *)addr)->sin6_addr); + ((const struct sockaddr_in6 *)addr)->sin6_addr, 0); break; #endif default: @@ -525,7 +525,7 @@ static int addr6_resolve(struct sockaddr_in6 *src_in, if (addr->bound_dev_if != 0) { ifp = dev_get_by_index(addr->net, addr->bound_dev_if); } else { - ifp = ip6_dev_find(addr->net, src_in->sin6_addr); + ifp = ip6_dev_find(addr->net, src_in->sin6_addr, 0); } /* check source interface */ Modified: head/sys/ofed/drivers/infiniband/core/ib_cma.c ============================================================================== --- head/sys/ofed/drivers/infiniband/core/ib_cma.c Wed Dec 5 13:24:12 2018 (r341532) +++ head/sys/ofed/drivers/infiniband/core/ib_cma.c Wed Dec 5 13:24:43 2018 (r341533) @@ -1329,7 +1329,8 @@ static bool validate_ipv6_net_dev(struct net_device *n struct rtentry *rte; bool ret; - dst_dev = ip6_dev_find(net_dev->if_vnet, dst_tmp.sin6_addr); + dst_dev = ip6_dev_find(net_dev->if_vnet, dst_tmp.sin6_addr, + net_dev->if_index); if (dst_dev != net_dev) { if (dst_dev != NULL) dev_put(dst_dev); From owner-svn-src-head@freebsd.org Wed Dec 5 13:25:14 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A9F1C131286F; Wed, 5 Dec 2018 13:25:14 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 740726F277; Wed, 5 Dec 2018 13:25:14 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 553A314F08; Wed, 5 Dec 2018 13:25:14 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5DPEpp070270; Wed, 5 Dec 2018 13:25:14 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5DPEgK070269; Wed, 5 Dec 2018 13:25:14 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051325.wB5DPEgK070269@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:25:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341534 - head/sys/ofed/drivers/infiniband/core X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 341534 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 740726F277 X-Spamd-Result: default: False [-0.76 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; NEURAL_HAM_SHORT(-0.15)[-0.149,0]; NEURAL_HAM_LONG(-0.07)[-0.072,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:25:14 -0000 Author: slavash Date: Wed Dec 5 13:25:13 2018 New Revision: 341534 URL: https://svnweb.freebsd.org/changeset/base/341534 Log: ibcore: Fix clearing of bound device interface. Binding to a loopback device is not allowed. Make sure the destination device address is global by clearing the bound device interface. Only do this conditionally, else link local addresses won't work. Submitted by: hselasky@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/ofed/drivers/infiniband/core/ib_addr.c Modified: head/sys/ofed/drivers/infiniband/core/ib_addr.c ============================================================================== --- head/sys/ofed/drivers/infiniband/core/ib_addr.c Wed Dec 5 13:24:43 2018 (r341533) +++ head/sys/ofed/drivers/infiniband/core/ib_addr.c Wed Dec 5 13:25:13 2018 (r341534) @@ -649,8 +649,13 @@ static int addr_resolve_neigh(struct ifnet *dev, if (dev->if_flags & IFF_LOOPBACK) { int ret; - /* find real device, not loopback one */ - addr->bound_dev_if = 0; + /* + * Binding to a loopback device is not allowed. Make + * sure the destination device address is global by + * clearing the bound device interface: + */ + if (addr->bound_dev_if == dev->if_index) + addr->bound_dev_if = 0; ret = rdma_translate_ip(dst_in, addr); if (ret == 0) { From owner-svn-src-head@freebsd.org Wed Dec 5 13:25:49 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D3D72131292E; Wed, 5 Dec 2018 13:25:48 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7850E6F3C5; Wed, 5 Dec 2018 13:25:48 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5AF5114F0B; Wed, 5 Dec 2018 13:25:48 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5DPmsA070341; Wed, 5 Dec 2018 13:25:48 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5DPlBI070338; Wed, 5 Dec 2018 13:25:47 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051325.wB5DPlBI070338@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:25:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341535 - head/sys/ofed/drivers/infiniband/ulp/ipoib X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/sys/ofed/drivers/infiniband/ulp/ipoib X-SVN-Commit-Revision: 341535 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7850E6F3C5 X-Spamd-Result: default: False [-0.69 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.52)[-0.521,0]; NEURAL_HAM_SHORT(-0.14)[-0.143,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.03)[-0.031,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:25:49 -0000 Author: slavash Date: Wed Dec 5 13:25:47 2018 New Revision: 341535 URL: https://svnweb.freebsd.org/changeset/base/341535 Log: ipoib: correct setting MTU from inside ipoib(4). It is not enough to set ifnet->if_mtu to change the interface MTU. System saves the MTU for route in the radix tree, and route cache keeps the interface MTU as well. Since addition of the multicast group causes recalculation of MTU, even bringing the interface up changes MTU from 4042 to 1500, which makes the system configuration inconsistent. Worse, ip_output() prefers route MTU over interface MTU, so large packets are not fragmented and dropped on floor. Fix it for ipoib(4) using the same approach (or hack) as was applied for it_tun/if_tap in r339012. Thanks to bz@ for giving the hint. Submitted by: kib@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_multicast.c Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h ============================================================================== --- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h Wed Dec 5 13:25:13 2018 (r341534) +++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h Wed Dec 5 13:25:47 2018 (r341535) @@ -518,7 +518,7 @@ void ipoib_path_iter_read(struct ipoib_path_iter *iter struct ipoib_path *path); #endif -int ipoib_change_mtu(struct ipoib_dev_priv *priv, int new_mtu); +int ipoib_change_mtu(struct ipoib_dev_priv *priv, int new_mtu, bool propagate); int ipoib_mcast_attach(struct ipoib_dev_priv *priv, u16 mlid, union ib_gid *mgid, int set_qkey); Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c ============================================================================== --- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Wed Dec 5 13:25:13 2018 (r341534) +++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Wed Dec 5 13:25:47 2018 (r341535) @@ -257,10 +257,34 @@ ipoib_stop(struct ipoib_dev_priv *priv) return 0; } +static int +ipoib_propagate_ifnet_mtu(struct ipoib_dev_priv *priv, int new_mtu, + bool propagate) +{ + struct ifnet *ifp; + struct ifreq ifr; + int error; + + ifp = priv->dev; + if (ifp->if_mtu == new_mtu) + return (0); + if (propagate) { + strlcpy(ifr.ifr_name, if_name(ifp), IFNAMSIZ); + ifr.ifr_mtu = new_mtu; + CURVNET_SET(ifp->if_vnet); + error = ifhwioctl(SIOCSIFMTU, ifp, (caddr_t)&ifr, curthread); + CURVNET_RESTORE(); + } else { + ifp->if_mtu = new_mtu; + error = 0; + } + return (error); +} + int -ipoib_change_mtu(struct ipoib_dev_priv *priv, int new_mtu) +ipoib_change_mtu(struct ipoib_dev_priv *priv, int new_mtu, bool propagate) { - struct ifnet *dev = priv->dev; + int error, prev_admin_mtu; /* dev->if_mtu > 2K ==> connected mode */ if (ipoib_cm_admin_enabled(priv)) { @@ -271,20 +295,21 @@ ipoib_change_mtu(struct ipoib_dev_priv *priv, int new_ ipoib_warn(priv, "mtu > %d will cause multicast packet drops.\n", priv->mcast_mtu); - dev->if_mtu = new_mtu; - return 0; + return (ipoib_propagate_ifnet_mtu(priv, new_mtu, propagate)); } if (new_mtu > IPOIB_UD_MTU(priv->max_ib_mtu)) return -EINVAL; + prev_admin_mtu = priv->admin_mtu; priv->admin_mtu = new_mtu; - - dev->if_mtu = min(priv->mcast_mtu, priv->admin_mtu); - - queue_work(ipoib_workqueue, &priv->flush_light); - - return 0; + error = ipoib_propagate_ifnet_mtu(priv, min(priv->mcast_mtu, + priv->admin_mtu), propagate); + if (error == 0) + queue_work(ipoib_workqueue, &priv->flush_light); + else + priv->admin_mtu = prev_admin_mtu; + return (error); } static int @@ -338,7 +363,7 @@ ipoib_ioctl(struct ifnet *ifp, u_long command, caddr_t /* * Set the interface MTU. */ - error = -ipoib_change_mtu(priv, ifr->ifr_mtu); + error = -ipoib_change_mtu(priv, ifr->ifr_mtu, false); break; default: error = EINVAL; Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_multicast.c ============================================================================== --- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_multicast.c Wed Dec 5 13:25:13 2018 (r341534) +++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_multicast.c Wed Dec 5 13:25:47 2018 (r341535) @@ -564,7 +564,8 @@ void ipoib_mcast_join_task(struct work_struct *work) spin_unlock_irq(&priv->lock); if (!ipoib_cm_admin_enabled(priv)) - ipoib_change_mtu(priv, min(priv->mcast_mtu, priv->admin_mtu)); + ipoib_change_mtu(priv, min(priv->mcast_mtu, priv->admin_mtu), + true); ipoib_dbg_mcast(priv, "successfully joined all multicast groups\n"); From owner-svn-src-head@freebsd.org Wed Dec 5 13:26:18 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5DD381312995; Wed, 5 Dec 2018 13:26:18 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 011D36F52B; Wed, 5 Dec 2018 13:26:18 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D3C7B14F0C; Wed, 5 Dec 2018 13:26:17 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5DQHIa070411; Wed, 5 Dec 2018 13:26:17 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5DQHs5070410; Wed, 5 Dec 2018 13:26:17 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051326.wB5DQHs5070410@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:26:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341536 - head/sys/ofed/drivers/infiniband/ulp/ipoib X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/sys/ofed/drivers/infiniband/ulp/ipoib X-SVN-Commit-Revision: 341536 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 011D36F52B X-Spamd-Result: default: False [-0.76 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; NEURAL_HAM_SHORT(-0.15)[-0.149,0]; NEURAL_HAM_LONG(-0.07)[-0.072,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:26:18 -0000 Author: slavash Date: Wed Dec 5 13:26:17 2018 New Revision: 341536 URL: https://svnweb.freebsd.org/changeset/base/341536 Log: ipoib: Don't do a light flush when MTU is unchanged. When changing the MTU of ibX network interfaces, check that the MTU was really changed before requesting an update of the multicast rules. Else we might go into an infinite loop joining and leaving ibX multicast groups towards the opensm master interface. Submitted by: hselasky@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c ============================================================================== --- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Wed Dec 5 13:25:47 2018 (r341535) +++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Wed Dec 5 13:26:17 2018 (r341536) @@ -305,9 +305,11 @@ ipoib_change_mtu(struct ipoib_dev_priv *priv, int new_ priv->admin_mtu = new_mtu; error = ipoib_propagate_ifnet_mtu(priv, min(priv->mcast_mtu, priv->admin_mtu), propagate); - if (error == 0) - queue_work(ipoib_workqueue, &priv->flush_light); - else + if (error == 0) { + /* check for MTU change to avoid infinite loop */ + if (prev_admin_mtu != new_mtu) + queue_work(ipoib_workqueue, &priv->flush_light); + } else priv->admin_mtu = prev_admin_mtu; return (error); } From owner-svn-src-head@freebsd.org Wed Dec 5 13:26:48 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4D8CD1312A3D; Wed, 5 Dec 2018 13:26:48 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D8D616F66D; Wed, 5 Dec 2018 13:26:47 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B9EA714F0F; Wed, 5 Dec 2018 13:26:47 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5DQliU070477; Wed, 5 Dec 2018 13:26:47 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5DQljK070476; Wed, 5 Dec 2018 13:26:47 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051326.wB5DQljK070476@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:26:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341537 - head/sys/ofed/drivers/infiniband/ulp/ipoib X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/sys/ofed/drivers/infiniband/ulp/ipoib X-SVN-Commit-Revision: 341537 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D8D616F66D X-Spamd-Result: default: False [-0.76 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; NEURAL_HAM_LONG(-0.07)[-0.072,0]; NEURAL_HAM_SHORT(-0.15)[-0.149,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:26:48 -0000 Author: slavash Date: Wed Dec 5 13:26:47 2018 New Revision: 341537 URL: https://svnweb.freebsd.org/changeset/base/341537 Log: ipoib: increase the non-cm queue length When a packet needs fragmentation, it might generate more than 3 fragments. With the queue length 3, all fragments are generated faster than the queue is drained, which effectively drops fourth and later fragments on the floor. Submitted by: kib@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h ============================================================================== --- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h Wed Dec 5 13:26:17 2018 (r341536) +++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h Wed Dec 5 13:26:47 2018 (r341537) @@ -133,8 +133,8 @@ enum { IPOIB_NUM_WC = 4, - IPOIB_MAX_PATH_REC_QUEUE = 3, - IPOIB_MAX_MCAST_QUEUE = 3, + IPOIB_MAX_PATH_REC_QUEUE = 16, + IPOIB_MAX_MCAST_QUEUE = 16, IPOIB_FLAG_OPER_UP = 0, IPOIB_FLAG_INITIALIZED = 1, From owner-svn-src-head@freebsd.org Wed Dec 5 13:27:18 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8BC381312AAC; Wed, 5 Dec 2018 13:27:18 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 30FBC6F809; Wed, 5 Dec 2018 13:27:18 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 13BF114F10; Wed, 5 Dec 2018 13:27:18 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5DRHxO070547; Wed, 5 Dec 2018 13:27:17 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5DRHmT070546; Wed, 5 Dec 2018 13:27:17 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051327.wB5DRHmT070546@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:27:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341538 - head/sys/ofed/drivers/infiniband/ulp/ipoib X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/sys/ofed/drivers/infiniband/ulp/ipoib X-SVN-Commit-Revision: 341538 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 30FBC6F809 X-Spamd-Result: default: False [-0.76 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; NEURAL_HAM_SHORT(-0.15)[-0.149,0]; NEURAL_HAM_LONG(-0.07)[-0.072,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:27:18 -0000 Author: slavash Date: Wed Dec 5 13:27:17 2018 New Revision: 341538 URL: https://svnweb.freebsd.org/changeset/base/341538 Log: ipoib: Notify on modify QP failure only when relevant Modify QP can fail and it can be acceptable, like when moving from RST to ERR state, all the rest are not acceptable and a message to the log should be printed. The current code prints on all failures and many messages like: "Failed to modify QP to ERROR state" appear, even when supported by the state machine of the QP object. Linux commit: 5dc78ad1904db597bdb4427f3ead437aae86f54c Submitted by: hselasky@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c ============================================================================== --- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c Wed Dec 5 13:26:47 2018 (r341537) +++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c Wed Dec 5 13:27:17 2018 (r341538) @@ -710,6 +710,30 @@ static int recvs_pending(struct ipoib_dev_priv *priv) return pending; } +static void check_qp_movement_and_print(struct ipoib_dev_priv *priv, + struct ib_qp *qp, + enum ib_qp_state new_state) +{ + struct ib_qp_attr qp_attr; + struct ib_qp_init_attr query_init_attr; + int ret; + + ret = ib_query_qp(qp, &qp_attr, IB_QP_STATE, &query_init_attr); + if (ret) { + ipoib_warn(priv, "%s: Failed to query QP (%d)\n", __func__, ret); + return; + } + + /* print according to the new-state and the previous state */ + if (new_state == IB_QPS_ERR && qp_attr.qp_state == IB_QPS_RESET) { + ipoib_dbg(priv, "Failed to modify QP %d->%d, acceptable\n", + qp_attr.qp_state, new_state); + } else { + ipoib_warn(priv, "Failed to modify QP %d->%d\n", + qp_attr.qp_state, new_state); + } +} + void ipoib_drain_cq(struct ipoib_dev_priv *priv) { int i, n; @@ -761,7 +785,7 @@ int ipoib_ib_dev_stop(struct ipoib_dev_priv *priv, int */ qp_attr.qp_state = IB_QPS_ERR; if (ib_modify_qp(priv->qp, &qp_attr, IB_QP_STATE)) - ipoib_warn(priv, "Failed to modify QP to ERROR state\n"); + check_qp_movement_and_print(priv, priv->qp, IB_QPS_ERR); /* Wait for all sends and receives to complete */ begin = jiffies; From owner-svn-src-head@freebsd.org Wed Dec 5 13:27:49 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7CAD51312B34; Wed, 5 Dec 2018 13:27:49 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 234576F99C; Wed, 5 Dec 2018 13:27:49 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 059AF14F13; Wed, 5 Dec 2018 13:27:49 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5DRmOM070613; Wed, 5 Dec 2018 13:27:48 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5DRmic070612; Wed, 5 Dec 2018 13:27:48 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051327.wB5DRmic070612@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:27:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341539 - head/sys/contrib/rdma/krping X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/sys/contrib/rdma/krping X-SVN-Commit-Revision: 341539 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 234576F99C X-Spamd-Result: default: False [-0.76 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; NEURAL_HAM_LONG(-0.07)[-0.072,0]; NEURAL_HAM_SHORT(-0.15)[-0.149,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:27:49 -0000 Author: slavash Date: Wed Dec 5 13:27:48 2018 New Revision: 341539 URL: https://svnweb.freebsd.org/changeset/base/341539 Log: krping: Fix for memory leak in error case. Submitted by: hselasky@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/contrib/rdma/krping/krping_dev.c Modified: head/sys/contrib/rdma/krping/krping_dev.c ============================================================================== --- head/sys/contrib/rdma/krping/krping_dev.c Wed Dec 5 13:27:17 2018 (r341538) +++ head/sys/contrib/rdma/krping/krping_dev.c Wed Dec 5 13:27:48 2018 (r341539) @@ -187,7 +187,7 @@ krping_write(struct cdev *dev, struct uio *uio, int io err = uiomove(cp, amt, uio); if (err) { uprintf("Write failed: bad address!\n"); - return err; + goto done; } cp += amt; remain -= amt; @@ -195,7 +195,8 @@ krping_write(struct cdev *dev, struct uio *uio, int io if (uio->uio_resid != 0) { uprintf("Message too big. max size is %d!\n", BUFFERSIZE); - return EMSGSIZE; + err = EMSGSIZE; + goto done; } /* null terminate and remove the \n */ @@ -204,6 +205,7 @@ krping_write(struct cdev *dev, struct uio *uio, int io krpingmsg->len = (unsigned long)(cp - krpingmsg->msg); uprintf("krping: write string = |%s|\n", krpingmsg->msg); err = krping_doit(krpingmsg->msg); +done: free(krpingmsg, M_DEVBUF); return(err); } From owner-svn-src-head@freebsd.org Wed Dec 5 13:28:18 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 34FB71312BC4; Wed, 5 Dec 2018 13:28:18 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C151A6FB16; Wed, 5 Dec 2018 13:28:17 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A28D614F14; Wed, 5 Dec 2018 13:28:17 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5DSHXI070685; Wed, 5 Dec 2018 13:28:17 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5DSHqm070684; Wed, 5 Dec 2018 13:28:17 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051328.wB5DSHqm070684@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:28:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341540 - head/contrib/ofed/libibverbs X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/contrib/ofed/libibverbs X-SVN-Commit-Revision: 341540 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C151A6FB16 X-Spamd-Result: default: False [-0.76 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; NEURAL_HAM_LONG(-0.07)[-0.072,0]; NEURAL_HAM_SHORT(-0.15)[-0.149,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:28:18 -0000 Author: slavash Date: Wed Dec 5 13:28:17 2018 New Revision: 341540 URL: https://svnweb.freebsd.org/changeset/base/341540 Log: libibverbs: Fix memory leak in ibv_read_sysfs_file(). Testing packetdrill using valgrind resulted in finding a memory leak in ibv_read_sysfs_file(). The attached patch fixes it. Submitted by: tuexen@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/contrib/ofed/libibverbs/sysfs.c Modified: head/contrib/ofed/libibverbs/sysfs.c ============================================================================== --- head/contrib/ofed/libibverbs/sysfs.c Wed Dec 5 13:27:48 2018 (r341539) +++ head/contrib/ofed/libibverbs/sysfs.c Wed Dec 5 13:28:17 2018 (r341540) @@ -79,7 +79,7 @@ int ibv_read_sysfs_file(const char *dir, const char *f char *buf, size_t size) { char *path, *s; - int fd; + int ret; size_t len; if (asprintf(&path, "%s/%s", dir, file) < 0) @@ -89,11 +89,12 @@ int ibv_read_sysfs_file(const char *dir, const char *f if (*s == '/') *s = '.'; - len = size; - if (sysctlbyname(&path[1], buf, &len, NULL, 0) == -1) - return -1; - + len = size; + ret = sysctlbyname(&path[1], buf, &len, NULL, 0); free(path); + + if (ret == -1) + return -1; if (len > 0 && buf[len - 1] == '\n') buf[--len] = '\0'; From owner-svn-src-head@freebsd.org Wed Dec 5 13:28:47 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0AC1F1312C5F; Wed, 5 Dec 2018 13:28:47 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A66A46FC90; Wed, 5 Dec 2018 13:28:46 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8807214F16; Wed, 5 Dec 2018 13:28:46 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5DSknW070751; Wed, 5 Dec 2018 13:28:46 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5DSklg070750; Wed, 5 Dec 2018 13:28:46 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051328.wB5DSklg070750@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:28:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341541 - head/contrib/ofed/opensm/opensm X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/contrib/ofed/opensm/opensm X-SVN-Commit-Revision: 341541 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A66A46FC90 X-Spamd-Result: default: False [-0.76 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; NEURAL_HAM_SHORT(-0.15)[-0.149,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.07)[-0.072,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:28:47 -0000 Author: slavash Date: Wed Dec 5 13:28:46 2018 New Revision: 341541 URL: https://svnweb.freebsd.org/changeset/base/341541 Log: opensm: Use precision specifier for scanf If user input a string larger than the length of buffer, the stack memory will be corrupted. Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/contrib/ofed/opensm/opensm/main.c Modified: head/contrib/ofed/opensm/opensm/main.c ============================================================================== --- head/contrib/ofed/opensm/opensm/main.c Wed Dec 5 13:28:17 2018 (r341540) +++ head/contrib/ofed/opensm/opensm/main.c Wed Dec 5 13:28:46 2018 (r341541) @@ -492,7 +492,7 @@ static ib_net64_t get_port_guid(IN osm_opensm_t * p_os fflush(stdout); if (scanf("%u", &choice) <= 0) { char junk[128]; - if (scanf("%s", junk) <= 0) + if (scanf("%127s", junk) <= 0) printf("\nError: Cannot scan!\n"); } else if (choice == 0) return 0; From owner-svn-src-head@freebsd.org Wed Dec 5 13:29:17 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C141B1312CED; Wed, 5 Dec 2018 13:29:17 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6813D6FE4F; Wed, 5 Dec 2018 13:29:17 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 493AF14F19; Wed, 5 Dec 2018 13:29:17 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5DTHWH070821; Wed, 5 Dec 2018 13:29:17 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5DTHNm070820; Wed, 5 Dec 2018 13:29:17 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051329.wB5DTHNm070820@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:29:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341542 - head/sys/dev/mlx4/mlx4_core X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/sys/dev/mlx4/mlx4_core X-SVN-Commit-Revision: 341542 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6813D6FE4F X-Spamd-Result: default: False [-0.76 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; NEURAL_HAM_SHORT(-0.15)[-0.149,0]; NEURAL_HAM_LONG(-0.07)[-0.072,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:29:17 -0000 Author: slavash Date: Wed Dec 5 13:29:16 2018 New Revision: 341542 URL: https://svnweb.freebsd.org/changeset/base/341542 Log: mlx4core: Avoid multiplication overflow by casting multiplication. Submitted by: hselasky@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx4/mlx4_core/mlx4_icm.c Modified: head/sys/dev/mlx4/mlx4_core/mlx4_icm.c ============================================================================== --- head/sys/dev/mlx4/mlx4_core/mlx4_icm.c Wed Dec 5 13:28:46 2018 (r341541) +++ head/sys/dev/mlx4/mlx4_core/mlx4_icm.c Wed Dec 5 13:29:16 2018 (r341542) @@ -411,7 +411,7 @@ int mlx4_init_icm_table(struct mlx4_dev *dev, struct m size = (u64) nobj * obj_size; for (i = 0; i * MLX4_TABLE_CHUNK_SIZE < reserved * obj_size; ++i) { chunk_size = MLX4_TABLE_CHUNK_SIZE; - if ((i + 1) * MLX4_TABLE_CHUNK_SIZE > size) + if ((u64) (i + 1) * MLX4_TABLE_CHUNK_SIZE > size) chunk_size = PAGE_ALIGN(size - i * MLX4_TABLE_CHUNK_SIZE); From owner-svn-src-head@freebsd.org Wed Dec 5 13:29:47 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B41671312D8C; Wed, 5 Dec 2018 13:29:47 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5A5C56FFB6; Wed, 5 Dec 2018 13:29:47 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3D15114F1C; Wed, 5 Dec 2018 13:29:47 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5DTlvm070887; Wed, 5 Dec 2018 13:29:47 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5DTlX7070886; Wed, 5 Dec 2018 13:29:47 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051329.wB5DTlX7070886@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:29:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341543 - head/sys/dev/mlx4/mlx4_core X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/sys/dev/mlx4/mlx4_core X-SVN-Commit-Revision: 341543 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5A5C56FFB6 X-Spamd-Result: default: False [-0.76 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; NEURAL_HAM_SHORT(-0.15)[-0.149,0]; NEURAL_HAM_LONG(-0.07)[-0.072,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:29:47 -0000 Author: slavash Date: Wed Dec 5 13:29:46 2018 New Revision: 341543 URL: https://svnweb.freebsd.org/changeset/base/341543 Log: mlx4: Zero initialize device capabilities to avoid use of uninitialized fields. Submitted by: hselasky@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx4/mlx4_core/mlx4_main.c Modified: head/sys/dev/mlx4/mlx4_core/mlx4_main.c ============================================================================== --- head/sys/dev/mlx4/mlx4_core/mlx4_main.c Wed Dec 5 13:29:16 2018 (r341542) +++ head/sys/dev/mlx4/mlx4_core/mlx4_main.c Wed Dec 5 13:29:46 2018 (r341543) @@ -2208,7 +2208,7 @@ static int mlx4_init_hca(struct mlx4_dev *dev) { struct mlx4_priv *priv = mlx4_priv(dev); struct mlx4_adapter adapter; - struct mlx4_dev_cap dev_cap; + struct mlx4_dev_cap dev_cap = {}; struct mlx4_profile profile; struct mlx4_init_hca_param init_hca; u64 icm_size; From owner-svn-src-head@freebsd.org Wed Dec 5 13:30:17 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B18EF1312E05; Wed, 5 Dec 2018 13:30:17 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 558C570103; Wed, 5 Dec 2018 13:30:17 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3697F14F22; Wed, 5 Dec 2018 13:30:17 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5DUHNC070985; Wed, 5 Dec 2018 13:30:17 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5DUHdk070984; Wed, 5 Dec 2018 13:30:17 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051330.wB5DUHdk070984@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:30:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341544 - head/sys/dev/mlx4/mlx4_core X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/sys/dev/mlx4/mlx4_core X-SVN-Commit-Revision: 341544 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 558C570103 X-Spamd-Result: default: False [-0.76 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; NEURAL_HAM_SHORT(-0.15)[-0.149,0]; NEURAL_HAM_LONG(-0.07)[-0.072,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:30:17 -0000 Author: slavash Date: Wed Dec 5 13:30:16 2018 New Revision: 341544 URL: https://svnweb.freebsd.org/changeset/base/341544 Log: mlx4core: Add checks for invalid port numbers. Submitted by: hselasky@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx4/mlx4_core/mlx4_cmd.c Modified: head/sys/dev/mlx4/mlx4_core/mlx4_cmd.c ============================================================================== --- head/sys/dev/mlx4/mlx4_core/mlx4_cmd.c Wed Dec 5 13:29:46 2018 (r341543) +++ head/sys/dev/mlx4/mlx4_core/mlx4_cmd.c Wed Dec 5 13:30:16 2018 (r341544) @@ -961,6 +961,8 @@ static int mlx4_MAD_IFC_wrapper(struct mlx4_dev *dev, if (!err && slave != mlx4_master_func_num(dev)) { u8 *state = outsmp->data + PORT_STATE_OFFSET; + if (port < 1 || port > dev->caps.num_ports) + return -EINVAL; *state = (*state & 0xf0) | vf_port_state(dev, port, slave); slave_cap_mask = priv->mfunc.master.slave_state[slave].ib_cap_mask[port]; memcpy(outsmp->data + PORT_CAPABILITY_LOCATION_IN_SMP, &slave_cap_mask, 4); @@ -968,8 +970,12 @@ static int mlx4_MAD_IFC_wrapper(struct mlx4_dev *dev, return err; } if (smp->attr_id == IB_SMP_ATTR_GUID_INFO) { - __be64 guid = mlx4_get_admin_guid(dev, slave, - port); + __be64 guid; + + if (port < 1 || port > dev->caps.num_ports) + return -EINVAL; + + guid = mlx4_get_admin_guid(dev, slave, port); /* set the PF admin guid to the FW/HW burned * GUID, if it wasn't yet set From owner-svn-src-head@freebsd.org Wed Dec 5 13:30:49 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B8AA61312E83; Wed, 5 Dec 2018 13:30:49 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5FCEE702A7; Wed, 5 Dec 2018 13:30:49 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 26DD614F2F; Wed, 5 Dec 2018 13:30:49 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5DUnuE071058; Wed, 5 Dec 2018 13:30:49 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5DUmZp071056; Wed, 5 Dec 2018 13:30:48 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051330.wB5DUmZp071056@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:30:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341545 - in head/sys/dev/mlx4: . mlx4_core X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: in head/sys/dev/mlx4: . mlx4_core X-SVN-Commit-Revision: 341545 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5FCEE702A7 X-Spamd-Result: default: False [-0.69 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.52)[-0.521,0]; NEURAL_HAM_SHORT(-0.14)[-0.143,0]; NEURAL_HAM_LONG(-0.03)[-0.031,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:30:50 -0000 Author: slavash Date: Wed Dec 5 13:30:48 2018 New Revision: 341545 URL: https://svnweb.freebsd.org/changeset/base/341545 Log: mlx4: Add board identifier and firmware version to sysctl In last mlx4 update (r325841) we lost the sysctl to show the firmware version for mlx4 devices. Add both board identifier and firmware version under: sys.device.mlx4_core0.hw sysctl node. Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx4/device.h head/sys/dev/mlx4/mlx4_core/mlx4_main.c Modified: head/sys/dev/mlx4/device.h ============================================================================== --- head/sys/dev/mlx4/device.h Wed Dec 5 13:30:16 2018 (r341544) +++ head/sys/dev/mlx4/device.h Wed Dec 5 13:30:48 2018 (r341545) @@ -877,6 +877,8 @@ struct mlx4_dev { u64 regid_allmulti_array[MLX4_MAX_PORTS + 1]; struct mlx4_vf_dev *dev_vfs; u8 uar_page_shift; + struct sysctl_ctx_list hw_ctx; + char fw_str[64]; }; struct mlx4_clock_params { Modified: head/sys/dev/mlx4/mlx4_core/mlx4_main.c ============================================================================== --- head/sys/dev/mlx4/mlx4_core/mlx4_main.c Wed Dec 5 13:30:16 2018 (r341544) +++ head/sys/dev/mlx4/mlx4_core/mlx4_main.c Wed Dec 5 13:30:48 2018 (r341545) @@ -1893,6 +1893,7 @@ static void unmap_internal_clock(struct mlx4_dev *dev) static void mlx4_close_hca(struct mlx4_dev *dev) { + sysctl_ctx_free(&dev->hw_ctx); unmap_internal_clock(dev); unmap_bf_area(dev); if (mlx4_is_slave(dev)) @@ -3745,10 +3746,14 @@ err_disable_pdev: static int mlx4_init_one(struct pci_dev *pdev, const struct pci_device_id *id) { - struct mlx4_priv *priv; - struct mlx4_dev *dev; - int ret; + struct sysctl_ctx_list *ctx; + struct sysctl_oid *node; + struct sysctl_oid_list *node_list; + struct mlx4_priv *priv; + struct mlx4_dev *dev; + int ret; + printk_once(KERN_INFO "%s", mlx4_version); priv = kzalloc(sizeof(*priv), GFP_KERNEL); @@ -3773,8 +3778,28 @@ static int mlx4_init_one(struct pci_dev *pdev, const s if (ret) { kfree(dev->persist); kfree(priv); + return ret; } else { pci_save_state(pdev->dev.bsddev); + } + + snprintf(dev->fw_str, sizeof(dev->fw_str), "%d.%d.%d", + (int) (dev->caps.fw_ver >> 32), + (int) (dev->caps.fw_ver >> 16) & 0xffff, + (int) (dev->caps.fw_ver & 0xffff)); + + ctx = &dev->hw_ctx; + sysctl_ctx_init(ctx); + node = SYSCTL_ADD_NODE(ctx,SYSCTL_CHILDREN(pdev->dev.kobj.oidp), + OID_AUTO, "hw" , CTLFLAG_RD, 0, "mlx4 dev hw information"); + if (node != NULL) { + node_list = SYSCTL_CHILDREN(node); + SYSCTL_ADD_STRING(ctx, node_list, OID_AUTO, + "fw_version", CTLFLAG_RD, dev->fw_str, 0, + "Device firmware version"); + SYSCTL_ADD_STRING(ctx, node_list, OID_AUTO, + "board_id", CTLFLAG_RD, dev->board_id, 0, + "Device board identifier"); } return ret; From owner-svn-src-head@freebsd.org Wed Dec 5 13:31:15 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 93AB11312F00; Wed, 5 Dec 2018 13:31:15 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3643F70438; Wed, 5 Dec 2018 13:31:15 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 13A6914F4F; Wed, 5 Dec 2018 13:31:15 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5DVExe074110; Wed, 5 Dec 2018 13:31:14 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5DVEJa074109; Wed, 5 Dec 2018 13:31:14 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051331.wB5DVEJa074109@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:31:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341546 - head/sys/dev/mlx4/mlx4_core X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/sys/dev/mlx4/mlx4_core X-SVN-Commit-Revision: 341546 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3643F70438 X-Spamd-Result: default: False [-0.76 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; NEURAL_HAM_SHORT(-0.15)[-0.149,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.07)[-0.072,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:31:15 -0000 Author: slavash Date: Wed Dec 5 13:31:14 2018 New Revision: 341546 URL: https://svnweb.freebsd.org/changeset/base/341546 Log: mlx4en: Add driver version to sysctl desc Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx4/mlx4_core/mlx4_main.c Modified: head/sys/dev/mlx4/mlx4_core/mlx4_main.c ============================================================================== --- head/sys/dev/mlx4/mlx4_core/mlx4_main.c Wed Dec 5 13:30:48 2018 (r341545) +++ head/sys/dev/mlx4/mlx4_core/mlx4_main.c Wed Dec 5 13:31:14 2018 (r341546) @@ -121,6 +121,9 @@ MODULE_PARM_DESC(enable_4k_uar, #define RESET_PERSIST_MASK_FLAGS (MLX4_FLAG_SRIOV) +static char mlx4_description[] = "Mellanox driver" + " (" DRV_VERSION ")"; + static char mlx4_version[] = DRV_NAME ": Mellanox ConnectX core driver v" DRV_VERSION " (" DRV_RELDATE ")\n"; @@ -3780,6 +3783,7 @@ static int mlx4_init_one(struct pci_dev *pdev, const s kfree(priv); return ret; } else { + device_set_desc(pdev->dev.bsddev, mlx4_description); pci_save_state(pdev->dev.bsddev); } @@ -3907,6 +3911,13 @@ static void mlx4_remove_one(struct pci_dev *pdev) mutex_lock(&persist->interface_state_mutex); persist->interface_state |= MLX4_INTERFACE_STATE_DELETION; mutex_unlock(&persist->interface_state_mutex); + + /* + * Clear the device description to avoid use after free, + * because the bsddev is not destroyed when this module is + * unloaded: + */ + device_set_desc(pdev->dev.bsddev, NULL); /* Disabling SR-IOV is not allowed while there are active vf's */ if (mlx4_is_master(dev) && dev->flags & MLX4_FLAG_SRIOV) { From owner-svn-src-head@freebsd.org Wed Dec 5 13:31:47 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D1C1C13131AD; Wed, 5 Dec 2018 13:31:46 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 78E45707A1; Wed, 5 Dec 2018 13:31:46 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5AD0815078; Wed, 5 Dec 2018 13:31:46 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5DVk8D074893; Wed, 5 Dec 2018 13:31:46 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5DVj87074890; Wed, 5 Dec 2018 13:31:45 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051331.wB5DVj87074890@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:31:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341547 - head/sys/dev/mlx4/mlx4_en X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/sys/dev/mlx4/mlx4_en X-SVN-Commit-Revision: 341547 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 78E45707A1 X-Spamd-Result: default: False [-0.62 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.50)[-0.498,0]; NEURAL_SPAM_LONG(0.01)[0.010,0]; NEURAL_HAM_SHORT(-0.14)[-0.136,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:31:47 -0000 Author: slavash Date: Wed Dec 5 13:31:45 2018 New Revision: 341547 URL: https://svnweb.freebsd.org/changeset/base/341547 Log: mlx4en: Remove the DRBR and associated logic in the transmit path. The hardware queues are deep enough currently and using the DRBR and associated callbacks only leads to more task switching in the TX path. The is also a race setting the queue_state which can lead to hung TX rings. Submitted by: hselasky@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx4/mlx4_en/en.h head/sys/dev/mlx4/mlx4_en/mlx4_en_cq.c head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c head/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c Modified: head/sys/dev/mlx4/mlx4_en/en.h ============================================================================== --- head/sys/dev/mlx4/mlx4_en/en.h Wed Dec 5 13:31:14 2018 (r341546) +++ head/sys/dev/mlx4/mlx4_en/en.h Wed Dec 5 13:31:45 2018 (r341547) @@ -271,10 +271,8 @@ struct mlx4_en_tx_ring { u32 doorbell_qpn; u8 *buf; u16 poll_cnt; - int blocked; struct mlx4_en_tx_info *tx_info; u8 queue_index; - struct buf_ring *br; u32 last_nr_txbb; struct mlx4_qp qp; struct mlx4_qp_context context; @@ -806,7 +804,6 @@ int mlx4_en_create_rx_ring(struct mlx4_en_priv *priv, void mlx4_en_destroy_rx_ring(struct mlx4_en_priv *priv, struct mlx4_en_rx_ring **pring, u32 size, u16 stride); -void mlx4_en_tx_que(void *context, int pending); void mlx4_en_rx_que(void *context, int pending); int mlx4_en_activate_rx_rings(struct mlx4_en_priv *priv); void mlx4_en_deactivate_rx_ring(struct mlx4_en_priv *priv, Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_cq.c ============================================================================== --- head/sys/dev/mlx4/mlx4_en/mlx4_en_cq.c Wed Dec 5 13:31:14 2018 (r341546) +++ head/sys/dev/mlx4/mlx4_en/mlx4_en_cq.c Wed Dec 5 13:31:45 2018 (r341547) @@ -44,6 +44,10 @@ static void mlx4_en_cq_event(struct mlx4_cq *cq, enum return; } +static void mlx4_en_tx_que(void *arg, int pending) +{ + +} int mlx4_en_create_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq **pcq, Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c ============================================================================== --- head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c Wed Dec 5 13:31:14 2018 (r341546) +++ head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c Wed Dec 5 13:31:45 2018 (r341547) @@ -1574,9 +1574,12 @@ static void mlx4_en_restart(struct work_struct *work) if (priv->blocked == 0 || priv->port_up == 0) return; for (i = 0; i < priv->tx_ring_num; i++) { + int watchdog_time; + ring = priv->tx_ring[i]; - if (ring->blocked && - ring->watchdog_time + MLX4_EN_WATCHDOG_TIMEOUT < ticks) + watchdog_time = READ_ONCE(ring->watchdog_time); + if (watchdog_time != 0 && + time_after(ticks, ring->watchdog_time)) goto reset; } return; Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c ============================================================================== --- head/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c Wed Dec 5 13:31:14 2018 (r341546) +++ head/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c Wed Dec 5 13:31:45 2018 (r341547) @@ -94,15 +94,6 @@ int mlx4_en_create_tx_ring(struct mlx4_en_priv *priv, mtx_init(&ring->tx_lock.m, "mlx4 tx", NULL, MTX_DEF); mtx_init(&ring->comp_lock.m, "mlx4 comp", NULL, MTX_DEF); - /* Allocate the buf ring */ - ring->br = buf_ring_alloc(MLX4_EN_DEF_TX_QUEUE_SIZE, M_DEVBUF, - M_WAITOK, &ring->tx_lock.m); - if (ring->br == NULL) { - en_err(priv, "Failed allocating tx_info ring\n"); - err = -ENOMEM; - goto err_free_dma_tag; - } - tmp = size * sizeof(struct mlx4_en_tx_info); ring->tx_info = kzalloc_node(tmp, GFP_KERNEL, node); if (!ring->tx_info) { @@ -190,8 +181,6 @@ err_dma_map: err_info: vfree(ring->tx_info); err_ring: - buf_ring_free(ring->br, M_DEVBUF); -err_free_dma_tag: bus_dma_tag_destroy(ring->dma_tag); done: kfree(ring); @@ -206,7 +195,6 @@ void mlx4_en_destroy_tx_ring(struct mlx4_en_priv *priv uint32_t x; en_dbg(DRV, priv, "Destroying tx ring, qpn: %d\n", ring->qpn); - buf_ring_free(ring->br, M_DEVBUF); if (ring->bf_enabled) mlx4_bf_free(mdev->dev, &ring->bf); mlx4_qp_remove(mdev->dev, &ring->qp); @@ -236,8 +224,8 @@ int mlx4_en_activate_tx_ring(struct mlx4_en_priv *priv ring->cons = 0xffffffff; ring->last_nr_txbb = 1; ring->poll_cnt = 0; - ring->blocked = 0; memset(ring->buf, 0, ring->buf_size); + ring->watchdog_time = 0; ring->qp_state = MLX4_QP_STATE_RST; ring->doorbell_qpn = ring->qp.qpn << 8; @@ -429,14 +417,6 @@ static int mlx4_en_process_tx_cq(struct net_device *de wmb(); ring->cons += txbbs_skipped; - /* Wakeup Tx queue if it was stopped and ring is not full */ - if (unlikely(ring->blocked) && !mlx4_en_tx_ring_is_full(ring)) { - ring->blocked = 0; - if (atomic_fetchadd_int(&priv->blocked, -1) == 1) - atomic_clear_int(&dev->if_drv_flags ,IFF_DRV_OACTIVE); - priv->port_stats.wake_queue++; - ring->wake_queue++; - } return (0); } @@ -682,15 +662,6 @@ static int mlx4_en_xmit(struct mlx4_en_priv *priv, int /* check if TX ring is full */ if (unlikely(mlx4_en_tx_ring_is_full(ring))) { - /* every full native Tx ring stops queue */ - if (ring->blocked == 0) - atomic_add_int(&priv->blocked, 1); - /* Set HW-queue-is-full flag */ - atomic_set_int(&ifp->if_drv_flags, IFF_DRV_OACTIVE); - priv->port_stats.queue_stopped++; - ring->blocked = 1; - ring->queue_stopped++; - /* Use interrupts to find out when queue opened */ mlx4_en_arm_cq(priv, priv->tx_cq[tx_ind]); return (ENOBUFS); @@ -956,81 +927,35 @@ tx_drop: } static int -mlx4_en_transmit_locked(struct ifnet *dev, int tx_ind, struct mbuf *m) +mlx4_en_transmit_locked(struct ifnet *ifp, int tx_ind, struct mbuf *mb) { - struct mlx4_en_priv *priv = netdev_priv(dev); - struct mlx4_en_tx_ring *ring; - struct mbuf *next; - int enqueued, err = 0; + struct mlx4_en_priv *priv = netdev_priv(ifp); + struct mlx4_en_tx_ring *ring = priv->tx_ring[tx_ind]; + int err = 0; - ring = priv->tx_ring[tx_ind]; - if ((dev->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != - IFF_DRV_RUNNING || priv->port_up == 0) { - if (m != NULL) - err = drbr_enqueue(dev, ring->br, m); - return (err); + if (unlikely((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0 || + READ_ONCE(priv->port_up) == 0)) { + m_freem(mb); + return (ENETDOWN); } - enqueued = 0; - if (m != NULL) - /* - * If we can't insert mbuf into drbr, try to xmit anyway. - * We keep the error we got so we could return that after xmit. - */ - err = drbr_enqueue(dev, ring->br, m); - - /* Process the queue */ - while ((next = drbr_peek(dev, ring->br)) != NULL) { - if (mlx4_en_xmit(priv, tx_ind, &next) != 0) { - if (next == NULL) { - drbr_advance(dev, ring->br); - } else { - drbr_putback(dev, ring->br, next); - } - break; - } - drbr_advance(dev, ring->br); - enqueued++; - if ((dev->if_drv_flags & IFF_DRV_RUNNING) == 0) - break; + if (mlx4_en_xmit(priv, tx_ind, &mb) != 0) { + /* NOTE: m_freem() is NULL safe */ + m_freem(mb); + err = ENOBUFS; + if (ring->watchdog_time == 0) + ring->watchdog_time = ticks + MLX4_EN_WATCHDOG_TIMEOUT; + } else { + ring->watchdog_time = 0; } - - if (enqueued > 0) - ring->watchdog_time = ticks; - return (err); } -void -mlx4_en_tx_que(void *context, int pending) -{ - struct mlx4_en_tx_ring *ring; - struct mlx4_en_priv *priv; - struct net_device *dev; - struct mlx4_en_cq *cq; - int tx_ind; - cq = context; - dev = cq->dev; - priv = dev->if_softc; - tx_ind = cq->ring; - ring = priv->tx_ring[tx_ind]; - - if (priv->port_up != 0 && - (dev->if_drv_flags & IFF_DRV_RUNNING) != 0) { - mlx4_en_xmit_poll(priv, tx_ind); - spin_lock(&ring->tx_lock); - if (!drbr_empty(dev, ring->br)) - mlx4_en_transmit_locked(dev, tx_ind, NULL); - spin_unlock(&ring->tx_lock); - } -} - int mlx4_en_transmit(struct ifnet *dev, struct mbuf *m) { struct mlx4_en_priv *priv = netdev_priv(dev); struct mlx4_en_tx_ring *ring; - struct mlx4_en_cq *cq; int i, err = 0; if (priv->port_up == 0) { @@ -1047,17 +972,15 @@ mlx4_en_transmit(struct ifnet *dev, struct mbuf *m) } ring = priv->tx_ring[i]; - if (spin_trylock(&ring->tx_lock)) { - err = mlx4_en_transmit_locked(dev, i, m); - spin_unlock(&ring->tx_lock); - /* Poll CQ here */ - mlx4_en_xmit_poll(priv, i); - } else { - err = drbr_enqueue(dev, ring->br, m); - cq = priv->tx_cq[i]; - taskqueue_enqueue(cq->tq, &cq->cq_task); - } + spin_lock(&ring->tx_lock); + + err = mlx4_en_transmit_locked(dev, i, m); + spin_unlock(&ring->tx_lock); + + /* Poll CQ here */ + mlx4_en_xmit_poll(priv, i); + #if __FreeBSD_version >= 1100000 if (unlikely(err != 0)) if_inc_counter(dev, IFCOUNTER_IQDROPS, 1); @@ -1072,18 +995,9 @@ void mlx4_en_qflush(struct ifnet *dev) { struct mlx4_en_priv *priv = netdev_priv(dev); - struct mlx4_en_tx_ring *ring; - struct mbuf *m; if (priv->port_up == 0) return; - for (int i = 0; i < priv->tx_ring_num; i++) { - ring = priv->tx_ring[i]; - spin_lock(&ring->tx_lock); - while ((m = buf_ring_dequeue_sc(ring->br)) != NULL) - m_freem(m); - spin_unlock(&ring->tx_lock); - } if_qflush(dev); } From owner-svn-src-head@freebsd.org Wed Dec 5 13:32:17 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9E4CA1313267; Wed, 5 Dec 2018 13:32:17 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3233F709AA; Wed, 5 Dec 2018 13:32:17 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F09B4150A2; Wed, 5 Dec 2018 13:32:16 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5DWGpU075903; Wed, 5 Dec 2018 13:32:16 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5DWGYh075899; Wed, 5 Dec 2018 13:32:16 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051332.wB5DWGYh075899@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:32:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341548 - in head/sys/dev/mlx4: . mlx4_core mlx4_en X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: in head/sys/dev/mlx4: . mlx4_core mlx4_en X-SVN-Commit-Revision: 341548 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3233F709AA X-Spamd-Result: default: False [-0.69 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.52)[-0.521,0]; NEURAL_HAM_SHORT(-0.14)[-0.143,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.03)[-0.031,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:32:18 -0000 Author: slavash Date: Wed Dec 5 13:32:15 2018 New Revision: 341548 URL: https://svnweb.freebsd.org/changeset/base/341548 Log: mlx4en: Add support for netdump. Implement the needed callback functions and support for polling the driver. Differential Revision: https://reviews.freebsd.org/D15259 Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx4/driver.h head/sys/dev/mlx4/mlx4_core/mlx4_eq.c head/sys/dev/mlx4/mlx4_en/en.h head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c head/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c Modified: head/sys/dev/mlx4/driver.h ============================================================================== --- head/sys/dev/mlx4/driver.h Wed Dec 5 13:31:45 2018 (r341547) +++ head/sys/dev/mlx4/driver.h Wed Dec 5 13:32:15 2018 (r341548) @@ -101,4 +101,7 @@ static inline u64 mlx4_mac_to_u64(const u8 *addr) return mac; } +void mlx4_disable_interrupts(struct mlx4_dev *); +void mlx4_poll_interrupts(struct mlx4_dev *); + #endif /* MLX4_DRIVER_H */ Modified: head/sys/dev/mlx4/mlx4_core/mlx4_eq.c ============================================================================== --- head/sys/dev/mlx4/mlx4_core/mlx4_eq.c Wed Dec 5 13:31:45 2018 (r341547) +++ head/sys/dev/mlx4/mlx4_core/mlx4_eq.c Wed Dec 5 13:32:15 2018 (r341548) @@ -1535,3 +1535,34 @@ void mlx4_release_eq(struct mlx4_dev *dev, int vec) } EXPORT_SYMBOL(mlx4_release_eq); +void +mlx4_disable_interrupts(struct mlx4_dev *dev) +{ + struct mlx4_priv *priv = container_of(dev, struct mlx4_priv, dev); + int i; + + if (dev->flags & MLX4_FLAG_MSI_X) { + for (i = 0; i < (dev->caps.num_comp_vectors + 1); ++i) + disable_irq(priv->eq_table.eq[i].irq); + } else { + disable_irq(dev->persist->pdev->irq); + } +} +EXPORT_SYMBOL(mlx4_disable_interrupts); + +void +mlx4_poll_interrupts(struct mlx4_dev *dev) +{ + struct mlx4_priv *priv = container_of(dev, struct mlx4_priv, dev); + int i; + + if (dev->flags & MLX4_FLAG_MSI_X) { + for (i = 0; i < (dev->caps.num_comp_vectors + 1); ++i) { + mlx4_msi_x_interrupt(priv->eq_table.eq[i].irq, + priv->eq_table.eq + i); + } + } else { + mlx4_interrupt(dev->persist->pdev->irq, dev); + } +} +EXPORT_SYMBOL(mlx4_poll_interrupts); Modified: head/sys/dev/mlx4/mlx4_en/en.h ============================================================================== --- head/sys/dev/mlx4/mlx4_en/en.h Wed Dec 5 13:31:45 2018 (r341547) +++ head/sys/dev/mlx4/mlx4_en/en.h Wed Dec 5 13:32:15 2018 (r341548) @@ -54,6 +54,7 @@ #include #include +#include #include "en_port.h" #include @@ -784,6 +785,7 @@ int mlx4_en_arm_cq(struct mlx4_en_priv *priv, struct m void mlx4_en_tx_irq(struct mlx4_cq *mcq); u16 mlx4_en_select_queue(struct net_device *dev, struct mbuf *mb); +int mlx4_en_xmit(struct mlx4_en_priv *priv, int tx_ind, struct mbuf **mbp); int mlx4_en_transmit(struct ifnet *dev, struct mbuf *m); int mlx4_en_create_tx_ring(struct mlx4_en_priv *priv, struct mlx4_en_tx_ring **pring, Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c ============================================================================== --- head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c Wed Dec 5 13:31:45 2018 (r341547) +++ head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c Wed Dec 5 13:32:15 2018 (r341548) @@ -53,6 +53,8 @@ #include "en.h" #include "en_port.h" +NETDUMP_DEFINE(mlx4_en); + static void mlx4_en_sysctl_stat(struct mlx4_en_priv *priv); static void mlx4_en_sysctl_conf(struct mlx4_en_priv *priv); @@ -2311,6 +2313,8 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int ifmedia_add(&priv->media, IFM_ETHER | IFM_AUTO, 0, NULL); ifmedia_set(&priv->media, IFM_ETHER | IFM_AUTO); + NETDUMP_SET(dev, mlx4_en); + en_warn(priv, "Using %d TX rings\n", prof->tx_ring_num); en_warn(priv, "Using %d RX rings\n", prof->rx_ring_num); @@ -2892,3 +2896,54 @@ static void mlx4_en_sysctl_stat(struct mlx4_en_priv *p CTLFLAG_RD, &rx_ring->errors, 0, "RX soft errors"); } } + +#ifdef NETDUMP +static void +mlx4_en_netdump_init(struct ifnet *dev, int *nrxr, int *ncl, int *clsize) +{ + struct mlx4_en_priv *priv; + + priv = if_getsoftc(dev); + mutex_lock(&priv->mdev->state_lock); + *nrxr = priv->rx_ring_num; + *ncl = NETDUMP_MAX_IN_FLIGHT; + *clsize = priv->rx_mb_size; + mutex_unlock(&priv->mdev->state_lock); +} + +static void +mlx4_en_netdump_event(struct ifnet *dev, enum netdump_ev event) +{ +} + +static int +mlx4_en_netdump_transmit(struct ifnet *dev, struct mbuf *m) +{ + struct mlx4_en_priv *priv; + int err; + + priv = if_getsoftc(dev); + if ((if_getdrvflags(dev) & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != + IFF_DRV_RUNNING || !priv->link_state) + return (ENOENT); + + err = mlx4_en_xmit(priv, 0, &m); + if (err != 0 && m != NULL) + m_freem(m); + return (err); +} + +static int +mlx4_en_netdump_poll(struct ifnet *dev, int count) +{ + struct mlx4_en_priv *priv; + + priv = if_getsoftc(dev); + if ((if_getdrvflags(dev) & IFF_DRV_RUNNING) == 0 || !priv->link_state) + return (ENOENT); + + mlx4_poll_interrupts(priv->mdev->dev); + + return (0); +} +#endif /* NETDUMP */ Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c ============================================================================== --- head/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c Wed Dec 5 13:31:45 2018 (r341547) +++ head/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c Wed Dec 5 13:32:15 2018 (r341548) @@ -628,7 +628,7 @@ static void mlx4_bf_copy(void __iomem *dst, volatile u __iowrite64_copy(dst, __DEVOLATILE(void *, src), bytecnt / 8); } -static int mlx4_en_xmit(struct mlx4_en_priv *priv, int tx_ind, struct mbuf **mbp) +int mlx4_en_xmit(struct mlx4_en_priv *priv, int tx_ind, struct mbuf **mbp) { enum { DS_FACT = TXBB_SIZE / DS_SIZE_ALIGNMENT, From owner-svn-src-head@freebsd.org Wed Dec 5 13:32:48 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E62DE1313349; Wed, 5 Dec 2018 13:32:47 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B787370B60; Wed, 5 Dec 2018 13:32:47 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 99398150B4; Wed, 5 Dec 2018 13:32:47 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5DWl6H075971; Wed, 5 Dec 2018 13:32:47 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5DWldZ075968; Wed, 5 Dec 2018 13:32:47 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051332.wB5DWldZ075968@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:32:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341549 - head/sys/dev/mlx4/mlx4_en X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/sys/dev/mlx4/mlx4_en X-SVN-Commit-Revision: 341549 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B787370B60 X-Spamd-Result: default: False [-0.62 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.50)[-0.498,0]; NEURAL_HAM_SHORT(-0.14)[-0.136,0]; NEURAL_SPAM_LONG(0.01)[0.010,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:32:48 -0000 Author: slavash Date: Wed Dec 5 13:32:46 2018 New Revision: 341549 URL: https://svnweb.freebsd.org/changeset/base/341549 Log: mlx4en: Add support for receiving all data using one or more MCLBYTES sized mbufs. Also when the MTU is greater than MCLBYTES. Submitted by: hselasky@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx4/mlx4_en/en.h head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c head/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c Modified: head/sys/dev/mlx4/mlx4_en/en.h ============================================================================== --- head/sys/dev/mlx4/mlx4_en/en.h Wed Dec 5 13:32:15 2018 (r341548) +++ head/sys/dev/mlx4/mlx4_en/en.h Wed Dec 5 13:32:46 2018 (r341549) @@ -75,6 +75,15 @@ #define MAX_RX_RINGS 128 #define MIN_RX_RINGS 4 #define TXBB_SIZE 64 + +#ifndef MLX4_EN_MAX_RX_SEGS +#define MLX4_EN_MAX_RX_SEGS 1 /* or 8 */ +#endif + +#ifndef MLX4_EN_MAX_RX_BYTES +#define MLX4_EN_MAX_RX_BYTES MCLBYTES +#endif + #define HEADROOM (2048 / TXBB_SIZE + 1) #define INIT_OWNER_BIT 0xffffffff #define STAMP_STRIDE 64 @@ -297,10 +306,12 @@ struct mlx4_en_tx_ring { }; struct mlx4_en_rx_desc { - /* actual number of entries depends on rx ring stride */ - struct mlx4_wqe_data_seg data[0]; + struct mlx4_wqe_data_seg data[MLX4_EN_MAX_RX_SEGS]; }; +/* the size of the structure above must be power of two */ +CTASSERT(powerof2(sizeof(struct mlx4_en_rx_desc))); + struct mlx4_en_rx_mbuf { bus_dmamap_t dma_map; struct mbuf *mbuf; @@ -309,7 +320,7 @@ struct mlx4_en_rx_mbuf { struct mlx4_en_rx_spare { bus_dmamap_t dma_map; struct mbuf *mbuf; - u64 paddr_be; + bus_dma_segment_t segs[MLX4_EN_MAX_RX_SEGS]; }; struct mlx4_en_rx_ring { @@ -319,7 +330,6 @@ struct mlx4_en_rx_ring { u32 size ; /* number of Rx descs*/ u32 actual_size; u32 size_mask; - u16 stride; u16 log_stride; u16 cqn; /* index of port CQ associated with this ring */ u32 prod; @@ -327,6 +337,7 @@ struct mlx4_en_rx_ring { u32 buf_size; u8 fcs_del; u32 rx_mb_size; + u32 rx_mr_key_be; int qpn; u8 *buf; struct mlx4_en_rx_mbuf *mbuf; @@ -559,7 +570,6 @@ struct mlx4_en_priv { int registered; int gone; int allocated; - int stride; unsigned char current_mac[ETH_ALEN + 2]; u64 mac; int mac_index; @@ -805,7 +815,7 @@ int mlx4_en_create_rx_ring(struct mlx4_en_priv *priv, u32 size, int node); void mlx4_en_destroy_rx_ring(struct mlx4_en_priv *priv, struct mlx4_en_rx_ring **pring, - u32 size, u16 stride); + u32 size); void mlx4_en_rx_que(void *context, int pending); int mlx4_en_activate_rx_rings(struct mlx4_en_priv *priv); void mlx4_en_deactivate_rx_ring(struct mlx4_en_priv *priv, Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c ============================================================================== --- head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c Wed Dec 5 13:32:15 2018 (r341548) +++ head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c Wed Dec 5 13:32:46 2018 (r341549) @@ -1683,7 +1683,7 @@ void mlx4_en_free_resources(struct mlx4_en_priv *priv) for (i = 0; i < priv->rx_ring_num; i++) { if (priv->rx_ring[i]) mlx4_en_destroy_rx_ring(priv, &priv->rx_ring[i], - priv->prof->rx_ring_size, priv->stride); + priv->prof->rx_ring_size); if (priv->rx_cq[i]) mlx4_en_destroy_cq(priv, &priv->rx_cq[i]); } @@ -1734,8 +1734,7 @@ err: for (i = 0; i < priv->rx_ring_num; i++) { if (priv->rx_ring[i]) mlx4_en_destroy_rx_ring(priv, &priv->rx_ring[i], - prof->rx_ring_size, - priv->stride); + prof->rx_ring_size); if (priv->rx_cq[i]) mlx4_en_destroy_cq(priv, &priv->rx_cq[i]); } @@ -2236,9 +2235,6 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int err = -EINVAL; goto out; } - - priv->stride = roundup_pow_of_two(sizeof(struct mlx4_en_rx_desc) + - DS_SIZE); mlx4_en_sysctl_conf(priv); Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c ============================================================================== --- head/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c Wed Dec 5 13:32:15 2018 (r341548) +++ head/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c Wed Dec 5 13:32:46 2018 (r341549) @@ -44,14 +44,13 @@ #include "en.h" - +#if (MLX4_EN_MAX_RX_SEGS == 1) static void mlx4_en_init_rx_desc(struct mlx4_en_priv *priv, struct mlx4_en_rx_ring *ring, int index) { - struct mlx4_en_rx_desc *rx_desc = (struct mlx4_en_rx_desc *) - (ring->buf + (ring->stride * index)); - int possible_frags; + struct mlx4_en_rx_desc *rx_desc = + ((struct mlx4_en_rx_desc *)ring->buf) + index; int i; /* Set size and memtype fields */ @@ -63,38 +62,75 @@ static void mlx4_en_init_rx_desc(struct mlx4_en_priv * * stride, remaining (unused) fragments must be padded with * null address/size and a special memory key: */ - possible_frags = (ring->stride - sizeof(struct mlx4_en_rx_desc)) / DS_SIZE; - for (i = 1; i < possible_frags; i++) { + for (i = 1; i < MLX4_EN_MAX_RX_SEGS; i++) { rx_desc->data[i].byte_count = 0; rx_desc->data[i].lkey = cpu_to_be32(MLX4_EN_MEMTYPE_PAD); rx_desc->data[i].addr = 0; } } +#endif +static inline struct mbuf * +mlx4_en_alloc_mbuf(struct mlx4_en_rx_ring *ring) +{ + struct mbuf *mb; + +#if (MLX4_EN_MAX_RX_SEGS == 1) + mb = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, ring->rx_mb_size); + if (likely(mb != NULL)) + mb->m_pkthdr.len = mb->m_len = ring->rx_mb_size; +#else + mb = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, MLX4_EN_MAX_RX_BYTES); + if (likely(mb != NULL)) { + struct mbuf *mb_head = mb; + int i; + + mb->m_len = MLX4_EN_MAX_RX_BYTES; + mb->m_pkthdr.len = MLX4_EN_MAX_RX_BYTES; + + for (i = 1; i != MLX4_EN_MAX_RX_SEGS; i++) { + if (mb_head->m_pkthdr.len >= ring->rx_mb_size) + break; + mb = (mb->m_next = m_getjcl(M_NOWAIT, MT_DATA, 0, MLX4_EN_MAX_RX_BYTES)); + if (unlikely(mb == NULL)) { + m_freem(mb_head); + return (NULL); + } + mb->m_len = MLX4_EN_MAX_RX_BYTES; + mb_head->m_pkthdr.len += MLX4_EN_MAX_RX_BYTES; + } + /* rewind to first mbuf in chain */ + mb = mb_head; + } +#endif + return (mb); +} + static int -mlx4_en_alloc_buf(struct mlx4_en_rx_ring *ring, - __be64 *pdma, struct mlx4_en_rx_mbuf *mb_list) +mlx4_en_alloc_buf(struct mlx4_en_rx_ring *ring, struct mlx4_en_rx_desc *rx_desc, + struct mlx4_en_rx_mbuf *mb_list) { - bus_dma_segment_t segs[1]; + bus_dma_segment_t segs[MLX4_EN_MAX_RX_SEGS]; bus_dmamap_t map; struct mbuf *mb; int nsegs; int err; +#if (MLX4_EN_MAX_RX_SEGS != 1) + int i; +#endif /* try to allocate a new spare mbuf */ if (unlikely(ring->spare.mbuf == NULL)) { - mb = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, ring->rx_mb_size); + mb = mlx4_en_alloc_mbuf(ring); if (unlikely(mb == NULL)) return (-ENOMEM); - /* setup correct length */ - mb->m_pkthdr.len = mb->m_len = ring->rx_mb_size; /* make sure IP header gets aligned */ m_adj(mb, MLX4_NET_IP_ALIGN); /* load spare mbuf into BUSDMA */ err = -bus_dmamap_load_mbuf_sg(ring->dma_tag, ring->spare.dma_map, - mb, segs, &nsegs, BUS_DMA_NOWAIT); + mb, ring->spare.segs, &nsegs, BUS_DMA_NOWAIT); if (unlikely(err != 0)) { m_freem(mb); return (err); @@ -102,8 +138,14 @@ mlx4_en_alloc_buf(struct mlx4_en_rx_ring *ring, /* store spare info */ ring->spare.mbuf = mb; - ring->spare.paddr_be = cpu_to_be64(segs[0].ds_addr); +#if (MLX4_EN_MAX_RX_SEGS != 1) + /* zero remaining segs */ + for (i = nsegs; i != MLX4_EN_MAX_RX_SEGS; i++) { + ring->spare.segs[i].ds_addr = 0; + ring->spare.segs[i].ds_len = 0; + } +#endif bus_dmamap_sync(ring->dma_tag, ring->spare.dma_map, BUS_DMASYNC_PREREAD); } @@ -115,13 +157,10 @@ mlx4_en_alloc_buf(struct mlx4_en_rx_ring *ring, bus_dmamap_unload(ring->dma_tag, mb_list->dma_map); } - mb = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, ring->rx_mb_size); + mb = mlx4_en_alloc_mbuf(ring); if (unlikely(mb == NULL)) goto use_spare; - /* setup correct length */ - mb->m_pkthdr.len = mb->m_len = ring->rx_mb_size; - /* make sure IP header gets aligned */ m_adj(mb, MLX4_NET_IP_ALIGN); @@ -132,7 +171,20 @@ mlx4_en_alloc_buf(struct mlx4_en_rx_ring *ring, goto use_spare; } - *pdma = cpu_to_be64(segs[0].ds_addr); +#if (MLX4_EN_MAX_RX_SEGS == 1) + rx_desc->data[0].addr = cpu_to_be64(segs[0].ds_addr); +#else + for (i = 0; i != nsegs; i++) { + rx_desc->data[i].byte_count = cpu_to_be32(segs[i].ds_len); + rx_desc->data[i].lkey = ring->rx_mr_key_be; + rx_desc->data[i].addr = cpu_to_be64(segs[i].ds_addr); + } + for (; i != MLX4_EN_MAX_RX_SEGS; i++) { + rx_desc->data[i].byte_count = 0; + rx_desc->data[i].lkey = cpu_to_be32(MLX4_EN_MEMTYPE_PAD); + rx_desc->data[i].addr = 0; + } +#endif mb_list->mbuf = mb; bus_dmamap_sync(ring->dma_tag, mb_list->dma_map, BUS_DMASYNC_PREREAD); @@ -149,7 +201,21 @@ use_spare: ring->spare.mbuf = NULL; /* store physical address */ - *pdma = ring->spare.paddr_be; +#if (MLX4_EN_MAX_RX_SEGS == 1) + rx_desc->data[0].addr = cpu_to_be64(ring->spare.segs[0].ds_addr); +#else + for (i = 0; i != MLX4_EN_MAX_RX_SEGS; i++) { + if (ring->spare.segs[i].ds_len != 0) { + rx_desc->data[i].byte_count = cpu_to_be32(ring->spare.segs[i].ds_len); + rx_desc->data[i].lkey = ring->rx_mr_key_be; + rx_desc->data[i].addr = cpu_to_be64(ring->spare.segs[i].ds_addr); + } else { + rx_desc->data[i].byte_count = 0; + rx_desc->data[i].lkey = cpu_to_be32(MLX4_EN_MEMTYPE_PAD); + rx_desc->data[i].addr = 0; + } + } +#endif return (0); } @@ -167,13 +233,13 @@ static int mlx4_en_prepare_rx_desc(struct mlx4_en_priv *priv, struct mlx4_en_rx_ring *ring, int index) { - struct mlx4_en_rx_desc *rx_desc = (struct mlx4_en_rx_desc *) - (ring->buf + (index * ring->stride)); + struct mlx4_en_rx_desc *rx_desc = + ((struct mlx4_en_rx_desc *)ring->buf) + index; struct mlx4_en_rx_mbuf *mb_list = ring->mbuf + index; mb_list->mbuf = NULL; - if (mlx4_en_alloc_buf(ring, &rx_desc->data[0].addr, mb_list)) { + if (mlx4_en_alloc_buf(ring, rx_desc, mb_list)) { priv->port_stats.rx_alloc_failed++; return (-ENOMEM); } @@ -321,7 +387,7 @@ int mlx4_en_create_rx_ring(struct mlx4_en_priv *priv, BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ MJUM16BYTES, /* maxsize */ - 1, /* nsegments */ + MLX4_EN_MAX_RX_SEGS, /* nsegments */ MJUM16BYTES, /* maxsegsize */ 0, /* flags */ NULL, NULL, /* lockfunc, lockfuncarg */ @@ -334,11 +400,10 @@ int mlx4_en_create_rx_ring(struct mlx4_en_priv *priv, ring->cons = 0; ring->size = size; ring->size_mask = size - 1; - ring->stride = roundup_pow_of_two( - sizeof(struct mlx4_en_rx_desc) + DS_SIZE); - ring->log_stride = ffs(ring->stride) - 1; - ring->buf_size = ring->size * ring->stride + TXBB_SIZE; + ring->log_stride = ilog2(sizeof(struct mlx4_en_rx_desc)); + ring->buf_size = (ring->size * sizeof(struct mlx4_en_rx_desc)) + TXBB_SIZE; + tmp = size * sizeof(struct mlx4_en_rx_mbuf); ring->mbuf = kzalloc(tmp, GFP_KERNEL); @@ -398,11 +463,11 @@ err_ring: int mlx4_en_activate_rx_rings(struct mlx4_en_priv *priv) { struct mlx4_en_rx_ring *ring; +#if (MLX4_EN_MAX_RX_SEGS == 1) int i; +#endif int ring_ind; int err; - int stride = roundup_pow_of_two( - sizeof(struct mlx4_en_rx_desc) + DS_SIZE); for (ring_ind = 0; ring_ind < priv->rx_ring_num; ring_ind++) { ring = priv->rx_ring[ring_ind]; @@ -413,8 +478,7 @@ int mlx4_en_activate_rx_rings(struct mlx4_en_priv *pri ring->cqn = priv->rx_cq[ring_ind]->mcq.cqn; ring->rx_mb_size = priv->rx_mb_size; - ring->stride = stride; - if (ring->stride <= TXBB_SIZE) { + if (sizeof(struct mlx4_en_rx_desc) <= TXBB_SIZE) { /* Stamp first unused send wqe */ __be32 *ptr = (__be32 *)ring->buf; __be32 stamp = cpu_to_be32(1 << STAMP_SHIFT); @@ -423,15 +487,18 @@ int mlx4_en_activate_rx_rings(struct mlx4_en_priv *pri ring->buf += TXBB_SIZE; } - ring->log_stride = ffs(ring->stride) - 1; - ring->buf_size = ring->size * ring->stride; + ring->log_stride = ilog2(sizeof(struct mlx4_en_rx_desc)); + ring->buf_size = ring->size * sizeof(struct mlx4_en_rx_desc); memset(ring->buf, 0, ring->buf_size); mlx4_en_update_rx_prod_db(ring); +#if (MLX4_EN_MAX_RX_SEGS == 1) /* Initialize all descriptors */ for (i = 0; i < ring->size; i++) mlx4_en_init_rx_desc(priv, ring, i); +#endif + ring->rx_mr_key_be = cpu_to_be32(priv->mdev->mr.key); #ifdef INET /* Configure lro mngr */ @@ -466,7 +533,7 @@ err_buffers: while (ring_ind >= 0) { ring = priv->rx_ring[ring_ind]; - if (ring->stride <= TXBB_SIZE) + if (sizeof(struct mlx4_en_rx_desc) <= TXBB_SIZE) ring->buf -= TXBB_SIZE; ring_ind--; } @@ -477,14 +544,14 @@ err_buffers: void mlx4_en_destroy_rx_ring(struct mlx4_en_priv *priv, struct mlx4_en_rx_ring **pring, - u32 size, u16 stride) + u32 size) { struct mlx4_en_dev *mdev = priv->mdev; struct mlx4_en_rx_ring *ring = *pring; uint32_t x; mlx4_en_unmap_buffer(&ring->wqres.buf); - mlx4_free_hwq_res(mdev->dev, &ring->wqres, size * stride + TXBB_SIZE); + mlx4_free_hwq_res(mdev->dev, &ring->wqres, size * sizeof(struct mlx4_en_rx_desc) + TXBB_SIZE); for (x = 0; x != size; x++) bus_dmamap_destroy(ring->dma_tag, ring->mbuf[x].dma_map); /* free spare mbuf, if any */ @@ -511,7 +578,7 @@ void mlx4_en_deactivate_rx_ring(struct mlx4_en_priv *p tcp_lro_free(&ring->lro); #endif mlx4_en_free_rx_buf(priv, ring); - if (ring->stride <= TXBB_SIZE) + if (sizeof(struct mlx4_en_rx_desc) <= TXBB_SIZE) ring->buf -= TXBB_SIZE; } @@ -557,21 +624,43 @@ mlx4_en_rx_mb(struct mlx4_en_priv *priv, struct mlx4_e struct mlx4_en_rx_desc *rx_desc, struct mlx4_en_rx_mbuf *mb_list, int length) { +#if (MLX4_EN_MAX_RX_SEGS != 1) + struct mbuf *mb_head; +#endif struct mbuf *mb; /* get mbuf */ mb = mb_list->mbuf; /* collect used fragment while atomically replacing it */ - if (mlx4_en_alloc_buf(ring, &rx_desc->data[0].addr, mb_list)) + if (mlx4_en_alloc_buf(ring, rx_desc, mb_list)) return (NULL); /* range check hardware computed value */ - if (unlikely(length > mb->m_len)) - length = mb->m_len; + if (unlikely(length > mb->m_pkthdr.len)) + length = mb->m_pkthdr.len; +#if (MLX4_EN_MAX_RX_SEGS == 1) /* update total packet length in packet header */ mb->m_len = mb->m_pkthdr.len = length; +#else + mb->m_pkthdr.len = length; + for (mb_head = mb; mb != NULL; mb = mb->m_next) { + if (mb->m_len > length) + mb->m_len = length; + length -= mb->m_len; + if (likely(length == 0)) { + if (likely(mb->m_next != NULL)) { + /* trim off empty mbufs */ + m_freem(mb->m_next); + mb->m_next = NULL; + } + break; + } + } + /* rewind to first mbuf in chain */ + mb = mb_head; +#endif return (mb); } @@ -660,8 +749,7 @@ int mlx4_en_process_rx_cq(struct net_device *dev, stru while (XNOR(cqe->owner_sr_opcode & MLX4_CQE_OWNER_MASK, cons_index & size)) { mb_list = ring->mbuf + index; - rx_desc = (struct mlx4_en_rx_desc *) - (ring->buf + (index << ring->log_stride)); + rx_desc = ((struct mlx4_en_rx_desc *)ring->buf) + index; /* * make sure we read the CQE after we read the ownership bit @@ -830,7 +918,7 @@ static int mlx4_en_config_rss_qp(struct mlx4_en_priv * qp->event = mlx4_en_sqp_event; memset(context, 0, sizeof *context); - mlx4_en_fill_qp_context(priv, ring->actual_size, ring->stride, 0, 0, + mlx4_en_fill_qp_context(priv, ring->actual_size, sizeof(struct mlx4_en_rx_desc), 0, 0, qpn, ring->cqn, -1, context); context->db_rec_addr = cpu_to_be64(ring->wqres.db.dma); From owner-svn-src-head@freebsd.org Wed Dec 5 13:38:36 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4BDB613136E7; Wed, 5 Dec 2018 13:38:36 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E64A871011; Wed, 5 Dec 2018 13:38:35 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C7813150CB; Wed, 5 Dec 2018 13:38:35 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5DcZsu076284; Wed, 5 Dec 2018 13:38:35 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5DcZTc076283; Wed, 5 Dec 2018 13:38:35 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051338.wB5DcZTc076283@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:38:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341550 - head/sys/dev/mlx4/mlx4_en X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/sys/dev/mlx4/mlx4_en X-SVN-Commit-Revision: 341550 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E64A871011 X-Spamd-Result: default: False [-0.69 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; NEURAL_HAM_LONG(-0.07)[-0.072,0]; NEURAL_HAM_SHORT(-0.08)[-0.077,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:38:36 -0000 Author: slavash Date: Wed Dec 5 13:38:35 2018 New Revision: 341550 URL: https://svnweb.freebsd.org/changeset/base/341550 Log: mlx4en: Remove duplicate statistics variable assignment. The "priv->pkstats.rx_dropped" is written twice in a row. Submitted by: hselasky@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_port.c Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_port.c ============================================================================== --- head/sys/dev/mlx4/mlx4_en/mlx4_en_port.c Wed Dec 5 13:32:46 2018 (r341549) +++ head/sys/dev/mlx4/mlx4_en/mlx4_en_port.c Wed Dec 5 13:38:35 2018 (r341550) @@ -256,7 +256,6 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u priv->pkstats.rx_length_errors = be32_to_cpu(mlx4_en_stats->RdropLength); priv->pkstats.rx_over_errors = be32_to_cpu(mlx4_en_stats->RdropOvflw); priv->pkstats.rx_crc_errors = be32_to_cpu(mlx4_en_stats->RCRC); - priv->pkstats.rx_dropped = be32_to_cpu(mlx4_en_stats->RdropOvflw); priv->pkstats.tx_dropped = be32_to_cpu(mlx4_en_stats->TDROP); /* RX stats */ From owner-svn-src-head@freebsd.org Wed Dec 5 13:39:06 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 49FE61313760; Wed, 5 Dec 2018 13:39:06 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E0BBC7121A; Wed, 5 Dec 2018 13:39:05 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C3184150CD; Wed, 5 Dec 2018 13:39:05 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5Dd5WJ076354; Wed, 5 Dec 2018 13:39:05 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5Dd5Kx076353; Wed, 5 Dec 2018 13:39:05 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051339.wB5Dd5Kx076353@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:39:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341551 - head/sys/dev/mlx4/mlx4_core X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/sys/dev/mlx4/mlx4_core X-SVN-Commit-Revision: 341551 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E0BBC7121A X-Spamd-Result: default: False [-0.69 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; NEURAL_HAM_LONG(-0.07)[-0.072,0]; NEURAL_HAM_SHORT(-0.08)[-0.077,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:39:06 -0000 Author: slavash Date: Wed Dec 5 13:39:05 2018 New Revision: 341551 URL: https://svnweb.freebsd.org/changeset/base/341551 Log: mlx4: Make sure default VNET is set when adding a new interface. Adding an interface might be done outside the device_attach() routine and will then cause a panic, due to the VNET not being defined. Submitted by: hselasky@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx4/mlx4_core/mlx4_intf.c Modified: head/sys/dev/mlx4/mlx4_core/mlx4_intf.c ============================================================================== --- head/sys/dev/mlx4/mlx4_core/mlx4_intf.c Wed Dec 5 13:38:35 2018 (r341550) +++ head/sys/dev/mlx4/mlx4_core/mlx4_intf.c Wed Dec 5 13:39:05 2018 (r341551) @@ -62,8 +62,11 @@ static void mlx4_add_device(struct mlx4_interface *int spin_lock_irq(&priv->ctx_lock); list_add_tail(&dev_ctx->list, &priv->ctx_list); spin_unlock_irq(&priv->ctx_lock); - if (intf->activate) + if (intf->activate) { + CURVNET_SET_QUIET(vnet0); intf->activate(&priv->dev, dev_ctx->context); + CURVNET_RESTORE(); + } } else kfree(dev_ctx); } From owner-svn-src-head@freebsd.org Wed Dec 5 13:39:36 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 942C213137BD; Wed, 5 Dec 2018 13:39:36 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3B10A7139B; Wed, 5 Dec 2018 13:39:36 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1C285150D0; Wed, 5 Dec 2018 13:39:36 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5DdZTb076421; Wed, 5 Dec 2018 13:39:35 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5DdZQq076420; Wed, 5 Dec 2018 13:39:35 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051339.wB5DdZQq076420@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:39:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341552 - head/sys/dev/mlx4/mlx4_en X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/sys/dev/mlx4/mlx4_en X-SVN-Commit-Revision: 341552 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3B10A7139B X-Spamd-Result: default: False [-0.69 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; NEURAL_HAM_SHORT(-0.08)[-0.077,0]; NEURAL_HAM_LONG(-0.07)[-0.072,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:39:36 -0000 Author: slavash Date: Wed Dec 5 13:39:35 2018 New Revision: 341552 URL: https://svnweb.freebsd.org/changeset/base/341552 Log: mlx4en: Optimise reception of small packets. Copy small packets like TCP ACKs into a new mbuf reusing the existing mbuf to receive a new ethernet frame. This avoids wasting buffer space for small sized packets. Submitted by: hselasky@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c ============================================================================== --- head/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c Wed Dec 5 13:39:05 2018 (r341551) +++ head/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c Wed Dec 5 13:39:35 2018 (r341552) @@ -629,6 +629,24 @@ mlx4_en_rx_mb(struct mlx4_en_priv *priv, struct mlx4_e #endif struct mbuf *mb; + /* optimise reception of small packets */ + if (length <= (MHLEN - MLX4_NET_IP_ALIGN) && + (mb = m_gethdr(M_NOWAIT, MT_DATA)) != NULL) { + + /* set packet length */ + mb->m_pkthdr.len = mb->m_len = length; + + /* make sure IP header gets aligned */ + mb->m_data += MLX4_NET_IP_ALIGN; + + bus_dmamap_sync(ring->dma_tag, mb_list->dma_map, + BUS_DMASYNC_POSTREAD); + + bcopy(mtod(mb_list->mbuf, caddr_t), mtod(mb, caddr_t), length); + + return (mb); + } + /* get mbuf */ mb = mb_list->mbuf; From owner-svn-src-head@freebsd.org Wed Dec 5 13:40:06 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CA7D71313857; Wed, 5 Dec 2018 13:40:06 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 70B16714F1; Wed, 5 Dec 2018 13:40:06 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 528D4150D5; Wed, 5 Dec 2018 13:40:06 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5De6TA076521; Wed, 5 Dec 2018 13:40:06 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5De6DY076520; Wed, 5 Dec 2018 13:40:06 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051340.wB5De6DY076520@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:40:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341553 - head/sys/dev/mlx5/mlx5_ib X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_ib X-SVN-Commit-Revision: 341553 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 70B16714F1 X-Spamd-Result: default: False [-0.69 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; NEURAL_HAM_SHORT(-0.08)[-0.077,0]; NEURAL_HAM_LONG(-0.07)[-0.072,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:40:07 -0000 Author: slavash Date: Wed Dec 5 13:40:05 2018 New Revision: 341553 URL: https://svnweb.freebsd.org/changeset/base/341553 Log: mlx5: Fix integer overflow while resizing CQ The user can provide very large cqe_size which will cause to integer overflow. Linux commit: 28e9091e3119933c38933cb8fc48d5618eb784c8 Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c ============================================================================== --- head/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c Wed Dec 5 13:39:35 2018 (r341552) +++ head/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c Wed Dec 5 13:40:05 2018 (r341553) @@ -1124,7 +1124,12 @@ static int resize_user(struct mlx5_ib_dev *dev, struct if (ucmd.reserved0 || ucmd.reserved1) return -EINVAL; - umem = ib_umem_get(context, ucmd.buf_addr, entries * ucmd.cqe_size, + /* check multiplication overflow */ + if (ucmd.cqe_size && SIZE_MAX / ucmd.cqe_size <= entries - 1) + return -EINVAL; + + umem = ib_umem_get(context, ucmd.buf_addr, + (size_t)ucmd.cqe_size * entries, IB_ACCESS_LOCAL_WRITE, 1); if (IS_ERR(umem)) { err = PTR_ERR(umem); From owner-svn-src-head@freebsd.org Wed Dec 5 13:40:37 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1F5E713138DD; Wed, 5 Dec 2018 13:40:37 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BBC4471658; Wed, 5 Dec 2018 13:40:36 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9E805150DE; Wed, 5 Dec 2018 13:40:36 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5DeabK076588; Wed, 5 Dec 2018 13:40:36 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5Deaf5076586; Wed, 5 Dec 2018 13:40:36 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051340.wB5Deaf5076586@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:40:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341554 - in head/sys/dev/mlx5: mlx5_core mlx5_ib X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: in head/sys/dev/mlx5: mlx5_core mlx5_ib X-SVN-Commit-Revision: 341554 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: BBC4471658 X-Spamd-Result: default: False [-0.62 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.52)[-0.521,0]; NEURAL_HAM_SHORT(-0.07)[-0.070,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.03)[-0.031,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:40:37 -0000 Author: slavash Date: Wed Dec 5 13:40:36 2018 New Revision: 341554 URL: https://svnweb.freebsd.org/changeset/base/341554 Log: mlx5: Raise fatal IB event when sys error occurs All other mlx5_events report the port number as 1 based, which is how FW reports it in the port event EQE. Reporting 0 for this event causes mlx5_ib to not raise a fatal event notification to registered clients due to a seemingly invalid port. All switch cases in mlx5_ib_event that go through the port check are supposed to set the port now, so just do it once at variable declaration. Linux commit: aba462134634b502d720e15b23154f21cfa277e5 Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_core/mlx5_health.c head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Modified: head/sys/dev/mlx5/mlx5_core/mlx5_health.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_health.c Wed Dec 5 13:40:05 2018 (r341553) +++ head/sys/dev/mlx5/mlx5_core/mlx5_health.c Wed Dec 5 13:40:36 2018 (r341554) @@ -269,7 +269,7 @@ void mlx5_enter_error_state(struct mlx5_core_dev *dev, mlx5_core_err(dev, "system error event triggered\n"); err_state_done: - mlx5_core_event(dev, MLX5_DEV_EVENT_SYS_ERROR, 0); + mlx5_core_event(dev, MLX5_DEV_EVENT_SYS_ERROR, 1); mutex_unlock(&dev->intf_state_mutex); } Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Wed Dec 5 13:40:05 2018 (r341553) +++ head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Wed Dec 5 13:40:36 2018 (r341554) @@ -2335,7 +2335,7 @@ static void mlx5_ib_event(struct mlx5_core_dev *dev, v struct mlx5_ib_dev *ibdev = (struct mlx5_ib_dev *)context; struct ib_event ibev; bool fatal = false; - u8 port = 0; + u8 port = (u8)param; switch (event) { case MLX5_DEV_EVENT_SYS_ERROR: @@ -2347,8 +2347,6 @@ static void mlx5_ib_event(struct mlx5_core_dev *dev, v case MLX5_DEV_EVENT_PORT_UP: case MLX5_DEV_EVENT_PORT_DOWN: case MLX5_DEV_EVENT_PORT_INITIALIZED: - port = (u8)param; - /* In RoCE, port up/down events are handled in * mlx5_netdev_event(). */ @@ -2362,24 +2360,20 @@ static void mlx5_ib_event(struct mlx5_core_dev *dev, v case MLX5_DEV_EVENT_LID_CHANGE: ibev.event = IB_EVENT_LID_CHANGE; - port = (u8)param; break; case MLX5_DEV_EVENT_PKEY_CHANGE: ibev.event = IB_EVENT_PKEY_CHANGE; - port = (u8)param; schedule_work(&ibdev->devr.ports[port - 1].pkey_change_work); break; case MLX5_DEV_EVENT_GUID_CHANGE: ibev.event = IB_EVENT_GID_CHANGE; - port = (u8)param; break; case MLX5_DEV_EVENT_CLIENT_REREG: ibev.event = IB_EVENT_CLIENT_REREGISTER; - port = (u8)param; break; default: @@ -2390,7 +2384,7 @@ static void mlx5_ib_event(struct mlx5_core_dev *dev, v ibev.device = &ibdev->ib_dev; ibev.element.port_num = port; - if (port < 1 || port > ibdev->num_ports) { + if (!rdma_is_port_valid(&ibdev->ib_dev, port)) { mlx5_ib_warn(ibdev, "warning: event(%d) on port %d\n", event, port); return; } From owner-svn-src-head@freebsd.org Wed Dec 5 13:41:08 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 287BE1313973; Wed, 5 Dec 2018 13:41:08 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6B5177183B; Wed, 5 Dec 2018 13:41:07 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4D8F6150F9; Wed, 5 Dec 2018 13:41:07 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5Df7OA076659; Wed, 5 Dec 2018 13:41:07 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5Df6UD076657; Wed, 5 Dec 2018 13:41:06 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051341.wB5Df6UD076657@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:41:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341555 - in head/sys/dev/mlx5: mlx5_core mlx5_en X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: in head/sys/dev/mlx5: mlx5_core mlx5_en X-SVN-Commit-Revision: 341555 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6B5177183B X-Spamd-Result: default: False [-0.69 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; NEURAL_HAM_SHORT(-0.08)[-0.077,0]; NEURAL_HAM_LONG(-0.07)[-0.072,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:41:08 -0000 Author: slavash Date: Wed Dec 5 13:41:06 2018 New Revision: 341555 URL: https://svnweb.freebsd.org/changeset/base/341555 Log: mlx5: Discard unused return values. Submitted by: hselasky@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c Modified: head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c Wed Dec 5 13:40:36 2018 (r341554) +++ head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c Wed Dec 5 13:41:06 2018 (r341555) @@ -128,7 +128,7 @@ mlx5_fwp_alloc(struct mlx5_core_dev *dev, gfp_t flags, /* load memory into DMA */ MLX5_DMA_LOCK(dev); - err = bus_dmamap_load( + (void) bus_dmamap_load( dev->cmd.dma_tag, fwp[x].dma_map, fwp[x].virt_addr, MLX5_ADAPTER_PAGE_SIZE, &mlx5_fwp_load_mem_cb, fwp + x, BUS_DMA_WAITOK | BUS_DMA_COHERENT); Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c Wed Dec 5 13:40:36 2018 (r341554) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c Wed Dec 5 13:41:06 2018 (r341555) @@ -421,7 +421,6 @@ mlx5e_rlw_channel_set_rate_locked(struct mlx5e_rl_work if (rate == 0) { /* rate doesn't exist, fallback to unlimited */ - error = EINVAL; index = 0; rate = 0; atomic_add_64(&rlw->priv->rl.stats.tx_modify_rate_failure, 1ULL); From owner-svn-src-head@freebsd.org Wed Dec 5 13:41:38 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 92EB41313B2E; Wed, 5 Dec 2018 13:41:38 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3970871A02; Wed, 5 Dec 2018 13:41:38 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1A6DE1512B; Wed, 5 Dec 2018 13:41:38 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5DfbYI076727; Wed, 5 Dec 2018 13:41:37 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5Dfb2E076724; Wed, 5 Dec 2018 13:41:37 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051341.wB5Dfb2E076724@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:41:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341556 - head/sys/dev/mlx5/mlx5_core X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 341556 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3970871A02 X-Spamd-Result: default: False [-0.69 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; NEURAL_HAM_SHORT(-0.08)[-0.077,0]; NEURAL_HAM_LONG(-0.07)[-0.072,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:41:38 -0000 Author: slavash Date: Wed Dec 5 13:41:37 2018 New Revision: 341556 URL: https://svnweb.freebsd.org/changeset/base/341556 Log: mlx5: Fix for potential memory leaks. Make sure allocated data gets freed in error cases. Submitted by: hselasky@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c head/sys/dev/mlx5/mlx5_core/mlx5_vport.c Modified: head/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c Wed Dec 5 13:41:06 2018 (r341555) +++ head/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c Wed Dec 5 13:41:37 2018 (r341556) @@ -1601,9 +1601,10 @@ static char *get_dest_name(struct mlx5_flow_destinatio case MLX5_FLOW_CONTEXT_DEST_TYPE_TIR: snprintf(name, 20, "dest_%s_%u", "tir", dest->tir_num); return name; + default: + kfree(name); + return NULL; } - - return NULL; } /* assumed fg is locked */ Modified: head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c Wed Dec 5 13:41:06 2018 (r341555) +++ head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c Wed Dec 5 13:41:37 2018 (r341556) @@ -153,6 +153,7 @@ failure: bus_dmamem_free(dev->cmd.dma_tag, fwp[x].virt_addr, fwp[x].dma_map); } sx_xunlock(&dev->cmd.dma_sx); + kfree(fwp); return (NULL); } Modified: head/sys/dev/mlx5/mlx5_core/mlx5_vport.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_vport.c Wed Dec 5 13:41:06 2018 (r341555) +++ head/sys/dev/mlx5/mlx5_core/mlx5_vport.c Wed Dec 5 13:41:37 2018 (r341556) @@ -1597,8 +1597,8 @@ int mlx5_query_vport_counter(struct mlx5_core_dev *dev err = mlx5_cmd_exec(dev, in, in_sz, out, out_size); - kvfree(in); ex: + kvfree(in); return err; } EXPORT_SYMBOL_GPL(mlx5_query_vport_counter); From owner-svn-src-head@freebsd.org Wed Dec 5 13:42:07 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9F9FD1313BBA; Wed, 5 Dec 2018 13:42:07 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4664071CBC; Wed, 5 Dec 2018 13:42:07 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 276FC15261; Wed, 5 Dec 2018 13:42:07 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5Dg7u4080486; Wed, 5 Dec 2018 13:42:07 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5Dg6bO080485; Wed, 5 Dec 2018 13:42:06 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051342.wB5Dg6bO080485@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:42:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341557 - in head/sys/dev/mlx5: . mlx5_ib X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: in head/sys/dev/mlx5: . mlx5_ib X-SVN-Commit-Revision: 341557 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4664071CBC X-Spamd-Result: default: False [-0.62 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.52)[-0.521,0]; NEURAL_HAM_SHORT(-0.07)[-0.070,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.03)[-0.031,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:42:07 -0000 Author: slavash Date: Wed Dec 5 13:42:06 2018 New Revision: 341557 URL: https://svnweb.freebsd.org/changeset/base/341557 Log: mlx5: Add SRQ fixes from Linux Combine multiple fixes from Linux to SRQ. Linux commits: c73b791 IB/mlx5: Assign SRQ type earlier 0fd27a8 IB/mlx5: Fix out-of-bound access c2b37f7 IB/mlx5: Fix integer overflows in mlx5_ib_create_srq d63c467 RDMA/mlx5: Fix memory leak in mlx5_ib_create_srq() error path Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/driver.h head/sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.c Modified: head/sys/dev/mlx5/driver.h ============================================================================== --- head/sys/dev/mlx5/driver.h Wed Dec 5 13:41:37 2018 (r341556) +++ head/sys/dev/mlx5/driver.h Wed Dec 5 13:42:06 2018 (r341557) @@ -462,8 +462,8 @@ struct mlx5_core_srq { struct mlx5_core_rsc_common common; /* must be first */ u32 srqn; int max; - int max_gs; - int max_avail_gather; + size_t max_gs; + size_t max_avail_gather; int wqe_shift; void (*event)(struct mlx5_core_srq *, int); atomic_t refcount; Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.c ============================================================================== --- head/sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.c Wed Dec 5 13:41:37 2018 (r341556) +++ head/sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.c Wed Dec 5 13:42:06 2018 (r341557) @@ -159,8 +159,6 @@ static int create_srq_kernel(struct mlx5_ib_dev *dev, int err; int i; struct mlx5_wqe_srq_next_seg *next; - int page_shift; - int npages; err = mlx5_db_alloc(dev->mdev, &srq->db); if (err) { @@ -173,7 +171,6 @@ static int create_srq_kernel(struct mlx5_ib_dev *dev, err = -ENOMEM; goto err_db; } - page_shift = srq->buf.page_shift; srq->head = 0; srq->tail = srq->msrq.max - 1; @@ -185,10 +182,8 @@ static int create_srq_kernel(struct mlx5_ib_dev *dev, cpu_to_be16((i + 1) & (srq->msrq.max - 1)); } - npages = DIV_ROUND_UP(srq->buf.npages, 1 << (page_shift - PAGE_SHIFT)); - mlx5_ib_dbg(dev, "buf_size %d, page_shift %d, npages %d, calc npages %d\n", - buf_size, page_shift, srq->buf.npages, npages); - in->pas = mlx5_vzalloc(sizeof(*in->pas) * npages); + mlx5_ib_dbg(dev, "srq->buf.page_shift = %d\n", srq->buf.page_shift); + in->pas = mlx5_vzalloc(sizeof(*in->pas) * srq->buf.npages); if (!in->pas) { err = -ENOMEM; goto err_buf; @@ -204,7 +199,7 @@ static int create_srq_kernel(struct mlx5_ib_dev *dev, } srq->wq_sig = !!srq_signature; - in->log_page_size = page_shift - MLX5_ADAPTER_PAGE_SHIFT; + in->log_page_size = srq->buf.page_shift - MLX5_ADAPTER_PAGE_SHIFT; if (MLX5_CAP_GEN(dev->mdev, cqe_version) == MLX5_CQE_VERSION_V1 && in->type == IB_SRQT_XRC) in->user_index = MLX5_IB_DEFAULT_UIDX; @@ -242,8 +237,8 @@ struct ib_srq *mlx5_ib_create_srq(struct ib_pd *pd, { struct mlx5_ib_dev *dev = to_mdev(pd->device); struct mlx5_ib_srq *srq; - int desc_size; - int buf_size; + size_t desc_size; + size_t buf_size; int err; struct mlx5_srq_attr in = {0}; __u32 max_srq_wqes = 1 << MLX5_CAP_GEN(dev->mdev, log_max_srq_sz); @@ -267,15 +262,25 @@ struct ib_srq *mlx5_ib_create_srq(struct ib_pd *pd, desc_size = sizeof(struct mlx5_wqe_srq_next_seg) + srq->msrq.max_gs * sizeof(struct mlx5_wqe_data_seg); + if (desc_size == 0 || srq->msrq.max_gs > desc_size) { + err = -EINVAL; + goto err_srq; + } desc_size = roundup_pow_of_two(desc_size); - desc_size = max_t(int, 32, desc_size); + desc_size = max_t(size_t, 32, desc_size); + if (desc_size < sizeof(struct mlx5_wqe_srq_next_seg)) { + err = -EINVAL; + goto err_srq; + } srq->msrq.max_avail_gather = (desc_size - sizeof(struct mlx5_wqe_srq_next_seg)) / sizeof(struct mlx5_wqe_data_seg); srq->msrq.wqe_shift = ilog2(desc_size); buf_size = srq->msrq.max * desc_size; - mlx5_ib_dbg(dev, "desc_size 0x%x, req wr 0x%x, srq size 0x%x, max_gs 0x%x, max_avail_gather 0x%x\n", - desc_size, init_attr->attr.max_wr, srq->msrq.max, srq->msrq.max_gs, - srq->msrq.max_avail_gather); + if (buf_size < desc_size) { + err = -EINVAL; + goto err_srq; + } + in.type = init_attr->srq_type; if (pd->uobject) err = create_srq_user(pd, srq, &in, udata, buf_size); @@ -288,7 +293,6 @@ struct ib_srq *mlx5_ib_create_srq(struct ib_pd *pd, goto err_srq; } - in.type = init_attr->srq_type; in.log_size = ilog2(srq->msrq.max); in.wqe_shift = srq->msrq.wqe_shift - 4; if (srq->wq_sig) From owner-svn-src-head@freebsd.org Wed Dec 5 13:42:37 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7BCAD1313C2A; Wed, 5 Dec 2018 13:42:37 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2103771E67; Wed, 5 Dec 2018 13:42:37 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DD85315280; Wed, 5 Dec 2018 13:42:36 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5DgaFv081264; Wed, 5 Dec 2018 13:42:36 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5DgaDX081263; Wed, 5 Dec 2018 13:42:36 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051342.wB5DgaDX081263@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:42:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341558 - head/sys/dev/mlx5/mlx5_core X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 341558 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2103771E67 X-Spamd-Result: default: False [-0.62 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.52)[-0.521,0]; NEURAL_HAM_SHORT(-0.07)[-0.070,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.03)[-0.031,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:42:37 -0000 Author: slavash Date: Wed Dec 5 13:42:36 2018 New Revision: 341558 URL: https://svnweb.freebsd.org/changeset/base/341558 Log: mlx5: Convert some spaces into tabs and use device_printf() instead of printf(). Submitted by: hselasky@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_main.c Wed Dec 5 13:42:06 2018 (r341557) +++ head/sys/dev/mlx5/mlx5_core/mlx5_main.c Wed Dec 5 13:42:36 2018 (r341558) @@ -1211,7 +1211,7 @@ static int init_one(struct pci_dev *pdev, priv->pci_dev_data = id->driver_data; if (prof_sel < 0 || prof_sel >= ARRAY_SIZE(profiles)) { - printf("mlx5_core: WARN: ""selected profile out of range, selecting default (%d)\n", MLX5_DEFAULT_PROF); + device_printf(bsddev, "WARN: selected profile out of range, selecting default (%d)\n", MLX5_DEFAULT_PROF); prof_sel = MLX5_DEFAULT_PROF; } dev->profile = &profiles[prof_sel]; @@ -1226,38 +1226,38 @@ static int init_one(struct pci_dev *pdev, INIT_LIST_HEAD(&priv->ctx_list); spin_lock_init(&priv->ctx_lock); - mutex_init(&dev->pci_status_mutex); - mutex_init(&dev->intf_state_mutex); + mutex_init(&dev->pci_status_mutex); + mutex_init(&dev->intf_state_mutex); err = mlx5_pci_init(dev, priv); if (err) { - device_printf((&pdev->dev)->bsddev, "ERR: ""mlx5_pci_init failed %d\n", err); + device_printf(bsddev, "ERR: mlx5_pci_init failed %d\n", err); goto clean_dev; } - err = mlx5_health_init(dev); - if (err) { - device_printf((&pdev->dev)->bsddev, "ERR: ""mlx5_health_init failed %d\n", err); - goto close_pci; - } + err = mlx5_health_init(dev); + if (err) { + device_printf(bsddev, "ERR: mlx5_health_init failed %d\n", err); + goto close_pci; + } mlx5_pagealloc_init(dev); err = mlx5_load_one(dev, priv, true); if (err) { - device_printf((&pdev->dev)->bsddev, "ERR: ""mlx5_register_device failed %d\n", err); + device_printf(bsddev, "ERR: mlx5_load_one failed %d\n", err); goto clean_health; } mlx5_fwdump_prep(dev); - pci_save_state(pdev->dev.bsddev); + pci_save_state(bsddev); return 0; clean_health: mlx5_pagealloc_cleanup(dev); - mlx5_health_cleanup(dev); + mlx5_health_cleanup(dev); close_pci: - mlx5_pci_close(dev, priv); + mlx5_pci_close(dev, priv); clean_dev: sysctl_ctx_free(&dev->sysctl_ctx); kfree(dev); From owner-svn-src-head@freebsd.org Wed Dec 5 13:43:08 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8A7FA1313CDC; Wed, 5 Dec 2018 13:43:08 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 278747200C; Wed, 5 Dec 2018 13:43:08 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 09B5415281; Wed, 5 Dec 2018 13:43:08 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5Dh7gZ081336; Wed, 5 Dec 2018 13:43:07 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5Dh7En081333; Wed, 5 Dec 2018 13:43:07 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051343.wB5Dh7En081333@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:43:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341559 - in head/sys/dev/mlx5: mlx5_core mlx5_en X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: in head/sys/dev/mlx5: mlx5_core mlx5_en X-SVN-Commit-Revision: 341559 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 278747200C X-Spamd-Result: default: False [-0.69 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; NEURAL_HAM_SHORT(-0.08)[-0.077,0]; NEURAL_HAM_LONG(-0.07)[-0.072,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:43:08 -0000 Author: slavash Date: Wed Dec 5 13:43:07 2018 New Revision: 341559 URL: https://svnweb.freebsd.org/changeset/base/341559 Log: mlx5: Move hw.mlx5 node definition to mlx5_core. Submitted by: kib@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_core/mlx5_core.h head/sys/dev/mlx5/mlx5_core/mlx5_main.c head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Modified: head/sys/dev/mlx5/mlx5_core/mlx5_core.h ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_core.h Wed Dec 5 13:42:36 2018 (r341558) +++ head/sys/dev/mlx5/mlx5_core/mlx5_core.h Wed Dec 5 13:43:07 2018 (r341559) @@ -103,4 +103,6 @@ struct mlx5_crspace_regmap { extern struct pci_driver mlx5_core_driver; +SYSCTL_DECL(_hw_mlx5); + #endif /* __MLX5_CORE_H__ */ Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_main.c Wed Dec 5 13:42:36 2018 (r341558) +++ head/sys/dev/mlx5/mlx5_core/mlx5_main.c Wed Dec 5 13:43:07 2018 (r341559) @@ -61,6 +61,8 @@ static int prof_sel = MLX5_DEFAULT_PROF; module_param_named(prof_sel, prof_sel, int, 0444); MODULE_PARM_DESC(prof_sel, "profile selector. Valid range 0 - 2"); +SYSCTL_NODE(_hw, OID_AUTO, mlx5, CTLFLAG_RW, 0, "mlx5 HW controls"); + #define NUMA_NO_NODE -1 static LIST_HEAD(intf_list); Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 5 13:42:36 2018 (r341558) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 5 13:43:07 2018 (r341559) @@ -159,7 +159,7 @@ static const struct { MALLOC_DEFINE(M_MLX5EN, "MLX5EN", "MLX5 Ethernet"); -static SYSCTL_NODE(_hw, OID_AUTO, mlx5, CTLFLAG_RW, 0, "MLX5 driver parameters"); +SYSCTL_DECL(_hw_mlx5); static void mlx5e_update_carrier(struct mlx5e_priv *priv) From owner-svn-src-head@freebsd.org Wed Dec 5 13:43:39 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 894141313D44; Wed, 5 Dec 2018 13:43:39 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D914872156; Wed, 5 Dec 2018 13:43:38 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BB5B815282; Wed, 5 Dec 2018 13:43:38 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5DhcG0081406; Wed, 5 Dec 2018 13:43:38 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5DhcYr081402; Wed, 5 Dec 2018 13:43:38 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051343.wB5DhcYr081402@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:43:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341560 - in head/sys/dev/mlx5: . mlx5_core X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: in head/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 341560 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D914872156 X-Spamd-Result: default: False [-0.62 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.52)[-0.521,0]; NEURAL_HAM_LONG(-0.03)[-0.031,0]; NEURAL_HAM_SHORT(-0.07)[-0.070,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:43:39 -0000 Author: slavash Date: Wed Dec 5 13:43:37 2018 New Revision: 341560 URL: https://svnweb.freebsd.org/changeset/base/341560 Log: mlx5: Fix use-after-free in self-healing flow When the mlx5 health mechanism detects a problem while the driver is in the middle of init_one or remove_one, the driver needs to prevent the health mechanism from scheduling future work; if future work is scheduled, there is a problem with use-after-free: the system WQ tries to run the work item (which has been freed) at the scheduled future time. Prevent this by disabling work item scheduling in the health mechanism when the driver is in the middle of init_one() or remove_one(). Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/driver.h head/sys/dev/mlx5/mlx5_core/mlx5_health.c head/sys/dev/mlx5/mlx5_core/mlx5_main.c Modified: head/sys/dev/mlx5/driver.h ============================================================================== --- head/sys/dev/mlx5/driver.h Wed Dec 5 13:43:07 2018 (r341559) +++ head/sys/dev/mlx5/driver.h Wed Dec 5 13:43:37 2018 (r341560) @@ -923,7 +923,7 @@ void mlx5_unmap_free_uar(struct mlx5_core_dev *mdev, s void mlx5_health_cleanup(struct mlx5_core_dev *dev); int mlx5_health_init(struct mlx5_core_dev *dev); void mlx5_start_health_poll(struct mlx5_core_dev *dev); -void mlx5_stop_health_poll(struct mlx5_core_dev *dev); +void mlx5_stop_health_poll(struct mlx5_core_dev *dev, bool disable_health); void mlx5_drain_health_wq(struct mlx5_core_dev *dev); void mlx5_drain_health_recovery(struct mlx5_core_dev *dev); void mlx5_trigger_health_work(struct mlx5_core_dev *dev); Modified: head/sys/dev/mlx5/mlx5_core/mlx5_health.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_health.c Wed Dec 5 13:43:07 2018 (r341559) +++ head/sys/dev/mlx5/mlx5_core/mlx5_health.c Wed Dec 5 13:43:37 2018 (r341560) @@ -516,9 +516,17 @@ void mlx5_start_health_poll(struct mlx5_core_dev *dev) round_jiffies(jiffies + MLX5_HEALTH_POLL_INTERVAL)); } -void mlx5_stop_health_poll(struct mlx5_core_dev *dev) +void mlx5_stop_health_poll(struct mlx5_core_dev *dev, bool disable_health) { struct mlx5_core_health *health = &dev->priv.health; + unsigned long flags; + + if (disable_health) { + spin_lock_irqsave(&health->wq_lock, flags); + set_bit(MLX5_DROP_NEW_HEALTH_WORK, &health->flags); + set_bit(MLX5_DROP_NEW_RECOVERY_WORK, &health->flags); + spin_unlock_irqrestore(&health->wq_lock, flags); + } del_timer_sync(&health->timer); } Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_main.c Wed Dec 5 13:43:07 2018 (r341559) +++ head/sys/dev/mlx5/mlx5_core/mlx5_main.c Wed Dec 5 13:43:37 2018 (r341560) @@ -1107,7 +1107,7 @@ err_cleanup_once: mlx5_cleanup_once(dev); err_stop_poll: - mlx5_stop_health_poll(dev); + mlx5_stop_health_poll(dev, boot); if (mlx5_cmd_teardown_hca(dev)) { device_printf((&dev->pdev->dev)->bsddev, "ERR: ""tear_down_hca failed, skip cleanup\n"); goto out_err; @@ -1159,7 +1159,7 @@ static int mlx5_unload_one(struct mlx5_core_dev *dev, mlx5_disable_msix(dev); if (cleanup) mlx5_cleanup_once(dev); - mlx5_stop_health_poll(dev); + mlx5_stop_health_poll(dev, cleanup); err = mlx5_cmd_teardown_hca(dev); if (err) { device_printf((&dev->pdev->dev)->bsddev, "ERR: ""tear_down_hca failed, skip cleanup\n"); @@ -1405,6 +1405,12 @@ static int mlx5_try_fast_unload(struct mlx5_core_dev * mlx5_core_dbg(dev, "Device in internal error state, giving up\n"); return -EAGAIN; } + + /* Panic tear down fw command will stop the PCI bus communication + * with the HCA, so the health polll is no longer needed. + */ + mlx5_drain_health_wq(dev); + mlx5_stop_health_poll(dev, false); err = mlx5_cmd_force_teardown_hca(dev); if (err) { From owner-svn-src-head@freebsd.org Wed Dec 5 13:44:11 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 460441313DF8; Wed, 5 Dec 2018 13:44:11 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DBD18723A1; Wed, 5 Dec 2018 13:44:10 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8076B1528F; Wed, 5 Dec 2018 13:44:08 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5Di8TH081496; Wed, 5 Dec 2018 13:44:08 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5Di8Xr081495; Wed, 5 Dec 2018 13:44:08 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051344.wB5Di8Xr081495@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:44:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341561 - head/sys/dev/mlx5/mlx5_core X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 341561 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: DBD18723A1 X-Spamd-Result: default: False [-0.69 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; NEURAL_HAM_SHORT(-0.08)[-0.077,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.07)[-0.072,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:44:11 -0000 Author: slavash Date: Wed Dec 5 13:44:08 2018 New Revision: 341561 URL: https://svnweb.freebsd.org/changeset/base/341561 Log: mlx5: Add global control to disable firmware reset, for all mlx5 devices. Submitted by: kib@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_core/mlx5_health.c Modified: head/sys/dev/mlx5/mlx5_core/mlx5_health.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_health.c Wed Dec 5 13:43:37 2018 (r341560) +++ head/sys/dev/mlx5/mlx5_core/mlx5_health.c Wed Dec 5 13:44:08 2018 (r341561) @@ -59,6 +59,11 @@ enum { MLX5_SENSOR_FW_SYND_RFR = 5, }; +static int mlx5_fw_reset_enable = 1; +SYSCTL_INT(_hw_mlx5, OID_AUTO, fw_reset_enable, CTLFLAG_RWTUN, + &mlx5_fw_reset_enable, 0, + "Enable firmware reset"); + static int lock_sem_sw_reset(struct mlx5_core_dev *dev) { int ret; @@ -180,10 +185,13 @@ static u32 check_fatal_sensors(struct mlx5_core_dev *d static void reset_fw_if_needed(struct mlx5_core_dev *dev) { - bool supported = (ioread32be(&dev->iseg->initializing) >> - MLX5_FW_RESET_SUPPORTED_OFFSET) & 1; + bool supported; u32 cmdq_addr, fatal_error; + if (!mlx5_fw_reset_enable) + return; + supported = (ioread32be(&dev->iseg->initializing) >> + MLX5_FW_RESET_SUPPORTED_OFFSET) & 1; if (!supported) return; From owner-svn-src-head@freebsd.org Wed Dec 5 13:44:39 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 62C931313EA0; Wed, 5 Dec 2018 13:44:39 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0B13572563; Wed, 5 Dec 2018 13:44:39 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DF87E15290; Wed, 5 Dec 2018 13:44:38 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5Dic5O081566; Wed, 5 Dec 2018 13:44:38 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5DicV1081564; Wed, 5 Dec 2018 13:44:38 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051344.wB5DicV1081564@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:44:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341562 - in head/sys/dev/mlx5: . mlx5_core X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: in head/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 341562 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0B13572563 X-Spamd-Result: default: False [-0.69 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; NEURAL_HAM_SHORT(-0.08)[-0.077,0]; NEURAL_HAM_LONG(-0.07)[-0.072,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:44:39 -0000 Author: slavash Date: Wed Dec 5 13:44:38 2018 New Revision: 341562 URL: https://svnweb.freebsd.org/changeset/base/341562 Log: mlx5: Extend vector argument to u64. Else the MLX5_TRIGGERED_CMD_COMP flag will be masked away. Submitted by: hselasky@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/driver.h head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Modified: head/sys/dev/mlx5/driver.h ============================================================================== --- head/sys/dev/mlx5/driver.h Wed Dec 5 13:44:08 2018 (r341561) +++ head/sys/dev/mlx5/driver.h Wed Dec 5 13:44:38 2018 (r341562) @@ -984,7 +984,7 @@ void mlx5_cq_completion(struct mlx5_core_dev *dev, u32 void mlx5_rsc_event(struct mlx5_core_dev *dev, u32 rsn, int event_type); void mlx5_srq_event(struct mlx5_core_dev *dev, u32 srqn, int event_type); struct mlx5_core_srq *mlx5_core_get_srq(struct mlx5_core_dev *dev, u32 srqn); -void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u32 vector); +void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u64 vector); void mlx5_cq_event(struct mlx5_core_dev *dev, u32 cqn, int event_type); int mlx5_create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, u8 vecidx, int nent, u64 mask, const char *name, struct mlx5_uar *uar); Modified: head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Wed Dec 5 13:44:08 2018 (r341561) +++ head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Wed Dec 5 13:44:38 2018 (r341562) @@ -1179,10 +1179,12 @@ static void free_msg(struct mlx5_core_dev *dev, struct } } -void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u32 vector) +void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u64 vector_flags) { struct mlx5_cmd *cmd = &dev->cmd; struct mlx5_cmd_work_ent *ent; + bool triggered = (vector_flags & MLX5_TRIGGERED_CMD_COMP) ? 1 : 0; + u32 vector = vector_flags; /* discard flags in the upper dword */ int i; /* make sure data gets read from RAM */ @@ -1206,7 +1208,7 @@ void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, else ent->ret = 0; ent->status = ent->lay->status_own >> 1; - if (vector & MLX5_TRIGGERED_CMD_COMP) + if (triggered) ent->status = MLX5_DRIVER_STATUS_ABORTED; else ent->status = ent->lay->status_own >> 1; From owner-svn-src-head@freebsd.org Wed Dec 5 13:45:10 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1391D1313F41; Wed, 5 Dec 2018 13:45:10 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AB7B47270D; Wed, 5 Dec 2018 13:45:09 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8C9A615293; Wed, 5 Dec 2018 13:45:09 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5Dj9rh081646; Wed, 5 Dec 2018 13:45:09 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5Dj9wO081644; Wed, 5 Dec 2018 13:45:09 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051345.wB5Dj9wO081644@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:45:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341563 - in head/sys/dev/mlx5: . mlx5_core X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: in head/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 341563 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: AB7B47270D X-Spamd-Result: default: False [-0.62 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.52)[-0.521,0]; NEURAL_HAM_SHORT(-0.07)[-0.070,0]; NEURAL_HAM_LONG(-0.03)[-0.031,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:45:10 -0000 Author: slavash Date: Wed Dec 5 13:45:08 2018 New Revision: 341563 URL: https://svnweb.freebsd.org/changeset/base/341563 Log: mlx5: Implement support for configuring PCIe packet write ordering via a sysctl. Submitted by: hselasky@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_core/mlx5_mr.c head/sys/dev/mlx5/mlx5_ifc.h Modified: head/sys/dev/mlx5/mlx5_core/mlx5_mr.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_mr.c Wed Dec 5 13:44:38 2018 (r341562) +++ head/sys/dev/mlx5/mlx5_core/mlx5_mr.c Wed Dec 5 13:45:08 2018 (r341563) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2018, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -30,6 +30,11 @@ #include #include "mlx5_core.h" +static int mlx5_relaxed_ordering_write; +SYSCTL_INT(_hw_mlx5, OID_AUTO, relaxed_ordering_write, CTLFLAG_RWTUN, + &mlx5_relaxed_ordering_write, 0, + "Set to enable relaxed ordering for PCIe writes"); + void mlx5_init_mr_table(struct mlx5_core_dev *dev) { struct mlx5_mr_table *table = &dev->priv.mr_table; @@ -63,6 +68,14 @@ int mlx5_core_create_mkey_cb(struct mlx5_core_dev *dev mkc = MLX5_ADDR_OF(create_mkey_in, in, memory_key_mkey_entry); MLX5_SET(create_mkey_in, in, opcode, MLX5_CMD_OP_CREATE_MKEY); MLX5_SET(mkc, mkc, mkey_7_0, key); + + if (mlx5_relaxed_ordering_write != 0) { + if (MLX5_CAP_GEN(dev, relaxed_ordering_write)) + MLX5_SET(mkc, mkc, relaxed_ordering_write, 1); + else + return (-EPROTONOSUPPORT); + } + if (callback) return mlx5_cmd_exec_cb(dev, in, inlen, out, outlen, callback, context); Modified: head/sys/dev/mlx5/mlx5_ifc.h ============================================================================== --- head/sys/dev/mlx5/mlx5_ifc.h Wed Dec 5 13:44:38 2018 (r341562) +++ head/sys/dev/mlx5/mlx5_ifc.h Wed Dec 5 13:45:08 2018 (r341563) @@ -933,7 +933,8 @@ struct mlx5_ifc_cmd_hca_cap_bits { u8 log_max_cq[0x5]; u8 log_max_eq_sz[0x8]; - u8 reserved_6[0x2]; + u8 relaxed_ordering_write[1]; + u8 reserved_6[0x1]; u8 log_max_mkey[0x6]; u8 reserved_7[0xc]; u8 log_max_eq[0x4]; @@ -2424,9 +2425,13 @@ enum { }; struct mlx5_ifc_mkc_bits { - u8 reserved_0[0x1]; + u8 reserved_at_0[0x1]; u8 free[0x1]; - u8 reserved_1[0xd]; + u8 reserved_at_2[0x1]; + u8 access_mode_4_2[0x3]; + u8 reserved_at_6[0x7]; + u8 relaxed_ordering_write[0x1]; + u8 reserved_at_e[0x1]; u8 small_fence_on_rdma_read_response[0x1]; u8 umr_en[0x1]; u8 a[0x1]; From owner-svn-src-head@freebsd.org Wed Dec 5 13:45:39 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 06BBD1313FDA; Wed, 5 Dec 2018 13:45:39 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A268572879; Wed, 5 Dec 2018 13:45:38 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8442315295; Wed, 5 Dec 2018 13:45:38 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5DjcNR081716; Wed, 5 Dec 2018 13:45:38 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5Djclg081714; Wed, 5 Dec 2018 13:45:38 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051345.wB5Djclg081714@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:45:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341564 - head/sys/dev/mlx5/mlx5_en X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 341564 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A268572879 X-Spamd-Result: default: False [-0.69 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; NEURAL_HAM_SHORT(-0.08)[-0.077,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.07)[-0.072,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:45:39 -0000 Author: slavash Date: Wed Dec 5 13:45:37 2018 New Revision: 341564 URL: https://svnweb.freebsd.org/changeset/base/341564 Log: mlx5: Add software tx_jumbo_packets counter This counter will represent transmitted packets which has more than 1518 octets. The NIC has multiple hardware counters for counting transmitted packets larger than 1518 octets. Each counter counts the packets in specific range. We accumulate those counters to have a single counter. Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/en.h head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Modified: head/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- head/sys/dev/mlx5/mlx5_en/en.h Wed Dec 5 13:45:08 2018 (r341563) +++ head/sys/dev/mlx5/mlx5_en/en.h Wed Dec 5 13:45:37 2018 (r341564) @@ -178,7 +178,8 @@ typedef void (mlx5e_cq_comp_t)(struct mlx5_core_cq *); m(+1, u64 tx_csum_offload, "tx_csum_offload", "Transmit checksum offload packets") \ m(+1, u64 tx_queue_dropped, "tx_queue_dropped", "Transmit queue dropped") \ m(+1, u64 tx_defragged, "tx_defragged", "Transmit queue defragged") \ - m(+1, u64 rx_wqe_err, "rx_wqe_err", "Receive WQE errors") + m(+1, u64 rx_wqe_err, "rx_wqe_err", "Receive WQE errors") \ + m(+1, u64 tx_jumbo_packets, "tx_jumbo_packets", "TX packets greater than 1518 octets") #define MLX5E_VPORT_STATS_NUM (0 MLX5E_VPORT_STATS(MLX5E_STATS_COUNT)) Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 5 13:45:08 2018 (r341563) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 5 13:45:37 2018 (r341564) @@ -502,6 +502,12 @@ mlx5e_update_stats_work(struct work_struct *work) } } + s->tx_jumbo_packets = + priv->stats.port_stats_debug.p1519to2047octets + + priv->stats.port_stats_debug.p2048to4095octets + + priv->stats.port_stats_debug.p4096to8191octets + + priv->stats.port_stats_debug.p8192to10239octets; + /* update counters */ s->tso_packets = tso_packets; s->tso_bytes = tso_bytes; From owner-svn-src-head@freebsd.org Wed Dec 5 13:46:10 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7859C131406E; Wed, 5 Dec 2018 13:46:10 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1AFDB729D1; Wed, 5 Dec 2018 13:46:10 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C835415296; Wed, 5 Dec 2018 13:46:09 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5Dk9O0081787; Wed, 5 Dec 2018 13:46:09 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5Dk9o0081786; Wed, 5 Dec 2018 13:46:09 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051346.wB5Dk9o0081786@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:46:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341565 - head/sys/dev/mlx5/mlx5_core X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 341565 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1AFDB729D1 X-Spamd-Result: default: False [-0.69 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; NEURAL_HAM_SHORT(-0.08)[-0.077,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.07)[-0.072,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:46:10 -0000 Author: slavash Date: Wed Dec 5 13:46:09 2018 New Revision: 341565 URL: https://svnweb.freebsd.org/changeset/base/341565 Log: mlx5: Fix wrong size allocation for QoS ETC TC register The driver allocates wrong size (due to wrong struct name) when issuing a query/set request to NIC's register. Linux commit: d14fcb8d877caf1b8d6bd65d444bf62b21f2070c Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_core/mlx5_port.c Modified: head/sys/dev/mlx5/mlx5_core/mlx5_port.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_port.c Wed Dec 5 13:45:37 2018 (r341564) +++ head/sys/dev/mlx5/mlx5_core/mlx5_port.c Wed Dec 5 13:46:09 2018 (r341565) @@ -810,7 +810,7 @@ int mlx5_query_port_cong_params(struct mlx5_core_dev * static int mlx5_query_port_qetcr_reg(struct mlx5_core_dev *mdev, u32 *out, int outlen) { - u32 in[MLX5_ST_SZ_DW(qtct_reg)]; + u32 in[MLX5_ST_SZ_DW(qetc_reg)]; if (!MLX5_CAP_GEN(mdev, ets)) return -ENOTSUPP; @@ -831,7 +831,7 @@ EXPORT_SYMBOL_GPL(mlx5_max_tc); static int mlx5_set_port_qetcr_reg(struct mlx5_core_dev *mdev, u32 *in, int inlen) { - u32 out[MLX5_ST_SZ_DW(qtct_reg)]; + u32 out[MLX5_ST_SZ_DW(qetc_reg)]; if (!MLX5_CAP_GEN(mdev, ets)) return -ENOTSUPP; From owner-svn-src-head@freebsd.org Wed Dec 5 13:46:40 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D0E9513140C8; Wed, 5 Dec 2018 13:46:40 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 76CC972B46; Wed, 5 Dec 2018 13:46:40 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 58CE015299; Wed, 5 Dec 2018 13:46:40 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5DkecE081856; Wed, 5 Dec 2018 13:46:40 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5DkdqM081852; Wed, 5 Dec 2018 13:46:39 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051346.wB5DkdqM081852@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:46:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341566 - in head/sys/dev/mlx5: . mlx5_core X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: in head/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 341566 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 76CC972B46 X-Spamd-Result: default: False [-0.55 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.50)[-0.498,0]; NEURAL_SPAM_LONG(0.01)[0.010,0]; NEURAL_HAM_SHORT(-0.06)[-0.063,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:46:41 -0000 Author: slavash Date: Wed Dec 5 13:46:39 2018 New Revision: 341566 URL: https://svnweb.freebsd.org/changeset/base/341566 Log: mlx5: Fixes to allow command polling mode to exist alongside event mode. A command is either polling or event driven and the mode cannot change during execution of a command. Make sure the event handler only handle commands which are not polled. This is done by checking the command mode in the command handler before completing commands. Submitted by: hselasky@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/driver.h head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c head/sys/dev/mlx5/mlx5_core/mlx5_eq.c head/sys/dev/mlx5/mlx5_core/mlx5_health.c Modified: head/sys/dev/mlx5/driver.h ============================================================================== --- head/sys/dev/mlx5/driver.h Wed Dec 5 13:46:09 2018 (r341565) +++ head/sys/dev/mlx5/driver.h Wed Dec 5 13:46:39 2018 (r341566) @@ -327,6 +327,11 @@ struct mlx5_traffic_counter { u64 octets; }; +enum mlx5_cmd_mode { + MLX5_CMD_MODE_POLLING, + MLX5_CMD_MODE_EVENTS +}; + struct mlx5_cmd_stats { u64 sum; u64 n; @@ -370,8 +375,9 @@ struct mlx5_cmd { struct workqueue_struct *wq; struct semaphore sem; struct semaphore pages_sem; - int mode; - struct mlx5_cmd_work_ent *ent_arr[MLX5_MAX_COMMANDS]; + enum mlx5_cmd_mode mode; + struct mlx5_cmd_work_ent * volatile ent_arr[MLX5_MAX_COMMANDS]; + volatile enum mlx5_cmd_mode ent_mode[MLX5_MAX_COMMANDS]; struct mlx5_cmd_debug dbg; struct cmd_msg_cache cache; int checksum_disabled; @@ -984,7 +990,7 @@ void mlx5_cq_completion(struct mlx5_core_dev *dev, u32 void mlx5_rsc_event(struct mlx5_core_dev *dev, u32 rsn, int event_type); void mlx5_srq_event(struct mlx5_core_dev *dev, u32 srqn, int event_type); struct mlx5_core_srq *mlx5_core_get_srq(struct mlx5_core_dev *dev, u32 srqn); -void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u64 vector); +void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u64 vector, enum mlx5_cmd_mode mode); void mlx5_cq_event(struct mlx5_core_dev *dev, u32 cqn, int event_type); int mlx5_create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, u8 vecidx, int nent, u64 mask, const char *name, struct mlx5_uar *uar); Modified: head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Wed Dec 5 13:46:09 2018 (r341565) +++ head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Wed Dec 5 13:46:39 2018 (r341566) @@ -50,11 +50,6 @@ enum { }; enum { - CMD_MODE_POLLING, - CMD_MODE_EVENTS -}; - -enum { NUM_LONG_LISTS = 2, NUM_MED_LISTS = 64, LONG_LIST_SIZE = (2ULL * 1024 * 1024 * 1024 / PAGE_SIZE) * 8 + 16 + @@ -160,6 +155,8 @@ static int alloc_ent(struct mlx5_cmd_work_ent *ent) ent->busy = 1; ent->idx = ret; clear_bit(ent->idx, &cmd->bitmask); + cmd->ent_mode[ent->idx] = + ent->polling ? MLX5_CMD_MODE_POLLING : MLX5_CMD_MODE_EVENTS; cmd->ent_arr[ent->idx] = ent; } spin_unlock_irqrestore(&cmd->alloc_lock, flags); @@ -172,6 +169,8 @@ static void free_ent(struct mlx5_cmd *cmd, int idx) unsigned long flags; spin_lock_irqsave(&cmd->alloc_lock, flags); + cmd->ent_arr[idx] = NULL; /* safety clear */ + cmd->ent_mode[idx] = MLX5_CMD_MODE_POLLING; /* reset mode */ set_bit(idx, &cmd->bitmask); spin_unlock_irqrestore(&cmd->alloc_lock, flags); } @@ -786,7 +785,7 @@ static void cb_timeout_handler(struct work_struct *wor mlx5_core_warn(dev, "%s(0x%x) timeout. Will cause a leak of a command resource\n", mlx5_command_str(msg_to_opcode(ent->in)), msg_to_opcode(ent->in)); - mlx5_cmd_comp_handler(dev, 1UL << ent->idx); + mlx5_cmd_comp_handler(dev, 1UL << ent->idx, MLX5_CMD_MODE_EVENTS); } static void complete_command(struct mlx5_cmd_work_ent *ent) @@ -897,11 +896,12 @@ static void cmd_work_handler(struct work_struct *work) mlx5_fwp_flush(cmd->cmd_page); iowrite32be(1 << ent->idx, &dev->iseg->cmd_dbell); mmiowb(); - /* if not in polling don't use ent after this point*/ - if (cmd->mode == CMD_MODE_POLLING || poll_cmd) { + + /* if not in polling don't use ent after this point */ + if (poll_cmd) { poll_timeout(ent); /* make sure we read the descriptor after ownership is SW */ - mlx5_cmd_comp_handler(dev, 1U << ent->idx); + mlx5_cmd_comp_handler(dev, 1U << ent->idx, MLX5_CMD_MODE_POLLING); } } @@ -938,15 +938,13 @@ static const char *deliv_status_to_str(u8 status) static int wait_func(struct mlx5_core_dev *dev, struct mlx5_cmd_work_ent *ent) { int timeout = msecs_to_jiffies(MLX5_CMD_TIMEOUT_MSEC); - struct mlx5_cmd *cmd = &dev->cmd; int err; - if (cmd->mode == CMD_MODE_POLLING || ent->polling) { + if (ent->polling) { wait_for_completion(&ent->done); - err = ent->ret; } else if (!wait_for_completion_timeout(&ent->done, timeout)) { ent->ret = -ETIMEDOUT; - mlx5_cmd_comp_handler(dev, 1UL << ent->idx); + mlx5_cmd_comp_handler(dev, 1UL << ent->idx, MLX5_CMD_MODE_EVENTS); } err = ent->ret; @@ -988,7 +986,7 @@ static int mlx5_cmd_invoke(struct mlx5_core_dev *dev, if (IS_ERR(ent)) return PTR_ERR(ent); - ent->polling = force_polling; + ent->polling = force_polling || (cmd->mode == MLX5_CMD_MODE_POLLING); if (!callback) init_completion(&ent->done); @@ -1158,12 +1156,12 @@ static void mlx5_cmd_change_mod(struct mlx5_core_dev * void mlx5_cmd_use_events(struct mlx5_core_dev *dev) { - mlx5_cmd_change_mod(dev, CMD_MODE_EVENTS); + mlx5_cmd_change_mod(dev, MLX5_CMD_MODE_EVENTS); } void mlx5_cmd_use_polling(struct mlx5_core_dev *dev) { - mlx5_cmd_change_mod(dev, CMD_MODE_POLLING); + mlx5_cmd_change_mod(dev, MLX5_CMD_MODE_POLLING); } static void free_msg(struct mlx5_core_dev *dev, struct mlx5_cmd_msg *msg) @@ -1179,7 +1177,8 @@ static void free_msg(struct mlx5_core_dev *dev, struct } } -void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u64 vector_flags) +void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u64 vector_flags, + enum mlx5_cmd_mode cmd_mode) { struct mlx5_cmd *cmd = &dev->cmd; struct mlx5_cmd_work_ent *ent; @@ -1193,7 +1192,13 @@ void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, while (vector != 0) { i = ffs(vector) - 1; vector &= ~(1U << i); + /* check command mode */ + if (cmd->ent_mode[i] != cmd_mode) + continue; ent = cmd->ent_arr[i]; + /* check if command was already handled */ + if (ent == NULL) + continue; if (ent->callback) cancel_delayed_work(&ent->cb_timeout_work); ent->ts2 = ktime_get_ns(); @@ -1545,7 +1550,7 @@ int mlx5_cmd_init(struct mlx5_core_dev *dev) mlx5_core_dbg(dev, "descriptor at dma 0x%llx\n", (unsigned long long)(cmd->dma)); - cmd->mode = CMD_MODE_POLLING; + cmd->mode = MLX5_CMD_MODE_POLLING; err = create_msg_cache(dev); if (err) { Modified: head/sys/dev/mlx5/mlx5_core/mlx5_eq.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_eq.c Wed Dec 5 13:46:09 2018 (r341565) +++ head/sys/dev/mlx5/mlx5_core/mlx5_eq.c Wed Dec 5 13:46:39 2018 (r341566) @@ -254,8 +254,10 @@ static int mlx5_eq_int(struct mlx5_core_dev *dev, stru break; case MLX5_EVENT_TYPE_CMD: - if (dev->state != MLX5_DEVICE_STATE_INTERNAL_ERROR) - mlx5_cmd_comp_handler(dev, be32_to_cpu(eqe->data.cmd.vector)); + if (dev->state != MLX5_DEVICE_STATE_INTERNAL_ERROR) { + mlx5_cmd_comp_handler(dev, be32_to_cpu(eqe->data.cmd.vector), + MLX5_CMD_MODE_EVENTS); + } break; case MLX5_EVENT_TYPE_PORT_CHANGE: Modified: head/sys/dev/mlx5/mlx5_core/mlx5_health.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_health.c Wed Dec 5 13:46:09 2018 (r341565) +++ head/sys/dev/mlx5/mlx5_core/mlx5_health.c Wed Dec 5 13:46:39 2018 (r341566) @@ -141,7 +141,7 @@ static void mlx5_trigger_cmd_completions(struct mlx5_c spin_unlock_irqrestore(&dev->cmd.alloc_lock, flags); mlx5_core_dbg(dev, "vector 0x%jx\n", (uintmax_t)vector); - mlx5_cmd_comp_handler(dev, vector); + mlx5_cmd_comp_handler(dev, vector, MLX5_CMD_MODE_EVENTS); return; no_trig: From owner-svn-src-head@freebsd.org Wed Dec 5 13:47:13 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6B43D1314168; Wed, 5 Dec 2018 13:47:13 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0F71572CD2; Wed, 5 Dec 2018 13:47:13 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 263351529B; Wed, 5 Dec 2018 13:47:11 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5DlBMp081929; Wed, 5 Dec 2018 13:47:11 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5DlA2g081926; Wed, 5 Dec 2018 13:47:10 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051347.wB5DlA2g081926@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:47:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341567 - in head/sys: compat/linuxkpi/common/src dev/mlx5/mlx5_core dev/mlx5/mlx5_en dev/mlx5/mlx5_ib X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: in head/sys: compat/linuxkpi/common/src dev/mlx5/mlx5_core dev/mlx5/mlx5_en dev/mlx5/mlx5_ib X-SVN-Commit-Revision: 341567 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0F71572CD2 X-Spamd-Result: default: False [-0.62 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.52)[-0.521,0]; NEURAL_HAM_SHORT(-0.07)[-0.070,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.03)[-0.031,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:47:13 -0000 Author: slavash Date: Wed Dec 5 13:47:10 2018 New Revision: 341567 URL: https://svnweb.freebsd.org/changeset/base/341567 Log: mlx5: Fix driver version location Driver description should be set by core and not by the Ethernet driver. Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/src/linux_pci.c head/sys/dev/mlx5/mlx5_core/mlx5_main.c head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Modified: head/sys/compat/linuxkpi/common/src/linux_pci.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_pci.c Wed Dec 5 13:46:39 2018 (r341566) +++ head/sys/compat/linuxkpi/common/src/linux_pci.c Wed Dec 5 13:47:10 2018 (r341567) @@ -199,6 +199,7 @@ linux_pci_detach(device_t dev) spin_lock(&pci_lock); list_del(&pdev->links); spin_unlock(&pci_lock); + device_set_desc(dev, NULL); put_device(&pdev->dev); return (0); Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_main.c Wed Dec 5 13:46:39 2018 (r341566) +++ head/sys/dev/mlx5/mlx5_core/mlx5_main.c Wed Dec 5 13:47:10 2018 (r341567) @@ -44,6 +44,8 @@ #include "mlx5_core.h" #include "fs_core.h" +static const char mlx5_version[] = "Mellanox Core driver " + DRIVER_VERSION " (" DRIVER_RELDATE ")"; MODULE_AUTHOR("Eli Cohen "); MODULE_DESCRIPTION("Mellanox Connect-IB, ConnectX-4 core driver"); MODULE_LICENSE("Dual BSD/GPL"); @@ -1219,6 +1221,9 @@ static int init_one(struct pci_dev *pdev, dev->profile = &profiles[prof_sel]; dev->pdev = pdev; dev->event = mlx5_core_event; + + /* Set desc */ + device_set_desc(bsddev, mlx5_version); sysctl_ctx_init(&dev->sysctl_ctx); SYSCTL_ADD_INT(&dev->sysctl_ctx, Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 5 13:46:39 2018 (r341566) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 5 13:47:10 2018 (r341567) @@ -34,8 +34,8 @@ #define ETH_DRIVER_VERSION "3.4.2" #endif -char mlx5e_version[] = "Mellanox Ethernet driver" - " (" ETH_DRIVER_VERSION ")"; +static const char mlx5e_version[] = "mlx5en: Mellanox Ethernet driver " + ETH_DRIVER_VERSION " (" DRIVER_RELDATE ")\n"; static int mlx5e_get_wqe_sz(struct mlx5e_priv *priv, u32 *wqe_sz, u32 *nsegs); @@ -3687,9 +3687,6 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) /* set default MTU */ mlx5e_set_dev_port_mtu(ifp, ifp->if_mtu); - /* Set desc */ - device_set_desc(mdev->pdev->dev.bsddev, mlx5e_version); - /* Set default media status */ priv->media_status_last = IFM_AVALID; priv->media_active_last = IFM_ETHER | IFM_AUTO | @@ -3805,13 +3802,6 @@ mlx5e_destroy_ifp(struct mlx5_core_dev *mdev, void *vp /* don't allow more IOCTLs */ priv->gone = 1; - /* - * Clear the device description to avoid use after free, - * because the bsddev is not destroyed when this module is - * unloaded: - */ - device_set_desc(mdev->pdev->dev.bsddev, NULL); - /* XXX wait a bit to allow IOCTL handlers to complete */ pause("W", hz); @@ -3896,6 +3886,14 @@ mlx5e_cleanup(void) { mlx5_unregister_interface(&mlx5e_interface); } + +static void +mlx5e_show_version(void __unused *arg) +{ + + printf("%s", mlx5e_version); +} +SYSINIT(mlx5e_show_version, SI_SUB_DRIVERS, SI_ORDER_ANY, mlx5e_show_version, NULL); module_init_order(mlx5e_init, SI_ORDER_THIRD); module_exit_order(mlx5e_cleanup, SI_ORDER_THIRD); Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Wed Dec 5 13:46:39 2018 (r341566) +++ head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Wed Dec 5 13:47:10 2018 (r341567) @@ -50,7 +50,7 @@ #include #include "mlx5_ib.h" -#define DRIVER_NAME "mlx5_ib" +#define DRIVER_NAME "mlx5ib" #ifndef DRIVER_VERSION #define DRIVER_VERSION "3.4.2" #endif @@ -2963,8 +2963,6 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev) if ((ll == IB_LINK_LAYER_ETHERNET) && !MLX5_CAP_GEN(mdev, roce)) return NULL; - printk_once(KERN_INFO "%s", mlx5_version); - dev = (struct mlx5_ib_dev *)ib_alloc_device(sizeof(*dev)); if (!dev) return NULL; @@ -3258,6 +3256,14 @@ static void __exit mlx5_ib_cleanup(void) mlx5_unregister_interface(&mlx5_ib_interface); mlx5_ib_odp_cleanup(); } + +static void +mlx5_ib_show_version(void __unused *arg) +{ + + printf("%s", mlx5_version); +} +SYSINIT(mlx5_ib_show_version, SI_SUB_DRIVERS, SI_ORDER_ANY, mlx5_ib_show_version, NULL); module_init_order(mlx5_ib_init, SI_ORDER_THIRD); module_exit_order(mlx5_ib_cleanup, SI_ORDER_THIRD); From owner-svn-src-head@freebsd.org Wed Dec 5 13:47:42 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 219B613141C3; Wed, 5 Dec 2018 13:47:42 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BC78572E31; Wed, 5 Dec 2018 13:47:41 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9EDCB1529C; Wed, 5 Dec 2018 13:47:41 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5DlfmN081995; Wed, 5 Dec 2018 13:47:41 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5Dlfvp081994; Wed, 5 Dec 2018 13:47:41 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051347.wB5Dlfvp081994@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:47:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341568 - head/sys/dev/mlx5/mlx5_ib X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_ib X-SVN-Commit-Revision: 341568 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: BC78572E31 X-Spamd-Result: default: False [-0.69 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; NEURAL_HAM_SHORT(-0.08)[-0.077,0]; NEURAL_HAM_LONG(-0.07)[-0.072,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:47:42 -0000 Author: slavash Date: Wed Dec 5 13:47:41 2018 New Revision: 341568 URL: https://svnweb.freebsd.org/changeset/base/341568 Log: mlx5ib: Fix sign extension in mlx5_ib_query_device "fw_rev_min(dev->mdev)" with type "unsigned short" (16 bits, unsigned) is promoted in "fw_rev_min(dev->mdev) << 16" to type "int" (32 bits, signed), then sign-extended to type "unsigned long" (64 bits, unsigned). If "fw_rev_min(dev->mdev) << 16" is greater than 0x7FFFFFFF, the upper bits of the result will all be 1. Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Wed Dec 5 13:47:10 2018 (r341567) +++ head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Wed Dec 5 13:47:41 2018 (r341568) @@ -605,7 +605,7 @@ static int mlx5_ib_query_device(struct ib_device *ibde return err; props->fw_ver = ((u64)fw_rev_maj(dev->mdev) << 32) | - (fw_rev_min(dev->mdev) << 16) | + ((u32)fw_rev_min(dev->mdev) << 16) | fw_rev_sub(dev->mdev); props->device_cap_flags = IB_DEVICE_CHANGE_PHY_PORT | IB_DEVICE_PORT_ACTIVE_EVENT | From owner-svn-src-head@freebsd.org Wed Dec 5 13:48:11 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 248EE1314238; Wed, 5 Dec 2018 13:48:11 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BCC7F72F68; Wed, 5 Dec 2018 13:48:10 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9F52D1529D; Wed, 5 Dec 2018 13:48:10 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5DmABW082065; Wed, 5 Dec 2018 13:48:10 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5DmABK082064; Wed, 5 Dec 2018 13:48:10 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051348.wB5DmABK082064@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:48:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341569 - head/sys/dev/mlx5/mlx5_ib X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_ib X-SVN-Commit-Revision: 341569 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: BCC7F72F68 X-Spamd-Result: default: False [-0.69 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; NEURAL_HAM_LONG(-0.07)[-0.072,0]; NEURAL_HAM_SHORT(-0.08)[-0.077,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:48:11 -0000 Author: slavash Date: Wed Dec 5 13:48:10 2018 New Revision: 341569 URL: https://svnweb.freebsd.org/changeset/base/341569 Log: mlx5ib: Fix null pointer dereference in mlx5_ib_create_srq Although "create_srq_user" does overwrite "in.pas" on some paths, it also contains at least one feasible path which does not overwrite it. Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.c Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.c ============================================================================== --- head/sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.c Wed Dec 5 13:47:41 2018 (r341568) +++ head/sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.c Wed Dec 5 13:48:10 2018 (r341569) @@ -287,7 +287,7 @@ struct ib_srq *mlx5_ib_create_srq(struct ib_pd *pd, else err = create_srq_kernel(dev, srq, &in, buf_size); - if (err) { + if (err || !in.pas) { mlx5_ib_warn(dev, "create srq %s failed, err %d\n", pd->uobject ? "user" : "kernel", err); goto err_srq; From owner-svn-src-head@freebsd.org Wed Dec 5 13:48:40 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C537B13142A8; Wed, 5 Dec 2018 13:48:40 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 67F23730DE; Wed, 5 Dec 2018 13:48:40 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 49F0A1529E; Wed, 5 Dec 2018 13:48:40 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5DmewF082135; Wed, 5 Dec 2018 13:48:40 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5DmeXk082134; Wed, 5 Dec 2018 13:48:40 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051348.wB5DmeXk082134@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:48:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341570 - head/sys/dev/mlx5/mlx5_ib X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_ib X-SVN-Commit-Revision: 341570 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 67F23730DE X-Spamd-Result: default: False [-0.69 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; NEURAL_HAM_SHORT(-0.08)[-0.077,0]; NEURAL_HAM_LONG(-0.07)[-0.072,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:48:41 -0000 Author: slavash Date: Wed Dec 5 13:48:39 2018 New Revision: 341570 URL: https://svnweb.freebsd.org/changeset/base/341570 Log: mlx5ib: Make sure the congestion work timer does not escape the drain procedure. If the mlx5_ib_read_cong_stats() function was running when mlx5ib was unloaded, because this function unconditionally restarts the timer, the timer can still be pending after the delayed work has been cancelled. To fix this simply loop on the delayed work cancel procedure as long as it returns non-zero. Submitted by: hselasky@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_cong.c Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_cong.c ============================================================================== --- head/sys/dev/mlx5/mlx5_ib/mlx5_ib_cong.c Wed Dec 5 13:48:10 2018 (r341569) +++ head/sys/dev/mlx5/mlx5_ib/mlx5_ib_cong.c Wed Dec 5 13:48:39 2018 (r341570) @@ -393,7 +393,8 @@ void mlx5_ib_cleanup_congestion(struct mlx5_ib_dev *dev) { - cancel_delayed_work_sync(&dev->congestion.dwork); + while (cancel_delayed_work_sync(&dev->congestion.dwork)) + ; sysctl_ctx_free(&dev->congestion.ctx); sx_destroy(&dev->congestion.lock); } From owner-svn-src-head@freebsd.org Wed Dec 5 13:49:12 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 646FF1314331; Wed, 5 Dec 2018 13:49:12 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C8F5173262; Wed, 5 Dec 2018 13:49:11 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AABA4152A1; Wed, 5 Dec 2018 13:49:11 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5DnB6W082205; Wed, 5 Dec 2018 13:49:11 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5DnBBr082204; Wed, 5 Dec 2018 13:49:11 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051349.wB5DnBBr082204@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 13:49:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341571 - head/sys/dev/mlx5/mlx5_ib X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_ib X-SVN-Commit-Revision: 341571 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C8F5173262 X-Spamd-Result: default: False [-0.69 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; NEURAL_HAM_SHORT(-0.08)[-0.077,0]; NEURAL_HAM_LONG(-0.07)[-0.072,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 13:49:12 -0000 Author: slavash Date: Wed Dec 5 13:49:11 2018 New Revision: 341571 URL: https://svnweb.freebsd.org/changeset/base/341571 Log: mlx5ib: Set default active width and speed when querying port. Make sure the active width and speed is set in case the translate_eth_proto_oper() function doesn't recognize the current port operation mask. Linux commit: 7672ed33c4c15dbe9d56880683baaba4227cf940 Submitted by: hselasky@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Wed Dec 5 13:48:39 2018 (r341570) +++ head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Wed Dec 5 13:49:11 2018 (r341571) @@ -219,6 +219,8 @@ static int translate_eth_proto_oper(u32 eth_proto_oper *active_speed = IB_SPEED_EDR; break; default: + *active_width = IB_WIDTH_4X; + *active_speed = IB_SPEED_QDR; return -EINVAL; } From owner-svn-src-head@freebsd.org Wed Dec 5 14:11:24 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A553C1314F5F; Wed, 5 Dec 2018 14:11:23 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 533DE742D0; Wed, 5 Dec 2018 14:11:23 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 33F1715647; Wed, 5 Dec 2018 14:11:23 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5EBN21095446; Wed, 5 Dec 2018 14:11:23 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5EBLCk095432; Wed, 5 Dec 2018 14:11:21 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051411.wB5EBLCk095432@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 14:11:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341572 - in head/sys: dev/mlx5 dev/mlx5/mlx5_accel dev/mlx5/mlx5_core dev/mlx5/mlx5_fpga dev/mlx5/mlx5_lib modules/mlx5 modules/mlx5en modules/mlx5ib X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: in head/sys: dev/mlx5 dev/mlx5/mlx5_accel dev/mlx5/mlx5_core dev/mlx5/mlx5_fpga dev/mlx5/mlx5_lib modules/mlx5 modules/mlx5en modules/mlx5ib X-SVN-Commit-Revision: 341572 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 533DE742D0 X-Spamd-Result: default: False [-0.40 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.45)[-0.446,0]; NEURAL_SPAM_LONG(0.09)[0.092,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_SHORT(-0.05)[-0.049,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 14:11:24 -0000 Author: slavash Date: Wed Dec 5 14:11:20 2018 New Revision: 341572 URL: https://svnweb.freebsd.org/changeset/base/341572 Log: mlx5fpga: Initial code import. Submitted by: kib@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Added: head/sys/dev/mlx5/mlx5_accel/ head/sys/dev/mlx5/mlx5_accel/ipsec.h (contents, props changed) head/sys/dev/mlx5/mlx5_fpga/ head/sys/dev/mlx5/mlx5_fpga/cmd.h (contents, props changed) head/sys/dev/mlx5/mlx5_fpga/conn.h (contents, props changed) head/sys/dev/mlx5/mlx5_fpga/core.h (contents, props changed) head/sys/dev/mlx5/mlx5_fpga/ipsec.h (contents, props changed) head/sys/dev/mlx5/mlx5_fpga/mlx5_ifc_fpga.h (contents, props changed) head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_cmd.c (contents, props changed) head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_conn.c (contents, props changed) head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_core.c (contents, props changed) head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_ipsec.c (contents, props changed) head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_sdk.c (contents, props changed) head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_trans.c (contents, props changed) head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_xfer.c (contents, props changed) head/sys/dev/mlx5/mlx5_fpga/sdk.h (contents, props changed) head/sys/dev/mlx5/mlx5_fpga/trans.h (contents, props changed) head/sys/dev/mlx5/mlx5_fpga/xfer.h (contents, props changed) head/sys/dev/mlx5/mlx5_lib/ head/sys/dev/mlx5/mlx5_lib/mlx5.h (contents, props changed) head/sys/dev/mlx5/mlx5_lib/mlx5_gid.c (contents, props changed) Modified: head/sys/dev/mlx5/device.h head/sys/dev/mlx5/driver.h head/sys/dev/mlx5/mlx5_core/mlx5_core.h head/sys/dev/mlx5/mlx5_core/mlx5_main.c head/sys/dev/mlx5/mlx5_core/wq.h head/sys/dev/mlx5/mlx5_ifc.h head/sys/dev/mlx5/mlx5io.h head/sys/modules/mlx5/Makefile head/sys/modules/mlx5en/Makefile head/sys/modules/mlx5ib/Makefile Modified: head/sys/dev/mlx5/device.h ============================================================================== --- head/sys/dev/mlx5/device.h Wed Dec 5 13:49:11 2018 (r341571) +++ head/sys/dev/mlx5/device.h Wed Dec 5 14:11:20 2018 (r341572) @@ -1034,6 +1034,12 @@ enum mlx5_qcam_feature_groups { #define MLX5_CAP_QCAM_FEATURE(mdev, fld) \ MLX5_GET(qcam_reg, (mdev)->caps.qcam, qos_feature_cap_mask.feature_cap.fld) +#define MLX5_CAP_FPGA(mdev, cap) \ + MLX5_GET(fpga_cap, (mdev)->caps.fpga, cap) + +#define MLX5_CAP64_FPGA(mdev, cap) \ + MLX5_GET64(fpga_cap, (mdev)->caps.fpga, cap) + enum { MLX5_CMD_STAT_OK = 0x0, MLX5_CMD_STAT_INT_ERR = 0x1, Modified: head/sys/dev/mlx5/driver.h ============================================================================== --- head/sys/dev/mlx5/driver.h Wed Dec 5 13:49:11 2018 (r341571) +++ head/sys/dev/mlx5/driver.h Wed Dec 5 14:11:20 2018 (r341572) @@ -40,6 +40,7 @@ #include #include #include +#include #include #include @@ -131,6 +132,10 @@ enum { MLX5_REG_DCBX_PARAM = 0x4020, MLX5_REG_DCBX_APP = 0x4021, MLX5_REG_PCAP = 0x5001, + MLX5_REG_FPGA_CAP = 0x4022, + MLX5_REG_FPGA_CTRL = 0x4023, + MLX5_REG_FPGA_ACCESS_REG = 0x4024, + MLX5_REG_FPGA_SHELL_CNTR = 0x4025, MLX5_REG_PMTU = 0x5003, MLX5_REG_PTYS = 0x5004, MLX5_REG_PAOS = 0x5006, @@ -404,6 +409,13 @@ struct mlx5_buf { u8 load_done; }; +struct mlx5_frag_buf { + struct mlx5_buf_list *frags; + int npages; + int size; + u8 page_shift; +}; + struct mlx5_eq { struct mlx5_core_dev *dev; __be32 __iomem *doorbell; @@ -442,6 +454,20 @@ struct mlx5_core_sig_ctx { u32 sigerr_count; }; +enum { + MLX5_MKEY_MR = 1, + MLX5_MKEY_MW, + MLX5_MKEY_MR_USER, +}; + +struct mlx5_core_mkey { + u64 iova; + u64 size; + u32 key; + u32 pd; + u32 type; +}; + struct mlx5_core_mr { u64 iova; u64 size; @@ -645,6 +671,14 @@ enum mlx5_pci_status { MLX5_PCI_STATUS_ENABLED, }; +#define MLX5_MAX_RESERVED_GIDS 8 + +struct mlx5_rsvd_gids { + unsigned int start; + unsigned int count; + struct ida ida; +}; + struct mlx5_special_contexts { int resd_lkey; }; @@ -663,6 +697,7 @@ struct mlx5_core_dev { u32 hca_caps_max[MLX5_CAP_NUM][MLX5_UN_SZ_DW(hca_cap_union)]; struct { u32 qcam[MLX5_ST_SZ_DW(qcam_reg)]; + u32 fpga[MLX5_ST_SZ_DW(fpga_cap)]; } caps; phys_addr_t iseg_base; struct mlx5_init_seg __iomem *iseg; @@ -691,6 +726,14 @@ struct mlx5_core_dev { struct sysctl_ctx_list sysctl_ctx; int msix_eqvec; + + struct { + struct mlx5_rsvd_gids reserved_gids; + atomic_t roce_en; + } roce; +#ifdef CONFIG_MLX5_FPGA + struct mlx5_fpga_device *fpga; +#endif }; enum { @@ -1105,6 +1148,11 @@ struct mlx5_interface { void *mlx5_get_protocol_dev(struct mlx5_core_dev *mdev, int protocol); int mlx5_register_interface(struct mlx5_interface *intf); void mlx5_unregister_interface(struct mlx5_interface *intf); + +unsigned int mlx5_core_reserved_gids_count(struct mlx5_core_dev *dev); +int mlx5_core_roce_gid_set(struct mlx5_core_dev *dev, unsigned int index, + u8 roce_version, u8 roce_l3_type, const u8 *gid, + const u8 *mac, bool vlan, u16 vlan_id); struct mlx5_profile { u64 mask; Added: head/sys/dev/mlx5/mlx5_accel/ipsec.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/mlx5/mlx5_accel/ipsec.h Wed Dec 5 14:11:20 2018 (r341572) @@ -0,0 +1,139 @@ +/*- + * Copyright (c) 2017 Mellanox Technologies. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * 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. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * $FreeBSD$ + */ + +#ifndef __MLX5_ACCEL_IPSEC_H__ +#define __MLX5_ACCEL_IPSEC_H__ + +#ifdef CONFIG_MLX5_ACCEL + +#include + +enum { + MLX5_ACCEL_IPSEC_DEVICE = BIT(1), + MLX5_ACCEL_IPSEC_IPV6 = BIT(2), + MLX5_ACCEL_IPSEC_ESP = BIT(3), + MLX5_ACCEL_IPSEC_LSO = BIT(4), +}; + +#define MLX5_IPSEC_SADB_IP_AH BIT(7) +#define MLX5_IPSEC_SADB_IP_ESP BIT(6) +#define MLX5_IPSEC_SADB_SA_VALID BIT(5) +#define MLX5_IPSEC_SADB_SPI_EN BIT(4) +#define MLX5_IPSEC_SADB_DIR_SX BIT(3) +#define MLX5_IPSEC_SADB_IPV6 BIT(2) + +enum { + MLX5_IPSEC_CMD_ADD_SA = 0, + MLX5_IPSEC_CMD_DEL_SA = 1, +}; + +enum mlx5_accel_ipsec_enc_mode { + MLX5_IPSEC_SADB_MODE_NONE = 0, + MLX5_IPSEC_SADB_MODE_AES_GCM_128_AUTH_128 = 1, + MLX5_IPSEC_SADB_MODE_AES_GCM_256_AUTH_128 = 3, +}; + +#define MLX5_IPSEC_DEV(mdev) (mlx5_accel_ipsec_device_caps(mdev) & \ + MLX5_ACCEL_IPSEC_DEVICE) + +struct mlx5_accel_ipsec_sa { + __be32 cmd; + u8 key_enc[32]; + u8 key_auth[32]; + __be32 sip[4]; + __be32 dip[4]; + union { + struct { + __be32 reserved; + u8 salt_iv[8]; + __be32 salt; + } __packed gcm; + struct { + u8 salt[16]; + } __packed cbc; + }; + __be32 spi; + __be32 sw_sa_handle; + __be16 tfclen; + u8 enc_mode; + u8 sip_masklen; + u8 dip_masklen; + u8 flags; + u8 reserved[2]; +} __packed; + +/** + * mlx5_accel_ipsec_sa_cmd_exec - Execute an IPSec SADB command + * @mdev: mlx5 device + * @cmd: command to execute + * May be called from atomic context. Returns context pointer, or error + * Caller must eventually call mlx5_accel_ipsec_sa_cmd_wait from non-atomic + * context, to cleanup the context pointer + */ +void *mlx5_accel_ipsec_sa_cmd_exec(struct mlx5_core_dev *mdev, + struct mlx5_accel_ipsec_sa *cmd); + +/** + * mlx5_accel_ipsec_sa_cmd_wait - Wait for command execution completion + * @context: Context pointer returned from call to mlx5_accel_ipsec_sa_cmd_exec + * Sleeps (killable) until command execution is complete. + * Returns the command result, or -EINTR if killed + */ +int mlx5_accel_ipsec_sa_cmd_wait(void *context); + +u32 mlx5_accel_ipsec_device_caps(struct mlx5_core_dev *mdev); + +unsigned int mlx5_accel_ipsec_counters_count(struct mlx5_core_dev *mdev); +int mlx5_accel_ipsec_counters_read(struct mlx5_core_dev *mdev, u64 *counters, + unsigned int count); + +int mlx5_accel_ipsec_init(struct mlx5_core_dev *mdev); +void mlx5_accel_ipsec_cleanup(struct mlx5_core_dev *mdev); + +#else + +#define MLX5_IPSEC_DEV(mdev) false + +static inline int mlx5_accel_ipsec_init(struct mlx5_core_dev *mdev) +{ + return 0; +} + +static inline void mlx5_accel_ipsec_cleanup(struct mlx5_core_dev *mdev) +{ +} + +#endif + +#endif /* __MLX5_ACCEL_IPSEC_H__ */ Modified: head/sys/dev/mlx5/mlx5_core/mlx5_core.h ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_core.h Wed Dec 5 13:49:11 2018 (r341571) +++ head/sys/dev/mlx5/mlx5_core/mlx5_core.h Wed Dec 5 14:11:20 2018 (r341572) @@ -85,6 +85,9 @@ void mlx5_enter_error_state(struct mlx5_core_dev *dev, void mlx5_disable_device(struct mlx5_core_dev *dev); void mlx5_recover_device(struct mlx5_core_dev *dev); +int mlx5_register_device(struct mlx5_core_dev *dev); +void mlx5_unregister_device(struct mlx5_core_dev *dev); + void mlx5e_init(void); void mlx5e_cleanup(void); Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_main.c Wed Dec 5 13:49:11 2018 (r341571) +++ head/sys/dev/mlx5/mlx5_core/mlx5_main.c Wed Dec 5 14:11:20 2018 (r341572) @@ -41,6 +41,8 @@ #include #include #include +#include +#include #include "mlx5_core.h" #include "fs_core.h" @@ -734,7 +736,8 @@ static void mlx5_remove_device(struct mlx5_interface * } } -static int mlx5_register_device(struct mlx5_core_dev *dev) +int +mlx5_register_device(struct mlx5_core_dev *dev) { struct mlx5_priv *priv = &dev->priv; struct mlx5_interface *intf; @@ -748,7 +751,8 @@ static int mlx5_register_device(struct mlx5_core_dev * return 0; } -static void mlx5_unregister_device(struct mlx5_core_dev *dev) +void +mlx5_unregister_device(struct mlx5_core_dev *dev) { struct mlx5_priv *priv = &dev->priv; struct mlx5_interface *intf; @@ -912,6 +916,9 @@ static int mlx5_init_once(struct mlx5_core_dev *dev, s mlx5_init_srq_table(dev); mlx5_init_mr_table(dev); + mlx5_init_reserved_gids(dev); + mlx5_fpga_init(dev); + #ifdef RATELIMIT err = mlx5_init_rl_table(dev); if (err) { @@ -941,6 +948,8 @@ static void mlx5_cleanup_once(struct mlx5_core_dev *de #ifdef RATELIMIT mlx5_cleanup_rl_table(dev); #endif + mlx5_fpga_cleanup(dev); + mlx5_cleanup_reserved_gids(dev); mlx5_cleanup_mr_table(dev); mlx5_cleanup_srq_table(dev); mlx5_cleanup_qp_table(dev); @@ -1075,6 +1084,12 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, st goto err_free_comp_eqs; } + err = mlx5_fpga_device_start(dev); + if (err) { + dev_err(&pdev->dev, "fpga device start failed %d\n", err); + goto err_fpga_start; + } + err = mlx5_register_device(dev); if (err) { dev_err(&pdev->dev, "mlx5_register_device failed %d\n", err); @@ -1088,6 +1103,7 @@ out: mutex_unlock(&dev->intf_state_mutex); return 0; +err_fpga_start: err_fs: mlx5_cleanup_fs(dev); @@ -1152,6 +1168,7 @@ static int mlx5_unload_one(struct mlx5_core_dev *dev, mlx5_unregister_device(dev); + mlx5_fpga_device_stop(dev); mlx5_cleanup_fs(dev); unmap_bf_area(dev); mlx5_wait_for_reclaim_vfs_pages(dev); Modified: head/sys/dev/mlx5/mlx5_core/wq.h ============================================================================== --- head/sys/dev/mlx5/mlx5_core/wq.h Wed Dec 5 13:49:11 2018 (r341571) +++ head/sys/dev/mlx5/mlx5_core/wq.h Wed Dec 5 14:11:20 2018 (r341572) @@ -42,11 +42,22 @@ struct mlx5_wq_ctrl { struct mlx5_db db; }; +struct mlx5_frag_wq_ctrl { + struct mlx5_core_dev *mdev; + struct mlx5_frag_buf frag_buf; + struct mlx5_db db; +}; + struct mlx5_wq_cyc { void *buf; __be32 *db; u16 sz_m1; u8 log_stride; +}; + +struct mlx5_wq_qp { + struct mlx5_wq_cyc rq; + struct mlx5_wq_cyc sq; }; struct mlx5_cqwq { Added: head/sys/dev/mlx5/mlx5_fpga/cmd.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/mlx5/mlx5_fpga/cmd.h Wed Dec 5 14:11:20 2018 (r341572) @@ -0,0 +1,82 @@ +/*- + * Copyright (c) 2017, Mellanox Technologies, Ltd. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * 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. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * $FreeBSD$ + */ + +#ifndef __MLX5_FPGA_H__ +#define __MLX5_FPGA_H__ + +#include +#include +#include + +enum mlx5_fpga_qpc_field_select { + MLX5_FPGA_QPC_STATE = BIT(0), +}; + +struct mlx5_fpga_qp_counters { + u64 rx_ack_packets; + u64 rx_send_packets; + u64 tx_ack_packets; + u64 tx_send_packets; + u64 rx_total_drop; +}; + +struct mlx5_fpga_shell_counters { + u64 ddr_read_requests; + u64 ddr_write_requests; + u64 ddr_read_bytes; + u64 ddr_write_bytes; +}; + +int mlx5_fpga_caps(struct mlx5_core_dev *dev); +int mlx5_fpga_query(struct mlx5_core_dev *dev, struct mlx5_fpga_query *query); +int mlx5_fpga_ctrl_op(struct mlx5_core_dev *dev, u8 op); +int mlx5_fpga_access_reg(struct mlx5_core_dev *dev, u8 size, u64 addr, + void *buf, bool write); +int mlx5_fpga_sbu_caps(struct mlx5_core_dev *dev, void *caps, int size); +int mlx5_fpga_load(struct mlx5_core_dev *dev, enum mlx5_fpga_image image); +int mlx5_fpga_image_select(struct mlx5_core_dev *dev, + enum mlx5_fpga_image image); +int mlx5_fpga_shell_counters(struct mlx5_core_dev *dev, bool clear, + struct mlx5_fpga_shell_counters *data); + +int mlx5_fpga_create_qp(struct mlx5_core_dev *dev, void *fpga_qpc, + u32 *fpga_qpn); +int mlx5_fpga_modify_qp(struct mlx5_core_dev *dev, u32 fpga_qpn, + enum mlx5_fpga_qpc_field_select fields, void *fpga_qpc); +int mlx5_fpga_query_qp(struct mlx5_core_dev *dev, u32 fpga_qpn, void *fpga_qpc); +int mlx5_fpga_query_qp_counters(struct mlx5_core_dev *dev, u32 fpga_qpn, + bool clear, struct mlx5_fpga_qp_counters *data); +int mlx5_fpga_destroy_qp(struct mlx5_core_dev *dev, u32 fpga_qpn); + +#endif /* __MLX5_FPGA_H__ */ Added: head/sys/dev/mlx5/mlx5_fpga/conn.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/mlx5/mlx5_fpga/conn.h Wed Dec 5 14:11:20 2018 (r341572) @@ -0,0 +1,97 @@ +/*- + * Copyright (c) 2017 Mellanox Technologies. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * 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. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * $FreeBSD$ + */ + +#ifndef __MLX5_FPGA_CONN_H__ +#define __MLX5_FPGA_CONN_H__ + +#include +#include +#include +#include +#include +#include + +struct mlx5_fpga_conn { + struct mlx5_fpga_device *fdev; + + void (*recv_cb)(void *cb_arg, struct mlx5_fpga_dma_buf *buf); + void *cb_arg; + + /* FPGA QP */ + u32 fpga_qpc[MLX5_ST_SZ_DW(fpga_qpc)]; + u32 fpga_qpn; + + /* CQ */ + struct { + struct mlx5_cqwq wq; + struct mlx5_frag_wq_ctrl wq_ctrl; + struct mlx5_core_cq mcq; + struct tasklet_struct tasklet; + } cq; + + /* QP */ + struct { + bool active; + int sgid_index; + struct mlx5_wq_qp wq; + struct mlx5_wq_ctrl wq_ctrl; + struct mlx5_core_qp mqp; + struct { + spinlock_t lock; /* Protects all SQ state */ + unsigned int pc; + unsigned int cc; + unsigned int size; + struct mlx5_fpga_dma_buf **bufs; + struct list_head backlog; + } sq; + struct { + unsigned int pc; + unsigned int cc; + unsigned int size; + struct mlx5_fpga_dma_buf **bufs; + } rq; + } qp; +}; + +int mlx5_fpga_conn_device_init(struct mlx5_fpga_device *fdev); +void mlx5_fpga_conn_device_cleanup(struct mlx5_fpga_device *fdev); +struct mlx5_fpga_conn * +mlx5_fpga_conn_create(struct mlx5_fpga_device *fdev, + struct mlx5_fpga_conn_attr *attr, + enum mlx5_ifc_fpga_qp_type qp_type); +void mlx5_fpga_conn_destroy(struct mlx5_fpga_conn *conn); +int mlx5_fpga_conn_send(struct mlx5_fpga_conn *conn, + struct mlx5_fpga_dma_buf *buf); + +#endif /* __MLX5_FPGA_CONN_H__ */ Added: head/sys/dev/mlx5/mlx5_fpga/core.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/mlx5/mlx5_fpga/core.h Wed Dec 5 14:11:20 2018 (r341572) @@ -0,0 +1,140 @@ +/*- + * Copyright (c) 2017, Mellanox Technologies, Ltd. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * 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. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * $FreeBSD$ + */ + +#ifndef __MLX5_FPGA_CORE_H__ +#define __MLX5_FPGA_CORE_H__ + +#ifdef CONFIG_MLX5_FPGA + +#include +#include + +/* Represents client-specific and Innova device-specific information */ +struct mlx5_fpga_client_data { + struct list_head list; + struct mlx5_fpga_client *client; + void *data; + bool added; +}; + +enum mlx5_fdev_state { + MLX5_FDEV_STATE_SUCCESS = 0, + MLX5_FDEV_STATE_FAILURE = 1, + MLX5_FDEV_STATE_IN_PROGRESS = 2, + MLX5_FDEV_STATE_NONE = 0xFFFF, +}; + +/* Represents an Innova device */ +struct mlx5_fpga_device { + struct mlx5_core_dev *mdev; + struct completion load_event; + spinlock_t state_lock; /* Protects state transitions */ + enum mlx5_fdev_state fdev_state; + enum mlx5_fpga_status image_status; + enum mlx5_fpga_image last_admin_image; + enum mlx5_fpga_image last_oper_image; + + /* QP Connection resources */ + struct { + u32 pdn; + struct mlx5_core_mkey mkey; + struct mlx5_uars_page *uar; + } conn_res; + + struct mlx5_fpga_ipsec *ipsec; + + struct list_head list; + struct list_head client_data_list; + + /* Shell Transactions state */ + struct mlx5_fpga_conn *shell_conn; + struct mlx5_fpga_trans_device_state *trans; +}; + +#define mlx5_fpga_dbg(__adev, format, ...) \ + dev_dbg(&(__adev)->mdev->pdev->dev, "FPGA: %s:%d:(pid %d): " format, \ + __func__, __LINE__, current->pid, ##__VA_ARGS__) + +#define mlx5_fpga_err(__adev, format, ...) \ + dev_err(&(__adev)->mdev->pdev->dev, "FPGA: %s:%d:(pid %d): " format, \ + __func__, __LINE__, current->pid, ##__VA_ARGS__) + +#define mlx5_fpga_warn(__adev, format, ...) \ + dev_warn(&(__adev)->mdev->pdev->dev, "FPGA: %s:%d:(pid %d): " format, \ + __func__, __LINE__, current->pid, ##__VA_ARGS__) + +#define mlx5_fpga_warn_ratelimited(__adev, format, ...) \ + dev_warn_ratelimited(&(__adev)->mdev->pdev->dev, "FPGA: %s:%d: " \ + format, __func__, __LINE__, ##__VA_ARGS__) + +#define mlx5_fpga_notice(__adev, format, ...) \ + dev_notice(&(__adev)->mdev->pdev->dev, "FPGA: " format, ##__VA_ARGS__) + +#define mlx5_fpga_info(__adev, format, ...) \ + dev_info(&(__adev)->mdev->pdev->dev, "FPGA: " format, ##__VA_ARGS__) + +int mlx5_fpga_init(struct mlx5_core_dev *mdev); +void mlx5_fpga_cleanup(struct mlx5_core_dev *mdev); +int mlx5_fpga_device_start(struct mlx5_core_dev *mdev); +void mlx5_fpga_device_stop(struct mlx5_core_dev *mdev); +void mlx5_fpga_event(struct mlx5_core_dev *mdev, u8 event, void *data); + +#else + +static inline int mlx5_fpga_init(struct mlx5_core_dev *mdev) +{ + return 0; +} + +static inline void mlx5_fpga_cleanup(struct mlx5_core_dev *mdev) +{ +} + +static inline int mlx5_fpga_device_start(struct mlx5_core_dev *mdev) +{ + return 0; +} + +static inline void mlx5_fpga_device_stop(struct mlx5_core_dev *mdev) +{ +} + +static inline void mlx5_fpga_event(struct mlx5_core_dev *mdev, u8 event, + void *data) +{ +} + +#endif + +#endif /* __MLX5_FPGA_CORE_H__ */ Added: head/sys/dev/mlx5/mlx5_fpga/ipsec.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/mlx5/mlx5_fpga/ipsec.h Wed Dec 5 14:11:20 2018 (r341572) @@ -0,0 +1,95 @@ +/*- + * Copyright (c) 2017 Mellanox Technologies. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * 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. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * $FreeBSD$ + */ + +#ifndef __MLX5_FPGA_IPSEC_H__ +#define __MLX5_FPGA_IPSEC_H__ + +#include + +#ifdef CONFIG_MLX5_FPGA + +void *mlx5_fpga_ipsec_sa_cmd_exec(struct mlx5_core_dev *mdev, + struct mlx5_accel_ipsec_sa *cmd); +int mlx5_fpga_ipsec_sa_cmd_wait(void *context); + +u32 mlx5_fpga_ipsec_device_caps(struct mlx5_core_dev *mdev); +unsigned int mlx5_fpga_ipsec_counters_count(struct mlx5_core_dev *mdev); +int mlx5_fpga_ipsec_counters_read(struct mlx5_core_dev *mdev, u64 *counters, + unsigned int counters_count); + +int mlx5_fpga_ipsec_init(struct mlx5_core_dev *mdev); +void mlx5_fpga_ipsec_cleanup(struct mlx5_core_dev *mdev); + +#else + +static inline void *mlx5_fpga_ipsec_sa_cmd_exec(struct mlx5_core_dev *mdev, + struct mlx5_accel_ipsec_sa *cmd) +{ + return ERR_PTR(-EOPNOTSUPP); +} + +static inline int mlx5_fpga_ipsec_sa_cmd_wait(void *context) +{ + return -EOPNOTSUPP; +} + +static inline u32 mlx5_fpga_ipsec_device_caps(struct mlx5_core_dev *mdev) +{ + return 0; +} + +static inline unsigned int +mlx5_fpga_ipsec_counters_count(struct mlx5_core_dev *mdev) +{ + return 0; +} + +static inline int mlx5_fpga_ipsec_counters_read(struct mlx5_core_dev *mdev, + u64 *counters) +{ + return 0; +} + +static inline int mlx5_fpga_ipsec_init(struct mlx5_core_dev *mdev) +{ + return 0; +} + +static inline void mlx5_fpga_ipsec_cleanup(struct mlx5_core_dev *mdev) +{ +} + +#endif /* CONFIG_MLX5_FPGA */ + +#endif /* __MLX5_FPGA_SADB_H__ */ Added: head/sys/dev/mlx5/mlx5_fpga/mlx5_ifc_fpga.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/mlx5/mlx5_fpga/mlx5_ifc_fpga.h Wed Dec 5 14:11:20 2018 (r341572) @@ -0,0 +1,500 @@ +/*- + * Copyright (c) 2017, Mellanox Technologies, Ltd. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * 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. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * $FreeBSD$ + */ + +#ifndef MLX5_IFC_FPGA_H +#define MLX5_IFC_FPGA_H + +enum { + MLX5_FPGA_CAP_SANDBOX_VENDOR_ID_MLNX = 0x2c9, +}; + +enum { + MLX5_FPGA_CAP_SANDBOX_PRODUCT_ID_EXAMPLE = 0x1, + MLX5_FPGA_CAP_SANDBOX_PRODUCT_ID_IPSEC = 0x2, + MLX5_FPGA_CAP_SANDBOX_PRODUCT_ID_TLS = 0x3, +}; + +enum { + MLX5_FPGA_SHELL_CAPS_QP_TYPE_SHELL_QP = 0x1, + MLX5_FPGA_SHELL_CAPS_QP_TYPE_SANDBOX_QP = 0x2, +}; + +struct mlx5_ifc_fpga_shell_caps_bits { + u8 max_num_qps[0x10]; + u8 reserved_at_10[0x8]; + u8 total_rcv_credits[0x8]; + + u8 reserved_at_20[0xe]; + u8 qp_type[0x2]; + u8 reserved_at_30[0x5]; + u8 rae[0x1]; + u8 rwe[0x1]; + u8 rre[0x1]; + u8 reserved_at_38[0x4]; + u8 dc[0x1]; + u8 ud[0x1]; + u8 uc[0x1]; + u8 rc[0x1]; + + u8 reserved_at_40[0x1a]; + u8 log_ddr_size[0x6]; + + u8 max_fpga_qp_msg_size[0x20]; + + u8 reserved_at_80[0x180]; +}; + +struct mlx5_ifc_fpga_cap_bits { + u8 fpga_id[0x8]; + u8 fpga_device[0x18]; + + u8 register_file_ver[0x20]; + + u8 fpga_ctrl_modify[0x1]; + u8 reserved_at_41[0x5]; + u8 access_reg_query_mode[0x2]; + u8 reserved_at_48[0x6]; + u8 access_reg_modify_mode[0x2]; + u8 reserved_at_50[0x10]; + + u8 reserved_at_60[0x20]; + + u8 image_version[0x20]; + + u8 image_date[0x20]; + + u8 image_time[0x20]; + + u8 shell_version[0x20]; + + u8 reserved_at_100[0x80]; + + struct mlx5_ifc_fpga_shell_caps_bits shell_caps; + + u8 reserved_at_380[0x8]; + u8 ieee_vendor_id[0x18]; + + u8 sandbox_product_version[0x10]; + u8 sandbox_product_id[0x10]; + + u8 sandbox_basic_caps[0x20]; + + u8 reserved_at_3e0[0x10]; + u8 sandbox_extended_caps_len[0x10]; + + u8 sandbox_extended_caps_addr[0x40]; + + u8 fpga_ddr_start_addr[0x40]; + + u8 fpga_cr_space_start_addr[0x40]; + + u8 fpga_ddr_size[0x20]; + + u8 fpga_cr_space_size[0x20]; + + u8 reserved_at_500[0x300]; +}; + +enum { + MLX5_FPGA_CTRL_OPERATION_LOAD = 0x1, + MLX5_FPGA_CTRL_OPERATION_RESET = 0x2, + MLX5_FPGA_CTRL_OPERATION_FLASH_SELECT = 0x3, + MLX5_FPGA_CTRL_OPERATION_SANDBOX_BYPASS_ON = 0x4, + MLX5_FPGA_CTRL_OPERATION_SANDBOX_BYPASS_OFF = 0x5, + MLX5_FPGA_CTRL_OPERATION_RESET_SANDBOX = 0x6, +}; + +struct mlx5_ifc_fpga_ctrl_bits { + u8 reserved_at_0[0x8]; + u8 operation[0x8]; + u8 reserved_at_10[0x8]; + u8 status[0x8]; + + u8 reserved_at_20[0x8]; + u8 flash_select_admin[0x8]; + u8 reserved_at_30[0x8]; + u8 flash_select_oper[0x8]; + + u8 reserved_at_40[0x40]; +}; + +enum { + MLX5_FPGA_ERROR_EVENT_SYNDROME_CORRUPTED_DDR = 0x1, + MLX5_FPGA_ERROR_EVENT_SYNDROME_FLASH_TIMEOUT = 0x2, + MLX5_FPGA_ERROR_EVENT_SYNDROME_INTERNAL_LINK_ERROR = 0x3, + MLX5_FPGA_ERROR_EVENT_SYNDROME_WATCHDOG_FAILURE = 0x4, + MLX5_FPGA_ERROR_EVENT_SYNDROME_I2C_FAILURE = 0x5, + MLX5_FPGA_ERROR_EVENT_SYNDROME_IMAGE_CHANGED = 0x6, + MLX5_FPGA_ERROR_EVENT_SYNDROME_TEMPERATURE_CRITICAL = 0x7, +}; + +struct mlx5_ifc_fpga_error_event_bits { + u8 reserved_at_0[0x40]; + + u8 reserved_at_40[0x18]; + u8 syndrome[0x8]; + + u8 reserved_at_60[0x80]; +}; + +#define MLX5_FPGA_ACCESS_REG_SIZE_MAX 64 + +struct mlx5_ifc_fpga_access_reg_bits { + u8 reserved_at_0[0x20]; + + u8 reserved_at_20[0x10]; + u8 size[0x10]; + + u8 address[0x40]; + + u8 data[0][0x8]; +}; + +enum mlx5_ifc_fpga_qp_state { + MLX5_FPGA_QPC_STATE_INIT = 0x0, + MLX5_FPGA_QPC_STATE_ACTIVE = 0x1, + MLX5_FPGA_QPC_STATE_ERROR = 0x2, +}; + +enum mlx5_ifc_fpga_qp_type { + MLX5_FPGA_QPC_QP_TYPE_SHELL_QP = 0x0, + MLX5_FPGA_QPC_QP_TYPE_SANDBOX_QP = 0x1, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Wed Dec 5 14:17:24 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E7D571315327; Wed, 5 Dec 2018 14:17:23 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 904E67489B; Wed, 5 Dec 2018 14:17:23 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6FBED157D2; Wed, 5 Dec 2018 14:17:23 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5EHNHU098814; Wed, 5 Dec 2018 14:17:23 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5EHMcI098809; Wed, 5 Dec 2018 14:17:22 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051417.wB5EHMcI098809@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 14:17:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341573 - in head/sys: dev/mlx5 dev/mlx5/mlx5_fpga_tools modules/mlx5fpga_tools X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: in head/sys: dev/mlx5 dev/mlx5/mlx5_fpga_tools modules/mlx5fpga_tools X-SVN-Commit-Revision: 341573 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 904E67489B X-Spamd-Result: default: False [-0.67 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.47)[-0.473,0]; NEURAL_SPAM_LONG(0.05)[0.051,0]; NEURAL_HAM_SHORT(-0.25)[-0.249,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 14:17:24 -0000 Author: slavash Date: Wed Dec 5 14:17:22 2018 New Revision: 341573 URL: https://svnweb.freebsd.org/changeset/base/341573 Log: mlx5fpga_tools initial code import. Submitted by: kib@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Added: head/sys/dev/mlx5/mlx5_fpga_tools/ head/sys/dev/mlx5/mlx5_fpga_tools/mlx5fpga_tools_char.c (contents, props changed) head/sys/dev/mlx5/mlx5_fpga_tools/mlx5fpga_tools_main.c (contents, props changed) head/sys/dev/mlx5/mlx5_fpga_tools/tools.h (contents, props changed) head/sys/dev/mlx5/mlx5_fpga_tools/tools_char.h (contents, props changed) head/sys/modules/mlx5fpga_tools/ head/sys/modules/mlx5fpga_tools/Makefile (contents, props changed) Modified: head/sys/dev/mlx5/mlx5io.h Added: head/sys/dev/mlx5/mlx5_fpga_tools/mlx5fpga_tools_char.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/mlx5/mlx5_fpga_tools/mlx5fpga_tools_char.c Wed Dec 5 14:17:22 2018 (r341573) @@ -0,0 +1,325 @@ +/*- + * Copyright (c) 2017 Mellanox Technologies. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * 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. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * $FreeBSD$ + */ + +#include +#include +#include +#include +#include + +#define CHUNK_SIZE (128 * 1024) + +struct tools_context { + struct mlx5_fpga_tools_dev *tdev; + enum mlx5_fpga_access_type access_type; +}; + +static void +tools_char_ctx_dtor(void *data) +{ + + free(data, M_DEVBUF); +} + +static int +tools_char_open(struct cdev *dev, int oflags, int devtype, struct thread *td) +{ + struct tools_context *context; + + context = malloc(sizeof(*context), M_DEVBUF, M_WAITOK); + context->tdev = dev->si_drv1; + context->access_type = MLX5_FPGA_ACCESS_TYPE_DONTCARE; + devfs_set_cdevpriv(context, tools_char_ctx_dtor); + return (0); +} + +static int +mem_read(struct mlx5_fpga_tools_dev *tdev, void *buf, size_t count, + u64 address, enum mlx5_fpga_access_type access_type, size_t *retcnt) +{ + int ret; + + ret = sx_xlock_sig(&tdev->lock); + if (ret != 0) + return (ret); + ret = mlx5_fpga_mem_read(tdev->fdev, count, address, buf, access_type); + sx_xunlock(&tdev->lock); + if (ret < 0) { + dev_dbg(mlx5_fpga_dev(tdev->fdev), + "Failed to read %zu bytes at address 0x%jx: %d\n", + count, (uintmax_t)address, ret); + return (-ret); + } + *retcnt = ret; + return (0); +} + +static int +mem_write(struct mlx5_fpga_tools_dev *tdev, void *buf, size_t count, + u64 address, enum mlx5_fpga_access_type access_type, size_t *retcnt) +{ + int ret; + + ret = sx_xlock_sig(&tdev->lock); + if (ret != 0) + return (ret); + ret = mlx5_fpga_mem_write(tdev->fdev, count, address, buf, access_type); + sx_xunlock(&tdev->lock); + if (ret < 0) { + dev_dbg(mlx5_fpga_dev(tdev->fdev), + "Failed to write %zu bytes at address 0x%jx: %d\n", + count, (uintmax_t)address, ret); + return (-ret); + } + *retcnt = ret; + return (0); +} + +static void +tools_char_llseek(struct tools_context *context, struct uio *uio, ssize_t *len) +{ + uint64_t fbase, fsize; + size_t llen; + + llen = uio->uio_resid; + if (llen < 1) { + *len = 0; + return; + } + if (llen > CHUNK_SIZE) + llen = CHUNK_SIZE; + fbase = mlx5_fpga_ddr_base_get(context->tdev->fdev); + fsize = mlx5_fpga_ddr_size_get(context->tdev->fdev); + if (uio->uio_offset > fbase) + *len = 0; + else if (uio->uio_offset + *len > fbase + fsize) + *len = fbase + fsize - uio->uio_offset; + else + *len = llen; +} + +static int +tools_char_read(struct cdev *dev, struct uio *uio, int ioflag) +{ + struct tools_context *context; + void *kbuf; + size_t len, len1; + int ret; + + ret = devfs_get_cdevpriv((void **)&context); + if (ret != 0) + return (ret); + dev_dbg(mlx5_fpga_dev(context->tdev->fdev), + "tools char device reading %zu bytes at 0x%jx\n", uio->uio_resid, + (uintmax_t)uio->uio_offset); + + tools_char_llseek(context, uio, &len); + if (len == 0) + return (0); + + kbuf = malloc(len, M_DEVBUF, M_WAITOK); + ret = mem_read(context->tdev, kbuf, len, uio->uio_offset, + context->access_type, &len1); + if (ret == 0) + ret = uiomove(kbuf, len1, uio); + free(kbuf, M_DEVBUF); + return (ret); +} + +static int +tools_char_write(struct cdev *dev, struct uio *uio, int ioflag) +{ + struct tools_context *context; + void *kbuf; + off_t of; + size_t len, len1; + int ret; + + ret = devfs_get_cdevpriv((void **)&context); + if (ret != 0) + return (ret); + dev_dbg(mlx5_fpga_dev(context->tdev->fdev), + "tools char device reading %zu bytes at 0x%jx\n", uio->uio_resid, + (uintmax_t)uio->uio_offset); + + tools_char_llseek(context, uio, &len); + if (len == 0) + return (0); + + kbuf = malloc(len, M_DEVBUF, M_WAITOK); + len1 = uio->uio_resid; + of = uio->uio_offset; + + ret = uiomove(kbuf, len, uio); + if (ret == 0) { + len1 -= uio->uio_resid; + ret = mem_write(context->tdev, kbuf, len, of, + context->access_type, &len1); + } + free(kbuf, M_DEVBUF); + return (ret); +} + +CTASSERT(MLX5_FPGA_CAP_ARR_SZ == MLX5_ST_SZ_DW(fpga_cap)); + +static int +tools_char_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, + struct thread *td) +{ + struct tools_context *context; + struct mlx5_fpga_device *fdev; + struct mlx5_fpga_query query; + u32 fpga_cap[MLX5_ST_SZ_DW(fpga_cap)] = {0}; + int arg, err; + + err = devfs_get_cdevpriv((void **)&context); + if (err != 0) + return (err); + fdev = context->tdev->fdev; + if (fdev == NULL) + return (ENXIO); + + switch (cmd) { + case MLX5_FPGA_ACCESS_TYPE: + arg = *(int *)data; + if (arg > MLX5_FPGA_ACCESS_TYPE_MAX) { + dev_err(mlx5_fpga_dev(fdev), + "unknown access type %u\n", arg); + err = EINVAL; + break; + } + context->access_type = arg; + break; + case MLX5_FPGA_LOAD: + arg = *(int *)data; + if (arg > MLX5_FPGA_IMAGE_MAX) { + dev_err(mlx5_fpga_dev(fdev), + "unknown image type %u\n", arg); + err = EINVAL; + break; + } + err = mlx5_fpga_device_reload(fdev, arg); + break; + case MLX5_FPGA_RESET: + err = mlx5_fpga_device_reload(fdev, MLX5_FPGA_IMAGE_MAX + 1); + break; + case MLX5_FPGA_IMAGE_SEL: + arg = *(int *)data; + if (arg > MLX5_FPGA_IMAGE_MAX) { + dev_err(mlx5_fpga_dev(fdev), + "unknown image type %u\n", arg); + err = EINVAL; + break; + } + err = mlx5_fpga_flash_select(fdev, arg); + break; + case MLX5_FPGA_QUERY: + mlx5_fpga_device_query(fdev, &query); + bcopy(&query, data, sizeof(query)); + err = 0; + break; + case MLX5_FPGA_CAP: + mlx5_fpga_get_cap(fdev, fpga_cap); + bcopy(&fpga_cap, data, sizeof(fpga_cap)); + err = 0; + break; + default: + dev_err(mlx5_fpga_dev(fdev), + "unknown ioctl command %#08lx\n", cmd); + err = ENOTTY; + } + return (err); +} + +static struct cdevsw mlx5_tools_char_cdevsw = { + .d_version = D_VERSION, + .d_name = "mlx5_tools_char", + .d_open = tools_char_open, + .d_read = tools_char_read, + .d_write = tools_char_write, + .d_ioctl = tools_char_ioctl, +}; + +int +mlx5_fpga_tools_char_add_one(struct mlx5_fpga_tools_dev *tdev) +{ + struct make_dev_args mda; + struct cdev *cd; + device_t bdev; + int ret; + + make_dev_args_init(&mda); + mda.mda_flags = MAKEDEV_WAITOK | MAKEDEV_CHECKNAME; + mda.mda_devsw = &mlx5_tools_char_cdevsw; + mda.mda_uid = UID_ROOT; + mda.mda_gid = GID_OPERATOR; + mda.mda_mode = 0660; + mda.mda_si_drv1 = tdev; + bdev = mlx5_fpga_dev(tdev->fdev)->bsddev; + ret = make_dev_s(&mda, &cd, + "%04x:%02x:%02x.%x" MLX5_FPGA_TOOLS_NAME_SUFFIX, + pci_get_domain(bdev), pci_get_bus(bdev), pci_get_slot(bdev), + pci_get_function(bdev)); + if (ret != 0) { + tdev->char_device = NULL; + dev_err(mlx5_fpga_dev(tdev->fdev), + "Failed to create a char device: %d\n", ret); + return (-ret); + } + tdev->char_device = cd; + + dev_dbg(mlx5_fpga_dev(tdev->fdev), "tools char device %s created\n", + cd->si_name); + return (0); +} + +void mlx5_fpga_tools_char_remove_one(struct mlx5_fpga_tools_dev *tdev) +{ + + dev_err(mlx5_fpga_dev(tdev->fdev), "tools char device %s destroyed\n", + ((struct cdev *)(tdev->char_device))->si_name); + destroy_dev((struct cdev *)(tdev->char_device)); +} + +int +mlx5_fpga_tools_char_init(void) +{ + + return (0); +} + +void +mlx5_fpga_tools_char_deinit(void) +{ +} Added: head/sys/dev/mlx5/mlx5_fpga_tools/mlx5fpga_tools_main.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/mlx5/mlx5_fpga_tools/mlx5fpga_tools_main.c Wed Dec 5 14:17:22 2018 (r341573) @@ -0,0 +1,143 @@ +/*- + * Copyright (c) 2017 Mellanox Technologies. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * 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. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * $FreeBSD$ + */ + +#include +#include +#include + +#if (__FreeBSD_version >= 1100000) +MODULE_DEPEND(mlx5fpga_tools, linuxkpi, 1, 1, 1); +#endif +MODULE_DEPEND(mlx5fpga_tools, mlx5, 1, 1, 1); +MODULE_DEPEND(mlx5fpga_tools, mlx5fpga, 1, 1, 1); +MODULE_VERSION(mlx5fpga_tools, 1); + +static void mlx5_fpga_tools_create(struct mlx5_fpga_device *fdev); +static int mlx5_fpga_tools_add(struct mlx5_fpga_device *fdev, u32 vid, u16 pid); +static void mlx5_fpga_tools_remove(struct mlx5_fpga_device *fdev); +static void mlx5_fpga_tools_destroy(struct mlx5_fpga_device *fdev); + +struct mlx5_fpga_tools_dev *mlx5_fpga_tools_alloc(struct mlx5_fpga_device *fdev); +void mlx5_fpga_tools_free(struct mlx5_fpga_tools_dev *tdev); + +static struct mlx5_fpga_client mlx5_fpga_tools_client = { + .name = MLX5_FPGA_TOOLS_DRIVER_NAME, + .create = mlx5_fpga_tools_create, + .add = mlx5_fpga_tools_add, + .remove = mlx5_fpga_tools_remove, + .destroy = mlx5_fpga_tools_destroy, +}; + +struct mlx5_fpga_tools_dev *mlx5_fpga_tools_alloc(struct mlx5_fpga_device *fdev) +{ + int ret; + struct mlx5_fpga_tools_dev *tdev; + + tdev = kzalloc(sizeof(*tdev), GFP_KERNEL); + if (!tdev) + goto out; + + tdev->fdev = fdev; + sx_init(&tdev->lock, "mlx5fpgat"); + ret = mlx5_fpga_tools_char_add_one(tdev); + if (ret) + goto err_free; + + goto out; + +err_free: + kfree(tdev); + tdev = NULL; + +out: + return tdev; +} + +void mlx5_fpga_tools_free(struct mlx5_fpga_tools_dev *tdev) +{ + mlx5_fpga_tools_char_remove_one(tdev); + kfree(tdev); +} + +static void mlx5_fpga_tools_create(struct mlx5_fpga_device *fdev) +{ + struct mlx5_fpga_tools_dev *dev = NULL; + + dev_dbg(mlx5_fpga_dev(fdev), "tools_create\n"); + + dev = mlx5_fpga_tools_alloc(fdev); + if (!dev) + return; + + mlx5_fpga_client_data_set(fdev, &mlx5_fpga_tools_client, dev); +} + +static int mlx5_fpga_tools_add(struct mlx5_fpga_device *fdev, u32 vid, u16 pid) +{ + return 0; +} + +static void mlx5_fpga_tools_remove(struct mlx5_fpga_device *fdev) +{ +} + +static void mlx5_fpga_tools_destroy(struct mlx5_fpga_device *fdev) +{ + struct mlx5_fpga_tools_dev *dev; + + dev_dbg(mlx5_fpga_dev(fdev), "tools_destroy\n"); + + dev = mlx5_fpga_client_data_get(fdev, &mlx5_fpga_tools_client); + if (dev) + mlx5_fpga_tools_free(dev); +} + +static int __init mlx5_fpga_tools_init(void) +{ + int ret = mlx5_fpga_tools_char_init(); + + if (ret) + return ret; + mlx5_fpga_client_register(&mlx5_fpga_tools_client); + return 0; +} + +static void __exit mlx5_fpga_tools_exit(void) +{ + mlx5_fpga_client_unregister(&mlx5_fpga_tools_client); + mlx5_fpga_tools_char_deinit(); +} + +module_init(mlx5_fpga_tools_init); +module_exit(mlx5_fpga_tools_exit); Added: head/sys/dev/mlx5/mlx5_fpga_tools/tools.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/mlx5/mlx5_fpga_tools/tools.h Wed Dec 5 14:17:22 2018 (r341573) @@ -0,0 +1,65 @@ +/*- + * Copyright (c) 2017 Mellanox Technologies. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * 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. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * $FreeBSD$ + */ + +#ifndef __TOOLS_H__ +#define __TOOLS_H__ + +#include +#include +#include +#include +#include +#include + +#define MLX5_FPGA_TOOLS_DRIVER_NAME "mlx5_fpga_tools" + +struct mlx5_fpga_tools_dev { + /* Core device and connection to FPGA */ + struct mlx5_fpga_device *fdev; + + /* Serializes memory accesses */ + struct sx lock; + + /* Char device state */ + void *char_device; +}; + +int mlx5_fpga_tools_mem_write(struct mlx5_fpga_tools_dev *tdev, + void *buf, size_t count, u64 address, + enum mlx5_fpga_access_type access_type); +int mlx5_fpga_tools_mem_read(struct mlx5_fpga_tools_dev *tdev, void *buf, + size_t count, u64 address, + enum mlx5_fpga_access_type access_type); + +#endif /* __TOOLS_H__ */ Added: head/sys/dev/mlx5/mlx5_fpga_tools/tools_char.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/mlx5/mlx5_fpga_tools/tools_char.h Wed Dec 5 14:17:22 2018 (r341573) @@ -0,0 +1,46 @@ +/*- + * Copyright (c) 2017 Mellanox Technologies. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * 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. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * $FreeBSD$ + */ + +#ifndef __TOOLS_CHAR_H__ +#define __TOOLS_CHAR_H__ + +#include + +int mlx5_fpga_tools_char_init(void); +void mlx5_fpga_tools_char_deinit(void); + +int mlx5_fpga_tools_char_add_one(struct mlx5_fpga_tools_dev *tdev); +void mlx5_fpga_tools_char_remove_one(struct mlx5_fpga_tools_dev *tdev); + +#endif /* __TOOLS_CHAR_H__ */ Modified: head/sys/dev/mlx5/mlx5io.h ============================================================================== --- head/sys/dev/mlx5/mlx5io.h Wed Dec 5 14:11:20 2018 (r341572) +++ head/sys/dev/mlx5/mlx5io.h Wed Dec 5 14:17:22 2018 (r341573) @@ -97,4 +97,15 @@ enum mlx5_fpga_access_type { MLX5_FPGA_ACCESS_TYPE_MAX = MLX5_FPGA_ACCESS_TYPE_DONTCARE, }; +#define MLX5_FPGA_CAP_ARR_SZ 0x40 + +#define MLX5_FPGA_ACCESS_TYPE _IOWINT('m', 0x80) +#define MLX5_FPGA_LOAD _IOWINT('m', 0x81) +#define MLX5_FPGA_RESET _IO('m', 0x82) +#define MLX5_FPGA_IMAGE_SEL _IOWINT('m', 0x83) +#define MLX5_FPGA_QUERY _IOR('m', 0x84, struct mlx5_fpga_query) +#define MLX5_FPGA_CAP _IOR('m', 0x85, u32[MLX5_FPGA_CAP_ARR_SZ]) + +#define MLX5_FPGA_TOOLS_NAME_SUFFIX "_mlx5_fpga_tools" + #endif Added: head/sys/modules/mlx5fpga_tools/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/mlx5fpga_tools/Makefile Wed Dec 5 14:17:22 2018 (r341573) @@ -0,0 +1,19 @@ +# $FreeBSD$ +.PATH: ${SRCTOP}/sys/dev/mlx5/mlx5_fpga_tools + +KMOD=mlx5fpga_tools +SRCS= \ + mlx5fpga_tools_main.c \ + mlx5fpga_tools_char.c + +SRCS+= \ + device_if.h bus_if.h vnode_if.h pci_if.h \ + opt_inet.h opt_inet6.h opt_rss.h opt_ratelimit.h + +CFLAGS+= -I${SRCTOP}/sys/ofed/include +CFLAGS+= -I${SRCTOP}/sys/compat/linuxkpi/common/include + +.include + +CFLAGS+= -Wno-cast-qual -Wno-pointer-arith ${GCC_MS_EXTENSIONS} +CFLAGS+= -DCONFIG_MLX5_FPGA -DCONFIG_MLX5_ACCEL From owner-svn-src-head@freebsd.org Wed Dec 5 14:18:54 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1F49C1315476; Wed, 5 Dec 2018 14:18:54 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B4EFA74AB7; Wed, 5 Dec 2018 14:18:53 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7D459157DF; Wed, 5 Dec 2018 14:18:53 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5EIr6n098924; Wed, 5 Dec 2018 14:18:53 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5EIrDe098922; Wed, 5 Dec 2018 14:18:53 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051418.wB5EIrDe098922@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 14:18:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341574 - in head/sys/dev/mlx5: . mlx5_fpga X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: in head/sys/dev/mlx5: . mlx5_fpga X-SVN-Commit-Revision: 341574 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B4EFA74AB7 X-Spamd-Result: default: False [-0.80 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.52)[-0.521,0]; NEURAL_HAM_SHORT(-0.25)[-0.249,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.03)[-0.031,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 14:18:54 -0000 Author: slavash Date: Wed Dec 5 14:18:52 2018 New Revision: 341574 URL: https://svnweb.freebsd.org/changeset/base/341574 Log: mlx5fpga: Support MorseQ board Added and supported new enum "morseQ = 4" for fpga_id field Submitted by: kib@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_core.c head/sys/dev/mlx5/mlx5io.h Modified: head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_core.c ============================================================================== --- head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_core.c Wed Dec 5 14:17:22 2018 (r341573) +++ head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_core.c Wed Dec 5 14:18:52 2018 (r341574) @@ -138,6 +138,8 @@ static const char *mlx5_fpga_name(u32 fpga_id) return "Edison"; case MLX5_FPGA_MORSE: return "Morse"; + case MLX5_FPGA_MORSEQ: + return "MorseQ"; } snprintf(ret, sizeof(ret), "Unknown %d", fpga_id); @@ -148,6 +150,7 @@ static int mlx5_fpga_device_load_check(struct mlx5_fpg { struct mlx5_fpga_query query; int err; + u32 fpga_id; err = mlx5_fpga_query(fdev->mdev, &query); if (err) { @@ -162,8 +165,9 @@ static int mlx5_fpga_device_load_check(struct mlx5_fpg mlx5_fpga_info(fdev, "Status %u; Admin image %u; Oper image %u\n", query.image_status, query.admin_image, query.oper_image); - /* For Morse project FPGA has no influence to network functionality */ - if (MLX5_CAP_FPGA(fdev->mdev, fpga_id) == MLX5_FPGA_MORSE) + /* For Morse projects FPGA has no influence to network functionality */ + fpga_id = MLX5_CAP_FPGA(fdev->mdev, fpga_id); + if (fpga_id == MLX5_FPGA_MORSE || fpga_id == MLX5_FPGA_MORSEQ) return 0; if (query.image_status != MLX5_FPGA_STATUS_SUCCESS) { @@ -226,7 +230,7 @@ int mlx5_fpga_device_start(struct mlx5_core_dev *mdev) fpga_id = MLX5_CAP_FPGA(fdev->mdev, fpga_id); mlx5_fpga_info(fdev, "FPGA card %s\n", mlx5_fpga_name(fpga_id)); - if (fpga_id == MLX5_FPGA_MORSE) + if (fpga_id == MLX5_FPGA_MORSE || fpga_id == MLX5_FPGA_MORSEQ) goto out; mlx5_fpga_info(fdev, "%s(%d) image, version %u; SBU %06x:%04x version %d\n", @@ -361,13 +365,16 @@ void mlx5_fpga_device_stop(struct mlx5_core_dev *mdev) unsigned int max_num_qps; unsigned long flags; int err; + u32 fpga_id; if (!fdev) return; - spin_lock_irqsave(&fdev->state_lock, flags); - if (MLX5_CAP_FPGA(mdev, fpga_id) == MLX5_FPGA_MORSE) + fpga_id = MLX5_CAP_FPGA(mdev, fpga_id); + if (fpga_id == MLX5_FPGA_MORSE || fpga_id == MLX5_FPGA_MORSEQ) return; + + spin_lock_irqsave(&fdev->state_lock, flags); if (fdev->fdev_state != MLX5_FDEV_STATE_SUCCESS) { spin_unlock_irqrestore(&fdev->state_lock, flags); Modified: head/sys/dev/mlx5/mlx5io.h ============================================================================== --- head/sys/dev/mlx5/mlx5io.h Wed Dec 5 14:17:22 2018 (r341573) +++ head/sys/dev/mlx5/mlx5io.h Wed Dec 5 14:18:52 2018 (r341574) @@ -61,6 +61,7 @@ enum mlx5_fpga_id { MLX5_FPGA_NEWTON = 0, MLX5_FPGA_EDISON = 1, MLX5_FPGA_MORSE = 2, + MLX5_FPGA_MORSEQ = 3, }; enum mlx5_fpga_image { From owner-svn-src-head@freebsd.org Wed Dec 5 14:19:58 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EFA7213155A2; Wed, 5 Dec 2018 14:19:57 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 95D4474D84; Wed, 5 Dec 2018 14:19:57 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 781B4157E5; Wed, 5 Dec 2018 14:19:57 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5EJvfe099076; Wed, 5 Dec 2018 14:19:57 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5EJu96099069; Wed, 5 Dec 2018 14:19:56 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051419.wB5EJu96099069@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 14:19:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341576 - in head/sys/dev/mlx5: . mlx5_fpga mlx5_fpga_tools X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: in head/sys/dev/mlx5: . mlx5_fpga mlx5_fpga_tools X-SVN-Commit-Revision: 341576 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 95D4474D84 X-Spamd-Result: default: False [-0.74 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.50)[-0.498,0]; NEURAL_SPAM_LONG(0.01)[0.010,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_SHORT(-0.25)[-0.249,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 14:19:58 -0000 Author: slavash Date: Wed Dec 5 14:19:55 2018 New Revision: 341576 URL: https://svnweb.freebsd.org/changeset/base/341576 Log: mlx5fpga: Add set and query connect/disconnect FPGA Submitted by: kib@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_fpga/cmd.h head/sys/dev/mlx5/mlx5_fpga/core.h head/sys/dev/mlx5/mlx5_fpga/mlx5_ifc_fpga.h head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_cmd.c head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_sdk.c head/sys/dev/mlx5/mlx5_fpga/sdk.h head/sys/dev/mlx5/mlx5_fpga_tools/mlx5fpga_tools_char.c head/sys/dev/mlx5/mlx5io.h Modified: head/sys/dev/mlx5/mlx5_fpga/cmd.h ============================================================================== --- head/sys/dev/mlx5/mlx5_fpga/cmd.h Wed Dec 5 14:19:23 2018 (r341575) +++ head/sys/dev/mlx5/mlx5_fpga/cmd.h Wed Dec 5 14:19:55 2018 (r341576) @@ -69,6 +69,8 @@ int mlx5_fpga_sbu_caps(struct mlx5_core_dev *dev, void int mlx5_fpga_load(struct mlx5_core_dev *dev, enum mlx5_fpga_image image); int mlx5_fpga_image_select(struct mlx5_core_dev *dev, enum mlx5_fpga_image image); +int mlx5_fpga_ctrl_connect(struct mlx5_core_dev *dev, + enum mlx5_fpga_connect *connect); int mlx5_fpga_shell_counters(struct mlx5_core_dev *dev, bool clear, struct mlx5_fpga_shell_counters *data); Modified: head/sys/dev/mlx5/mlx5_fpga/core.h ============================================================================== --- head/sys/dev/mlx5/mlx5_fpga/core.h Wed Dec 5 14:19:23 2018 (r341575) +++ head/sys/dev/mlx5/mlx5_fpga/core.h Wed Dec 5 14:19:55 2018 (r341576) @@ -52,6 +52,7 @@ enum mlx5_fdev_state { MLX5_FDEV_STATE_SUCCESS = 0, MLX5_FDEV_STATE_FAILURE = 1, MLX5_FDEV_STATE_IN_PROGRESS = 2, + MLX5_FDEV_STATE_DISCONNECTED = 3, MLX5_FDEV_STATE_NONE = 0xFFFF, }; Modified: head/sys/dev/mlx5/mlx5_fpga/mlx5_ifc_fpga.h ============================================================================== --- head/sys/dev/mlx5/mlx5_fpga/mlx5_ifc_fpga.h Wed Dec 5 14:19:23 2018 (r341575) +++ head/sys/dev/mlx5/mlx5_fpga/mlx5_ifc_fpga.h Wed Dec 5 14:19:55 2018 (r341576) @@ -133,6 +133,8 @@ enum { MLX5_FPGA_CTRL_OPERATION_SANDBOX_BYPASS_ON = 0x4, MLX5_FPGA_CTRL_OPERATION_SANDBOX_BYPASS_OFF = 0x5, MLX5_FPGA_CTRL_OPERATION_RESET_SANDBOX = 0x6, + MLX5_FPGA_CTRL_OPERATION_DISCONNECT = 0x9, + MLX5_FPGA_CTRL_OPERATION_CONNECT = 0xA, }; struct mlx5_ifc_fpga_ctrl_bits { Modified: head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_cmd.c ============================================================================== --- head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_cmd.c Wed Dec 5 14:19:23 2018 (r341575) +++ head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_cmd.c Wed Dec 5 14:19:55 2018 (r341576) @@ -37,6 +37,7 @@ #include #include #include +#include #define MLX5_FPGA_ACCESS_REG_SZ (MLX5_ST_SZ_DW(fpga_access_reg) + \ MLX5_FPGA_ACCESS_REG_SIZE_MAX) @@ -162,6 +163,33 @@ int mlx5_fpga_query(struct mlx5_core_dev *dev, struct query->admin_image = MLX5_GET(fpga_ctrl, out, flash_select_admin); query->oper_image = MLX5_GET(fpga_ctrl, out, flash_select_oper); return 0; +} + +int mlx5_fpga_ctrl_connect(struct mlx5_core_dev *dev, + enum mlx5_fpga_connect *connect) +{ + u32 in[MLX5_ST_SZ_DW(fpga_ctrl)] = {0}; + u32 out[MLX5_ST_SZ_DW(fpga_ctrl)]; + int status; + int err; + + if (*connect == MLX5_FPGA_CONNECT_QUERY) { + err = mlx5_core_access_reg(dev, in, sizeof(in), out, + sizeof(out), MLX5_REG_FPGA_CTRL, + 0, false); + if (err) + return err; + status = MLX5_GET(fpga_ctrl, out, status); + *connect = (status == MLX5_FDEV_STATE_DISCONNECTED) ? + MLX5_FPGA_CONNECT_DISCONNECT : + MLX5_FPGA_CONNECT_CONNECT; + } else { + MLX5_SET(fpga_ctrl, in, operation, *connect); + err = mlx5_core_access_reg(dev, in, sizeof(in), out, + sizeof(out), MLX5_REG_FPGA_CTRL, + 0, true); + } + return err; } int mlx5_fpga_query_mtmp(struct mlx5_core_dev *dev, Modified: head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_sdk.c ============================================================================== --- head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_sdk.c Wed Dec 5 14:19:23 2018 (r341575) +++ head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_sdk.c Wed Dec 5 14:19:55 2018 (r341576) @@ -342,6 +342,7 @@ int mlx5_fpga_device_reload(struct mlx5_fpga_device *f break; case MLX5_FDEV_STATE_SUCCESS: case MLX5_FDEV_STATE_FAILURE: + case MLX5_FDEV_STATE_DISCONNECTED: break; } spin_unlock_irqrestore(&fdev->state_lock, flags); @@ -426,6 +427,7 @@ int mlx5_fpga_flash_select(struct mlx5_fpga_device *fd case MLX5_FDEV_STATE_NONE: spin_unlock_irqrestore(&fdev->state_lock, flags); return -ENODEV; + case MLX5_FDEV_STATE_DISCONNECTED: case MLX5_FDEV_STATE_IN_PROGRESS: case MLX5_FDEV_STATE_SUCCESS: case MLX5_FDEV_STATE_FAILURE: @@ -441,6 +443,32 @@ int mlx5_fpga_flash_select(struct mlx5_fpga_device *fd return err; } EXPORT_SYMBOL(mlx5_fpga_flash_select); + +int mlx5_fpga_connectdisconnect(struct mlx5_fpga_device *fdev, + enum mlx5_fpga_connect *connect) +{ + unsigned long flags; + int err; + + spin_lock_irqsave(&fdev->state_lock, flags); + switch (fdev->fdev_state) { + case MLX5_FDEV_STATE_NONE: + spin_unlock_irqrestore(&fdev->state_lock, flags); + return -ENODEV; + case MLX5_FDEV_STATE_IN_PROGRESS: + case MLX5_FDEV_STATE_SUCCESS: + case MLX5_FDEV_STATE_FAILURE: + case MLX5_FDEV_STATE_DISCONNECTED: + break; + } + spin_unlock_irqrestore(&fdev->state_lock, flags); + + err = mlx5_fpga_ctrl_connect(fdev->mdev, connect); + if (err) + mlx5_fpga_err(fdev, "Failed to connect/disconnect: %d\n", err); + return err; +} +EXPORT_SYMBOL(mlx5_fpga_connectdisconnect); int mlx5_fpga_temperature(struct mlx5_fpga_device *fdev, struct mlx5_fpga_temperature *temp) Modified: head/sys/dev/mlx5/mlx5_fpga/sdk.h ============================================================================== --- head/sys/dev/mlx5/mlx5_fpga/sdk.h Wed Dec 5 14:19:23 2018 (r341575) +++ head/sys/dev/mlx5/mlx5_fpga/sdk.h Wed Dec 5 14:19:55 2018 (r341576) @@ -366,6 +366,16 @@ int mlx5_fpga_temperature(struct mlx5_fpga_device *fde struct mlx5_fpga_temperature *temp); /** + * mlx5_fpga_connectdisconnect() - Connect/disconnect ConnectX to FPGA + * @fdev: The FPGA device + + * Return: 0 if successful + * or any other error value otherwise. + */ +int mlx5_fpga_connectdisconnect(struct mlx5_fpga_device *fdev, + enum mlx5_fpga_connect *connect); + +/** * mlx5_fpga_get_cap() - Returns the FPGA cap mailbox from FW without parsing. * @fdev: The FPGA device * @fpga_caps: Is an array with a length of according to the size of Modified: head/sys/dev/mlx5/mlx5_fpga_tools/mlx5fpga_tools_char.c ============================================================================== --- head/sys/dev/mlx5/mlx5_fpga_tools/mlx5fpga_tools_char.c Wed Dec 5 14:19:23 2018 (r341575) +++ head/sys/dev/mlx5/mlx5_fpga_tools/mlx5fpga_tools_char.c Wed Dec 5 14:19:55 2018 (r341576) @@ -201,6 +201,7 @@ tools_char_ioctl(struct cdev *dev, u_long cmd, caddr_t struct mlx5_fpga_device *fdev; struct mlx5_fpga_query query; struct mlx5_fpga_temperature *temperature; + enum mlx5_fpga_connect *connect; u32 fpga_cap[MLX5_ST_SZ_DW(fpga_cap)] = {0}; int arg, err; @@ -260,6 +261,11 @@ tools_char_ioctl(struct cdev *dev, u_long cmd, caddr_t mlx5_fpga_temperature(fdev, temperature); err = 0; /* XXXKIB */ break; + case MLX5_FPGA_CONNECT: + connect = (enum mlx5_fpga_connect *)data; + mlx5_fpga_connectdisconnect(fdev, connect); + err = 0; /* XXXKIB */ + break; default: dev_err(mlx5_fpga_dev(fdev), "unknown ioctl command %#08lx\n", cmd); Modified: head/sys/dev/mlx5/mlx5io.h ============================================================================== --- head/sys/dev/mlx5/mlx5io.h Wed Dec 5 14:19:23 2018 (r341575) +++ head/sys/dev/mlx5/mlx5io.h Wed Dec 5 14:19:55 2018 (r341576) @@ -90,6 +90,12 @@ enum mlx5_fpga_tee { MLX5_FPGA_TEE_GENERATE_SINGLE_EVENT = 2, }; +enum mlx5_fpga_connect { + MLX5_FPGA_CONNECT_QUERY = 0, + MLX5_FPGA_CONNECT_DISCONNECT = 0x9, + MLX5_FPGA_CONNECT_CONNECT = 0xA, +}; + /** * enum mlx5_fpga_access_type - Enumerated the different methods possible for * accessing the device memory address space @@ -128,6 +134,7 @@ struct mlx5_fpga_temperature { #define MLX5_FPGA_QUERY _IOR('m', 0x84, struct mlx5_fpga_query) #define MLX5_FPGA_CAP _IOR('m', 0x85, u32[MLX5_FPGA_CAP_ARR_SZ]) #define MLX5_FPGA_TEMPERATURE _IOWR('m', 0x86, struct mlx5_fpga_temperature) +#define MLX5_FPGA_CONNECT _IOWR('m', 0x87, enum mlx5_fpga_connect) #define MLX5_FPGA_TOOLS_NAME_SUFFIX "_mlx5_fpga_tools" From owner-svn-src-head@freebsd.org Wed Dec 5 14:19:26 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EE5FF1315508; Wed, 5 Dec 2018 14:19:25 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9488C74C02; Wed, 5 Dec 2018 14:19:25 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7593F157E4; Wed, 5 Dec 2018 14:19:25 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5EJPDc099003; Wed, 5 Dec 2018 14:19:25 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5EJNtL098995; Wed, 5 Dec 2018 14:19:23 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051419.wB5EJNtL098995@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 14:19:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341575 - in head/sys/dev/mlx5: . mlx5_fpga mlx5_fpga_tools X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: in head/sys/dev/mlx5: . mlx5_fpga mlx5_fpga_tools X-SVN-Commit-Revision: 341575 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9488C74C02 X-Spamd-Result: default: False [-0.74 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.50)[-0.498,0]; NEURAL_SPAM_LONG(0.01)[0.010,0]; NEURAL_HAM_SHORT(-0.25)[-0.249,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 14:19:26 -0000 Author: slavash Date: Wed Dec 5 14:19:23 2018 New Revision: 341575 URL: https://svnweb.freebsd.org/changeset/base/341575 Log: mlx5fpga: IOCTL for FPGA temperature measurement Submitted by: kib@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/driver.h head/sys/dev/mlx5/mlx5_fpga/cmd.h head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_cmd.c head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_sdk.c head/sys/dev/mlx5/mlx5_fpga/sdk.h head/sys/dev/mlx5/mlx5_fpga_tools/mlx5fpga_tools_char.c head/sys/dev/mlx5/mlx5_ifc.h head/sys/dev/mlx5/mlx5io.h Modified: head/sys/dev/mlx5/driver.h ============================================================================== --- head/sys/dev/mlx5/driver.h Wed Dec 5 14:18:52 2018 (r341574) +++ head/sys/dev/mlx5/driver.h Wed Dec 5 14:19:23 2018 (r341575) @@ -151,6 +151,7 @@ enum { MLX5_REG_PMLP = 0x5002, MLX5_REG_NODE_DESC = 0x6001, MLX5_REG_HOST_ENDIANNESS = 0x7004, + MLX5_REG_MTMP = 0x900a, MLX5_REG_MCIA = 0x9014, MLX5_REG_MPCNT = 0x9051, }; Modified: head/sys/dev/mlx5/mlx5_fpga/cmd.h ============================================================================== --- head/sys/dev/mlx5/mlx5_fpga/cmd.h Wed Dec 5 14:18:52 2018 (r341574) +++ head/sys/dev/mlx5/mlx5_fpga/cmd.h Wed Dec 5 14:19:23 2018 (r341575) @@ -60,6 +60,8 @@ struct mlx5_fpga_shell_counters { int mlx5_fpga_caps(struct mlx5_core_dev *dev); int mlx5_fpga_query(struct mlx5_core_dev *dev, struct mlx5_fpga_query *query); +int mlx5_fpga_query_mtmp(struct mlx5_core_dev *dev, + struct mlx5_fpga_temperature *temp); int mlx5_fpga_ctrl_op(struct mlx5_core_dev *dev, u8 op); int mlx5_fpga_access_reg(struct mlx5_core_dev *dev, u8 size, u64 addr, void *buf, bool write); Modified: head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_cmd.c ============================================================================== --- head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_cmd.c Wed Dec 5 14:18:52 2018 (r341574) +++ head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_cmd.c Wed Dec 5 14:19:23 2018 (r341575) @@ -164,6 +164,38 @@ int mlx5_fpga_query(struct mlx5_core_dev *dev, struct return 0; } +int mlx5_fpga_query_mtmp(struct mlx5_core_dev *dev, + struct mlx5_fpga_temperature *temp) +{ + u32 in[MLX5_ST_SZ_DW(mtmp_reg)] = {0}; + u32 out[MLX5_ST_SZ_DW(mtmp_reg)] = {0}; + int err; + + MLX5_SET(mtmp_reg, in, sensor_index, temp->index); + MLX5_SET(mtmp_reg, in, i, + ((temp->index < MLX5_FPGA_INTERNAL_SENSORS_LOW) || + (temp->index > MLX5_FPGA_INTERNAL_SENSORS_HIGH)) ? 1 : 0); + + err = mlx5_core_access_reg(dev, in, sizeof(in), out, sizeof(out), + MLX5_REG_MTMP, 0, false); + if (err) + return err; + + temp->index = MLX5_GET(mtmp_reg, out, sensor_index); + temp->temperature = MLX5_GET(mtmp_reg, out, temperature); + temp->mte = MLX5_GET(mtmp_reg, out, mte); + temp->max_temperature = MLX5_GET(mtmp_reg, out, max_temperature); + temp->tee = MLX5_GET(mtmp_reg, out, tee); + temp->temperature_threshold_hi = MLX5_GET(mtmp_reg, out, + temperature_threshold_hi); + temp->temperature_threshold_lo = MLX5_GET(mtmp_reg, out, + temperature_threshold_lo); + memcpy(temp->sensor_name, MLX5_ADDR_OF(mtmp_reg, out, sensor_name), + MLX5_FLD_SZ_BYTES(mtmp_reg, sensor_name)); + + return 0; +} + int mlx5_fpga_create_qp(struct mlx5_core_dev *dev, void *fpga_qpc, u32 *fpga_qpn) { Modified: head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_sdk.c ============================================================================== --- head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_sdk.c Wed Dec 5 14:18:52 2018 (r341574) +++ head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_sdk.c Wed Dec 5 14:19:23 2018 (r341575) @@ -442,6 +442,13 @@ int mlx5_fpga_flash_select(struct mlx5_fpga_device *fd } EXPORT_SYMBOL(mlx5_fpga_flash_select); +int mlx5_fpga_temperature(struct mlx5_fpga_device *fdev, + struct mlx5_fpga_temperature *temp) +{ + return mlx5_fpga_query_mtmp(fdev->mdev, temp); +} +EXPORT_SYMBOL(mlx5_fpga_temperature); + struct device *mlx5_fpga_dev(struct mlx5_fpga_device *fdev) { return &fdev->mdev->pdev->dev; Modified: head/sys/dev/mlx5/mlx5_fpga/sdk.h ============================================================================== --- head/sys/dev/mlx5/mlx5_fpga/sdk.h Wed Dec 5 14:18:52 2018 (r341574) +++ head/sys/dev/mlx5/mlx5_fpga/sdk.h Wed Dec 5 14:19:23 2018 (r341575) @@ -356,6 +356,16 @@ void mlx5_fpga_device_query(struct mlx5_fpga_device *f struct device *mlx5_fpga_dev(struct mlx5_fpga_device *fdev); /** + * mlx5_fpga_temperature() - Retrieve FPGA sensor of temperature + * @fdev: The FPGA device + + * Return: 0 if successful + * or any other error value otherwise. + */ +int mlx5_fpga_temperature(struct mlx5_fpga_device *fdev, + struct mlx5_fpga_temperature *temp); + +/** * mlx5_fpga_get_cap() - Returns the FPGA cap mailbox from FW without parsing. * @fdev: The FPGA device * @fpga_caps: Is an array with a length of according to the size of Modified: head/sys/dev/mlx5/mlx5_fpga_tools/mlx5fpga_tools_char.c ============================================================================== --- head/sys/dev/mlx5/mlx5_fpga_tools/mlx5fpga_tools_char.c Wed Dec 5 14:18:52 2018 (r341574) +++ head/sys/dev/mlx5/mlx5_fpga_tools/mlx5fpga_tools_char.c Wed Dec 5 14:19:23 2018 (r341575) @@ -200,6 +200,7 @@ tools_char_ioctl(struct cdev *dev, u_long cmd, caddr_t struct tools_context *context; struct mlx5_fpga_device *fdev; struct mlx5_fpga_query query; + struct mlx5_fpga_temperature *temperature; u32 fpga_cap[MLX5_ST_SZ_DW(fpga_cap)] = {0}; int arg, err; @@ -253,6 +254,11 @@ tools_char_ioctl(struct cdev *dev, u_long cmd, caddr_t mlx5_fpga_get_cap(fdev, fpga_cap); bcopy(&fpga_cap, data, sizeof(fpga_cap)); err = 0; + break; + case MLX5_FPGA_TEMPERATURE: + temperature = (struct mlx5_fpga_temperature *)data; + mlx5_fpga_temperature(fdev, temperature); + err = 0; /* XXXKIB */ break; default: dev_err(mlx5_fpga_dev(fdev), Modified: head/sys/dev/mlx5/mlx5_ifc.h ============================================================================== --- head/sys/dev/mlx5/mlx5_ifc.h Wed Dec 5 14:18:52 2018 (r341574) +++ head/sys/dev/mlx5/mlx5_ifc.h Wed Dec 5 14:19:23 2018 (r341575) @@ -8520,6 +8520,31 @@ struct mlx5_ifc_link_level_retrans_cntr_grp_date_bits u8 reserved_0[0x640]; }; +struct mlx5_ifc_mtmp_reg_bits { + u8 i[0x1]; + u8 reserved_at_1[0x18]; + u8 sensor_index[0x7]; + + u8 reserved_at_20[0x10]; + u8 temperature[0x10]; + + u8 mte[0x1]; + u8 mtr[0x1]; + u8 reserved_at_42[0x0e]; + u8 max_temperature[0x10]; + + u8 tee[0x2]; + u8 reserved_at_62[0x0e]; + u8 temperature_threshold_hi[0x10]; + + u8 reserved_at_80[0x10]; + u8 temperature_threshold_lo[0x10]; + + u8 reserved_at_100[0x20]; + + u8 sensor_name[0x40]; +}; + struct mlx5_ifc_lane_2_module_mapping_bits { u8 reserved_0[0x6]; u8 rx_lane[0x2]; Modified: head/sys/dev/mlx5/mlx5io.h ============================================================================== --- head/sys/dev/mlx5/mlx5io.h Wed Dec 5 14:18:52 2018 (r341574) +++ head/sys/dev/mlx5/mlx5io.h Wed Dec 5 14:19:23 2018 (r341575) @@ -84,6 +84,12 @@ struct mlx5_fpga_query { enum mlx5_fpga_status image_status; }; +enum mlx5_fpga_tee { + MLX5_FPGA_TEE_DISABLE = 0, + MLX5_FPGA_TEE_GENERATE_EVENT = 1, + MLX5_FPGA_TEE_GENERATE_SINGLE_EVENT = 2, +}; + /** * enum mlx5_fpga_access_type - Enumerated the different methods possible for * accessing the device memory address space @@ -98,6 +104,21 @@ enum mlx5_fpga_access_type { MLX5_FPGA_ACCESS_TYPE_MAX = MLX5_FPGA_ACCESS_TYPE_DONTCARE, }; +#define MLX5_FPGA_INTERNAL_SENSORS_LOW 63 +#define MLX5_FPGA_INTERNAL_SENSORS_HIGH 63 + +struct mlx5_fpga_temperature { + uint32_t temperature; + uint32_t index; + uint32_t tee; + uint32_t max_temperature; + uint32_t temperature_threshold_hi; + uint32_t temperature_threshold_lo; + uint32_t mte; + uint32_t mtr; + char sensor_name[16]; +}; + #define MLX5_FPGA_CAP_ARR_SZ 0x40 #define MLX5_FPGA_ACCESS_TYPE _IOWINT('m', 0x80) @@ -106,6 +127,7 @@ enum mlx5_fpga_access_type { #define MLX5_FPGA_IMAGE_SEL _IOWINT('m', 0x83) #define MLX5_FPGA_QUERY _IOR('m', 0x84, struct mlx5_fpga_query) #define MLX5_FPGA_CAP _IOR('m', 0x85, u32[MLX5_FPGA_CAP_ARR_SZ]) +#define MLX5_FPGA_TEMPERATURE _IOWR('m', 0x86, struct mlx5_fpga_temperature) #define MLX5_FPGA_TOOLS_NAME_SUFFIX "_mlx5_fpga_tools" From owner-svn-src-head@freebsd.org Wed Dec 5 14:20:28 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 815DA131566C; Wed, 5 Dec 2018 14:20:28 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2920F74F11; Wed, 5 Dec 2018 14:20:28 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0B381157EA; Wed, 5 Dec 2018 14:20:28 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5EKRR0099177; Wed, 5 Dec 2018 14:20:27 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5EKRXg099174; Wed, 5 Dec 2018 14:20:27 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051420.wB5EKRXg099174@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 14:20:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341577 - in head/sys/dev/mlx5: . mlx5_core mlx5_en X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: in head/sys/dev/mlx5: . mlx5_core mlx5_en X-SVN-Commit-Revision: 341577 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2920F74F11 X-Spamd-Result: default: False [-0.74 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.50)[-0.498,0]; NEURAL_SPAM_LONG(0.01)[0.010,0]; NEURAL_HAM_SHORT(-0.25)[-0.249,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 14:20:28 -0000 Author: slavash Date: Wed Dec 5 14:20:26 2018 New Revision: 341577 URL: https://svnweb.freebsd.org/changeset/base/341577 Log: mlx5en: Implement support for bandwidth limiting in by ratio, ETS. Add support for setting the bandwidth limit as a ratio rather than in bits per second. The ratio must be an integer number between 1 and 100 inclusivly. Implement the needed firmware commands and SYSCTLs through mlx5en(4). Submitted by: hselasky@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_core/mlx5_port.c head/sys/dev/mlx5/mlx5_en/en.h head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c head/sys/dev/mlx5/port.h Modified: head/sys/dev/mlx5/mlx5_core/mlx5_port.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_port.c Wed Dec 5 14:19:55 2018 (r341576) +++ head/sys/dev/mlx5/mlx5_core/mlx5_port.c Wed Dec 5 14:20:26 2018 (r341577) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2018, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -931,6 +931,74 @@ int mlx5_set_port_prio_tc(struct mlx5_core_dev *mdev, return (err); } EXPORT_SYMBOL_GPL(mlx5_set_port_prio_tc); + +int mlx5_set_port_tc_group(struct mlx5_core_dev *mdev, const u8 *tc_group) +{ + u32 in[MLX5_ST_SZ_DW(qetc_reg)] = {}; + int i; + + for (i = 0; i <= mlx5_max_tc(mdev); i++) { + MLX5_SET(qetc_reg, in, tc_configuration[i].g, 1); + MLX5_SET(qetc_reg, in, tc_configuration[i].group, tc_group[i]); + } + + return mlx5_set_port_qetcr_reg(mdev, in, sizeof(in)); +} +EXPORT_SYMBOL_GPL(mlx5_set_port_tc_group); + +int mlx5_query_port_tc_group(struct mlx5_core_dev *mdev, + u8 tc, u8 *tc_group) +{ + u32 out[MLX5_ST_SZ_DW(qetc_reg)]; + void *ets_tcn_conf; + int err; + + err = mlx5_query_port_qetcr_reg(mdev, out, sizeof(out)); + if (err) + return err; + + ets_tcn_conf = MLX5_ADDR_OF(qetc_reg, out, + tc_configuration[tc]); + + *tc_group = MLX5_GET(ets_tcn_config_reg, ets_tcn_conf, + group); + + return 0; +} +EXPORT_SYMBOL_GPL(mlx5_query_port_tc_group); + +int mlx5_set_port_tc_bw_alloc(struct mlx5_core_dev *mdev, const u8 *tc_bw) +{ + u32 in[MLX5_ST_SZ_DW(qetc_reg)] = {}; + int i; + + for (i = 0; i <= mlx5_max_tc(mdev); i++) { + MLX5_SET(qetc_reg, in, tc_configuration[i].b, 1); + MLX5_SET(qetc_reg, in, tc_configuration[i].bw_allocation, tc_bw[i]); + } + + return mlx5_set_port_qetcr_reg(mdev, in, sizeof(in)); +} +EXPORT_SYMBOL_GPL(mlx5_set_port_tc_bw_alloc); + +int mlx5_query_port_tc_bw_alloc(struct mlx5_core_dev *mdev, u8 *bw_pct) +{ + u32 out[MLX5_ST_SZ_DW(qetc_reg)]; + void *ets_tcn_conf; + int err; + int i; + + err = mlx5_query_port_qetcr_reg(mdev, out, sizeof(out)); + if (err) + return err; + + for (i = 0; i <= mlx5_max_tc(mdev); i++) { + ets_tcn_conf = MLX5_ADDR_OF(qetc_reg, out, tc_configuration[i]); + bw_pct[i] = MLX5_GET(ets_tcn_config_reg, ets_tcn_conf, bw_allocation); + } + return 0; +} +EXPORT_SYMBOL_GPL(mlx5_query_port_tc_bw_alloc); int mlx5_modify_port_cong_params(struct mlx5_core_dev *mdev, void *in, int in_size) Modified: head/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- head/sys/dev/mlx5/mlx5_en/en.h Wed Dec 5 14:19:55 2018 (r341576) +++ head/sys/dev/mlx5/mlx5_en/en.h Wed Dec 5 14:20:26 2018 (r341577) @@ -493,6 +493,7 @@ struct mlx5e_params_ethtool { u64 arg [0]; MLX5E_PARAMS(MLX5E_STATS_VAR) u64 max_bw_value[IEEE_8021QAZ_MAX_TCS]; + u8 max_bw_share[IEEE_8021QAZ_MAX_TCS]; u8 prio_tc[IEEE_8021QAZ_MAX_TCS]; u8 dscp2prio[MLX5_MAX_SUPPORTED_DSCP]; u8 trust_state; @@ -844,19 +845,6 @@ struct mlx5e_eeprom { int page_valid; u32 *data; }; - -/* - * This structure contains rate limit extension to the IEEE 802.1Qaz ETS - * managed object. - * Values are 64 bits long and specified in Kbps to enable usage over both - * slow and very fast networks. - * - * @tc_maxrate: maximal tc tx bandwidth indexed by traffic class - */ -struct ieee_maxrate { - __u64 tc_maxrate[IEEE_8021QAZ_MAX_TCS]; -}; - #define MLX5E_FLD_MAX(typ, fld) ((1ULL << __mlx5_bit_sz(typ, fld)) - 1ULL) Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Wed Dec 5 14:19:55 2018 (r341576) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Wed Dec 5 14:20:26 2018 (r341577) @@ -121,6 +121,29 @@ done: } static int +mlx5e_get_max_alloc(struct mlx5e_priv *priv) +{ + struct mlx5_core_dev *mdev = priv->mdev; + int err; + int x; + + PRIV_LOCK(priv); + err = -mlx5_query_port_tc_bw_alloc(mdev, priv->params_ethtool.max_bw_share); + if (err == 0) { + /* set default value */ + for (x = 0; x != IEEE_8021QAZ_MAX_TCS; x++) { + priv->params_ethtool.max_bw_share[x] = + 100 / IEEE_8021QAZ_MAX_TCS; + } + err = -mlx5_set_port_tc_bw_alloc(mdev, + priv->params_ethtool.max_bw_share); + } + PRIV_UNLOCK(priv); + + return (err); +} + +static int mlx5e_get_dscp(struct mlx5e_priv *priv) { struct mlx5_core_dev *mdev = priv->mdev; @@ -144,56 +167,119 @@ done: return (err); } +static void +mlx5e_tc_get_parameters(struct mlx5e_priv *priv, + u64 *new_bw_value, u8 *max_bw_value, u8 *max_bw_unit) +{ + const u64 upper_limit_mbps = 255 * MLX5E_100MB; + const u64 upper_limit_gbps = 255 * MLX5E_1GB; + u64 temp; + int i; + + memset(max_bw_value, 0, IEEE_8021QAZ_MAX_TCS); + memset(max_bw_unit, 0, IEEE_8021QAZ_MAX_TCS); + + for (i = 0; i <= mlx5_max_tc(priv->mdev); i++) { + temp = (new_bw_value != NULL) ? + new_bw_value[i] : priv->params_ethtool.max_bw_value[i]; + + if (!temp) { + max_bw_unit[i] = MLX5_BW_NO_LIMIT; + } else if (temp > upper_limit_gbps) { + max_bw_unit[i] = MLX5_BW_NO_LIMIT; + } else if (temp <= upper_limit_mbps) { + max_bw_value[i] = howmany(temp, MLX5E_100MB); + max_bw_unit[i] = MLX5_100_MBPS_UNIT; + } else { + max_bw_value[i] = howmany(temp, MLX5E_1GB); + max_bw_unit[i] = MLX5_GBPS_UNIT; + } + } +} + static int mlx5e_tc_maxrate_handler(SYSCTL_HANDLER_ARGS) { struct mlx5e_priv *priv = arg1; - int prio_index = arg2; struct mlx5_core_dev *mdev = priv->mdev; u8 max_bw_unit[IEEE_8021QAZ_MAX_TCS]; u8 max_bw_value[IEEE_8021QAZ_MAX_TCS]; - int i, err; - u64 bw_val; - u64 result = priv->params_ethtool.max_bw_value[prio_index]; - const u64 upper_limit_mbps = 255 * MLX5E_100MB; - const u64 upper_limit_gbps = 255 * MLX5E_1GB; + u64 new_bw_value[IEEE_8021QAZ_MAX_TCS]; + u8 max_rates = mlx5_max_tc(mdev) + 1; + u8 x; + int err; PRIV_LOCK(priv); - err = sysctl_handle_64(oidp, &result, 0, req); - if (err || !req->newptr || - result == priv->params_ethtool.max_bw_value[prio_index]) + err = SYSCTL_OUT(req, priv->params_ethtool.max_bw_value, + sizeof(priv->params_ethtool.max_bw_value[0]) * max_rates); + if (err || !req->newptr) goto done; - - if (result % MLX5E_100MB) { - err = ERANGE; + err = SYSCTL_IN(req, new_bw_value, + sizeof(new_bw_value[0]) * max_rates); + if (err) goto done; + + /* range check input value */ + for (x = 0; x != max_rates; x++) { + if (new_bw_value[x] % MLX5E_100MB) { + err = ERANGE; + goto done; + } } - memset(max_bw_value, 0, sizeof(max_bw_value)); - memset(max_bw_unit, 0, sizeof(max_bw_unit)); + mlx5e_tc_get_parameters(priv, new_bw_value, max_bw_value, max_bw_unit); - for (i = 0; i <= mlx5_max_tc(mdev); i++) { - bw_val = (i == prio_index) ? result : priv->params_ethtool.max_bw_value[i]; + err = -mlx5_modify_port_tc_rate_limit(mdev, max_bw_value, max_bw_unit); + if (err) + goto done; - if (!bw_val) { - max_bw_unit[i] = MLX5_BW_NO_LIMIT; - } else if (bw_val > upper_limit_gbps) { - result = 0; - max_bw_unit[i] = MLX5_BW_NO_LIMIT; - } else if (bw_val <= upper_limit_mbps) { - max_bw_value[i] = howmany(bw_val, MLX5E_100MB); - max_bw_unit[i] = MLX5_100_MBPS_UNIT; - } else { - max_bw_value[i] = howmany(bw_val, MLX5E_1GB); - max_bw_unit[i] = MLX5_GBPS_UNIT; + memcpy(priv->params_ethtool.max_bw_value, new_bw_value, + sizeof(priv->params_ethtool.max_bw_value)); +done: + PRIV_UNLOCK(priv); + return (err); +} + +static int +mlx5e_tc_rate_share_handler(SYSCTL_HANDLER_ARGS) +{ + struct mlx5e_priv *priv = arg1; + struct mlx5_core_dev *mdev = priv->mdev; + u8 max_bw_share[IEEE_8021QAZ_MAX_TCS]; + u8 max_rates = mlx5_max_tc(mdev) + 1; + int i; + int err; + int sum; + + PRIV_LOCK(priv); + err = SYSCTL_OUT(req, priv->params_ethtool.max_bw_share, max_rates); + if (err || !req->newptr) + goto done; + err = SYSCTL_IN(req, max_bw_share, max_rates); + if (err) + goto done; + + /* range check input value */ + for (sum = i = 0; i != max_rates; i++) { + if (max_bw_share[i] < 1 || max_bw_share[i] > 100) { + err = ERANGE; + goto done; } + sum += max_bw_share[i]; } - err = -mlx5_modify_port_tc_rate_limit(mdev, max_bw_value, max_bw_unit); + /* sum of values should be as close to 100 as possible */ + if (sum < (100 - max_rates + 1) || sum > 100) { + err = ERANGE; + goto done; + } + + err = -mlx5_set_port_tc_bw_alloc(mdev, max_bw_share); if (err) goto done; - priv->params_ethtool.max_bw_value[prio_index] = result; + memcpy(priv->params_ethtool.max_bw_share, max_bw_share, + sizeof(priv->params_ethtool.max_bw_share)); done: PRIV_UNLOCK(priv); return (err); @@ -217,7 +303,6 @@ mlx5e_get_prio_tc(struct mlx5e_priv *priv) if (err) break; } - PRIV_UNLOCK(priv); return (err); } @@ -229,9 +314,10 @@ mlx5e_prio_to_tc_handler(SYSCTL_HANDLER_ARGS) int prio_index = arg2; struct mlx5_core_dev *mdev = priv->mdev; int err; - uint8_t result = priv->params_ethtool.prio_tc[prio_index]; + uint8_t result; PRIV_LOCK(priv); + result = priv->params_ethtool.prio_tc[prio_index]; err = sysctl_handle_8(oidp, &result, 0, req); if (err || !req->newptr || result == priv->params_ethtool.prio_tc[prio_index]) @@ -1151,33 +1237,37 @@ mlx5e_create_ethtool(struct mlx5e_priv *priv) qos_node = SYSCTL_ADD_NODE(&priv->sysctl_ctx, SYSCTL_CHILDREN(node), OID_AUTO, "qos", CTLFLAG_RW, NULL, "Quality Of Service configuration"); - if (node == NULL) + if (qos_node == NULL) return; - /* Prioriry rate limit support */ - if (mlx5e_getmaxrate(priv)) - return; - - for (i = 0; i <= mlx5_max_tc(mdev); i++) { - char name[32]; - snprintf(name, sizeof(name), "tc_%d_max_rate", i); + /* Priority rate limit support */ + if (mlx5e_getmaxrate(priv) == 0) { SYSCTL_ADD_PROC(&priv->sysctl_ctx, SYSCTL_CHILDREN(qos_node), - OID_AUTO, name, CTLTYPE_U64 | CTLFLAG_RW | CTLFLAG_MPSAFE, - priv, i, mlx5e_tc_maxrate_handler, "QU", - "Max rate for priority, specified in kilobits, where kilo=1000, \ - max_rate must be divisible by 100000"); + OID_AUTO, "tc_max_rate", CTLTYPE_U64 | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, + priv, 0, mlx5e_tc_maxrate_handler, "QU", + "Max rate for priority, specified in kilobits, where kilo=1000, " + "max_rate must be divisible by 100000"); } - if (mlx5e_get_prio_tc(priv)) - return; - - for (i = 0; i <= mlx5_max_tc(mdev); i++) { - char name[32]; - snprintf(name, sizeof(name), "prio_%d_to_tc", i); + /* Bandwidth limiting by ratio */ + if (mlx5e_get_max_alloc(priv) == 0) { SYSCTL_ADD_PROC(&priv->sysctl_ctx, SYSCTL_CHILDREN(qos_node), - OID_AUTO, name, CTLTYPE_U8 | CTLFLAG_RW | CTLFLAG_MPSAFE, + OID_AUTO, "tc_rate_share", CTLTYPE_U8 | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, + priv, 0, mlx5e_tc_rate_share_handler, "QU", + "Specify bandwidth ratio from 1 to 100 " + "for the available traffic classes"); + } + + /* Priority to traffic class mapping */ + if (mlx5e_get_prio_tc(priv) == 0) { + for (i = 0; i <= mlx5_max_tc(mdev); i++) { + char name[32]; + snprintf(name, sizeof(name), "prio_%d_to_tc", i); + SYSCTL_ADD_PROC(&priv->sysctl_ctx, SYSCTL_CHILDREN(qos_node), + OID_AUTO, name, CTLTYPE_U8 | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, priv, i, mlx5e_prio_to_tc_handler, "CU", "Set priority to traffic class"); + } } /* DSCP support */ Modified: head/sys/dev/mlx5/port.h ============================================================================== --- head/sys/dev/mlx5/port.h Wed Dec 5 14:19:55 2018 (r341576) +++ head/sys/dev/mlx5/port.h Wed Dec 5 14:20:26 2018 (r341577) @@ -161,6 +161,12 @@ int mlx5_query_port_prio_tc(struct mlx5_core_dev *mdev u8 prio, u8 *tc); int mlx5_set_port_prio_tc(struct mlx5_core_dev *mdev, int prio_index, const u8 prio_tc); +int mlx5_set_port_tc_group(struct mlx5_core_dev *mdev, const u8 *tc_group); +int mlx5_query_port_tc_group(struct mlx5_core_dev *mdev, + u8 tc, u8 *tc_group); +int mlx5_set_port_tc_bw_alloc(struct mlx5_core_dev *mdev, const u8 *tc_bw); +int mlx5_query_port_tc_bw_alloc(struct mlx5_core_dev *mdev, u8 *bw_pct); + int mlx5_set_trust_state(struct mlx5_core_dev *mdev, u8 trust_state); int mlx5_query_trust_state(struct mlx5_core_dev *mdev, u8 *trust_state); From owner-svn-src-head@freebsd.org Wed Dec 5 14:20:59 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5F312131572F; Wed, 5 Dec 2018 14:20:59 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 068DB750D0; Wed, 5 Dec 2018 14:20:59 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DC30E15813; Wed, 5 Dec 2018 14:20:58 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5EKw9g099247; Wed, 5 Dec 2018 14:20:58 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5EKwxr099242; Wed, 5 Dec 2018 14:20:58 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051420.wB5EKwxr099242@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 14:20:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341578 - head/sys/dev/mlx5/mlx5_en X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 341578 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 068DB750D0 X-Spamd-Result: default: False [-0.74 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.50)[-0.498,0]; NEURAL_SPAM_LONG(0.01)[0.010,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_SHORT(-0.25)[-0.249,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 14:20:59 -0000 Author: slavash Date: Wed Dec 5 14:20:57 2018 New Revision: 341578 URL: https://svnweb.freebsd.org/changeset/base/341578 Log: mlx5en: Remove the DRBR and associated logic in the transmit path. The hardware queues are deep enough currently and using the DRBR and associated callbacks only leads to more task switching in the TX path. The is also a race setting the queue_state which can lead to hung TX rings. Submitted by: hselasky@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/en.h head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Modified: head/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- head/sys/dev/mlx5/mlx5_en/en.h Wed Dec 5 14:20:26 2018 (r341577) +++ head/sys/dev/mlx5/mlx5_en/en.h Wed Dec 5 14:20:57 2018 (r341578) @@ -473,7 +473,6 @@ struct mlx5e_params { m(+1, u64 tx_coalesce_usecs, "tx_coalesce_usecs", "Limit in usec for joining tx packets") \ m(+1, u64 tx_coalesce_pkts, "tx_coalesce_pkts", "Maximum number of tx packets to join") \ m(+1, u64 tx_coalesce_mode, "tx_coalesce_mode", "0: EQE mode 1: CQE mode") \ - m(+1, u64 tx_bufring_disable, "tx_bufring_disable", "0: Enable bufring 1: Disable bufring") \ m(+1, u64 tx_completion_fact, "tx_completion_fact", "1..MAX: Completion event ratio") \ m(+1, u64 tx_completion_fact_max, "tx_completion_fact_max", "Maximum completion event ratio") \ m(+1, u64 hw_lro, "hw_lro", "set to enable hw_lro") \ @@ -606,8 +605,6 @@ struct mlx5e_sq { struct mlx5e_sq_stats stats; struct mlx5e_cq cq; - struct task sq_task; - struct taskqueue *sq_tq; /* pointers to per packet info: write@xmit, read@completion */ struct mlx5e_sq_mbuf *mbuf; @@ -628,7 +625,6 @@ struct mlx5e_sq { struct mlx5_wq_ctrl wq_ctrl; struct mlx5e_priv *priv; int tc; - unsigned int queue_state; } __aligned(MLX5E_CACHELINE_SIZE); static inline bool @@ -857,7 +853,6 @@ void mlx5e_cq_error_event(struct mlx5_core_cq *mcq, in void mlx5e_rx_cq_comp(struct mlx5_core_cq *); void mlx5e_tx_cq_comp(struct mlx5_core_cq *); struct mlx5_cqe64 *mlx5e_get_cqe(struct mlx5e_cq *cq); -void mlx5e_tx_que(void *context, int pending); int mlx5e_open_flow_table(struct mlx5e_priv *priv); void mlx5e_close_flow_table(struct mlx5e_priv *priv); Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Wed Dec 5 14:20:26 2018 (r341577) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Wed Dec 5 14:20:57 2018 (r341578) @@ -703,18 +703,6 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARGS) mlx5e_open_locked(priv->ifp); break; - case MLX5_PARAM_OFFSET(tx_bufring_disable): - /* rangecheck input value */ - priv->params_ethtool.tx_bufring_disable = - priv->params_ethtool.tx_bufring_disable ? 1 : 0; - - /* reconfigure the sendqueues, if any */ - if (was_opened) { - mlx5e_close_locked(priv->ifp); - mlx5e_open_locked(priv->ifp); - } - break; - case MLX5_PARAM_OFFSET(tx_completion_fact): /* network interface must be down */ if (was_opened) Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 5 14:20:26 2018 (r341577) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 5 14:20:57 2018 (r341578) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015 Mellanox Technologies. All rights reserved. + * Copyright (c) 2015-2018 Mellanox Technologies. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -1184,37 +1184,6 @@ mlx5e_create_sq(struct mlx5e_channel *c, sq->min_inline_mode = priv->params.tx_min_inline_mode; sq->vlan_inline_cap = MLX5_CAP_ETH(mdev, wqe_vlan_insert); - /* check if we should allocate a second packet buffer */ - if (priv->params_ethtool.tx_bufring_disable == 0) { - sq->br = buf_ring_alloc(MLX5E_SQ_TX_QUEUE_SIZE, M_MLX5EN, - M_WAITOK, &sq->lock); - if (sq->br == NULL) { - if_printf(c->ifp, "%s: Failed allocating sq drbr buffer\n", - __func__); - err = -ENOMEM; - goto err_free_sq_db; - } - - sq->sq_tq = taskqueue_create_fast("mlx5e_que", M_WAITOK, - taskqueue_thread_enqueue, &sq->sq_tq); - if (sq->sq_tq == NULL) { - if_printf(c->ifp, "%s: Failed allocating taskqueue\n", - __func__); - err = -ENOMEM; - goto err_free_drbr; - } - - TASK_INIT(&sq->sq_task, 0, mlx5e_tx_que, sq); -#ifdef RSS - cpu_id = rss_getcpu(c->ix % rss_getnumbuckets()); - CPU_SETOF(cpu_id, &cpu_mask); - taskqueue_start_threads_cpuset(&sq->sq_tq, 1, PI_NET, &cpu_mask, - "%s TX SQ%d.%d CPU%d", c->ifp->if_xname, c->ix, tc, cpu_id); -#else - taskqueue_start_threads(&sq->sq_tq, 1, PI_NET, - "%s TX SQ%d.%d", c->ifp->if_xname, c->ix, tc); -#endif - } snprintf(buffer, sizeof(buffer), "txstat%dtc%d", c->ix, tc); mlx5e_create_stats(&sq->stats.ctx, SYSCTL_CHILDREN(priv->sysctl_ifnet), buffer, mlx5e_sq_stats_desc, MLX5E_SQ_STATS_NUM, @@ -1222,10 +1191,6 @@ mlx5e_create_sq(struct mlx5e_channel *c, return (0); -err_free_drbr: - buf_ring_free(sq->br, M_MLX5EN); -err_free_sq_db: - mlx5e_free_sq_db(sq); err_sq_wq_destroy: mlx5_wq_destroy(&sq->wq_ctrl); @@ -1247,12 +1212,6 @@ mlx5e_destroy_sq(struct mlx5e_sq *sq) mlx5e_free_sq_db(sq); mlx5_wq_destroy(&sq->wq_ctrl); mlx5_unmap_free_uar(sq->priv->mdev, &sq->uar); - if (sq->sq_tq != NULL) { - taskqueue_drain(sq->sq_tq, &sq->sq_task); - taskqueue_free(sq->sq_tq); - } - if (sq->br != NULL) - buf_ring_free(sq->br, M_MLX5EN); } int @@ -1350,8 +1309,6 @@ mlx5e_open_sq(struct mlx5e_channel *c, err = mlx5e_modify_sq(sq, MLX5_SQC_STATE_RST, MLX5_SQC_STATE_RDY); if (err) goto err_disable_sq; - - WRITE_ONCE(sq->queue_state, MLX5E_SQ_READY); return (0); Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Wed Dec 5 14:20:26 2018 (r341577) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Wed Dec 5 14:20:57 2018 (r341578) @@ -249,10 +249,6 @@ mlx5e_get_header_size(struct mbuf *mb) return (eth_hdr_len); } -/* - * The return value is not going back to the stack because of - * the drbr - */ static int mlx5e_sq_xmit(struct mlx5e_sq *sq, struct mbuf **mbp) { @@ -269,13 +265,9 @@ mlx5e_sq_xmit(struct mlx5e_sq *sq, struct mbuf **mbp) u16 pi; u8 opcode; - /* - * Return ENOBUFS if the queue is full, this may trigger reinsertion - * of the mbuf into the drbr (see mlx5e_xmit_locked) - */ - if (unlikely(!mlx5e_sq_has_room_for(sq, 2 * MLX5_SEND_WQE_MAX_WQEBBS))) { + /* Return ENOBUFS if the queue is full */ + if (unlikely(!mlx5e_sq_has_room_for(sq, 2 * MLX5_SEND_WQE_MAX_WQEBBS))) return (ENOBUFS); - } /* Align SQ edge with NOPs to avoid WQE wrap around */ pi = ((~sq->pc) & sq->wq.sz_m1); @@ -497,71 +489,14 @@ mlx5e_poll_tx_cq(struct mlx5e_sq *sq, int budget) atomic_thread_fence_rel(); sq->cc = sqcc; - - if (sq->sq_tq != NULL && - atomic_cmpset_int(&sq->queue_state, MLX5E_SQ_FULL, MLX5E_SQ_READY)) - taskqueue_enqueue(sq->sq_tq, &sq->sq_task); } static int mlx5e_xmit_locked(struct ifnet *ifp, struct mlx5e_sq *sq, struct mbuf *mb) { - struct mbuf *next; int err = 0; - if (likely(mb != NULL)) { - /* - * If we can't insert mbuf into drbr, try to xmit anyway. - * We keep the error we got so we could return that after xmit. - */ - err = drbr_enqueue(ifp, sq->br, mb); - } - - /* - * Check if the network interface is closed or if the SQ is - * being stopped: - */ if (unlikely((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0 || - sq->stopped != 0)) - return (err); - - /* Process the queue */ - while ((next = drbr_peek(ifp, sq->br)) != NULL) { - if (mlx5e_sq_xmit(sq, &next) != 0) { - if (next != NULL) { - drbr_putback(ifp, sq->br, next); - atomic_store_rel_int(&sq->queue_state, MLX5E_SQ_FULL); - break; - } - } - drbr_advance(ifp, sq->br); - } - /* Check if we need to write the doorbell */ - if (likely(sq->doorbell.d64 != 0)) { - mlx5e_tx_notify_hw(sq, sq->doorbell.d32, 0); - sq->doorbell.d64 = 0; - } - /* - * Check if we need to start the event timer which flushes the - * transmit ring on timeout: - */ - if (unlikely(sq->cev_next_state == MLX5E_CEV_STATE_INITIAL && - sq->cev_factor != 1)) { - /* start the timer */ - mlx5e_sq_cev_timeout(sq); - } else { - /* don't send NOPs yet */ - sq->cev_next_state = MLX5E_CEV_STATE_HOLD_NOPS; - } - return (err); -} - -static int -mlx5e_xmit_locked_no_br(struct ifnet *ifp, struct mlx5e_sq *sq, struct mbuf *mb) -{ - int err = 0; - - if (unlikely((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0 || sq->stopped != 0)) { m_freem(mb); return (ENETDOWN); @@ -624,18 +559,9 @@ mlx5e_xmit(struct ifnet *ifp, struct mbuf *mb) return (ENXIO); } - if (unlikely(sq->br == NULL)) { - /* rate limited traffic */ - mtx_lock(&sq->lock); - ret = mlx5e_xmit_locked_no_br(ifp, sq, mb); - mtx_unlock(&sq->lock); - } else if (mtx_trylock(&sq->lock)) { - ret = mlx5e_xmit_locked(ifp, sq, mb); - mtx_unlock(&sq->lock); - } else { - ret = drbr_enqueue(ifp, sq->br, mb); - taskqueue_enqueue(sq->sq_tq, &sq->sq_task); - } + mtx_lock(&sq->lock); + ret = mlx5e_xmit_locked(ifp, sq, mb); + mtx_unlock(&sq->lock); return (ret); } @@ -649,18 +575,4 @@ mlx5e_tx_cq_comp(struct mlx5_core_cq *mcq) mlx5e_poll_tx_cq(sq, MLX5E_BUDGET_MAX); mlx5e_cq_arm(&sq->cq, MLX5_GET_DOORBELL_LOCK(&sq->priv->doorbell_lock)); mtx_unlock(&sq->comp_lock); -} - -void -mlx5e_tx_que(void *context, int pending) -{ - struct mlx5e_sq *sq = context; - struct ifnet *ifp = sq->ifp; - - if (ifp->if_drv_flags & IFF_DRV_RUNNING) { - mtx_lock(&sq->lock); - if (!drbr_empty(ifp, sq->br)) - mlx5e_xmit_locked(ifp, sq, NULL); - mtx_unlock(&sq->lock); - } } From owner-svn-src-head@freebsd.org Wed Dec 5 14:21:33 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1328C13157C8; Wed, 5 Dec 2018 14:21:33 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B719E75321; Wed, 5 Dec 2018 14:21:32 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CA9DB1583D; Wed, 5 Dec 2018 14:21:30 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5ELUcA002448; Wed, 5 Dec 2018 14:21:30 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5ELTZI002440; Wed, 5 Dec 2018 14:21:29 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051421.wB5ELTZI002440@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 14:21:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341579 - in head/sys/dev/mlx5: . mlx5_core mlx5_en X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: in head/sys/dev/mlx5: . mlx5_core mlx5_en X-SVN-Commit-Revision: 341579 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B719E75321 X-Spamd-Result: default: False [-0.67 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.47)[-0.473,0]; NEURAL_SPAM_LONG(0.05)[0.051,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_SHORT(-0.25)[-0.249,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 14:21:33 -0000 Author: slavash Date: Wed Dec 5 14:21:28 2018 New Revision: 341579 URL: https://svnweb.freebsd.org/changeset/base/341579 Log: mlx5en: Fix for inlining issues in transmit path 1) Don't exceed the drivers own hardcoded TX inline limit. The blueflame register size can be much greater than the hardcoded limit for inlining. Make sure we don't exceed the drivers own limit, because this also means that the maximum number of TX fragments becomes invalid and then memory size assumptions in the TX path no longer hold up. 2) Make sure the mlx5_query_min_inline() function returns an error code. 3) Header inlining is required when using TSO. 4) Catch failure to compute inline header size for TSO. 5) Add support for UDP when computing inline header size. 6) Fix for inlining issues with regards to DSCP. Make sure we inline 4 bytes beyond the ethernet and/or VLAN header to workaround a hardware bug extracting the DSCP field from the IPv4/v6 header. Submitted by: hselasky@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_core/mlx5_vport.c head/sys/dev/mlx5/mlx5_en/en.h head/sys/dev/mlx5/mlx5_en/en_rl.h head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c head/sys/dev/mlx5/vport.h Modified: head/sys/dev/mlx5/mlx5_core/mlx5_vport.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_vport.c Wed Dec 5 14:20:57 2018 (r341578) +++ head/sys/dev/mlx5/mlx5_core/mlx5_vport.c Wed Dec 5 14:21:28 2018 (r341579) @@ -222,20 +222,28 @@ int mlx5_query_nic_vport_min_inline(struct mlx5_core_d } EXPORT_SYMBOL_GPL(mlx5_query_nic_vport_min_inline); -void mlx5_query_min_inline(struct mlx5_core_dev *mdev, - u8 *min_inline_mode) +int mlx5_query_min_inline(struct mlx5_core_dev *mdev, + u8 *min_inline_mode) { + int err; + switch (MLX5_CAP_ETH(mdev, wqe_inline_mode)) { case MLX5_CAP_INLINE_MODE_L2: *min_inline_mode = MLX5_INLINE_MODE_L2; + err = 0; break; case MLX5_CAP_INLINE_MODE_VPORT_CONTEXT: - mlx5_query_nic_vport_min_inline(mdev, 0, min_inline_mode); + err = mlx5_query_nic_vport_min_inline(mdev, 0, min_inline_mode); break; case MLX5_CAP_INLINE_MODE_NOT_REQUIRED: *min_inline_mode = MLX5_INLINE_MODE_NONE; + err = 0; break; + default: + err = -EINVAL; + break; } + return err; } EXPORT_SYMBOL_GPL(mlx5_query_min_inline); Modified: head/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- head/sys/dev/mlx5/mlx5_en/en.h Wed Dec 5 14:20:57 2018 (r341578) +++ head/sys/dev/mlx5/mlx5_en/en.h Wed Dec 5 14:21:28 2018 (r341579) @@ -619,7 +619,9 @@ struct mlx5e_sq { u32 mkey_be; u16 max_inline; u8 min_inline_mode; - u8 vlan_inline_cap; + u8 min_insert_caps; +#define MLX5E_INSERT_VLAN 1 +#define MLX5E_INSERT_NON_VLAN 2 /* control path */ struct mlx5_wq_ctrl wq_ctrl; @@ -925,6 +927,7 @@ void mlx5e_drain_sq(struct mlx5e_sq *); void mlx5e_modify_tx_dma(struct mlx5e_priv *priv, uint8_t value); void mlx5e_modify_rx_dma(struct mlx5e_priv *priv, uint8_t value); void mlx5e_resume_sq(struct mlx5e_sq *sq); -u8 mlx5e_params_calculate_tx_min_inline(struct mlx5_core_dev *mdev); +void mlx5e_update_sq_inline(struct mlx5e_sq *sq); +void mlx5e_refresh_sq_inline(struct mlx5e_priv *priv); #endif /* _MLX5_EN_H_ */ Modified: head/sys/dev/mlx5/mlx5_en/en_rl.h ============================================================================== --- head/sys/dev/mlx5/mlx5_en/en_rl.h Wed Dec 5 14:20:57 2018 (r341578) +++ head/sys/dev/mlx5/mlx5_en/en_rl.h Wed Dec 5 14:21:28 2018 (r341579) @@ -166,6 +166,7 @@ struct mlx5e_rl_priv_data { int mlx5e_rl_init(struct mlx5e_priv *priv); void mlx5e_rl_cleanup(struct mlx5e_priv *priv); +void mlx5e_rl_refresh_sq_inline(struct mlx5e_rl_priv_data *rl); if_snd_tag_alloc_t mlx5e_rl_snd_tag_alloc; if_snd_tag_modify_t mlx5e_rl_snd_tag_modify; if_snd_tag_query_t mlx5e_rl_snd_tag_query; Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Wed Dec 5 14:20:57 2018 (r341578) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Wed Dec 5 14:21:28 2018 (r341579) @@ -374,6 +374,12 @@ mlx5e_trust_state_handler(SYSCTL_HANDLER_ARGS) goto done; priv->params_ethtool.trust_state = result; + + /* update inline mode */ + mlx5e_refresh_sq_inline(priv); +#ifdef RATELIMIT + mlx5e_rl_refresh_sq_inline(&priv->rl); +#endif done: PRIV_UNLOCK(priv); return (err); Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 5 14:20:57 2018 (r341578) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 5 14:21:28 2018 (r341579) @@ -1126,6 +1126,52 @@ static const char *mlx5e_sq_stats_desc[] = { MLX5E_SQ_STATS(MLX5E_STATS_DESC) }; +void +mlx5e_update_sq_inline(struct mlx5e_sq *sq) +{ + sq->max_inline = sq->priv->params.tx_max_inline; + sq->min_inline_mode = sq->priv->params.tx_min_inline_mode; + + /* + * Check if trust state is DSCP or if inline mode is NONE which + * indicates CX-5 or newer hardware. + */ + if (sq->priv->params_ethtool.trust_state != MLX5_QPTS_TRUST_PCP || + sq->min_inline_mode == MLX5_INLINE_MODE_NONE) { + if (MLX5_CAP_ETH(sq->priv->mdev, wqe_vlan_insert)) + sq->min_insert_caps = MLX5E_INSERT_VLAN | MLX5E_INSERT_NON_VLAN; + else + sq->min_insert_caps = MLX5E_INSERT_NON_VLAN; + } else { + sq->min_insert_caps = 0; + } +} + +static void +mlx5e_refresh_sq_inline_sub(struct mlx5e_priv *priv, struct mlx5e_channel *c) +{ + int i; + + for (i = 0; i != c->num_tc; i++) { + mtx_lock(&c->sq[i].lock); + mlx5e_update_sq_inline(&c->sq[i]); + mtx_unlock(&c->sq[i].lock); + } +} + +void +mlx5e_refresh_sq_inline(struct mlx5e_priv *priv) +{ + int i; + + /* check if channels are closed */ + if (test_bit(MLX5E_STATE_OPENED, &priv->state) == 0) + return; + + for (i = 0; i < priv->params.num_channels; i++) + mlx5e_refresh_sq_inline_sub(priv, priv->channel[i]); +} + static int mlx5e_create_sq(struct mlx5e_channel *c, int tc, @@ -1180,10 +1226,9 @@ mlx5e_create_sq(struct mlx5e_channel *c, sq->ifp = priv->ifp; sq->priv = priv; sq->tc = tc; - sq->max_inline = priv->params.tx_max_inline; - sq->min_inline_mode = priv->params.tx_min_inline_mode; - sq->vlan_inline_cap = MLX5_CAP_ETH(mdev, wqe_vlan_insert); + mlx5e_update_sq_inline(sq); + snprintf(buffer, sizeof(buffer), "txstat%dtc%d", c->ix, tc); mlx5e_create_stats(&sq->stats.ctx, SYSCTL_CHILDREN(priv->sysctl_ifnet), buffer, mlx5e_sq_stats_desc, MLX5E_SQ_STATS_NUM, @@ -2992,18 +3037,24 @@ mlx5e_check_required_hca_cap(struct mlx5_core_dev *mde static u16 mlx5e_get_max_inline_cap(struct mlx5_core_dev *mdev) { - int bf_buf_size = (1 << MLX5_CAP_GEN(mdev, log_bf_reg_size)) / 2; + uint32_t bf_buf_size = (1U << MLX5_CAP_GEN(mdev, log_bf_reg_size)) / 2U; - return bf_buf_size - - sizeof(struct mlx5e_tx_wqe) + - 2 /*sizeof(mlx5e_tx_wqe.inline_hdr_start)*/; + bf_buf_size -= sizeof(struct mlx5e_tx_wqe) - 2; + + /* verify against driver hardware limit */ + if (bf_buf_size > MLX5E_MAX_TX_INLINE) + bf_buf_size = MLX5E_MAX_TX_INLINE; + + return (bf_buf_size); } -static void +static int mlx5e_build_ifp_priv(struct mlx5_core_dev *mdev, struct mlx5e_priv *priv, int num_comp_vectors) { + int err; + /* * TODO: Consider link speed for setting "log_sq_size", * "log_rq_size" and "cq_moderation_xxx": @@ -3035,8 +3086,11 @@ mlx5e_build_ifp_priv(struct mlx5_core_dev *mdev, priv->params.default_vlan_prio = 0; priv->counter_set_id = -1; priv->params.tx_max_inline = mlx5e_get_max_inline_cap(mdev); - mlx5_query_min_inline(mdev, &priv->params.tx_min_inline_mode); + err = mlx5_query_min_inline(mdev, &priv->params.tx_min_inline_mode); + if (err) + return (err); + /* * hw lro is currently defaulted to off. when it won't anymore we * will consider the HW capability: "!!MLX5_CAP_ETH(mdev, lro_cap)" @@ -3058,6 +3112,8 @@ mlx5e_build_ifp_priv(struct mlx5_core_dev *mdev, INIT_WORK(&priv->update_stats_work, mlx5e_update_stats_work); INIT_WORK(&priv->update_carrier_work, mlx5e_update_carrier_work); INIT_WORK(&priv->set_rx_mode_work, mlx5e_set_rx_mode_work); + + return (0); } static int @@ -3297,20 +3353,6 @@ mlx5e_modify_rx_dma(struct mlx5e_priv *priv, uint8_t v } } -u8 -mlx5e_params_calculate_tx_min_inline(struct mlx5_core_dev *mdev) -{ - u8 min_inline_mode; - - min_inline_mode = MLX5_INLINE_MODE_L2; - mlx5_query_min_inline(mdev, &min_inline_mode); - if (min_inline_mode == MLX5_INLINE_MODE_NONE && - !MLX5_CAP_ETH(mdev, wqe_vlan_insert)) - min_inline_mode = MLX5_INLINE_MODE_L2; - - return (min_inline_mode); -} - static void mlx5e_add_hw_stats(struct mlx5e_priv *priv) { @@ -3590,7 +3632,12 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) mlx5_core_err(mdev, "SYSCTL_ADD_NODE() failed\n"); goto err_free_sysctl; } - mlx5e_build_ifp_priv(mdev, priv, ncv); + + err = mlx5e_build_ifp_priv(mdev, priv, ncv); + if (err) { + mlx5_core_err(mdev, "mlx5e_build_ifp_priv() failed (%d)\n", err); + goto err_free_sysctl; + } snprintf(unit, sizeof(unit), "mce%u_wq", device_get_unit(mdev->pdev->dev.bsddev)); Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c Wed Dec 5 14:20:57 2018 (r341578) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c Wed Dec 5 14:21:28 2018 (r341579) @@ -137,10 +137,9 @@ mlx5e_rl_create_sq(struct mlx5e_priv *priv, struct mlx sq->mkey_be = cpu_to_be32(priv->mr.key); sq->ifp = priv->ifp; sq->priv = priv; - sq->max_inline = priv->params.tx_max_inline; - sq->min_inline_mode = priv->params.tx_min_inline_mode; - sq->vlan_inline_cap = MLX5_CAP_ETH(mdev, wqe_vlan_insert); + mlx5e_update_sq_inline(sq); + return (0); err_sq_wq_destroy: @@ -1231,6 +1230,32 @@ mlx5e_rl_refresh_channel_params(struct mlx5e_rl_priv_d } } return (0); +} + +void +mlx5e_rl_refresh_sq_inline(struct mlx5e_rl_priv_data *rl) +{ + uint64_t x; + uint64_t y; + + for (y = 0; y != rl->param.tx_worker_threads_def; y++) { + struct mlx5e_rl_worker *rlw = rl->workers + y; + + for (x = 0; x != rl->param.tx_channels_per_worker_def; x++) { + struct mlx5e_rl_channel *channel; + struct mlx5e_sq *sq; + + channel = rlw->channels + x; + sq = channel->sq; + + if (sq == NULL) + continue; + + mtx_lock(&sq->lock); + mlx5e_update_sq_inline(sq); + mtx_unlock(&sq->lock); + } + } } static int Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Wed Dec 5 14:20:57 2018 (r341578) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Wed Dec 5 14:21:28 2018 (r341579) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015 Mellanox Technologies. All rights reserved. + * Copyright (c) 2015-2018 Mellanox Technologies. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -154,49 +154,53 @@ mlx5e_select_queue(struct ifnet *ifp, struct mbuf *mb) } static inline u16 -mlx5e_get_inline_hdr_size(struct mlx5e_sq *sq, struct mbuf *mb) +mlx5e_get_l2_header_size(struct mlx5e_sq *sq, struct mbuf *mb) { + struct ether_vlan_header *eh; + uint16_t eth_type; + int min_inline; - switch(sq->min_inline_mode) { - case MLX5_INLINE_MODE_NONE: + eh = mtod(mb, struct ether_vlan_header *); + if (unlikely(mb->m_len < ETHER_HDR_LEN)) { + goto max_inline; + } else if (eh->evl_encap_proto == htons(ETHERTYPE_VLAN)) { + if (unlikely(mb->m_len < (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN))) + goto max_inline; + eth_type = ntohs(eh->evl_proto); + min_inline = ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN; + } else { + eth_type = ntohs(eh->evl_encap_proto); + min_inline = ETHER_HDR_LEN; + } + + switch (eth_type) { + case ETHERTYPE_IP: + case ETHERTYPE_IPV6: /* - * When inline mode is NONE, we do not need to copy - * headers into WQEs, except when vlan tag framing is - * requested. Hardware might offload vlan tagging on - * transmit. This is a separate capability, which is - * known to be disabled on ConnectX-5 due to a hardware - * bug RM 931383. If vlan_inline_cap is not present and - * the packet has vlan tag, fall back to inlining. + * Make sure the TOS(IPv4) or traffic class(IPv6) + * field gets inlined. Else the SQ may stall. */ - if ((mb->m_flags & M_VLANTAG) != 0 && - sq->vlan_inline_cap == 0) - break; - return (0); - case MLX5_INLINE_MODE_L2: - /* - * Due to hardware limitations, when trust mode is - * DSCP, the hardware may request MLX5_INLINE_MODE_L2 - * while it really needs all L2 headers and the 4 first - * bytes of the IP header (which include the - * TOS/traffic-class). - * - * To avoid doing a firmware command for querying the - * trust state and parsing the mbuf for doing - * unnecessary checks (VLAN/eth_type) in the fast path, - * we are going for the worth case (22 Bytes) if - * the mb->m_pkthdr.len allows it. - */ - if (mb->m_pkthdr.len > ETHER_HDR_LEN + - ETHER_VLAN_ENCAP_LEN + 4) - return (MIN(sq->max_inline, ETHER_HDR_LEN + - ETHER_VLAN_ENCAP_LEN + 4)); + min_inline += 4; break; + default: + goto max_inline; } - return (MIN(sq->max_inline, mb->m_pkthdr.len)); + + /* + * m_copydata() will be used on the remaining header which + * does not need to reside within the first m_len bytes of + * data: + */ + if (mb->m_pkthdr.len < min_inline) + goto max_inline; + return (min_inline); + +max_inline: + return (MIN(mb->m_pkthdr.len, sq->max_inline)); } static int -mlx5e_get_header_size(struct mbuf *mb) +mlx5e_get_full_header_size(struct mbuf *mb) { struct ether_vlan_header *eh; struct tcphdr *th; @@ -210,31 +214,46 @@ mlx5e_get_header_size(struct mbuf *mb) if (mb->m_len < ETHER_HDR_LEN) return (0); if (eh->evl_encap_proto == htons(ETHERTYPE_VLAN)) { + if (mb->m_len < (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN)) + return (0); eth_type = ntohs(eh->evl_proto); eth_hdr_len = ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN; } else { eth_type = ntohs(eh->evl_encap_proto); eth_hdr_len = ETHER_HDR_LEN; } - if (mb->m_len < eth_hdr_len) - return (0); switch (eth_type) { case ETHERTYPE_IP: ip = (struct ip *)(mb->m_data + eth_hdr_len); if (mb->m_len < eth_hdr_len + sizeof(*ip)) return (0); - if (ip->ip_p != IPPROTO_TCP) + switch (ip->ip_p) { + case IPPROTO_TCP: + ip_hlen = ip->ip_hl << 2; + eth_hdr_len += ip_hlen; + break; + case IPPROTO_UDP: + ip_hlen = ip->ip_hl << 2; + eth_hdr_len += ip_hlen + 8; + goto done; + default: return (0); - ip_hlen = ip->ip_hl << 2; - eth_hdr_len += ip_hlen; + } break; case ETHERTYPE_IPV6: ip6 = (struct ip6_hdr *)(mb->m_data + eth_hdr_len); if (mb->m_len < eth_hdr_len + sizeof(*ip6)) return (0); - if (ip6->ip6_nxt != IPPROTO_TCP) + switch (ip6->ip6_nxt) { + case IPPROTO_TCP: + eth_hdr_len += sizeof(*ip6); + break; + case IPPROTO_UDP: + eth_hdr_len += sizeof(*ip6) + 8; + goto done; + default: return (0); - eth_hdr_len += sizeof(*ip6); + } break; default: return (0); @@ -244,7 +263,13 @@ mlx5e_get_header_size(struct mbuf *mb) th = (struct tcphdr *)(mb->m_data + eth_hdr_len); tcp_hlen = th->th_off << 2; eth_hdr_len += tcp_hlen; - if (mb->m_len < eth_hdr_len) +done: + /* + * m_copydata() will be used on the remaining header which + * does not need to reside within the first m_len bytes of + * data: + */ + if (mb->m_pkthdr.len < eth_hdr_len) return (0); return (eth_hdr_len); } @@ -306,7 +331,11 @@ mlx5e_sq_xmit(struct mlx5e_sq *sq, struct mbuf **mbp) wqe->eth.mss = cpu_to_be16(mss); opcode = MLX5_OPCODE_LSO; - ihs = mlx5e_get_header_size(mb); + ihs = mlx5e_get_full_header_size(mb); + if (unlikely(ihs == 0)) { + err = EINVAL; + goto tx_drop; + } payload_len = mb->m_pkthdr.len - ihs; if (payload_len == 0) num_pkts = 1; @@ -318,46 +347,72 @@ mlx5e_sq_xmit(struct mlx5e_sq *sq, struct mbuf **mbp) sq->stats.tso_bytes += payload_len; } else { opcode = MLX5_OPCODE_SEND; - ihs = mlx5e_get_inline_hdr_size(sq, mb); + + switch (sq->min_inline_mode) { + case MLX5_INLINE_MODE_IP: + case MLX5_INLINE_MODE_TCP_UDP: + ihs = mlx5e_get_full_header_size(mb); + if (unlikely(ihs == 0)) + ihs = mlx5e_get_l2_header_size(sq, mb); + break; + case MLX5_INLINE_MODE_L2: + ihs = mlx5e_get_l2_header_size(sq, mb); + break; + case MLX5_INLINE_MODE_NONE: + /* FALLTHROUGH */ + default: + if ((mb->m_flags & M_VLANTAG) != 0 && + (sq->min_insert_caps & MLX5E_INSERT_VLAN) != 0) { + /* inlining VLAN data is not required */ + wqe->eth.vlan_cmd = htons(0x8000); /* bit 0 CVLAN */ + wqe->eth.vlan_hdr = htons(mb->m_pkthdr.ether_vtag); + ihs = 0; + } else if ((mb->m_flags & M_VLANTAG) == 0 && + (sq->min_insert_caps & MLX5E_INSERT_NON_VLAN) != 0) { + /* inlining non-VLAN data is not required */ + ihs = 0; + } else { + /* we are forced to inlining L2 header, if any */ + ihs = mlx5e_get_l2_header_size(sq, mb); + } + break; + } sq->mbuf[pi].num_bytes = max_t (unsigned int, mb->m_pkthdr.len, ETHER_MIN_LEN - ETHER_CRC_LEN); } - if (ihs == 0) { - if ((mb->m_flags & M_VLANTAG) != 0) { - wqe->eth.vlan_cmd = htons(0x8000); /* bit 0 CVLAN */ - wqe->eth.vlan_hdr = htons(mb->m_pkthdr.ether_vtag); - } else { - wqe->eth.inline_hdr_sz = 0; - } - } else { - if ((mb->m_flags & M_VLANTAG) != 0) { - struct ether_vlan_header *eh = (struct ether_vlan_header - *)wqe->eth.inline_hdr_start; - /* Range checks */ - if (ihs > (MLX5E_MAX_TX_INLINE - ETHER_VLAN_ENCAP_LEN)) - ihs = (MLX5E_MAX_TX_INLINE - - ETHER_VLAN_ENCAP_LEN); - else if (ihs < ETHER_HDR_LEN) { - err = EINVAL; - goto tx_drop; - } - m_copydata(mb, 0, ETHER_HDR_LEN, (caddr_t)eh); - m_adj(mb, ETHER_HDR_LEN); - /* Insert 4 bytes VLAN tag into data stream */ - eh->evl_proto = eh->evl_encap_proto; - eh->evl_encap_proto = htons(ETHERTYPE_VLAN); - eh->evl_tag = htons(mb->m_pkthdr.ether_vtag); - /* Copy rest of header data, if any */ - m_copydata(mb, 0, ihs - ETHER_HDR_LEN, (caddr_t)(eh + - 1)); - m_adj(mb, ihs - ETHER_HDR_LEN); - /* Extend header by 4 bytes */ - ihs += ETHER_VLAN_ENCAP_LEN; - } else { - m_copydata(mb, 0, ihs, wqe->eth.inline_hdr_start); - m_adj(mb, ihs); + if (likely(ihs == 0)) { + /* nothing to inline */ + } else if (unlikely(ihs > sq->max_inline)) { + /* inline header size is too big */ + err = EINVAL; + goto tx_drop; + } else if ((mb->m_flags & M_VLANTAG) != 0) { + struct ether_vlan_header *eh = (struct ether_vlan_header *) + wqe->eth.inline_hdr_start; + + /* Range checks */ + if (unlikely(ihs > (MLX5E_MAX_TX_INLINE - ETHER_VLAN_ENCAP_LEN))) + ihs = (MLX5E_MAX_TX_INLINE - ETHER_VLAN_ENCAP_LEN); + else if (unlikely(ihs < ETHER_HDR_LEN)) { + err = EINVAL; + goto tx_drop; } + m_copydata(mb, 0, ETHER_HDR_LEN, (caddr_t)eh); + m_adj(mb, ETHER_HDR_LEN); + /* Insert 4 bytes VLAN tag into data stream */ + eh->evl_proto = eh->evl_encap_proto; + eh->evl_encap_proto = htons(ETHERTYPE_VLAN); + eh->evl_tag = htons(mb->m_pkthdr.ether_vtag); + /* Copy rest of header data, if any */ + m_copydata(mb, 0, ihs - ETHER_HDR_LEN, (caddr_t)(eh + 1)); + m_adj(mb, ihs - ETHER_HDR_LEN); + /* Extend header by 4 bytes */ + ihs += ETHER_VLAN_ENCAP_LEN; + wqe->eth.inline_hdr_sz = cpu_to_be16(ihs); + } else { + m_copydata(mb, 0, ihs, wqe->eth.inline_hdr_start); + m_adj(mb, ihs); wqe->eth.inline_hdr_sz = cpu_to_be16(ihs); } Modified: head/sys/dev/mlx5/vport.h ============================================================================== --- head/sys/dev/mlx5/vport.h Wed Dec 5 14:20:57 2018 (r341578) +++ head/sys/dev/mlx5/vport.h Wed Dec 5 14:21:28 2018 (r341579) @@ -88,7 +88,7 @@ int mlx5_set_nic_vport_current_mac(struct mlx5_core_de bool other_vport, u8 *addr); int mlx5_query_nic_vport_min_inline(struct mlx5_core_dev *mdev, u16 vport, u8 *min_inline); -void mlx5_query_min_inline(struct mlx5_core_dev *mdev, u8 *min_inline); +int mlx5_query_min_inline(struct mlx5_core_dev *mdev, u8 *min_inline); int mlx5_modify_nic_vport_min_inline(struct mlx5_core_dev *mdev, u16 vport, u8 min_inline); int mlx5_modify_nic_vport_port_guid(struct mlx5_core_dev *mdev, From owner-svn-src-head@freebsd.org Wed Dec 5 14:22:01 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EB0891315872; Wed, 5 Dec 2018 14:22:00 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 915DE75555; Wed, 5 Dec 2018 14:22:00 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 59A0E1585E; Wed, 5 Dec 2018 14:22:00 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5EM0QN004008; Wed, 5 Dec 2018 14:22:00 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5EM0DF004007; Wed, 5 Dec 2018 14:22:00 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051422.wB5EM0DF004007@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 14:22:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341580 - head/sys/dev/mlx5/mlx5_en X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 341580 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 915DE75555 X-Spamd-Result: default: False [-0.86 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; NEURAL_HAM_SHORT(-0.25)[-0.248,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.07)[-0.072,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 14:22:01 -0000 Author: slavash Date: Wed Dec 5 14:21:59 2018 New Revision: 341580 URL: https://svnweb.freebsd.org/changeset/base/341580 Log: mlx5en: Don't set rate on SQs when the SQ is already stopped. This can happen when connections are short lived and leads to a firmware error printout in dmesg, syndrome 0x51cfb0, because the SQ is in the wrong state. Submitted by: hselasky@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c Wed Dec 5 14:21:28 2018 (r341579) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c Wed Dec 5 14:21:59 2018 (r341580) @@ -458,9 +458,9 @@ mlx5e_rlw_channel_set_rate_locked(struct mlx5e_rl_work howmany(rate, 1000), burst); } - /* set new rate */ + /* set new rate, if SQ is not stopped */ sq = channel->sq; - if (sq != NULL) { + if (sq != NULL && sq->stopped == 0) { error = mlx5e_rl_modify_sq(sq, index); if (error != 0) atomic_add_64(&rlw->priv->rl.stats.tx_modify_rate_failure, 1ULL); From owner-svn-src-head@freebsd.org Wed Dec 5 14:22:32 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5DA4A1315A64; Wed, 5 Dec 2018 14:22:32 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 04CB37584F; Wed, 5 Dec 2018 14:22:32 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DA2C21597C; Wed, 5 Dec 2018 14:22:31 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5EMVw6004096; Wed, 5 Dec 2018 14:22:31 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5EMV5I004092; Wed, 5 Dec 2018 14:22:31 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051422.wB5EMV5I004092@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 14:22:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341581 - in head/sys/dev/mlx5: . mlx5_core mlx5_en X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: in head/sys/dev/mlx5: . mlx5_core mlx5_en X-SVN-Commit-Revision: 341581 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 04CB37584F X-Spamd-Result: default: False [-0.74 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.50)[-0.498,0]; NEURAL_SPAM_LONG(0.01)[0.010,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_SHORT(-0.25)[-0.249,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 14:22:32 -0000 Author: slavash Date: Wed Dec 5 14:22:30 2018 New Revision: 341581 URL: https://svnweb.freebsd.org/changeset/base/341581 Log: mlx5en: Add support for IFM_10G_LR and IFM_40G_ER4 media types. Inspect the ethernet compliance code to figure out actual cable type by reading the PDDR module info register. Submitted by: hselasky@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_core/mlx5_port.c head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c head/sys/dev/mlx5/mlx5_ifc.h head/sys/dev/mlx5/port.h Modified: head/sys/dev/mlx5/mlx5_core/mlx5_port.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_port.c Wed Dec 5 14:21:59 2018 (r341580) +++ head/sys/dev/mlx5/mlx5_core/mlx5_port.c Wed Dec 5 14:22:30 2018 (r341581) @@ -1146,3 +1146,39 @@ out: kfree(out); return err; } + +int mlx5_query_pddr_range_info(struct mlx5_core_dev *mdev, u8 local_port, u8 *is_er_type) +{ + u32 pddr_reg[MLX5_ST_SZ_DW(pddr_reg)] = {}; + int sz = MLX5_ST_SZ_BYTES(pddr_reg); + int error; + u8 ecc; + u8 ci; + + MLX5_SET(pddr_reg, pddr_reg, local_port, local_port); + MLX5_SET(pddr_reg, pddr_reg, page_select, 3 /* module info page */); + + error = mlx5_core_access_reg(mdev, pddr_reg, sz, pddr_reg, sz, + MLX5_ACCESS_REG_SUMMARY_CTRL_ID_PDDR, 0, 0); + if (error != 0) + return (error); + + ecc = MLX5_GET(pddr_reg, pddr_reg, page_data.pddr_module_info.ethernet_compliance_code); + ci = MLX5_GET(pddr_reg, pddr_reg, page_data.pddr_module_info.cable_identifier); + + switch (ci) { + case 0: /* QSFP28 */ + case 1: /* QSFP+ */ + *is_er_type = 0; + break; + case 2: /* SFP28/SFP+ */ + case 3: /* QSA (QSFP->SFP) */ + *is_er_type = ((ecc & (1 << 7)) != 0); + break; + default: + *is_er_type = 0; + break; + } + return (0); +} +EXPORT_SYMBOL_GPL(mlx5_query_pddr_range_info); Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 5 14:21:59 2018 (r341580) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 5 14:22:30 2018 (r341581) @@ -169,6 +169,7 @@ mlx5e_update_carrier(struct mlx5e_priv *priv) u32 eth_proto_oper; int error; u8 port_state; + u8 is_er_type; u8 i; port_state = mlx5_query_vport_state(mdev, @@ -197,10 +198,33 @@ mlx5e_update_carrier(struct mlx5e_priv *priv) if (mlx5e_mode_table[i].baudrate == 0) continue; if (MLX5E_PROT_MASK(i) & eth_proto_oper) { + u32 subtype = mlx5e_mode_table[i].subtype; + priv->ifp->if_baudrate = mlx5e_mode_table[i].baudrate; - priv->media_active_last = - mlx5e_mode_table[i].subtype | IFM_ETHER | IFM_FDX; + + switch (subtype) { + case IFM_10G_ER: + error = mlx5_query_pddr_range_info(mdev, 1, &is_er_type); + if (error != 0) { + if_printf(priv->ifp, "%s: query port pddr failed: %d\n", + __func__, error); + } + if (error != 0 || is_er_type == 0) + subtype = IFM_10G_LR; + break; + case IFM_40G_LR4: + error = mlx5_query_pddr_range_info(mdev, 1, &is_er_type); + if (error != 0) { + if_printf(priv->ifp, "%s: query port pddr failed: %d\n", + __func__, error); + } + if (error == 0 && is_er_type != 0) + subtype = IFM_40G_ER4; + break; + } + priv->media_active_last = subtype | IFM_ETHER | IFM_FDX; + break; } } if_link_state_change(priv->ifp, LINK_STATE_UP); @@ -224,6 +248,15 @@ mlx5e_find_link_mode(u32 subtype) u32 i; u32 link_mode = 0; + switch (subtype) { + case IFM_10G_LR: + subtype = IFM_10G_ER; + break; + case IFM_40G_ER4: + subtype = IFM_40G_LR4; + break; + } + for (i = 0; i < MLX5E_LINK_MODES_NUMBER; ++i) { if (mlx5e_mode_table[i].baudrate == 0) continue; @@ -3723,6 +3756,17 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) IFM_ETH_RXPAUSE | IFM_ETH_TXPAUSE, 0, NULL); } } + + /* Additional supported medias */ + ifmedia_add(&priv->media, IFM_10G_LR | IFM_ETHER, 0, NULL); + ifmedia_add(&priv->media, IFM_10G_LR | + IFM_ETHER | IFM_FDX | + IFM_ETH_RXPAUSE | IFM_ETH_TXPAUSE, 0, NULL); + + ifmedia_add(&priv->media, IFM_40G_ER4 | IFM_ETHER, 0, NULL); + ifmedia_add(&priv->media, IFM_40G_ER4 | + IFM_ETHER | IFM_FDX | + IFM_ETH_RXPAUSE | IFM_ETH_TXPAUSE, 0, NULL); ifmedia_add(&priv->media, IFM_ETHER | IFM_AUTO, 0, NULL); ifmedia_add(&priv->media, IFM_ETHER | IFM_AUTO | IFM_FDX | Modified: head/sys/dev/mlx5/mlx5_ifc.h ============================================================================== --- head/sys/dev/mlx5/mlx5_ifc.h Wed Dec 5 14:21:59 2018 (r341580) +++ head/sys/dev/mlx5/mlx5_ifc.h Wed Dec 5 14:22:30 2018 (r341581) @@ -755,6 +755,115 @@ struct mlx5_ifc_flow_table_nic_cap_bits { u8 reserved_1[0x7200]; }; +enum { + MLX5_ACCESS_REG_SUMMARY_CTRL_ID_PDDR = 0x5031, +}; + +struct mlx5_ifc_pddr_module_info_bits { + u8 cable_technology[0x8]; + u8 cable_breakout[0x8]; + u8 ext_ethernet_compliance_code[0x8]; + u8 ethernet_compliance_code[0x8]; + + u8 cable_type[0x4]; + u8 cable_vendor[0x4]; + u8 cable_length[0x8]; + u8 cable_identifier[0x8]; + u8 cable_power_class[0x8]; + + u8 reserved_at_40[0x8]; + u8 cable_rx_amp[0x8]; + u8 cable_rx_emphasis[0x8]; + u8 cable_tx_equalization[0x8]; + + u8 reserved_at_60[0x8]; + u8 cable_attenuation_12g[0x8]; + u8 cable_attenuation_7g[0x8]; + u8 cable_attenuation_5g[0x8]; + + u8 reserved_at_80[0x8]; + u8 rx_cdr_cap[0x4]; + u8 tx_cdr_cap[0x4]; + u8 reserved_at_90[0x4]; + u8 rx_cdr_state[0x4]; + u8 reserved_at_98[0x4]; + u8 tx_cdr_state[0x4]; + + u8 vendor_name[16][0x8]; + + u8 vendor_pn[16][0x8]; + + u8 vendor_rev[0x20]; + + u8 fw_version[0x20]; + + u8 vendor_sn[16][0x8]; + + u8 temperature[0x10]; + u8 voltage[0x10]; + + u8 rx_power_lane0[0x10]; + u8 rx_power_lane1[0x10]; + + u8 rx_power_lane2[0x10]; + u8 rx_power_lane3[0x10]; + + u8 reserved_at_2c0[0x40]; + + u8 tx_power_lane0[0x10]; + u8 tx_power_lane1[0x10]; + + u8 tx_power_lane2[0x10]; + u8 tx_power_lane3[0x10]; + + u8 reserved_at_340[0x40]; + + u8 tx_bias_lane0[0x10]; + u8 tx_bias_lane1[0x10]; + + u8 tx_bias_lane2[0x10]; + u8 tx_bias_lane3[0x10]; + + u8 reserved_at_3c0[0x40]; + + u8 temperature_high_th[0x10]; + u8 temperature_low_th[0x10]; + + u8 voltage_high_th[0x10]; + u8 voltage_low_th[0x10]; + + u8 rx_power_high_th[0x10]; + u8 rx_power_low_th[0x10]; + + u8 tx_power_high_th[0x10]; + u8 tx_power_low_th[0x10]; + + u8 tx_bias_high_th[0x10]; + u8 tx_bias_low_th[0x10]; + + u8 reserved_at_4a0[0x10]; + u8 wavelength[0x10]; + + u8 reserved_at_4c0[0x300]; +}; + +union mlx5_ifc_pddr_operation_info_page_pddr_phy_info_page_pddr_troubleshooting_page_pddr_module_info_auto_bits { + struct mlx5_ifc_pddr_module_info_bits pddr_module_info; + u8 reserved_at_0[0x7c0]; +}; + +struct mlx5_ifc_pddr_reg_bits { + u8 reserved_at_0[0x8]; + u8 local_port[0x8]; + u8 pnat[0x2]; + u8 reserved_at_12[0xe]; + + u8 reserved_at_20[0x18]; + u8 page_select[0x8]; + + union mlx5_ifc_pddr_operation_info_page_pddr_phy_info_page_pddr_troubleshooting_page_pddr_module_info_auto_bits page_data; +}; + struct mlx5_ifc_per_protocol_networking_offload_caps_bits { u8 csum_cap[0x1]; u8 vlan_cap[0x1]; Modified: head/sys/dev/mlx5/port.h ============================================================================== --- head/sys/dev/mlx5/port.h Wed Dec 5 14:21:59 2018 (r341580) +++ head/sys/dev/mlx5/port.h Wed Dec 5 14:22:30 2018 (r341581) @@ -174,4 +174,6 @@ int mlx5_query_trust_state(struct mlx5_core_dev *mdev, int mlx5_set_dscp2prio(struct mlx5_core_dev *mdev, const u8 *dscp2prio); int mlx5_query_dscp2prio(struct mlx5_core_dev *mdev, u8 *dscp2prio); +int mlx5_query_pddr_range_info(struct mlx5_core_dev *mdev, u8 local_port, u8 *is_er_type); + #endif /* __MLX5_PORT_H__ */ From owner-svn-src-head@freebsd.org Wed Dec 5 14:23:03 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DBCD31315B54; Wed, 5 Dec 2018 14:23:02 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7791775A8C; Wed, 5 Dec 2018 14:23:02 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E9C1215982; Wed, 5 Dec 2018 14:23:01 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5EN15x004268; Wed, 5 Dec 2018 14:23:01 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5EN1m0004265; Wed, 5 Dec 2018 14:23:01 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051423.wB5EN1m0004265@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 14:23:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341582 - head/sys/dev/mlx5/mlx5_en X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 341582 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7791775A8C X-Spamd-Result: default: False [-0.80 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.52)[-0.521,0]; NEURAL_HAM_SHORT(-0.25)[-0.249,0]; NEURAL_HAM_LONG(-0.03)[-0.031,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 14:23:03 -0000 Author: slavash Date: Wed Dec 5 14:23:01 2018 New Revision: 341582 URL: https://svnweb.freebsd.org/changeset/base/341582 Log: mlx5en: Fix race in mlx5e_ethtool_debug_stats(). Writing to the debug stats variable must be locked, else serialization will be lost which might cause various kernel panics due to creating and destroying sysctls out of order. Make sure the sysctl context is initialized after freeing the sysctl nodes, else they can be freed twice. Submitted by: hselasky@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/en.h head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Modified: head/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- head/sys/dev/mlx5/mlx5_en/en.h Wed Dec 5 14:22:30 2018 (r341581) +++ head/sys/dev/mlx5/mlx5_en/en.h Wed Dec 5 14:23:01 2018 (r341582) @@ -794,7 +794,6 @@ struct mlx5e_priv { struct sysctl_oid *sysctl_hw; int sysctl_debug; struct mlx5e_stats stats; - struct sysctl_ctx_list sysctl_ctx_channel_debug; int counter_set_id; struct workqueue_struct *wq; Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Wed Dec 5 14:22:30 2018 (r341581) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Wed Dec 5 14:23:01 2018 (r341582) @@ -1056,33 +1056,34 @@ static int mlx5e_ethtool_debug_stats(SYSCTL_HANDLER_ARGS) { struct mlx5e_priv *priv = arg1; - int error, sys_debug; + int sys_debug; + int error; + PRIV_LOCK(priv); sys_debug = priv->sysctl_debug; - error = sysctl_handle_int(oidp, &priv->sysctl_debug, 0, req); + error = sysctl_handle_int(oidp, &sys_debug, 0, req); if (error != 0 || !req->newptr) - return (error); - priv->sysctl_debug = priv->sysctl_debug != 0; + goto done; + sys_debug = sys_debug ? 1 : 0; if (sys_debug == priv->sysctl_debug) - return (0); + goto done; - PRIV_LOCK(priv); - if (priv->sysctl_debug) { + if ((priv->sysctl_debug = sys_debug)) { mlx5e_create_stats(&priv->stats.port_stats_debug.ctx, SYSCTL_CHILDREN(priv->sysctl_ifnet), "debug_stats", mlx5e_port_stats_debug_desc, MLX5E_PORT_STATS_DEBUG_NUM, priv->stats.port_stats_debug.arg); - SYSCTL_ADD_PROC(&priv->sysctl_ctx_channel_debug, + SYSCTL_ADD_PROC(&priv->stats.port_stats_debug.ctx, SYSCTL_CHILDREN(priv->sysctl_ifnet), OID_AUTO, "hw_ctx_debug", CTLFLAG_RD | CTLFLAG_MPSAFE | CTLTYPE_STRING, priv, 0, mlx5e_ethtool_debug_channel_info, "S", ""); } else { sysctl_ctx_free(&priv->stats.port_stats_debug.ctx); - sysctl_ctx_free(&priv->sysctl_ctx_channel_debug); } +done: PRIV_UNLOCK(priv); - return (0); + return (error); } static void Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 5 14:22:30 2018 (r341581) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 5 14:23:01 2018 (r341582) @@ -3639,8 +3639,6 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) if (ifp->if_capenable & IFCAP_TXCSUM_IPV6) ifp->if_hwassist |= (CSUM_UDP_IPV6 | CSUM_TCP_IPV6); - sysctl_ctx_init(&priv->sysctl_ctx_channel_debug); - /* ifnet sysctl tree */ sysctl_ctx_init(&priv->sysctl_ctx); priv->sysctl_ifnet = SYSCTL_ADD_NODE(&priv->sysctl_ctx, SYSCTL_STATIC_CHILDREN(_dev), @@ -3831,8 +3829,8 @@ err_free_wq: err_free_sysctl: sysctl_ctx_free(&priv->sysctl_ctx); - sysctl_ctx_free(&priv->sysctl_ctx_channel_debug); - + if (priv->sysctl_debug) + sysctl_ctx_free(&priv->stats.port_stats_debug.ctx); if_free(ifp); err_free_priv: @@ -3889,13 +3887,11 @@ mlx5e_destroy_ifp(struct mlx5_core_dev *mdev, void *vp mlx5e_rl_cleanup(priv); #endif /* destroy all remaining sysctl nodes */ - if (priv->sysctl_debug) { - sysctl_ctx_free(&priv->sysctl_ctx_channel_debug); - sysctl_ctx_free(&priv->stats.port_stats_debug.ctx); - } sysctl_ctx_free(&priv->stats.vport.ctx); sysctl_ctx_free(&priv->stats.pport.ctx); sysctl_ctx_free(&priv->sysctl_ctx); + if (priv->sysctl_debug) + sysctl_ctx_free(&priv->stats.port_stats_debug.ctx); mlx5_core_destroy_mkey(priv->mdev, &priv->mr); mlx5_dealloc_transport_domain(priv->mdev, priv->tdn); From owner-svn-src-head@freebsd.org Wed Dec 5 14:23:33 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2A4731315C06; Wed, 5 Dec 2018 14:23:33 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D20CB75C58; Wed, 5 Dec 2018 14:23:32 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9A0AB15985; Wed, 5 Dec 2018 14:23:32 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5ENWLX004338; Wed, 5 Dec 2018 14:23:32 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5ENVvk004333; Wed, 5 Dec 2018 14:23:31 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051423.wB5ENVvk004333@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 14:23:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341583 - head/sys/dev/mlx5/mlx5_en X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 341583 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D20CB75C58 X-Spamd-Result: default: False [-0.74 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.50)[-0.498,0]; NEURAL_HAM_SHORT(-0.25)[-0.249,0]; NEURAL_SPAM_LONG(0.01)[0.010,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 14:23:33 -0000 Author: slavash Date: Wed Dec 5 14:23:31 2018 New Revision: 341583 URL: https://svnweb.freebsd.org/changeset/base/341583 Log: mlx5en: Statically allocate and free the channel structure(s). By allocating the worst case size channel structure array at attach time we can eliminate various NULL checks in the fast path. And also reduce the chance for use-after-free issues in the transmit fast path. This change is also a requirement for implementing backpressure support. Submitted by: hselasky@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/en.h head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Modified: head/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- head/sys/dev/mlx5/mlx5_en/en.h Wed Dec 5 14:23:01 2018 (r341582) +++ head/sys/dev/mlx5/mlx5_en/en.h Wed Dec 5 14:23:31 2018 (r341583) @@ -596,7 +596,7 @@ struct mlx5e_sq { #define MLX5E_CEV_STATE_INITIAL 0 /* timer not started */ #define MLX5E_CEV_STATE_SEND_NOPS 1 /* send NOPs */ #define MLX5E_CEV_STATE_HOLD_NOPS 2 /* don't send NOPs yet */ - u16 stopped; /* set if SQ is stopped */ + u16 running; /* set if SQ is running */ struct callout cev_callout; union { u32 d32[2]; @@ -769,7 +769,6 @@ struct mlx5e_priv { u32 tdn; struct mlx5_core_mr mr; - struct mlx5e_channel *volatile *channel; u32 tisn[MLX5E_MAX_TX_NUM_TC]; u32 rqtn; u32 tirn[MLX5E_NUM_TT]; @@ -814,6 +813,8 @@ struct mlx5e_priv { int clbr_curr; struct mlx5e_clbr_point clbr_points[2]; u_int clbr_gen; + + struct mlx5e_channel channel[]; }; #define MLX5E_NET_IP_ALIGN 2 Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Wed Dec 5 14:23:01 2018 (r341582) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Wed Dec 5 14:23:31 2018 (r341583) @@ -1035,7 +1035,7 @@ mlx5e_ethtool_debug_channel_info(SYSCTL_HANDLER_ARGS) if (test_bit(MLX5E_STATE_OPENED, &priv->state) == 0) goto out; for (i = 0; i < priv->params.num_channels; i++) { - c = priv->channel[i]; + c = &priv->channel[i]; rq = &c->rq; sbuf_printf(&sb, "channel %d rq %d cq %d\n", c->ix, rq->rqn, rq->cq.mcq.cqn); Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 5 14:23:01 2018 (r341582) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 5 14:23:31 2018 (r341583) @@ -473,7 +473,6 @@ mlx5e_update_stats_work(struct work_struct *work) update_stats_work); struct mlx5_core_dev *mdev = priv->mdev; struct mlx5e_vport_stats *s = &priv->stats.vport; - struct mlx5e_rq_stats *rq_stats; struct mlx5e_sq_stats *sq_stats; struct buf_ring *sq_br; #if (__FreeBSD_version < 1100000) @@ -507,10 +506,10 @@ mlx5e_update_stats_work(struct work_struct *work) /* Collect firts the SW counters and then HW for consistency */ for (i = 0; i < priv->params.num_channels; i++) { - struct mlx5e_rq *rq = &priv->channel[i]->rq; + struct mlx5e_channel *pch = priv->channel + i; + struct mlx5e_rq *rq = &pch->rq; + struct mlx5e_rq_stats *rq_stats = &pch->rq.stats; - rq_stats = &priv->channel[i]->rq.stats; - /* collect stats from LRO */ rq_stats->sw_lro_queued = rq->lro.lro_queued; rq_stats->sw_lro_flushed = rq->lro.lro_flushed; @@ -522,8 +521,8 @@ mlx5e_update_stats_work(struct work_struct *work) rx_wqe_err += rq_stats->wqe_err; for (j = 0; j < priv->num_tc; j++) { - sq_stats = &priv->channel[i]->sq[j].stats; - sq_br = priv->channel[i]->sq[j].br; + sq_stats = &pch->sq[j].stats; + sq_br = pch->sq[j].br; tso_packets += sq_stats->tso_packets; tso_bytes += sq_stats->tso_bytes; @@ -1202,7 +1201,7 @@ mlx5e_refresh_sq_inline(struct mlx5e_priv *priv) return; for (i = 0; i < priv->params.num_channels; i++) - mlx5e_refresh_sq_inline_sub(priv, priv->channel[i]); + mlx5e_refresh_sq_inline_sub(priv, &priv->channel[i]); } static int @@ -1388,6 +1387,8 @@ mlx5e_open_sq(struct mlx5e_channel *c, if (err) goto err_disable_sq; + WRITE_ONCE(sq->running, 1); + return (0); err_disable_sq: @@ -1462,20 +1463,21 @@ mlx5e_drain_sq(struct mlx5e_sq *sq) /* * Check if already stopped. * - * NOTE: The "stopped" variable is only written when both the - * priv's configuration lock and the SQ's lock is locked. It - * can therefore safely be read when only one of the two locks - * is locked. This function is always called when the priv's - * configuration lock is locked. + * NOTE: Serialization of this function is managed by the + * caller ensuring the priv's state lock is locked or in case + * of rate limit support, a single thread manages drain and + * resume of SQs. The "running" variable can therefore safely + * be read without any locks. */ - if (sq->stopped != 0) + if (READ_ONCE(sq->running) == 0) return; - mtx_lock(&sq->lock); - /* don't put more packets into the SQ */ - sq->stopped = 1; + WRITE_ONCE(sq->running, 0); + /* serialize access to DMA rings */ + mtx_lock(&sq->lock); + /* teardown event factor timer, if any */ sq->cev_next_state = MLX5E_CEV_STATE_HOLD_NOPS; callout_stop(&sq->cev_callout); @@ -1768,15 +1770,14 @@ mlx5e_chan_mtx_destroy(struct mlx5e_channel *c) static int mlx5e_open_channel(struct mlx5e_priv *priv, int ix, struct mlx5e_channel_param *cparam, - struct mlx5e_channel *volatile *cp) + struct mlx5e_channel *c) { - struct mlx5e_channel *c; int err; - c = malloc(sizeof(*c), M_MLX5EN, M_WAITOK | M_ZERO); + memset(c, 0, sizeof(*c)); + c->priv = priv; c->ix = ix; - c->cpu = 0; c->ifp = priv->ifp; c->mkey_be = cpu_to_be32(priv->mr.key); c->num_tc = priv->num_tc; @@ -1803,9 +1804,6 @@ mlx5e_open_channel(struct mlx5e_priv *priv, int ix, if (err) goto err_close_sqs; - /* store channel pointer */ - *cp = c; - /* poll receive queue initially */ c->rq.cq.mcq.comp(&c->rq.cq.mcq); @@ -1823,39 +1821,24 @@ err_close_tx_cqs: err_free: /* destroy mutexes */ mlx5e_chan_mtx_destroy(c); - free(c, M_MLX5EN); return (err); } static void -mlx5e_close_channel(struct mlx5e_channel *volatile *pp) +mlx5e_close_channel(struct mlx5e_channel *c) { - struct mlx5e_channel *c = *pp; - - /* check if channel is already closed */ - if (c == NULL) - return; mlx5e_close_rq(&c->rq); } static void -mlx5e_close_channel_wait(struct mlx5e_channel *volatile *pp) +mlx5e_close_channel_wait(struct mlx5e_channel *c) { - struct mlx5e_channel *c = *pp; - - /* check if channel is already closed */ - if (c == NULL) - return; - /* ensure channel pointer is no longer used */ - *pp = NULL; - mlx5e_close_rq_wait(&c->rq); mlx5e_close_sqs_wait(c); mlx5e_close_cq(&c->rq.cq); mlx5e_close_tx_cqs(c); /* destroy mutexes */ mlx5e_chan_mtx_destroy(c); - free(c, M_MLX5EN); } static int @@ -2012,14 +1995,10 @@ static int mlx5e_open_channels(struct mlx5e_priv *priv) { struct mlx5e_channel_param cparam; - void *ptr; int err; int i; int j; - priv->channel = malloc(priv->params.num_channels * - sizeof(struct mlx5e_channel *), M_MLX5EN, M_WAITOK | M_ZERO); - mlx5e_build_channel_param(priv, &cparam); for (i = 0; i < priv->params.num_channels; i++) { err = mlx5e_open_channel(priv, i, &cparam, &priv->channel[i]); @@ -2028,7 +2007,7 @@ mlx5e_open_channels(struct mlx5e_priv *priv) } for (j = 0; j < priv->params.num_channels; j++) { - err = mlx5e_wait_for_min_rx_wqes(&priv->channel[j]->rq); + err = mlx5e_wait_for_min_rx_wqes(&priv->channel[j].rq); if (err) goto err_close_channels; } @@ -2036,39 +2015,22 @@ mlx5e_open_channels(struct mlx5e_priv *priv) return (0); err_close_channels: - for (i--; i >= 0; i--) { + while (i--) { mlx5e_close_channel(&priv->channel[i]); mlx5e_close_channel_wait(&priv->channel[i]); } - - /* remove "volatile" attribute from "channel" pointer */ - ptr = __DECONST(void *, priv->channel); - priv->channel = NULL; - - free(ptr, M_MLX5EN); - return (err); } static void mlx5e_close_channels(struct mlx5e_priv *priv) { - void *ptr; int i; - if (priv->channel == NULL) - return; - for (i = 0; i < priv->params.num_channels; i++) mlx5e_close_channel(&priv->channel[i]); for (i = 0; i < priv->params.num_channels; i++) mlx5e_close_channel_wait(&priv->channel[i]); - - /* remove "volatile" attribute from "channel" pointer */ - ptr = __DECONST(void *, priv->channel); - priv->channel = NULL; - - free(ptr, M_MLX5EN); } static int @@ -2134,9 +2096,6 @@ mlx5e_refresh_channel_params_sub(struct mlx5e_priv *pr int err; int i; - if (c == NULL) - return (EINVAL); - err = mlx5e_refresh_rq_params(priv, &c->rq); if (err) goto done; @@ -2155,13 +2114,14 @@ mlx5e_refresh_channel_params(struct mlx5e_priv *priv) { int i; - if (priv->channel == NULL) + /* check if channels are closed */ + if (test_bit(MLX5E_STATE_OPENED, &priv->state) == 0) return (EINVAL); for (i = 0; i < priv->params.num_channels; i++) { int err; - err = mlx5e_refresh_channel_params_sub(priv, priv->channel[i]); + err = mlx5e_refresh_channel_params_sub(priv, &priv->channel[i]); if (err) return (err); } @@ -2255,7 +2215,7 @@ mlx5e_open_rqt(struct mlx5e_priv *priv) /* apply receive side scaling stride, if any */ ix -= ix % (int)priv->params.channels_rsss; - MLX5_SET(rqtc, rqtc, rq_num[i], priv->channel[ix]->rq.rqn); + MLX5_SET(rqtc, rqtc, rq_num[i], priv->channel[ix].rq.rqn); } MLX5_SET(create_rqt_in, in, opcode, MLX5_CMD_OP_CREATE_RQT); @@ -2322,7 +2282,7 @@ mlx5e_build_tir_ctx(struct mlx5e_priv *priv, u32 * tir MLX5_SET(tirc, tirc, disp_type, MLX5_TIRC_DISP_TYPE_DIRECT); MLX5_SET(tirc, tirc, inline_rqn, - priv->channel[0]->rq.rqn); + priv->channel[0].rq.rqn); break; default: MLX5_SET(tirc, tirc, disp_type, @@ -3253,7 +3213,7 @@ mlx5e_resume_sq(struct mlx5e_sq *sq) int err; /* check if already enabled */ - if (sq->stopped == 0) + if (READ_ONCE(sq->running) != 0) return; err = mlx5e_modify_sq(sq, MLX5_SQC_STATE_ERR, @@ -3276,11 +3236,8 @@ mlx5e_resume_sq(struct mlx5e_sq *sq) "mlx5e_modify_sq() from RST to RDY failed: %d\n", err); } - mtx_lock(&sq->lock); sq->cev_next_state = MLX5E_CEV_STATE_INITIAL; - sq->stopped = 0; - mtx_unlock(&sq->lock); - + WRITE_ONCE(sq->running, 1); } static void @@ -3351,18 +3308,14 @@ mlx5e_modify_tx_dma(struct mlx5e_priv *priv, uint8_t v { int i; - if (priv->channel == NULL) + if (test_bit(MLX5E_STATE_OPENED, &priv->state) == 0) return; for (i = 0; i < priv->params.num_channels; i++) { - - if (!priv->channel[i]) - continue; - if (value) - mlx5e_disable_tx_dma(priv->channel[i]); + mlx5e_disable_tx_dma(&priv->channel[i]); else - mlx5e_enable_tx_dma(priv->channel[i]); + mlx5e_enable_tx_dma(&priv->channel[i]); } } @@ -3371,18 +3324,14 @@ mlx5e_modify_rx_dma(struct mlx5e_priv *priv, uint8_t v { int i; - if (priv->channel == NULL) + if (test_bit(MLX5E_STATE_OPENED, &priv->state) == 0) return; for (i = 0; i < priv->params.num_channels; i++) { - - if (!priv->channel[i]) - continue; - if (value) - mlx5e_disable_rx_dma(priv->channel[i]); + mlx5e_disable_rx_dma(&priv->channel[i]); else - mlx5e_enable_rx_dma(priv->channel[i]); + mlx5e_enable_rx_dma(&priv->channel[i]); } } @@ -3587,7 +3536,13 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) mlx5_core_dbg(mdev, "mlx5e_check_required_hca_cap() failed\n"); return (NULL); } - priv = malloc(sizeof(*priv), M_MLX5EN, M_WAITOK | M_ZERO); + /* + * Try to allocate the priv and make room for worst-case + * number of channel structures: + */ + priv = malloc(sizeof(*priv) + + (sizeof(priv->channel[0]) * mdev->priv.eq_table.num_comp_vectors), + M_MLX5EN, M_WAITOK | M_ZERO); mlx5e_priv_mtx_init(priv); ifp = priv->ifp = if_alloc(IFT_ETHER); Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c Wed Dec 5 14:23:01 2018 (r341582) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c Wed Dec 5 14:23:31 2018 (r341583) @@ -458,9 +458,9 @@ mlx5e_rlw_channel_set_rate_locked(struct mlx5e_rl_work howmany(rate, 1000), burst); } - /* set new rate, if SQ is not stopped */ + /* set new rate, if SQ is running */ sq = channel->sq; - if (sq != NULL && sq->stopped == 0) { + if (sq != NULL && READ_ONCE(sq->running) != 0) { error = mlx5e_rl_modify_sq(sq, index); if (error != 0) atomic_add_64(&rlw->priv->rl.stats.tx_modify_rate_failure, 1ULL); Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Wed Dec 5 14:23:01 2018 (r341582) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Wed Dec 5 14:23:31 2018 (r341583) @@ -81,17 +81,10 @@ static struct mlx5e_sq * mlx5e_select_queue(struct ifnet *ifp, struct mbuf *mb) { struct mlx5e_priv *priv = ifp->if_softc; - struct mlx5e_channel * volatile *ppch; - struct mlx5e_channel *pch; + struct mlx5e_sq *sq; u32 ch; u32 tc; - ppch = priv->channel; - - /* check if channels are successfully opened */ - if (unlikely(ppch == NULL)) - return (NULL); - /* obtain VLAN information if present */ if (mb->m_flags & M_VLANTAG) { tc = (mb->m_pkthdr.ether_vtag >> 13); @@ -116,7 +109,7 @@ mlx5e_select_queue(struct ifnet *ifp, struct mbuf *mb) struct mlx5e_rl_channel, m_snd_tag)->sq; /* check if valid */ - if (sq != NULL && sq->stopped == 0) + if (sq != NULL && sq->running != 0) return (sq); /* FALLTHROUGH */ @@ -146,10 +139,10 @@ mlx5e_select_queue(struct ifnet *ifp, struct mbuf *mb) #endif } - /* check if channel is allocated and not stopped */ - pch = ppch[ch]; - if (likely(pch != NULL && pch->sq[tc].stopped == 0)) - return (&pch->sq[tc]); + /* check if send queue is running */ + sq = &priv->channel[ch].sq[tc]; + if (likely(READ_ONCE(sq->running) != 0)) + return (sq); return (NULL); } @@ -552,7 +545,7 @@ mlx5e_xmit_locked(struct ifnet *ifp, struct mlx5e_sq * int err = 0; if (unlikely((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0 || - sq->stopped != 0)) { + READ_ONCE(sq->running) == 0)) { m_freem(mb); return (ENETDOWN); } From owner-svn-src-head@freebsd.org Wed Dec 5 14:24:04 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 523AC1315CBA; Wed, 5 Dec 2018 14:24:04 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EC47A75DAA; Wed, 5 Dec 2018 14:24:03 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B36F11598A; Wed, 5 Dec 2018 14:24:03 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5EO37Y004410; Wed, 5 Dec 2018 14:24:03 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5EO3JP004407; Wed, 5 Dec 2018 14:24:03 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051424.wB5EO3JP004407@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 14:24:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341584 - head/sys/dev/mlx5/mlx5_en X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 341584 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: EC47A75DAA X-Spamd-Result: default: False [-0.80 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.52)[-0.521,0]; NEURAL_HAM_LONG(-0.03)[-0.031,0]; NEURAL_HAM_SHORT(-0.25)[-0.249,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 14:24:04 -0000 Author: slavash Date: Wed Dec 5 14:24:02 2018 New Revision: 341584 URL: https://svnweb.freebsd.org/changeset/base/341584 Log: mlx5en: Count all transmitted and received bytes. Add counter for all transmitted and received bytes. Currently only all transmitted and received packets were counted. Fix description of RX LRO counters while at it. Submitted by: hselasky@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/en.h head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Modified: head/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- head/sys/dev/mlx5/mlx5_en/en.h Wed Dec 5 14:23:31 2018 (r341583) +++ head/sys/dev/mlx5/mlx5_en/en.h Wed Dec 5 14:24:02 2018 (r341584) @@ -379,9 +379,10 @@ struct mlx5e_port_stats_debug { #define MLX5E_RQ_STATS(m) \ m(+1, u64 packets, "packets", "Received packets") \ + m(+1, u64 bytes, "bytes", "Received bytes") \ m(+1, u64 csum_none, "csum_none", "Received packets") \ - m(+1, u64 lro_packets, "lro_packets", "Received packets") \ - m(+1, u64 lro_bytes, "lro_bytes", "Received packets") \ + m(+1, u64 lro_packets, "lro_packets", "Received LRO packets") \ + m(+1, u64 lro_bytes, "lro_bytes", "Received LRO bytes") \ m(+1, u64 sw_lro_queued, "sw_lro_queued", "Packets queued for SW LRO") \ m(+1, u64 sw_lro_flushed, "sw_lro_flushed", "Packets flushed from SW LRO") \ m(+1, u64 wqe_err, "wqe_err", "Received packets") @@ -396,6 +397,7 @@ struct mlx5e_rq_stats { #define MLX5E_SQ_STATS(m) \ m(+1, u64 packets, "packets", "Transmitted packets") \ + m(+1, u64 bytes, "bytes", "Transmitted bytes") \ m(+1, u64 tso_packets, "tso_packets", "Transmitted packets") \ m(+1, u64 tso_bytes, "tso_bytes", "Transmitted bytes") \ m(+1, u64 csum_offload_none, "csum_offload_none", "Transmitted packets") \ Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Wed Dec 5 14:23:31 2018 (r341583) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Wed Dec 5 14:24:02 2018 (r341584) @@ -482,6 +482,7 @@ mlx5e_poll_rx_cq(struct mlx5e_rq *rq, int budget) } mlx5e_build_rx_mbuf(cqe, rq, mb, byte_cnt); + rq->stats.bytes += byte_cnt; rq->stats.packets++; #if !defined(HAVE_TCP_LRO_RX) Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Wed Dec 5 14:23:31 2018 (r341583) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Wed Dec 5 14:24:02 2018 (r341584) @@ -472,7 +472,10 @@ mlx5e_sq_xmit(struct mlx5e_sq *sq, struct mbuf **mbp) sq->mbuf[pi].num_wqebbs = DIV_ROUND_UP(ds_cnt, MLX5_SEND_WQEBB_NUM_DS); sq->pc += sq->mbuf[pi].num_wqebbs; + /* Count all traffic going out */ sq->stats.packets++; + sq->stats.bytes += sq->mbuf[pi].num_bytes; + *mbp = NULL; /* safety clear */ return (0); From owner-svn-src-head@freebsd.org Wed Dec 5 14:24:35 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4041A1315D89; Wed, 5 Dec 2018 14:24:35 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DCC5A75F33; Wed, 5 Dec 2018 14:24:34 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A512C1598C; Wed, 5 Dec 2018 14:24:34 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5EOYiD004484; Wed, 5 Dec 2018 14:24:34 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5EOY0C004482; Wed, 5 Dec 2018 14:24:34 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051424.wB5EOY0C004482@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 14:24:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341585 - head/sys/dev/mlx5/mlx5_en X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 341585 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: DCC5A75F33 X-Spamd-Result: default: False [-0.80 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.52)[-0.521,0]; NEURAL_HAM_SHORT(-0.25)[-0.249,0]; NEURAL_HAM_LONG(-0.03)[-0.031,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 14:24:35 -0000 Author: slavash Date: Wed Dec 5 14:24:33 2018 New Revision: 341585 URL: https://svnweb.freebsd.org/changeset/base/341585 Log: mlx5en: Improve configuration of HW LRO. In order to enable HW LRO, both the "hw_lro" sysctl in the mlx5en(4) config space must be set, and the ifconfig(8) LRO capability must be set. Any other settings will disable HW LRO. Submitted by: hselasky@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Wed Dec 5 14:24:02 2018 (r341584) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Wed Dec 5 14:24:33 2018 (r341585) @@ -669,21 +669,24 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARGS) mlx5e_close_locked(priv->ifp); /* import HW LRO mode */ - if (priv->params_ethtool.hw_lro != 0) { - if ((priv->ifp->if_capenable & IFCAP_LRO) && - MLX5_CAP_ETH(priv->mdev, lro_cap)) { - priv->params.hw_lro_en = 1; - priv->params_ethtool.hw_lro = 1; + if (priv->params_ethtool.hw_lro != 0 && + MLX5_CAP_ETH(priv->mdev, lro_cap)) { + priv->params_ethtool.hw_lro = 1; + /* check if feature should actually be enabled */ + if (priv->ifp->if_capenable & IFCAP_LRO) { + priv->params.hw_lro_en = true; } else { - priv->params.hw_lro_en = 0; - priv->params_ethtool.hw_lro = 0; - error = EINVAL; + priv->params.hw_lro_en = false; - if_printf(priv->ifp, "Can't enable HW LRO: " - "The HW or SW LRO feature is disabled\n"); + if_printf(priv->ifp, "To enable HW LRO " + "please also enable LRO via ifconfig(8).\n"); } } else { - priv->params.hw_lro_en = 0; + /* return an error if HW does not support this feature */ + if (priv->params_ethtool.hw_lro != 0) + error = EINVAL; + priv->params.hw_lro_en = false; + priv->params_ethtool.hw_lro = 0; } /* restart network interface, if any */ if (was_opened) Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 5 14:24:02 2018 (r341584) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 5 14:24:33 2018 (r341585) @@ -2898,12 +2898,18 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t bool need_restart = false; ifp->if_capenable ^= IFCAP_LRO; + + /* figure out if updating HW LRO is needed */ if (!(ifp->if_capenable & IFCAP_LRO)) { if (priv->params.hw_lro_en) { priv->params.hw_lro_en = false; need_restart = true; - /* Not sure this is the correct way */ - priv->params_ethtool.hw_lro = priv->params.hw_lro_en; + } + } else { + if (priv->params.hw_lro_en == false && + priv->params_ethtool.hw_lro != 0) { + priv->params.hw_lro_en = true; + need_restart = true; } } if (was_opened && need_restart) { From owner-svn-src-head@freebsd.org Wed Dec 5 14:25:04 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AAA761315E23; Wed, 5 Dec 2018 14:25:04 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5D111760AA; Wed, 5 Dec 2018 14:25:04 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3DEE81598F; Wed, 5 Dec 2018 14:25:04 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5EP4UG004570; Wed, 5 Dec 2018 14:25:04 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5EP38T004562; Wed, 5 Dec 2018 14:25:03 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051425.wB5EP38T004562@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 14:25:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341586 - head/sys/dev/mlx5/mlx5_en X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 341586 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5D111760AA X-Spamd-Result: default: False [-0.74 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.50)[-0.498,0]; NEURAL_SPAM_LONG(0.01)[0.010,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_SHORT(-0.25)[-0.249,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 14:25:05 -0000 Author: slavash Date: Wed Dec 5 14:25:03 2018 New Revision: 341586 URL: https://svnweb.freebsd.org/changeset/base/341586 Log: mlx5en: Implement backpressure indication. The backpressure indication is implemented using an unlimited rate type of mbuf send tag. When the upper layers typically the socket layer has obtained such a tag, it can then query the destination driver queue for the current amount of space available in the send queue. A single mbuf send tag may be referenced multiple times and a refcount has been added to the mlx5e_priv structure to track its usage. Because the send tag resides in the mlx5e_channel structure, there is no need to wait for refcounts to reach zero until the mlx4en(4) driver is detached. The channels structure is persistant during the lifetime of the mlx5en(4) driver it belongs to and can so be accessed without any need of synchronization. The mlx5e_snd_tag structure was extended to contain a type field, because there are now two different tag types which end up in the driver which need to be distinguished. Submitted by: hselasky@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/en.h head/sys/dev/mlx5/mlx5_en/en_rl.h head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Modified: head/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- head/sys/dev/mlx5/mlx5_en/en.h Wed Dec 5 14:24:33 2018 (r341585) +++ head/sys/dev/mlx5/mlx5_en/en.h Wed Dec 5 14:25:03 2018 (r341586) @@ -580,6 +580,11 @@ enum { MLX5E_SQ_FULL }; +struct mlx5e_snd_tag { + struct m_snd_tag m_snd_tag; /* send tag */ + u32 type; /* tag type */ +}; + struct mlx5e_sq { /* data path */ struct mtx lock; @@ -640,11 +645,27 @@ mlx5e_sq_has_room_for(struct mlx5e_sq *sq, u16 n) return ((sq->wq.sz_m1 & (cc - pc)) >= n || cc == pc); } +static inline u32 +mlx5e_sq_queue_level(struct mlx5e_sq *sq) +{ + u16 cc; + u16 pc; + + if (sq == NULL) + return (0); + + cc = sq->cc; + pc = sq->pc; + + return (((sq->wq.sz_m1 & (pc - cc)) * + IF_SND_QUEUE_LEVEL_MAX) / sq->wq.sz_m1); +} + struct mlx5e_channel { /* data path */ struct mlx5e_rq rq; + struct mlx5e_snd_tag tag; struct mlx5e_sq sq[MLX5E_MAX_TX_NUM_TC]; - struct ifnet *ifp; u32 mkey_be; u8 num_tc; @@ -770,6 +791,7 @@ struct mlx5e_priv { u32 pdn; u32 tdn; struct mlx5_core_mr mr; + volatile unsigned int channel_refs; u32 tisn[MLX5E_MAX_TX_NUM_TC]; u32 rqtn; @@ -907,6 +929,24 @@ mlx5e_cq_arm(struct mlx5e_cq *cq, spinlock_t *dblock) mcq = &cq->mcq; mlx5_cq_arm(mcq, MLX5_CQ_DB_REQ_NOT, mcq->uar->map, dblock, cq->wq.cc); +} + +static inline void +mlx5e_ref_channel(struct mlx5e_priv *priv) +{ + + KASSERT(priv->channel_refs < INT_MAX, + ("Channel refs will overflow")); + atomic_fetchadd_int(&priv->channel_refs, 1); +} + +static inline void +mlx5e_unref_channel(struct mlx5e_priv *priv) +{ + + KASSERT(priv->channel_refs > 0, + ("Channel refs is not greater than zero")); + atomic_fetchadd_int(&priv->channel_refs, -1); } extern const struct ethtool_ops mlx5e_ethtool_ops; Modified: head/sys/dev/mlx5/mlx5_en/en_rl.h ============================================================================== --- head/sys/dev/mlx5/mlx5_en/en_rl.h Wed Dec 5 14:24:33 2018 (r341585) +++ head/sys/dev/mlx5/mlx5_en/en_rl.h Wed Dec 5 14:25:03 2018 (r341586) @@ -129,7 +129,7 @@ struct mlx5e_rl_channel_param { }; struct mlx5e_rl_channel { - struct m_snd_tag m_snd_tag; + struct mlx5e_snd_tag tag; STAILQ_ENTRY(mlx5e_rl_channel) entry; struct mlx5e_sq * volatile sq; struct mlx5e_rl_worker *worker; Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 5 14:24:33 2018 (r341585) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 5 14:25:03 2018 (r341586) @@ -886,7 +886,7 @@ mlx5e_create_rq(struct mlx5e_channel *c, wq_sz = mlx5_wq_ll_get_size(&rq->wq); - err = -tcp_lro_init_args(&rq->lro, c->ifp, TCP_LRO_ENTRIES, wq_sz); + err = -tcp_lro_init_args(&rq->lro, c->tag.m_snd_tag.ifp, TCP_LRO_ENTRIES, wq_sz); if (err) goto err_rq_wq_destroy; @@ -916,7 +916,7 @@ mlx5e_create_rq(struct mlx5e_channel *c, #endif } - rq->ifp = c->ifp; + rq->ifp = c->tag.m_snd_tag.ifp; rq->channel = c; rq->ix = c->ix; @@ -1778,7 +1778,9 @@ mlx5e_open_channel(struct mlx5e_priv *priv, int ix, c->priv = priv; c->ix = ix; - c->ifp = priv->ifp; + /* setup send tag */ + c->tag.m_snd_tag.ifp = priv->ifp; + c->tag.type = IF_SND_TAG_TYPE_UNLIMITED; c->mkey_be = cpu_to_be32(priv->mr.key); c->num_tc = priv->num_tc; @@ -2011,7 +2013,6 @@ mlx5e_open_channels(struct mlx5e_priv *priv) if (err) goto err_close_channels; } - return (0); err_close_channels: @@ -3525,6 +3526,141 @@ mlx5e_setup_pauseframes(struct mlx5e_priv *priv) PRIV_UNLOCK(priv); } +static int +mlx5e_ul_snd_tag_alloc(struct ifnet *ifp, + union if_snd_tag_alloc_params *params, + struct m_snd_tag **ppmt) +{ + struct mlx5e_priv *priv; + struct mlx5e_channel *pch; + + priv = ifp->if_softc; + + if (unlikely(priv->gone || params->hdr.flowtype == M_HASHTYPE_NONE)) { + return (EOPNOTSUPP); + } else { + /* keep this code synced with mlx5e_select_queue() */ + u32 ch = priv->params.num_channels; +#ifdef RSS + u32 temp; + + if (rss_hash2bucket(params->hdr.flowid, + params->hdr.flowtype, &temp) == 0) + ch = temp % ch; + else +#endif + ch = (params->hdr.flowid % 128) % ch; + + /* + * NOTE: The channels array is only freed at detach + * and it safe to return a pointer to the send tag + * inside the channels structure as long as we + * reference the priv. + */ + pch = priv->channel + ch; + + /* check if send queue is not running */ + if (unlikely(pch->sq[0].running == 0)) + return (ENXIO); + mlx5e_ref_channel(priv); + *ppmt = &pch->tag.m_snd_tag; + return (0); + } +} + +static int +mlx5e_ul_snd_tag_query(struct m_snd_tag *pmt, union if_snd_tag_query_params *params) +{ + struct mlx5e_channel *pch = + container_of(pmt, struct mlx5e_channel, tag.m_snd_tag); + + params->unlimited.max_rate = -1ULL; + params->unlimited.queue_level = mlx5e_sq_queue_level(&pch->sq[0]); + return (0); +} + +static void +mlx5e_ul_snd_tag_free(struct m_snd_tag *pmt) +{ + struct mlx5e_channel *pch = + container_of(pmt, struct mlx5e_channel, tag.m_snd_tag); + + mlx5e_unref_channel(pch->priv); +} + +static int +mlx5e_snd_tag_alloc(struct ifnet *ifp, + union if_snd_tag_alloc_params *params, + struct m_snd_tag **ppmt) +{ + + switch (params->hdr.type) { +#ifdef RATELIMIT + case IF_SND_TAG_TYPE_RATE_LIMIT: + return (mlx5e_rl_snd_tag_alloc(ifp, params, ppmt)); +#endif + case IF_SND_TAG_TYPE_UNLIMITED: + return (mlx5e_ul_snd_tag_alloc(ifp, params, ppmt)); + default: + return (EOPNOTSUPP); + } +} + +static int +mlx5e_snd_tag_modify(struct m_snd_tag *pmt, union if_snd_tag_modify_params *params) +{ + struct mlx5e_snd_tag *tag = + container_of(pmt, struct mlx5e_snd_tag, m_snd_tag); + + switch (tag->type) { +#ifdef RATELIMIT + case IF_SND_TAG_TYPE_RATE_LIMIT: + return (mlx5e_rl_snd_tag_modify(pmt, params)); +#endif + case IF_SND_TAG_TYPE_UNLIMITED: + default: + return (EOPNOTSUPP); + } +} + +static int +mlx5e_snd_tag_query(struct m_snd_tag *pmt, union if_snd_tag_query_params *params) +{ + struct mlx5e_snd_tag *tag = + container_of(pmt, struct mlx5e_snd_tag, m_snd_tag); + + switch (tag->type) { +#ifdef RATELIMIT + case IF_SND_TAG_TYPE_RATE_LIMIT: + return (mlx5e_rl_snd_tag_query(pmt, params)); +#endif + case IF_SND_TAG_TYPE_UNLIMITED: + return (mlx5e_ul_snd_tag_query(pmt, params)); + default: + return (EOPNOTSUPP); + } +} + +static void +mlx5e_snd_tag_free(struct m_snd_tag *pmt) +{ + struct mlx5e_snd_tag *tag = + container_of(pmt, struct mlx5e_snd_tag, m_snd_tag); + + switch (tag->type) { +#ifdef RATELIMIT + case IF_SND_TAG_TYPE_RATE_LIMIT: + mlx5e_rl_snd_tag_free(pmt); + break; +#endif + case IF_SND_TAG_TYPE_UNLIMITED: + mlx5e_ul_snd_tag_free(pmt); + break; + default: + break; + } +} + static void * mlx5e_create_ifp(struct mlx5_core_dev *mdev) { @@ -3578,13 +3714,11 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) ifp->if_capabilities |= IFCAP_LRO; ifp->if_capabilities |= IFCAP_TSO | IFCAP_VLAN_HWTSO; ifp->if_capabilities |= IFCAP_HWSTATS | IFCAP_HWRXTSTMP; -#ifdef RATELIMIT ifp->if_capabilities |= IFCAP_TXRTLMT; - ifp->if_snd_tag_alloc = mlx5e_rl_snd_tag_alloc; - ifp->if_snd_tag_free = mlx5e_rl_snd_tag_free; - ifp->if_snd_tag_modify = mlx5e_rl_snd_tag_modify; - ifp->if_snd_tag_query = mlx5e_rl_snd_tag_query; -#endif + ifp->if_snd_tag_alloc = mlx5e_snd_tag_alloc; + ifp->if_snd_tag_free = mlx5e_snd_tag_free; + ifp->if_snd_tag_modify = mlx5e_snd_tag_modify; + ifp->if_snd_tag_query = mlx5e_snd_tag_query; /* set TSO limits so that we don't have to drop TX packets */ ifp->if_hw_tsomax = MLX5E_MAX_TX_PAYLOAD_SIZE - (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN); @@ -3838,6 +3972,13 @@ mlx5e_destroy_ifp(struct mlx5_core_dev *mdev, void *vp PRIV_LOCK(priv); mlx5e_close_locked(ifp); PRIV_UNLOCK(priv); + + /* wait for all unlimited send tags to go away */ + while (priv->channel_refs != 0) { + if_printf(priv->ifp, "Waiting for all unlimited connections " + "to terminate\n"); + pause("W", hz); + } /* unregister device */ ifmedia_removeall(&priv->media); Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c Wed Dec 5 14:24:33 2018 (r341585) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c Wed Dec 5 14:25:03 2018 (r341586) @@ -841,7 +841,8 @@ mlx5e_rl_init(struct mlx5e_priv *priv) for (i = 0; i < rl->param.tx_channels_per_worker_def; i++) { struct mlx5e_rl_channel *channel = rlw->channels + i; channel->worker = rlw; - channel->m_snd_tag.ifp = priv->ifp; + channel->tag.m_snd_tag.ifp = priv->ifp; + channel->tag.type = IF_SND_TAG_TYPE_RATE_LIMIT; STAILQ_INSERT_TAIL(&rlw->index_list_head, channel, entry); } MLX5E_RL_WORKER_UNLOCK(rlw); @@ -1038,17 +1039,21 @@ mlx5e_rl_modify(struct mlx5e_rl_worker *rlw, struct ml } static int -mlx5e_rl_query(struct mlx5e_rl_worker *rlw, struct mlx5e_rl_channel *channel, uint64_t *prate) +mlx5e_rl_query(struct mlx5e_rl_worker *rlw, struct mlx5e_rl_channel *channel, + union if_snd_tag_query_params *params) { int retval; MLX5E_RL_WORKER_LOCK(rlw); switch (channel->state) { case MLX5E_RL_ST_USED: - *prate = channel->last_rate; + params->rate_limit.max_rate = channel->last_rate; + params->rate_limit.queue_level = mlx5e_sq_queue_level(channel->sq); retval = 0; break; case MLX5E_RL_ST_MODIFY: + params->rate_limit.max_rate = channel->last_rate; + params->rate_limit.queue_level = mlx5e_sq_queue_level(channel->sq); retval = EBUSY; break; default: @@ -1120,7 +1125,7 @@ mlx5e_rl_snd_tag_alloc(struct ifnet *ifp, } /* store pointer to mbuf tag */ - *ppmt = &channel->m_snd_tag; + *ppmt = &channel->tag.m_snd_tag; done: return (error); } @@ -1130,7 +1135,7 @@ int mlx5e_rl_snd_tag_modify(struct m_snd_tag *pmt, union if_snd_tag_modify_params *params) { struct mlx5e_rl_channel *channel = - container_of(pmt, struct mlx5e_rl_channel, m_snd_tag); + container_of(pmt, struct mlx5e_rl_channel, tag.m_snd_tag); return (mlx5e_rl_modify(channel->worker, channel, params->rate_limit.max_rate)); } @@ -1139,16 +1144,16 @@ int mlx5e_rl_snd_tag_query(struct m_snd_tag *pmt, union if_snd_tag_query_params *params) { struct mlx5e_rl_channel *channel = - container_of(pmt, struct mlx5e_rl_channel, m_snd_tag); + container_of(pmt, struct mlx5e_rl_channel, tag.m_snd_tag); - return (mlx5e_rl_query(channel->worker, channel, ¶ms->rate_limit.max_rate)); + return (mlx5e_rl_query(channel->worker, channel, params)); } void mlx5e_rl_snd_tag_free(struct m_snd_tag *pmt) { struct mlx5e_rl_channel *channel = - container_of(pmt, struct mlx5e_rl_channel, m_snd_tag); + container_of(pmt, struct mlx5e_rl_channel, tag.m_snd_tag); mlx5e_rl_free(channel->worker, channel); } Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Wed Dec 5 14:24:33 2018 (r341585) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Wed Dec 5 14:25:03 2018 (r341586) @@ -78,6 +78,47 @@ SYSINIT(mlx5e_hash_init, SI_SUB_RANDOM, SI_ORDER_ANY, #endif static struct mlx5e_sq * +mlx5e_select_queue_by_send_tag(struct ifnet *ifp, struct mbuf *mb) +{ + struct mlx5e_snd_tag *ptag; + struct mlx5e_sq *sq; + + /* check for route change */ + if (mb->m_pkthdr.snd_tag->ifp != ifp) + return (NULL); + + /* get pointer to sendqueue */ + ptag = container_of(mb->m_pkthdr.snd_tag, + struct mlx5e_snd_tag, m_snd_tag); + + switch (ptag->type) { +#ifdef RATELIMIT + case IF_SND_TAG_TYPE_RATE_LIMIT: + sq = container_of(ptag, + struct mlx5e_rl_channel, tag)->sq; + break; +#endif + case IF_SND_TAG_TYPE_UNLIMITED: + sq = &container_of(ptag, + struct mlx5e_channel, tag)->sq[0]; + KASSERT(({ + struct mlx5e_priv *priv = ifp->if_softc; + priv->channel_refs > 0; }), + ("mlx5e_select_queue: Channel refs are zero for unlimited tag")); + break; + default: + sq = NULL; + break; + } + + /* check if valid */ + if (sq != NULL && READ_ONCE(sq->running) != 0) + return (sq); + + return (NULL); +} + +static struct mlx5e_sq * mlx5e_select_queue(struct ifnet *ifp, struct mbuf *mb) { struct mlx5e_priv *priv = ifp->if_softc; @@ -96,25 +137,6 @@ mlx5e_select_queue(struct ifnet *ifp, struct mbuf *mb) ch = priv->params.num_channels; -#ifdef RATELIMIT - if (mb->m_pkthdr.snd_tag != NULL) { - struct mlx5e_sq *sq; - - /* check for route change */ - if (mb->m_pkthdr.snd_tag->ifp != ifp) - return (NULL); - - /* get pointer to sendqueue */ - sq = container_of(mb->m_pkthdr.snd_tag, - struct mlx5e_rl_channel, m_snd_tag)->sq; - - /* check if valid */ - if (sq != NULL && sq->running != 0) - return (sq); - - /* FALLTHROUGH */ - } -#endif /* check if flowid is set */ if (M_HASHTYPE_GET(mb) != M_HASHTYPE_NONE) { #ifdef RSS @@ -587,27 +609,33 @@ mlx5e_xmit(struct ifnet *ifp, struct mbuf *mb) struct mlx5e_sq *sq; int ret; - sq = mlx5e_select_queue(ifp, mb); - if (unlikely(sq == NULL)) { -#ifdef RATELIMIT - /* Check for route change */ - if (mb->m_pkthdr.snd_tag != NULL && - mb->m_pkthdr.snd_tag->ifp != ifp) { + if (mb->m_pkthdr.snd_tag != NULL) { + sq = mlx5e_select_queue_by_send_tag(ifp, mb); + if (unlikely(sq == NULL)) { + /* Check for route change */ + if (mb->m_pkthdr.snd_tag->ifp != ifp) { + /* Free mbuf */ + m_freem(mb); + + /* + * Tell upper layers about route + * change and to re-transmit this + * packet: + */ + return (EAGAIN); + } + goto select_queue; + } + } else { +select_queue: + sq = mlx5e_select_queue(ifp, mb); + if (unlikely(sq == NULL)) { /* Free mbuf */ m_freem(mb); - /* - * Tell upper layers about route change and to - * re-transmit this packet: - */ - return (EAGAIN); + /* Invalid send queue */ + return (ENXIO); } -#endif - /* Free mbuf */ - m_freem(mb); - - /* Invalid send queue */ - return (ENXIO); } mtx_lock(&sq->lock); From owner-svn-src-head@freebsd.org Wed Dec 5 14:25:36 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D6FA41315ECC; Wed, 5 Dec 2018 14:25:35 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7E62C76232; Wed, 5 Dec 2018 14:25:35 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5AB4315991; Wed, 5 Dec 2018 14:25:35 +0000 (UTC) (envelope-from slavash@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5EPZfn004644; Wed, 5 Dec 2018 14:25:35 GMT (envelope-from slavash@FreeBSD.org) Received: (from slavash@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5EPY1e004639; Wed, 5 Dec 2018 14:25:34 GMT (envelope-from slavash@FreeBSD.org) Message-Id: <201812051425.wB5EPY1e004639@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slavash set sender to slavash@FreeBSD.org using -f From: Slava Shwartsman Date: Wed, 5 Dec 2018 14:25:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341587 - in head/sys/dev: mlx4/mlx4_core mlx4/mlx4_ib mlx5/mlx5_core mlx5/mlx5_en mlx5/mlx5_ib X-SVN-Group: head X-SVN-Commit-Author: slavash X-SVN-Commit-Paths: in head/sys/dev: mlx4/mlx4_core mlx4/mlx4_ib mlx5/mlx5_core mlx5/mlx5_en mlx5/mlx5_ib X-SVN-Commit-Revision: 341587 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7E62C76232 X-Spamd-Result: default: False [-0.80 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.52)[-0.521,0]; NEURAL_HAM_SHORT(-0.25)[-0.249,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.03)[-0.031,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 14:25:36 -0000 Author: slavash Date: Wed Dec 5 14:25:34 2018 New Revision: 341587 URL: https://svnweb.freebsd.org/changeset/base/341587 Log: mlx4/mlx5: Updated driver version to 3.5.0 Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx4/mlx4_core/mlx4.h head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c head/sys/dev/mlx5/mlx5_core/mlx5_core.h head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Modified: head/sys/dev/mlx4/mlx4_core/mlx4.h ============================================================================== --- head/sys/dev/mlx4/mlx4_core/mlx4.h Wed Dec 5 14:25:03 2018 (r341586) +++ head/sys/dev/mlx4/mlx4_core/mlx4.h Wed Dec 5 14:25:34 2018 (r341587) @@ -53,8 +53,8 @@ #define DRV_NAME "mlx4_core" #define PFX DRV_NAME ": " -#define DRV_VERSION "3.4.1" -#define DRV_RELDATE "October 2017" +#define DRV_VERSION "3.5.0" +#define DRV_RELDATE "November 2018" #define MLX4_FS_UDP_UC_EN (1 << 1) #define MLX4_FS_TCP_UC_EN (1 << 2) Modified: head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c ============================================================================== --- head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c Wed Dec 5 14:25:03 2018 (r341586) +++ head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c Wed Dec 5 14:25:34 2018 (r341587) @@ -64,9 +64,9 @@ #define DRV_NAME MLX4_IB_DRV_NAME #ifndef DRV_VERSION -#define DRV_VERSION "3.4.1" +#define DRV_VERSION "3.5.0" #endif -#define DRV_RELDATE "February 2018" +#define DRV_RELDATE "November 2018" #define MLX4_IB_FLOW_MAX_PRIO 0xFFF #define MLX4_IB_FLOW_QPN_MASK 0xFFFFFF Modified: head/sys/dev/mlx5/mlx5_core/mlx5_core.h ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_core.h Wed Dec 5 14:25:03 2018 (r341586) +++ head/sys/dev/mlx5/mlx5_core/mlx5_core.h Wed Dec 5 14:25:34 2018 (r341587) @@ -34,9 +34,9 @@ #define DRIVER_NAME "mlx5_core" #ifndef DRIVER_VERSION -#define DRIVER_VERSION "3.4.2" +#define DRIVER_VERSION "3.5.0" #endif -#define DRIVER_RELDATE "July 2018" +#define DRIVER_RELDATE "November 2018" extern int mlx5_core_debug_mask; Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 5 14:25:03 2018 (r341586) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 5 14:25:34 2018 (r341587) @@ -31,8 +31,9 @@ #include #ifndef ETH_DRIVER_VERSION -#define ETH_DRIVER_VERSION "3.4.2" +#define ETH_DRIVER_VERSION "3.5.0" #endif +#define DRIVER_RELDATE "November 2018" static const char mlx5e_version[] = "mlx5en: Mellanox Ethernet driver " ETH_DRIVER_VERSION " (" DRIVER_RELDATE ")\n"; Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Wed Dec 5 14:25:03 2018 (r341586) +++ head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Wed Dec 5 14:25:34 2018 (r341587) @@ -52,9 +52,9 @@ #define DRIVER_NAME "mlx5ib" #ifndef DRIVER_VERSION -#define DRIVER_VERSION "3.4.2" +#define DRIVER_VERSION "3.5.0" #endif -#define DRIVER_RELDATE "July 2018" +#define DRIVER_RELDATE "November 2018" MODULE_DESCRIPTION("Mellanox Connect-IB HCA IB driver"); MODULE_LICENSE("Dual BSD/GPL"); From owner-svn-src-head@freebsd.org Wed Dec 5 15:24:44 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1B8FF1317F79 for ; Wed, 5 Dec 2018 15:24:44 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from sonic313-10.consmr.mail.ne1.yahoo.com (sonic313-10.consmr.mail.ne1.yahoo.com [66.163.185.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A5FB97887D for ; Wed, 5 Dec 2018 15:24:43 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1544023483; bh=4Eu4MHwAILr1FlzH5rmEPVOaZx53iWPY/i2OhGmI9TI=; h=Subject:To:References:From:Date:In-Reply-To:From:Subject; b=PsMc31DDeCkJyj/SZxAfDgVh+VLLNWyIUu2mMJfS7nfFfRtRWQ7PvUYUr6SnCF6z3oU+XV4CsoSOH8DNI6pgaowFns42Bh1TcflUfUNqqt6rAuqBocH9E04kB/ovLKE7NByo9oY9AKiUmUran3R/jU4zjvSp8H/7zjk7dLNDWNZtCwiHj6E0lINcq8gsdleXiTa9iyZXne9KSgpqDRNcFvE9Hhx7IW2ui4JSSggCebdr/0fXs8+cWL3CIOw14uikYgjxIliWooIGd2GcLUzzIurYR7TUBATL6qcgM3Za8hY129a3TSsZEEew2wQCu7JIIyuDbWtcxlTX/ZXwMmapvA== X-YMail-OSG: v0QC9fIVM1n2ptGV_jKqSTGw1KjZ8CaoI0XkENXQptwI2NGN.6A2HuFx3xutlXZ Eq7iKmOBuuxn5wWrWEazCWJrw9rvECDj8z1QOzjhXDKICh0pAYIiPvxP6oXGDDnk0r0hQMHYpYHR J2UP4Gpbr1F93AlWQwoosDe8QfEajd2kIfMNMyeKayYa4QbKl_rvLx6sYWFl2Q3sp4LNUqIW932q Pl4DiNY2G7cL7FS50hK9US0oRoPrjxnnI60y00dYYOuDjynaLUrzTB2ZPwfcqNyPOaaZtapGXUfb Mg_jZziqSVd7qpYZPqBrAAwyBLhXsC.2yKfyL2Ue6wlTFC.xRyb8yVjmBo1OIPlVWfwqeSEjrvt1 XVaJedIHZ8dQGoq3byyjSgDrHFxi1xywOeDq6TSgX13qRhVTbawuUWJX98N_qz3QFQRa.AhifD8G tW7ulpd_SsBKdwURv_olGYML43f.SBylwGMN58YVGLzC9dQ23b_JTmWCp8ZZftUWtX6oAVSDAjZ7 wg80NhAGk3T6T3lB_1i9jvDSnuy3JRk9W4Fe7hqNOwchyLTWm923DbscQlSAn5srd5zKLIBfSTSc qs4KMwWTPIn7Xb7tS95jA1.AOXrvynOUzgaDkreYNQHS7Y_Fhqf1JLe6g4.aV.dAyoxs6quLPPG8 .hC4B94c4anC5EDDZn85YNbh3U7E663HD4vUIS_Qr7sqjLYbxtvfWRs6lmxvWTiMl_mccx6qCcjf gEAEPNO8yz4XVP8g1iIX4M.BozVwi8DaSXluOBWPKS2yh_aVCNnfK5FMewJnbZotST_EiVzs9hAb QENxqip4nam_leVzRdtnkazq6HT0ssinUakgWL0HZAkR0D_TxlnBOXlU_lttWpWpBInEWBdsATz0 ke6j27jR5STmfN.AvkIn0tP2..g5YB27646jxsX.XQBT0ZS3hN2RJmjsV4Bn4zuDJpFkmUoDtEH_ pg0vZROxBM62vXAyhn3KfnwIrTDHOnaMy6MPcsWMBesS_oEjZKgxEh5P094.e_WeOVM28ah.Lpi5 e_nJyfOTA3bsILwT_h7FKQFN1QA-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic313.consmr.mail.ne1.yahoo.com with HTTP; Wed, 5 Dec 2018 15:24:43 +0000 Received: from 181.52.72.201 (EHLO [192.168.0.6]) ([181.52.72.201]) by smtp407.mail.ne1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID f39ff07b9b4b80f6bea9b7f27a89dfc7; Wed, 05 Dec 2018 15:24:38 +0000 (UTC) Subject: Re: svn commit: r341505 - head/share/man/man5 To: koobs@FreeBSD.org, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201812042251.wB4MpE2m018782@repo.freebsd.org> <343a2f70-fb4c-bc5c-d32c-789e7797a628@FreeBSD.org> From: Pedro Giffuni Message-ID: <44199325-5b07-5195-1157-63c197eb5f07@FreeBSD.org> Date: Wed, 5 Dec 2018 10:24:40 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.3.2 MIME-Version: 1.0 In-Reply-To: <343a2f70-fb4c-bc5c-d32c-789e7797a628@FreeBSD.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Rspamd-Queue-Id: A5FB97887D X-Spamd-Result: default: False [-0.24 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.17)[-0.166,0]; ASN(0.00)[asn:36646, ipnet:66.163.184.0/21, country:US]; NEURAL_SPAM_SHORT(0.11)[0.106,0]; NEURAL_HAM_LONG(-0.18)[-0.184,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 15:24:44 -0000 On 12/5/18 12:06 AM, Kubilay Kocak wrote: > On 5/12/2018 9:51 am, Pedro F. Giffuni wrote: >> Starting with FreeBSD 12 we fully support writing ext4 filesystems > > Can we remove '2' from the module/man/etc name if (since) it supports > multiple extXfs versions? Is there anything serious preventing it? > Bad idea: neither us or linux support the old extfs format. It is a common misconception that ext3 or ext4 are different filesystems: they are both extensions over the ext2 format and they were always intended to work like that. You can currently create plain ext2 filesystems on FreeBSD and add ext3/4 features on top and it will work just fine. The distinction on linux about ext2/3/4 is rather accidental: they didn't master Version Control in time to branch instead of forking the implementation a couple of times. It also seems like ext3 disappeared. > Seems minor but I think worth it for discovery/pola/obviousness, and a > good time (early in the 13.0 cycle). > > We get a lot of user questions about ext*fs support on FreeBSD and > pointing to an ext2fs man page also feels a bit weird. > This has to be "fixed" through documentation. I will admit that I haven't been working properly on the documentation, other than trying to remember some details in the Wiki page. > Happy to get/organise a !committer contributor to take care of this if > no-one wants to pick it up. > I will be glad to review/commit manpage changes that make things clearer. We should probably even try to document the format, as I recall we do for FAT somewhere(?). Pedro. From owner-svn-src-head@freebsd.org Wed Dec 5 15:38:53 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1DB7A13182F0; Wed, 5 Dec 2018 15:38:53 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B036679347; Wed, 5 Dec 2018 15:38:52 +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 9132D16555; Wed, 5 Dec 2018 15:38:52 +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 wB5Fcqli041066; Wed, 5 Dec 2018 15:38:52 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5Fcqk3041065; Wed, 5 Dec 2018 15:38:52 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201812051538.wB5Fcqk3041065@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Wed, 5 Dec 2018 15:38:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341589 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 341589 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B036679347 X-Spamd-Result: default: False [-0.53 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; NEURAL_SPAM_SHORT(0.09)[0.085,0]; NEURAL_HAM_LONG(-0.07)[-0.072,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 15:38:53 -0000 Author: vmaffione Date: Wed Dec 5 15:38:52 2018 New Revision: 341589 URL: https://svnweb.freebsd.org/changeset/base/341589 Log: netmap.h: include stdatomic.h The stdatomic.h header exports atomic_thread_fence(), that can be used to implement the nm_stst_barrier() macro needed by netmap. MFC after: 3 days Modified: head/sys/net/netmap.h Modified: head/sys/net/netmap.h ============================================================================== --- head/sys/net/netmap.h Wed Dec 5 15:05:26 2018 (r341588) +++ head/sys/net/netmap.h Wed Dec 5 15:38:52 2018 (r341589) @@ -784,9 +784,10 @@ static inline void nm_stst_barrier(void) #ifdef _KERNEL #define nm_stst_barrier atomic_thread_fence_rel #else /* !_KERNEL */ +#include static inline void nm_stst_barrier(void) { - __atomic_thread_fence(__ATOMIC_RELEASE); + atomic_thread_fence(memory_order_release); } #endif /* !_KERNEL */ From owner-svn-src-head@freebsd.org Wed Dec 5 15:42:32 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 225141318547; Wed, 5 Dec 2018 15:42:32 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BD7C7797B6; Wed, 5 Dec 2018 15:42:31 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9EC07166E0; Wed, 5 Dec 2018 15:42:31 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5FgVC0045777; Wed, 5 Dec 2018 15:42:31 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5FgVHM045776; Wed, 5 Dec 2018 15:42:31 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201812051542.wB5FgVHM045776@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 5 Dec 2018 15:42:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341590 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 341590 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: BD7C7797B6 X-Spamd-Result: default: False [-0.53 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; NEURAL_SPAM_SHORT(0.09)[0.085,0]; NEURAL_HAM_LONG(-0.07)[-0.072,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 15:42:32 -0000 Author: hselasky Date: Wed Dec 5 15:42:31 2018 New Revision: 341590 URL: https://svnweb.freebsd.org/changeset/base/341590 Log: Fix LINT build after r341572. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Wed Dec 5 15:38:52 2018 (r341589) +++ head/sys/conf/files Wed Dec 5 15:42:31 2018 (r341590) @@ -4772,6 +4772,8 @@ dev/mlx5/mlx5_core/mlx5_vsc.c optional mlx5 pci \ compile-with "${OFED_C}" dev/mlx5/mlx5_core/mlx5_wq.c optional mlx5 pci \ compile-with "${OFED_C}" +dev/mlx5/mlx5_lib/mlx5_gid.c optional mlx5 pci \ + compile-with "${OFED_C}" dev/mlx5/mlx5_en/mlx5_en_ethtool.c optional mlx5en pci inet inet6 \ compile-with "${OFED_C}" From owner-svn-src-head@freebsd.org Wed Dec 5 15:53:35 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 87D4F1318DDB; Wed, 5 Dec 2018 15:53:35 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2AA1D7A3AE; Wed, 5 Dec 2018 15:53:35 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0B45C1689C; Wed, 5 Dec 2018 15:53:35 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5FrY2v052596; Wed, 5 Dec 2018 15:53:34 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5FrYid052595; Wed, 5 Dec 2018 15:53:34 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201812051553.wB5FrYid052595@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 5 Dec 2018 15:53:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341591 - head/sys/compat/linuxkpi/common/include/asm X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/asm X-SVN-Commit-Revision: 341591 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2AA1D7A3AE X-Spamd-Result: default: False [-0.68 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; NEURAL_HAM_SHORT(-0.06)[-0.062,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.07)[-0.072,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 15:53:35 -0000 Author: hselasky Date: Wed Dec 5 15:53:34 2018 New Revision: 341591 URL: https://svnweb.freebsd.org/changeset/base/341591 Log: Fix some build of LinuxKPI on some platforms after r341518. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/asm/atomic-long.h Modified: head/sys/compat/linuxkpi/common/include/asm/atomic-long.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/asm/atomic-long.h Wed Dec 5 15:42:31 2018 (r341590) +++ head/sys/compat/linuxkpi/common/include/asm/atomic-long.h Wed Dec 5 15:53:34 2018 (r341591) @@ -78,7 +78,15 @@ atomic_long_dec(atomic_long_t *v) static inline long atomic_long_xchg(atomic_long_t *v, long val) { +#if defined(__i386__) || defined(__amd64__) || defined(__aarch64__) return atomic_swap_long(&v->counter, val); +#else + long ret = atomic_long_read(v); + + while (!atomic_fcmpset_long(&v->counter, &ret, val)) + ; + return (ret); +#endif } static inline long From owner-svn-src-head@freebsd.org Wed Dec 5 15:56:45 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D2A301319021; Wed, 5 Dec 2018 15:56:45 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7AED07A6DE; Wed, 5 Dec 2018 15:56:45 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 45072168AC; Wed, 5 Dec 2018 15:56:45 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5FujT2052967; Wed, 5 Dec 2018 15:56:45 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5FujFg052966; Wed, 5 Dec 2018 15:56:45 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201812051556.wB5FujFg052966@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 5 Dec 2018 15:56:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341592 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 341592 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7AED07A6DE X-Spamd-Result: default: False [-0.68 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; NEURAL_HAM_SHORT(-0.06)[-0.062,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.07)[-0.072,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 15:56:46 -0000 Author: hselasky Date: Wed Dec 5 15:56:44 2018 New Revision: 341592 URL: https://svnweb.freebsd.org/changeset/base/341592 Log: Remove redundant declaration after r341517. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/idr.h Modified: head/sys/compat/linuxkpi/common/include/linux/idr.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/idr.h Wed Dec 5 15:53:34 2018 (r341591) +++ head/sys/compat/linuxkpi/common/include/linux/idr.h Wed Dec 5 15:56:44 2018 (r341592) @@ -91,7 +91,6 @@ void idr_init(struct idr *idp); int idr_alloc(struct idr *idp, void *ptr, int start, int end, gfp_t); int idr_alloc_cyclic(struct idr *idp, void *ptr, int start, int end, gfp_t); int idr_for_each(struct idr *idp, int (*fn)(int id, void *p, void *data), void *data); -bool idr_is_empty(struct idr *idp); #define idr_for_each_entry(idp, entry, id) \ for ((id) = 0; ((entry) = idr_get_next(idp, &(id))) != NULL; ++(id)) From owner-svn-src-head@freebsd.org Wed Dec 5 16:02:56 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B7B441319531; Wed, 5 Dec 2018 16:02:55 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5EC727AD1A; Wed, 5 Dec 2018 16:02:55 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from [192.168.1.5] (c-71-198-162-232.hsd1.ca.comcast.net [71.198.162.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: rpokala) by smtp.freebsd.org (Postfix) with ESMTPSA id 87A6B23998; Wed, 5 Dec 2018 16:02:54 +0000 (UTC) (envelope-from rpokala@freebsd.org) User-Agent: Microsoft-MacOutlook/10.13.0.181109 Date: Wed, 05 Dec 2018 08:02:50 -0800 Subject: Re: svn commit: r341505 - head/share/man/man5 From: Ravi Pokala To: Pedro Giffuni , , , , Message-ID: <11537130-DA0A-4F13-BC24-E5BCA6F2F12C@panasas.com> Thread-Topic: svn commit: r341505 - head/share/man/man5 References: <201812042251.wB4MpE2m018782@repo.freebsd.org> <343a2f70-fb4c-bc5c-d32c-789e7797a628@FreeBSD.org> <44199325-5b07-5195-1157-63c197eb5f07@FreeBSD.org> In-Reply-To: <44199325-5b07-5195-1157-63c197eb5f07@FreeBSD.org> Mime-version: 1.0 Content-type: text/plain; charset="UTF-8" Content-transfer-encoding: quoted-printable X-Rspamd-Queue-Id: 5EC727AD1A X-Spamd-Result: default: False [-1.96 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.77)[-0.774,0]; NEURAL_HAM_LONG(-0.54)[-0.542,0]; NEURAL_HAM_SHORT(-0.64)[-0.643,0]; ASN(0.00)[asn:11403, ipnet:96.47.64.0/20, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 16:02:56 -0000 > I will be glad to review/commit manpage changes that make things=20 > clearer. We should probably even try to document the format, as I recall=20 > we do for FAT somewhere(?). In addition to updating the manpage, perhaps also create links to it as ext= 3fs.5 and ext4fs.5? -Ravi (rpokala@) =EF=BB=BF-----Original Message----- From: on behalf of Pedro Giffuni Date: 2018-12-05, Wednesday at 07:24 To: , , , Subject: Re: svn commit: r341505 - head/share/man/man5 On 12/5/18 12:06 AM, Kubilay Kocak wrote: >> On 5/12/2018 9:51 am, Pedro F. Giffuni wrote: >>> Starting with FreeBSD 12 we fully support writing ext4 filesystems >> >> Can we remove '2' from the module/man/etc name if (since) it supports=20 >> multiple extXfs versions? Is there anything serious preventing it? >> > Bad idea: neither us or linux support the old extfs format. It is a=20 > common misconception that ext3 or ext4 are different filesystems: they=20 > are both extensions over the ext2 format and they were always intended=20 > to work like that. >=20 > You can currently create plain ext2 filesystems on FreeBSD and add=20 > ext3/4 features on top and it will work just fine. The distinction on=20 > linux about ext2/3/4 is rather accidental: they didn't master Version=20 > Control in time to branch instead of forking the implementation a couple=20 > of times. It also seems like ext3 disappeared. >=20 >> Seems minor but I think worth it for discovery/pola/obviousness, and a=20 >> good time (early in the 13.0 cycle). >> >> We get a lot of user questions about ext*fs support on FreeBSD and=20 >> pointing to an ext2fs man page also feels a bit weird. > > This has to be "fixed" through documentation. I will admit that I=20 > haven't been working properly on the documentation, other than trying to=20 > remember some details in the Wiki page. >=20 >> Happy to get/organise a !committer contributor to take care of this if=20 >> no-one wants to pick it up. > > I will be glad to review/commit manpage changes that make things=20 > clearer. We should probably even try to document the format, as I recall=20 > we do for FAT somewhere(?). >=20 > Pedro. From owner-svn-src-head@freebsd.org Wed Dec 5 16:23:08 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 556C1131A5D0; Wed, 5 Dec 2018 16:23:08 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8D11C7BA80; Wed, 5 Dec 2018 16:23:07 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id wB5GN5rp041646; Wed, 5 Dec 2018 08:23:05 -0800 (PST) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id wB5GN3HK041645; Wed, 5 Dec 2018 08:23:03 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201812051623.wB5GN3HK041645@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r341505 - head/share/man/man5 In-Reply-To: <44199325-5b07-5195-1157-63c197eb5f07@FreeBSD.org> To: Pedro Giffuni Date: Wed, 5 Dec 2018 08:23:03 -0800 (PST) CC: koobs@freebsd.org, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 8D11C7BA80 X-Spamd-Result: default: False [-0.73 / 15.00]; ARC_NA(0.00)[]; HAS_REPLYTO(0.00)[rgrimes@freebsd.org]; NEURAL_HAM_MEDIUM(-0.61)[-0.613,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-0.57)[-0.571,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[dnsmgr.net]; REPLYTO_DOM_NEQ_FROM_DOM(0.00)[]; AUTH_NA(1.00)[]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[3]; IP_SCORE(-0.02)[country: US(-0.09)]; MX_GOOD(-0.01)[cached: pdx.rh.CN85.dnsmgr.net]; NEURAL_HAM_SHORT(-0.42)[-0.416,0]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:13868, ipnet:69.59.192.0/19, country:US]; MID_RHS_MATCH_FROM(0.00)[] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 16:23:08 -0000 > On 12/5/18 12:06 AM, Kubilay Kocak wrote: > > On 5/12/2018 9:51 am, Pedro F. Giffuni wrote: > >> Starting with FreeBSD 12 we fully support writing ext4 filesystems > > > > Can we remove '2' from the module/man/etc name if (since) it supports > > multiple extXfs versions? Is there anything serious preventing it? > > > Bad idea: neither us or linux support the old extfs format. It is a > common misconception that ext3 or ext4 are different filesystems: they > are both extensions over the ext2 format and they were always intended > to work like that. > > You can currently create plain ext2 filesystems on FreeBSD and add > ext3/4 features on top and it will work just fine. The distinction on > linux about ext2/3/4 is rather accidental: they didn't master Version > Control in time to branch instead of forking the implementation a couple > of times. It also seems like ext3 disappeared. > > > > Seems minor but I think worth it for discovery/pola/obviousness, and a > > good time (early in the 13.0 cycle). > > > > We get a lot of user questions about ext*fs support on FreeBSD and > > pointing to an ext2fs man page also feels a bit weird. > > > This has to be "fixed" through documentation. I will admit that I > haven't been working properly on the documentation, other than trying to > remember some details in the Wiki page. One simple fix would be to add MLINKS for ext3fs and ext4fs so that you could refer a user to ext4fs. Then manual page itself already has a proper NAME entry, so infact hum, these links should already be in place, that appears to be an oversight. --- share/man/man5/Makefile.prior 2017-07-20 23:42:14.000000000 +0000 +++ share/man/man5/Makefile 2018-12-05 16:23:02.923541000 +0000 @@ -69,6 +69,8 @@ tmpfs.5 MLINKS= dir.5 dirent.5 +MLINKS+=ext2fs.5 ext3fs.5 +MLINKS+=ext2fs.5 ext4fs.5 MLINKS+=fs.5 inode.5 MLINKS+=hosts.equiv.5 rhosts.5 MLINKS+=msdosfs.5 msdos.5 > > Happy to get/organise a !committer contributor to take care of this if > > no-one wants to pick it up. > > > > I will be glad to review/commit manpage changes that make things > clearer. We should probably even try to document the format, as I recall > we do for FAT somewhere(?). > > Pedro. > > > > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Wed Dec 5 16:43:05 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4C953131B2CB; Wed, 5 Dec 2018 16:43:05 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E6D3C7CBD9; Wed, 5 Dec 2018 16:43:04 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ADB4E17142; Wed, 5 Dec 2018 16:43:04 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5Gh445078407; Wed, 5 Dec 2018 16:43:04 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5Gh45m078405; Wed, 5 Dec 2018 16:43:04 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201812051643.wB5Gh45m078405@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 5 Dec 2018 16:43:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341593 - in head/sys: contrib/vchiq/interface/compat kern sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: contrib/vchiq/interface/compat kern sys X-SVN-Commit-Revision: 341593 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E6D3C7CBD9 X-Spamd-Result: default: False [-0.68 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.52)[-0.521,0]; NEURAL_HAM_SHORT(-0.13)[-0.126,0]; NEURAL_HAM_LONG(-0.03)[-0.031,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 16:43:05 -0000 Author: mjg Date: Wed Dec 5 16:43:03 2018 New Revision: 341593 URL: https://svnweb.freebsd.org/changeset/base/341593 Log: sx: retire SX_NOADAPTIVE The flag is not used by anything for years and supporting it requires an explicit read from the lock when entering slow path. Flag value is left unused on purpose. Sponsored by: The FreeBSD Foundation Modified: head/sys/contrib/vchiq/interface/compat/vchi_bsd.h head/sys/kern/kern_sx.c head/sys/sys/sx.h Modified: head/sys/contrib/vchiq/interface/compat/vchi_bsd.h ============================================================================== --- head/sys/contrib/vchiq/interface/compat/vchi_bsd.h Wed Dec 5 15:56:44 2018 (r341592) +++ head/sys/contrib/vchiq/interface/compat/vchi_bsd.h Wed Dec 5 16:43:03 2018 (r341593) @@ -162,10 +162,6 @@ struct mutex { */ typedef struct rwlock rwlock_t; -#if defined(SX_ADAPTIVESPIN) && !defined(SX_NOADAPTIVE) -#define SX_NOADAPTIVE SX_ADAPTIVESPIN -#endif - #define DEFINE_RWLOCK(name) \ struct rwlock name; \ SX_SYSINIT(name, &name, #name) Modified: head/sys/kern/kern_sx.c ============================================================================== --- head/sys/kern/kern_sx.c Wed Dec 5 15:56:44 2018 (r341592) +++ head/sys/kern/kern_sx.c Wed Dec 5 16:43:03 2018 (r341593) @@ -71,8 +71,6 @@ __FBSDID("$FreeBSD$"); #define ADAPTIVE_SX #endif -CTASSERT((SX_NOADAPTIVE & LO_CLASSFLAGS) == SX_NOADAPTIVE); - #ifdef HWPMC_HOOKS #include PMC_SOFT_DECLARE( , , lock, failed); @@ -233,7 +231,7 @@ sx_init_flags(struct sx *sx, const char *description, int flags; MPASS((opts & ~(SX_QUIET | SX_RECURSE | SX_NOWITNESS | SX_DUPOK | - SX_NOPROFILE | SX_NOADAPTIVE | SX_NEW)) == 0); + SX_NOPROFILE | SX_NEW)) == 0); ASSERT_ATOMIC_LOAD_PTR(sx->sx_lock, ("%s: sx_lock not aligned for %s: %p", __func__, description, &sx->sx_lock)); @@ -252,7 +250,6 @@ sx_init_flags(struct sx *sx, const char *description, if (opts & SX_NEW) flags |= LO_NEW; - flags |= opts & SX_NOADAPTIVE; lock_init(&sx->lock_object, &lock_class_sx, description, NULL, flags); sx->sx_lock = SX_LOCK_UNLOCKED; sx->sx_recurse = 0; @@ -572,7 +569,6 @@ _sx_xlock_hard(struct sx *sx, uintptr_t x, int opts LO volatile struct thread *owner; u_int i, n, spintries = 0; enum { READERS, WRITER } sleep_reason = READERS; - bool adaptive; bool in_critical = false; #endif #ifdef LOCK_PROFILING @@ -642,10 +638,6 @@ _sx_xlock_hard(struct sx *sx, uintptr_t x, int opts LO CTR5(KTR_LOCK, "%s: %s contested (lock=%p) at %s:%d", __func__, sx->lock_object.lo_name, (void *)sx->sx_lock, file, line); -#ifdef ADAPTIVE_SX - adaptive = ((sx->lock_object.lo_flags & SX_NOADAPTIVE) == 0); -#endif - #ifdef HWPMC_HOOKS PMC_SOFT_CALL( , , lock, failed); #endif @@ -669,8 +661,6 @@ _sx_xlock_hard(struct sx *sx, uintptr_t x, int opts LO lda.spin_cnt++; #endif #ifdef ADAPTIVE_SX - if (__predict_false(!adaptive)) - goto sleepq; /* * If the lock is write locked and the owner is * running on another CPU, spin until the owner stops @@ -762,20 +752,18 @@ retry_sleepq: * chain lock. If so, drop the sleep queue lock and try * again. */ - if (adaptive) { - if (!(x & SX_LOCK_SHARED)) { - owner = (struct thread *)SX_OWNER(x); - if (TD_IS_RUNNING(owner)) { - sleepq_release(&sx->lock_object); - sx_drop_critical(x, &in_critical, - &extra_work); - continue; - } - } else if (SX_SHARERS(x) > 0 && sleep_reason == WRITER) { + if (!(x & SX_LOCK_SHARED)) { + owner = (struct thread *)SX_OWNER(x); + if (TD_IS_RUNNING(owner)) { sleepq_release(&sx->lock_object); - sx_drop_critical(x, &in_critical, &extra_work); + sx_drop_critical(x, &in_critical, + &extra_work); continue; } + } else if (SX_SHARERS(x) > 0 && sleep_reason == WRITER) { + sleepq_release(&sx->lock_object); + sx_drop_critical(x, &in_critical, &extra_work); + continue; } #endif @@ -1021,7 +1009,6 @@ _sx_slock_hard(struct sx *sx, int opts, uintptr_t x LO #ifdef ADAPTIVE_SX volatile struct thread *owner; u_int i, n, spintries = 0; - bool adaptive; #endif #ifdef LOCK_PROFILING uint64_t waittime = 0; @@ -1066,10 +1053,6 @@ _sx_slock_hard(struct sx *sx, int opts, uintptr_t x LO lock_delay_arg_init(&lda, NULL); #endif -#ifdef ADAPTIVE_SX - adaptive = ((sx->lock_object.lo_flags & SX_NOADAPTIVE) == 0); -#endif - #ifdef HWPMC_HOOKS PMC_SOFT_CALL( , , lock, failed); #endif @@ -1095,9 +1078,6 @@ _sx_slock_hard(struct sx *sx, int opts, uintptr_t x LO #endif #ifdef ADAPTIVE_SX - if (__predict_false(!adaptive)) - goto sleepq; - /* * If the owner is running on another CPU, spin until * the owner stops running or the state of the lock @@ -1154,7 +1134,6 @@ _sx_slock_hard(struct sx *sx, int opts, uintptr_t x LO continue; } } -sleepq: #endif /* @@ -1176,7 +1155,7 @@ retry_sleepq: * the owner stops running or the state of the lock * changes. */ - if (!(x & SX_LOCK_SHARED) && adaptive) { + if (!(x & SX_LOCK_SHARED)) { owner = (struct thread *)SX_OWNER(x); if (TD_IS_RUNNING(owner)) { sleepq_release(&sx->lock_object); Modified: head/sys/sys/sx.h ============================================================================== --- head/sys/sys/sx.h Wed Dec 5 15:56:44 2018 (r341592) +++ head/sys/sys/sx.h Wed Dec 5 16:43:03 2018 (r341593) @@ -273,7 +273,6 @@ __sx_xunlock(struct sx *sx, struct thread *td, const c #define SX_NOPROFILE 0x02 #define SX_NOWITNESS 0x04 #define SX_QUIET 0x08 -#define SX_NOADAPTIVE 0x10 #define SX_RECURSE 0x20 #define SX_NEW 0x40 From owner-svn-src-head@freebsd.org Wed Dec 5 16:55:46 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CC086131BA3E; Wed, 5 Dec 2018 16:55:46 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6E24C7D5A7; Wed, 5 Dec 2018 16:55:46 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 479D4172E1; Wed, 5 Dec 2018 16:55:46 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5GtkcJ083669; Wed, 5 Dec 2018 16:55:46 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5GtktR083668; Wed, 5 Dec 2018 16:55:46 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201812051655.wB5GtktR083668@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 5 Dec 2018 16:55:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341594 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 341594 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6E24C7D5A7 X-Spamd-Result: default: False [-1.02 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; NEURAL_HAM_LONG(-0.07)[-0.072,0]; NEURAL_HAM_SHORT(-0.40)[-0.405,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 16:55:47 -0000 Author: markj Date: Wed Dec 5 16:55:45 2018 New Revision: 341594 URL: https://svnweb.freebsd.org/changeset/base/341594 Log: Netdump support was added to mlx4en(4) in r341548. MFC with: r341548 Modified: head/share/man/man4/netdump.4 Modified: head/share/man/man4/netdump.4 ============================================================================== --- head/share/man/man4/netdump.4 Wed Dec 5 16:43:03 2018 (r341593) +++ head/share/man/man4/netdump.4 Wed Dec 5 16:55:45 2018 (r341594) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 29, 2018 +.Dd December 5, 2018 .Dt NETDUMP 4 .Os .Sh NAME @@ -105,6 +105,7 @@ The following network drivers support netdump: .Xr em 4 , .Xr igb 4 , .Xr ix 4 , +.Xr mlx4en 4 , .Xr re 4 , .Xr vtnet 4 . .Sh SYSCTL VARIABLES From owner-svn-src-head@freebsd.org Wed Dec 5 17:06:02 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D3B6013213CE; Wed, 5 Dec 2018 17:06:01 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2531A7DE11; Wed, 5 Dec 2018 17:06:01 +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 05E7C174AB; Wed, 5 Dec 2018 17:06:01 +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 wB5H60vn088851; Wed, 5 Dec 2018 17:06:00 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5H60eE088848; Wed, 5 Dec 2018 17:06:00 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201812051706.wB5H60eE088848@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 5 Dec 2018 17:06:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341595 - in head/sys: netinet netinet6 X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys: netinet netinet6 X-SVN-Commit-Revision: 341595 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2531A7DE11 X-Spamd-Result: default: False [-0.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.52)[-0.521,0]; NEURAL_HAM_LONG(-0.03)[-0.031,0]; NEURAL_HAM_SHORT(-0.41)[-0.413,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 17:06:02 -0000 Author: markj Date: Wed Dec 5 17:06:00 2018 New Revision: 341595 URL: https://svnweb.freebsd.org/changeset/base/341595 Log: Clamp the INPCB port hash tables to IPPORT_MAX + 1 chains. Memory beyond that limit was previously unused, wasting roughly 1MB per 8GB of RAM. Also retire INP_PCBLBGROUP_PORTHASH, which was identical to INP_PCBPORTHASH. Reviewed by: glebius MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D17803 Modified: head/sys/netinet/in_pcb.c head/sys/netinet/in_pcb.h head/sys/netinet6/in6_pcb.c Modified: head/sys/netinet/in_pcb.c ============================================================================== --- head/sys/netinet/in_pcb.c Wed Dec 5 16:55:45 2018 (r341594) +++ head/sys/netinet/in_pcb.c Wed Dec 5 17:06:00 2018 (r341595) @@ -339,8 +339,7 @@ in_pcbinslbgrouphash(struct inpcb *inp) } #endif - idx = INP_PCBLBGROUP_PORTHASH(inp->inp_lport, - pcbinfo->ipi_lbgrouphashmask); + idx = INP_PCBPORTHASH(inp->inp_lport, pcbinfo->ipi_lbgrouphashmask); hdr = &pcbinfo->ipi_lbgrouphashbase[idx]; CK_LIST_FOREACH(grp, hdr, il_list) { if (grp->il_vflag == inp->inp_vflag && @@ -397,9 +396,7 @@ in_pcbremlbgrouphash(struct inpcb *inp) INP_HASH_WLOCK_ASSERT(pcbinfo); hdr = &pcbinfo->ipi_lbgrouphashbase[ - INP_PCBLBGROUP_PORTHASH(inp->inp_lport, - pcbinfo->ipi_lbgrouphashmask)]; - + INP_PCBPORTHASH(inp->inp_lport, pcbinfo->ipi_lbgrouphashmask)]; CK_LIST_FOREACH(grp, hdr, il_list) { for (i = 0; i < grp->il_inpcnt; ++i) { if (grp->il_inp[i] != inp) @@ -439,6 +436,8 @@ in_pcbinfo_init(struct inpcbinfo *pcbinfo, const char char *inpcbzone_name, uma_init inpcbzone_init, u_int hashfields) { + porthash_nelements = imin(porthash_nelements, IPPORT_MAX + 1); + INP_INFO_LOCK_INIT(pcbinfo, name); INP_HASH_LOCK_INIT(pcbinfo, "pcbinfohash"); /* XXXRW: argument? */ INP_LIST_LOCK_INIT(pcbinfo, "pcbinfolist"); @@ -452,7 +451,7 @@ in_pcbinfo_init(struct inpcbinfo *pcbinfo, const char &pcbinfo->ipi_hashmask); pcbinfo->ipi_porthashbase = hashinit(porthash_nelements, M_PCB, &pcbinfo->ipi_porthashmask); - pcbinfo->ipi_lbgrouphashbase = hashinit(hash_nelements, M_PCB, + pcbinfo->ipi_lbgrouphashbase = hashinit(porthash_nelements, M_PCB, &pcbinfo->ipi_lbgrouphashmask); #ifdef PCBGROUP in_pcbgroup_init(pcbinfo, hashfields, hash_nelements); @@ -1950,8 +1949,8 @@ in_pcblookup_lbgroup(const struct inpcbinfo *pcbinfo, INP_HASH_LOCK_ASSERT(pcbinfo); - hdr = &pcbinfo->ipi_lbgrouphashbase[INP_PCBLBGROUP_PORTHASH(lport, - pcbinfo->ipi_lbgrouphashmask)]; + hdr = &pcbinfo->ipi_lbgrouphashbase[ + INP_PCBPORTHASH(lport, pcbinfo->ipi_lbgrouphashmask)]; /* * Order of socket selection: Modified: head/sys/netinet/in_pcb.h ============================================================================== --- head/sys/netinet/in_pcb.h Wed Dec 5 16:55:45 2018 (r341594) +++ head/sys/netinet/in_pcb.h Wed Dec 5 17:06:00 2018 (r341595) @@ -688,8 +688,6 @@ int inp_so_options(const struct inpcb *inp); (((faddr) ^ ((faddr) >> 16) ^ ntohs((lport) ^ (fport))) & (mask)) #define INP_PCBPORTHASH(lport, mask) \ (ntohs((lport)) & (mask)) -#define INP_PCBLBGROUP_PORTHASH(lport, mask) \ - (ntohs((lport)) & (mask)) #define INP_PCBLBGROUP_PKTHASH(faddr, lport, fport) \ ((faddr) ^ ((faddr) >> 16) ^ ntohs((lport) ^ (fport))) #define INP6_PCBHASHKEY(faddr) ((faddr)->s6_addr32[3]) Modified: head/sys/netinet6/in6_pcb.c ============================================================================== --- head/sys/netinet6/in6_pcb.c Wed Dec 5 16:55:45 2018 (r341594) +++ head/sys/netinet6/in6_pcb.c Wed Dec 5 17:06:00 2018 (r341595) @@ -880,8 +880,8 @@ in6_pcblookup_lbgroup(const struct inpcbinfo *pcbinfo, INP_HASH_LOCK_ASSERT(pcbinfo); - hdr = &pcbinfo->ipi_lbgrouphashbase[INP_PCBLBGROUP_PORTHASH( - lport, pcbinfo->ipi_lbgrouphashmask)]; + hdr = &pcbinfo->ipi_lbgrouphashbase[ + INP_PCBPORTHASH(lport, pcbinfo->ipi_lbgrouphashmask)]; /* * Order of socket selection: From owner-svn-src-head@freebsd.org Wed Dec 5 17:28:41 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7249F1321E3D; Wed, 5 Dec 2018 17:28:41 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 183957F37A; Wed, 5 Dec 2018 17:28:41 +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 E913317858; Wed, 5 Dec 2018 17:28:40 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5HSe30099328; Wed, 5 Dec 2018 17:28:40 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5HSes8099327; Wed, 5 Dec 2018 17:28:40 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201812051728.wB5HSes8099327@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Wed, 5 Dec 2018 17:28:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341598 - head/lib/libc/sys X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/lib/libc/sys X-SVN-Commit-Revision: 341598 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 183957F37A X-Spamd-Result: default: False [-0.86 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; NEURAL_HAM_LONG(-0.07)[-0.072,0]; NEURAL_HAM_SHORT(-0.25)[-0.247,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 17:28:41 -0000 Author: asomers Date: Wed Dec 5 17:28:40 2018 New Revision: 341598 URL: https://svnweb.freebsd.org/changeset/base/341598 Log: stat(2): clarify which syscalls modify file timestamps The list of syscalls that modify st_atim, st_mtim, and st_ctim was quite out of date and probably not accurate to begin with. Update it, and make it clear that the list is open-ended. Reviewed by: kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D18410 Modified: head/lib/libc/sys/stat.2 Modified: head/lib/libc/sys/stat.2 ============================================================================== --- head/lib/libc/sys/stat.2 Wed Dec 5 17:13:33 2018 (r341597) +++ head/lib/libc/sys/stat.2 Wed Dec 5 17:28:40 2018 (r341598) @@ -28,7 +28,7 @@ .\" @(#)stat.2 8.4 (Berkeley) 5/1/95 .\" $FreeBSD$ .\" -.Dd November 11, 2018 +.Dd December 5, 2018 .Dt STAT 2 .Os .Sh NAME @@ -193,45 +193,53 @@ are: .Bl -tag -width ".Va st_birthtim" .It Va st_atim Time when file data was last accessed. -Changed by the -.Xr mknod 2 , -.Xr utimes 2 , +Changed implicitly by syscalls such as .Xr read 2 and -.Xr readv 2 -system calls. +.Xr readv 2 , +and explicitly by +.Xr utimes 2 . .It Va st_mtim Time when file data was last modified. -Changed by the +Changed implicitly by syscalls such as +.Xr truncate 2 , +.Xr write 2 , +and +.Xr writev 2 , +and explicitly by +.Xr utimes 2 . +Also, any syscall which modifies directory content changes the +.Va st_mtim +for the affected directory. +For instance, +.Xr creat 2 , .Xr mkdir 2 , -.Xr mkfifo 2 , -.Xr mknod 2 , -.Xr utimes 2 , -.Xr write 2 +.Xr rename 2 , +.Xr link 2 , and -.Xr writev 2 -system calls. +.Xr unlink 2 . .It Va st_ctim Time when file status was last changed (inode data modification). -Changed by the +Changed implicitly by any syscall that affects file metadata, including +.Va st_mtim , +such as .Xr chflags 2 , .Xr chmod 2 , .Xr chown 2 , +.Xr truncate 2 , +.Xr utimes 2 , +and +.Xr write 2 . +Also, any syscall which modifies directory content changes the +.Va st_ctim +for the affected directory. +For instance, .Xr creat 2 , -.Xr link 2 , .Xr mkdir 2 , -.Xr mkfifo 2 , -.Xr mknod 2 , .Xr rename 2 , -.Xr rmdir 2 , -.Xr symlink 2 , -.Xr truncate 2 , -.Xr unlink 2 , -.Xr utimes 2 , -.Xr write 2 +.Xr link 2 , and -.Xr writev 2 -system calls. +.Xr unlink 2 . .It Va st_birthtim Time when the inode was created. .El From owner-svn-src-head@freebsd.org Wed Dec 5 17:29:15 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0DF7A1321EB3; Wed, 5 Dec 2018 17:29:15 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A853A7F588; Wed, 5 Dec 2018 17:29:14 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8AA271785B; Wed, 5 Dec 2018 17:29:14 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5HTEQw099536; Wed, 5 Dec 2018 17:29:14 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5HTEfj099535; Wed, 5 Dec 2018 17:29:14 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201812051729.wB5HTEfj099535@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 5 Dec 2018 17:29:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341599 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 341599 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A853A7F588 X-Spamd-Result: default: False [-0.86 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; NEURAL_HAM_LONG(-0.07)[-0.072,0]; NEURAL_HAM_SHORT(-0.25)[-0.247,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 17:29:15 -0000 Author: brooks Date: Wed Dec 5 17:29:14 2018 New Revision: 341599 URL: https://svnweb.freebsd.org/changeset/base/341599 Log: Remove ifdef BOOTCDROM option to start init. When BOOTCDROM is defined (via CFLAGS as there is no config option) it causes -C to be passed to init, but our init and the version of sysinstall I glanced at in 6.x don't support -C. The last plausibly related support was removed from the tree in 1995. Reviewed by: kib Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D18431 Modified: head/sys/kern/init_main.c Modified: head/sys/kern/init_main.c ============================================================================== --- head/sys/kern/init_main.c Wed Dec 5 17:28:40 2018 (r341598) +++ head/sys/kern/init_main.c Wed Dec 5 17:29:14 2018 (r341599) @@ -775,10 +775,6 @@ start_init(void *dummy) options++; } #endif -#ifdef BOOTCDROM - *flagp++ = 'C'; - options++; -#endif if (options == 0) *flagp++ = '-'; *flagp++ = 0; From owner-svn-src-head@freebsd.org Wed Dec 5 17:35:16 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 12D69132224C; Wed, 5 Dec 2018 17:35:16 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A5C947FABD; Wed, 5 Dec 2018 17:35:15 +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 8662E17A12; Wed, 5 Dec 2018 17:35:15 +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 wB5HZFvi004518; Wed, 5 Dec 2018 17:35:15 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5HZFuc004517; Wed, 5 Dec 2018 17:35:15 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201812051735.wB5HZFuc004517@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 5 Dec 2018 17:35:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341600 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 341600 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A5C947FABD X-Spamd-Result: default: False [-0.86 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.543,0]; NEURAL_HAM_SHORT(-0.25)[-0.247,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.07)[-0.072,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 17:35:16 -0000 Author: brooks Date: Wed Dec 5 17:35:15 2018 New Revision: 341600 URL: https://svnweb.freebsd.org/changeset/base/341600 Log: Remove never enabled support for "fastboot". This has been ifdef notyet since the import of BSD 4.4 Lite Kernel Sources in r1541. Sponsored by: DARPA, AFRL Modified: head/sys/kern/init_main.c Modified: head/sys/kern/init_main.c ============================================================================== --- head/sys/kern/init_main.c Wed Dec 5 17:29:14 2018 (r341599) +++ head/sys/kern/init_main.c Wed Dec 5 17:35:15 2018 (r341600) @@ -769,12 +769,6 @@ start_init(void *dummy) *flagp++ = 's'; options++; } -#ifdef notyet - if (boothowto & RB_FASTBOOT) { - *flagp++ = 'f'; - options++; - } -#endif if (options == 0) *flagp++ = '-'; *flagp++ = 0; From owner-svn-src-head@freebsd.org Wed Dec 5 17:42:12 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6B6C61322585; Wed, 5 Dec 2018 17:42:12 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-it1-f169.google.com (mail-it1-f169.google.com [209.85.166.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C2CCA7FF99; Wed, 5 Dec 2018 17:42:11 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-it1-f169.google.com with SMTP id h65so21493904ith.3; Wed, 05 Dec 2018 09:42:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc:content-transfer-encoding; bh=WNkq4qdpyP08HR0WHXx9Xb4JieudjLkY0MhTS7Fg3nY=; b=t+iVdl6Cie/cJ3SAmzi4z7k3Dh0VQtX3X7bvYKZyz+4Sq3cItHScTln45Mebd0uSyG 6jmEw5M3Ct1iT7sjB90f1X51zBou+GfHW6meDojrqsLNXF/YAxXiSo/OaA14cWzx1Www iO6EbMvy1/lUrrH3V24QjBBTdmY+NLzDO37qeoBuP2GfbDeWg3Uxu24sWGKuI1W4g9wy oetIOL0CkGysy2qqsSSzphXiroddtg3Y6iqZ7jxLUw/LmFJywsllQ03FeMEGg9ocG+HJ FsfRoHCYpYit/YcG3qAbSvKx3ur1Uj5AsjfaAOO8n5A53fGGiFgIZvsMVjQxhrO1x9mb n0Yg== X-Gm-Message-State: AA+aEWa//0y7WImb5gqGMFU7vNOUEdY2PT68O9zcZ7PLJyjieKtv1y/r o6te/daDqEOEgNZTw4jAOtrMRswV X-Google-Smtp-Source: AFSGD/WKFZk4Nv4SBApJV0+2kGxiSh/WV5CAkLeO8XnxBeivQWR7fWbMr7B2mVBLb3UR8RDgNfiEWQ== X-Received: by 2002:a24:7dd5:: with SMTP id b204mr16852998itc.105.1544031724719; Wed, 05 Dec 2018 09:42:04 -0800 (PST) Received: from mail-it1-f180.google.com (mail-it1-f180.google.com. [209.85.166.180]) by smtp.gmail.com with ESMTPSA id o18sm4011355ioh.31.2018.12.05.09.42.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Dec 2018 09:42:04 -0800 (PST) Received: by mail-it1-f180.google.com with SMTP id c9so21532816itj.1; Wed, 05 Dec 2018 09:42:04 -0800 (PST) X-Received: by 2002:a24:2f82:: with SMTP id j124mr14979954itj.166.1544031724154; Wed, 05 Dec 2018 09:42:04 -0800 (PST) MIME-Version: 1.0 References: <201812042251.wB4MpE2m018782@repo.freebsd.org> <343a2f70-fb4c-bc5c-d32c-789e7797a628@FreeBSD.org> <44199325-5b07-5195-1157-63c197eb5f07@FreeBSD.org> In-Reply-To: <44199325-5b07-5195-1157-63c197eb5f07@FreeBSD.org> Reply-To: cem@freebsd.org From: Conrad Meyer Date: Wed, 5 Dec 2018 09:41:53 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r341505 - head/share/man/man5 To: Pedro Giffuni Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: C2CCA7FF99 X-Spamd-Result: default: False [-5.82 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; HAS_REPLYTO(0.00)[cem@freebsd.org]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[freebsd.org]; TO_DN_SOME(0.00)[]; REPLYTO_ADDR_EQ_FROM(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCVD_COUNT_THREE(0.00)[4]; IP_SCORE(-2.84)[ip: (-9.33), ipnet: 209.85.128.0/17(-3.49), asn: 15169(-1.29), country: US(-0.09)]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; NEURAL_HAM_SHORT(-0.97)[-0.970,0]; RCVD_IN_DNSWL_NONE(0.00)[169.166.85.209.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FORGED_SENDER(0.30)[cem@freebsd.org,csecem@gmail.com]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; TAGGED_FROM(0.00)[]; FROM_NEQ_ENVFROM(0.00)[cem@freebsd.org,csecem@gmail.com] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 17:42:12 -0000 On Wed, Dec 5, 2018 at 7:24 AM Pedro Giffuni wrote: > On 12/5/18 12:06 AM, Kubilay Kocak wrote: > > Can we remove '2' from the module/man/etc name if (since) it supports > > multiple extXfs versions? Is there anything serious preventing it? > > You can currently create plain ext2 filesystems on FreeBSD and add > ext3/4 features on top and it will work just fine. The distinction on > linux about ext2/3/4 is rather accidental: they didn't master Version > Control in time to branch instead of forking the implementation a couple > of times. It also seems like ext3 disappeared. The Linux model is that the current incarnation of the ext2/3/4 driver is named "ext4," and that's what Linux users expect. You can mount any ext2/3/4 filesystem with the Linux ext4 driver. For ext4, it was a result of wanting to keep ext3 stable while developing ext4 in-tree. (For a while, it was called "ext4dev"). ext4 is long-since stabilized and ext3 became fully redundant with ext4, so I guess they dropped it. I think we should just follow that convention and rename ext2fs to ext4fs. We can mention support for the less-used ancient ext2/3 in a COMPATIBILITY section or something, if we don't already, but ext4 has been the go-to basic Linux filesystem for a decade. (Seriously: "On 11 October 2008, the patches that mark ext4 as stable code were merged in the Linux 2.6.28.") If we support ext4, call it ext4. My 2=C2=A2, Conrad From owner-svn-src-head@freebsd.org Wed Dec 5 18:19:30 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 17A1C1323750; Wed, 5 Dec 2018 18:19:30 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ACCA18184F; Wed, 5 Dec 2018 18:19:29 +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 8A0CA1809F; Wed, 5 Dec 2018 18:19:29 +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 wB5IJT8M025790; Wed, 5 Dec 2018 18:19:29 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5IJTHl025789; Wed, 5 Dec 2018 18:19:29 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201812051819.wB5IJTHl025789@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 5 Dec 2018 18:19:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341601 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 341601 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: ACCA18184F X-Spamd-Result: default: False [-0.61 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.47)[-0.467,0]; NEURAL_HAM_LONG(-0.11)[-0.112,0]; NEURAL_HAM_SHORT(-0.03)[-0.029,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 18:19:30 -0000 Author: markj Date: Wed Dec 5 18:19:29 2018 New Revision: 341601 URL: https://svnweb.freebsd.org/changeset/base/341601 Log: ixl(4) has netdump support via iflib. Reported by: kbowling MFC after: 3 days Modified: head/share/man/man4/netdump.4 Modified: head/share/man/man4/netdump.4 ============================================================================== --- head/share/man/man4/netdump.4 Wed Dec 5 17:35:15 2018 (r341600) +++ head/share/man/man4/netdump.4 Wed Dec 5 18:19:29 2018 (r341601) @@ -105,6 +105,7 @@ The following network drivers support netdump: .Xr em 4 , .Xr igb 4 , .Xr ix 4 , +.Xr ixl 4 , .Xr mlx4en 4 , .Xr re 4 , .Xr vtnet 4 . From owner-svn-src-head@freebsd.org Wed Dec 5 18:26:41 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 936941323A4D; Wed, 5 Dec 2018 18:26:41 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1E9E68257E; Wed, 5 Dec 2018 18:26:41 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E88B51824A; Wed, 5 Dec 2018 18:26:40 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5IQeQh030783; Wed, 5 Dec 2018 18:26:40 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5IQesA030782; Wed, 5 Dec 2018 18:26:40 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201812051826.wB5IQesA030782@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Wed, 5 Dec 2018 18:26:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341602 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 341602 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1E9E68257E X-Spamd-Result: default: False [-0.55 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.45)[-0.445,0]; NEURAL_HAM_SHORT(-0.03)[-0.025,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.08)[-0.083,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 18:26:41 -0000 Author: alc Date: Wed Dec 5 18:26:40 2018 New Revision: 341602 URL: https://svnweb.freebsd.org/changeset/base/341602 Log: Terminate a blist_alloc search when a blst_meta_alloc call fails with cursor == 0. Every call to blst_meta_alloc but the one at the root is made only when the meta-node is known to include a free block, so that either the allocation will succeed, the node hint will be updated, or the last block of the meta- node range is, and remains, free. But the call at the root is made without checking that there is a free block, so in the case that every block is allocated, there is no hint update to prevent the current code from looping forever. Submitted by: Doug Moore Reported by: pho Reviewed by: pho Tested by: pho X-MFC with: r340402 Differential Revision: https://reviews.freebsd.org/D17999 Modified: head/sys/kern/subr_blist.c Modified: head/sys/kern/subr_blist.c ============================================================================== --- head/sys/kern/subr_blist.c Wed Dec 5 18:19:29 2018 (r341601) +++ head/sys/kern/subr_blist.c Wed Dec 5 18:26:40 2018 (r341602) @@ -295,9 +295,9 @@ blist_alloc(blist_t bl, daddr_t count) * This loop iterates at most twice. An allocation failure in the * first iteration leads to a second iteration only if the cursor was * non-zero. When the cursor is zero, an allocation failure will - * reduce the hint, stopping further iterations. + * stop further iterations. */ - while (count <= bl->bl_root->bm_bighint) { + for (;;) { blk = blst_meta_alloc(bl->bl_root, bl->bl_cursor, count, bl->bl_radix); if (blk != SWAPBLK_NONE) { @@ -306,10 +306,10 @@ blist_alloc(blist_t bl, daddr_t count) if (bl->bl_cursor == bl->bl_blocks) bl->bl_cursor = 0; return (blk); - } + } else if (bl->bl_cursor == 0) + return (SWAPBLK_NONE); bl->bl_cursor = 0; } - return (SWAPBLK_NONE); } /* From owner-svn-src-head@freebsd.org Wed Dec 5 18:47:00 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1AF5F1324076 for ; Wed, 5 Dec 2018 18:47:00 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from sonic313-20.consmr.mail.gq1.yahoo.com (sonic313-20.consmr.mail.gq1.yahoo.com [98.137.65.83]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6954E83189 for ; Wed, 5 Dec 2018 18:46:59 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1544035617; bh=SkQoh6+UPTyKJn20OY/Lnb8eAvu4LVTBKFM3bica/3w=; h=From:Subject:To:Cc:References:Date:In-Reply-To:From:Subject; b=i8Ijwx7RbzEGBAmI6gd80XPlhj2L339tctxve1pvrT6Ga0wOwxew3PXw31rRkamT8Rl5FbkpP05mX1hlj/OJGON8CifaN8G0gHr7BWyZZBU2OAzYy1CHf//1a87spQsX5Y8GD6E4zhJ0/3HxIv5tPgKIdzd4UirG1bc5utQUEZvSL3v/c49+BWtk1wTGI7vfalT8M6LGHeHpRP8At+8QuROdKhAWm8O5mywwfyrOdGGymWPIMnABXC2sJSn0LiXpXAjCHvJNhMloW3GyozfBmI8IZ4kdDa+QYsX3Ohztbg41LAJQx0tAKKjeNRraCXNsZl6cwSzfm/vWy+j1XFH/zQ== X-YMail-OSG: HzQQQtMVM1msBJa4UWEHtG.JPich_npVxm6BondEy86pGTQ0eMIB6..vTqV.VyK SmFirK5w1Zeo9geyMb6JtO7ESkSeyVNEp1y_folZmhEFYOCSTln_CLyUFMlpG3b7Z8l9OLA7Jpzb wTJIMTPML6X1DLmt4cX_3FgqpEOaBaSga41OJd9reAVnk_Qqb5q.QRCtvg7Xd58xUuMUkXCMF1qc 8b95WEC_whfuiLjB2xDXSUzIucggMA2jvGEMEfD3LPstyahjHKDLHWeMe_yDerVSMaEHzEGroN0L 9xiWvIGOhvn_RzhT7moEb3GmIfkeMJCb8RGl89rSt6f8kEYEmgtDwcE0pkNytD26DcmNAukEiC.x 8o_jKrIMyvrbx63w_7BCA2cbKvjTe08Bu.iLD6bOTBNjnzsHHwHQRW0FhCJ5PsAgWTmgGwPOYfjR eyka8gY96lQAjr5tS2gCB7YLSTbtxXVVLhhlmwZGOFDiPtyucyHjO00JJ8ggQKLg.lO_kDzuMNcA qNZ2NKS_qfs4Wp1O_6eQ96QdIUx7I0Toa1km3G.D9jVlcka4MwfhbyTSWV.g9GeJQheX0owdoZaV cQGx0AsgtJVbjYdkanEYut3WNpJ9ANyXB__leEeJbteNhEuDYmzacGE8aqUpsHtKFb7TG_oZodh8 pTSavFUgm9bSF80XRm58wExVnyOomwPSpMgSJPuFPGZCMbN57Pjxa3m9Yf6K..wnXzCxvFnt4NLG gtkDyn3kXhstJ.15t7Lqqu6Cj_uxi_dodX7SrAJfbPkQYLRBmg713fyIVaALP5CJ8Yrduue60FOi aDH3Vnlwg5LDnpb5aajsMkCOFxXHr0p4X00WJ8EAAYrP0bJe9l1YiFIPSh062SsO_RU3JEqkiGYi Vp5k3Cn4MjqJpCcTJH4uMjKaPrFktnDxz2uaovKzNKeumPWHhvM7ZmRsayR8hv61gGUqp..Pz9Nu tTATjAy_i8QD3jR6gb076S6IJIkN7lDUcZrah5.ElPWDU86i5jA3VUWeG220h7xpI8SwGj4eIN96 hvRnn8XsTbuvGDRV23rM0gAl.LA-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic313.consmr.mail.gq1.yahoo.com with HTTP; Wed, 5 Dec 2018 18:46:57 +0000 Received: from 181.52.72.201 (EHLO [192.168.0.6]) ([181.52.72.201]) by smtp401.mail.gq1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID a253ee1785c5e9afa46d8f685d48883b; Wed, 05 Dec 2018 18:46:53 +0000 (UTC) From: Pedro Giffuni Subject: Re: svn commit: r341505 - head/share/man/man5 To: cem@freebsd.org Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201812042251.wB4MpE2m018782@repo.freebsd.org> <343a2f70-fb4c-bc5c-d32c-789e7797a628@FreeBSD.org> <44199325-5b07-5195-1157-63c197eb5f07@FreeBSD.org> Organization: FreeBSD Project Message-ID: <2b9783a8-9254-4b70-65c8-7e27b43b0726@FreeBSD.org> Date: Wed, 5 Dec 2018 13:46:54 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.3.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Rspamd-Queue-Id: 6954E83189 X-Spamd-Result: default: False [-0.30 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.06)[-0.064,0]; NEURAL_HAM_SHORT(-0.15)[-0.147,0]; NEURAL_HAM_LONG(-0.09)[-0.091,0]; ASN(0.00)[asn:36647, ipnet:98.137.64.0/21, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 18:47:00 -0000 On 05/12/2018 12:41, Conrad Meyer wrote: > On Wed, Dec 5, 2018 at 7:24 AM Pedro Giffuni wrote: >> On 12/5/18 12:06 AM, Kubilay Kocak wrote: >>> Can we remove '2' from the module/man/etc name if (since) it supports >>> multiple extXfs versions? Is there anything serious preventing it? >> You can currently create plain ext2 filesystems on FreeBSD and add >> ext3/4 features on top and it will work just fine. The distinction on >> linux about ext2/3/4 is rather accidental: they didn't master Version >> Control in time to branch instead of forking the implementation a couple >> of times. It also seems like ext3 disappeared. > The Linux model is that the current incarnation of the ext2/3/4 driver > is named "ext4," and that's what Linux users expect. You can mount > any ext2/3/4 filesystem with the Linux ext4 driver. For ext4, it was > a result of wanting to keep ext3 stable while developing ext4 in-tree. > (For a while, it was called "ext4dev"). ext4 is long-since stabilized > and ext3 became fully redundant with ext4, so I guess they dropped it. From a linux user/marketing perspective you are right. Are we sure there will never be an ext5fs? I would hate to start moving a filesystem in the tree every time a new release comes out. > I think we should just follow that convention and rename ext2fs to > ext4fs. We can mention support for the less-used ancient ext2/3 in a > COMPATIBILITY section or something, if we don't already, but ext4 has > been the go-to basic Linux filesystem for a decade. (Seriously: "On > 11 October 2008, the patches that mark ext4 as stable code were merged > in the Linux 2.6.28.") If we support ext4, call it ext4. We do support enough of ext4 that we could call it ext4 ... OTOH, the implementation is pretty much UFS1 plus ext2/3/4 extensions. I like it as it is because people looking at the code will find out exactly where it all comes from: we are currently doing no effort keep up to date with what ext4 does and we are focusing on compatibility.  For now I think adding a link in the documentation as others have suggested is enough. > My 2¢, > Conrad Thanks! All feedback is appreciated. Pedro. From owner-svn-src-head@freebsd.org Wed Dec 5 18:56:49 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 365CA1324A43; Wed, 5 Dec 2018 18:56:49 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-it1-f180.google.com (mail-it1-f180.google.com [209.85.166.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8EAFB84EF2; Wed, 5 Dec 2018 18:56:48 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-it1-f180.google.com with SMTP id b5so21902214iti.2; Wed, 05 Dec 2018 10:56:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=JScy33BtMVaZO6oS9fCMjURD4GIMBehpNQLo+KGB6Ho=; b=b5Fg9c4egMqIw+7W2EsnzHlNQvVGFhFujoehjkFnHD1+oVN15f636LxWFUapB61r1w M0PrkjQLX1Q7iNCAmmiYo5AkgEBOk36bmRof97ohIR0Aywf6W9jWO7FtXp/iO90GdYU0 cQ+a8u1Fz7kniN0Ab4lc0BKYB65m+9jxo3PSat8kWG0qPRqkBKUe5/Rg5HRyNt8+xfLI g0NTrYlJ1zKU65otKcva3UKeUPrffE3NQK0PTDjUrxd7D3H0p8HyQWFawCatHW7J/+Sf 3zRuR8wmB8JcvF92soFImzAO+f61E98tKm+ds410vD1irn813GVaZLIH2Ca/2HcdUn/E uTZw== X-Gm-Message-State: AA+aEWanS5htHv1Tte83JLm/CHY7/erAsVrF+RmM3bRO3wjUOCh6oQKq YQtr97xDArkwXvzupxM7evfNBS0e X-Google-Smtp-Source: AFSGD/WhtpOWiHCtth+yrVmsWcK4wcEze5TJ5eiADT97NcBY+dyhPRhHS1tHraanwcX7p82/bR3hQQ== X-Received: by 2002:a24:5608:: with SMTP id o8mr9708992itb.35.1544036202265; Wed, 05 Dec 2018 10:56:42 -0800 (PST) Received: from mail-it1-f182.google.com (mail-it1-f182.google.com. [209.85.166.182]) by smtp.gmail.com with ESMTPSA id n16sm8415344iom.58.2018.12.05.10.56.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Dec 2018 10:56:42 -0800 (PST) Received: by mail-it1-f182.google.com with SMTP id c9so21915126itj.1; Wed, 05 Dec 2018 10:56:41 -0800 (PST) X-Received: by 2002:a24:b64a:: with SMTP id d10mr9917817itj.149.1544036201685; Wed, 05 Dec 2018 10:56:41 -0800 (PST) MIME-Version: 1.0 References: <201812042251.wB4MpE2m018782@repo.freebsd.org> <343a2f70-fb4c-bc5c-d32c-789e7797a628@FreeBSD.org> <44199325-5b07-5195-1157-63c197eb5f07@FreeBSD.org> <2b9783a8-9254-4b70-65c8-7e27b43b0726@FreeBSD.org> In-Reply-To: <2b9783a8-9254-4b70-65c8-7e27b43b0726@FreeBSD.org> Reply-To: cem@freebsd.org From: Conrad Meyer Date: Wed, 5 Dec 2018 10:56:30 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r341505 - head/share/man/man5 To: Pedro Giffuni Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 8EAFB84EF2 X-Spamd-Result: default: False [-5.65 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; HAS_REPLYTO(0.00)[cem@freebsd.org]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; REPLYTO_ADDR_EQ_FROM(0.00)[]; RCVD_COUNT_THREE(0.00)[4]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; NEURAL_HAM_SHORT(-0.99)[-0.993,0]; FORGED_SENDER(0.30)[cem@freebsd.org,csecem@gmail.com]; RCVD_TLS_LAST(0.00)[]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; TAGGED_FROM(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_NEQ_ENVFROM(0.00)[cem@freebsd.org,csecem@gmail.com]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.org]; IP_SCORE(-2.65)[ip: (-8.38), ipnet: 209.85.128.0/17(-3.48), asn: 15169(-1.30), country: US(-0.09)]; RCVD_IN_DNSWL_NONE(0.00)[180.166.85.209.list.dnswl.org : 127.0.5.0]; RWL_MAILSPIKE_POSSIBLE(0.00)[180.166.85.209.rep.mailspike.net : 127.0.0.17] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 18:56:49 -0000 On Wed, Dec 5, 2018 at 10:47 AM Pedro Giffuni wrote: > On 05/12/2018 12:41, Conrad Meyer wrote: > > The Linux model is that the current incarnation of the ext2/3/4 driver > > is named "ext4," and that's what Linux users expect. You can mount > > any ext2/3/4 filesystem with the Linux ext4 driver. For ext4, it was > > a result of wanting to keep ext3 stable while developing ext4 in-tree. > > (For a while, it was called "ext4dev"). ext4 is long-since stabilized > > and ext3 became fully redundant with ext4, so I guess they dropped it. > > From a linux user/marketing perspective you are right. > > Are we sure there will never be an ext5fs? I would hate to start moving > a filesystem in the tree every time a new release comes out. While I think we can be reasonably confident ext4 is the last one, it's somewhat irrelevant. Linux isn't spawning new extN's at anything like the frequency we do releases; ext3 was current from about 2001 to 2008, and ext4 from 2008 to present. On top of that, there's no particular reason the source code location in the tree has to be tied to the name of the driver, or that mount(8) couldn't do the right thing given any "-t ext[234]" or "-t ext[234]fs". Best, Conrad From owner-svn-src-head@freebsd.org Wed Dec 5 19:18:17 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5F0771324F0E; Wed, 5 Dec 2018 19:18:17 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F05C085A3F; Wed, 5 Dec 2018 19:18:16 +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 CCDA118A9E; Wed, 5 Dec 2018 19:18:16 +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 wB5JIGEA060428; Wed, 5 Dec 2018 19:18:16 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5JIGxo060427; Wed, 5 Dec 2018 19:18:16 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201812051918.wB5JIGxo060427@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 5 Dec 2018 19:18:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341604 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 341604 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: F05C085A3F X-Spamd-Result: default: False [-0.11 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.45)[-0.445,0]; NEURAL_SPAM_SHORT(0.41)[0.414,0]; NEURAL_HAM_LONG(-0.08)[-0.083,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 19:18:17 -0000 Author: brooks Date: Wed Dec 5 19:18:16 2018 New Revision: 341604 URL: https://svnweb.freebsd.org/changeset/base/341604 Log: Further simplify arguments to init. With the removal of BOOTCDROM and fastboot support, this code always passed "-s" or "--". The latter simply terminates getopt(3) processing in init so we only need to pass "-s" in the single user case, or nothing in other cases. The passing of "--" seems to have been done to ensure that the number of arguments passed to init was always the same and thus that argc was the same. Also GC the write-only variable pathlen (not in reviewed version). Reviewed by: kib, jhb Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D18441 Modified: head/sys/kern/init_main.c Modified: head/sys/kern/init_main.c ============================================================================== --- head/sys/kern/init_main.c Wed Dec 5 19:16:12 2018 (r341603) +++ head/sys/kern/init_main.c Wed Dec 5 19:18:16 2018 (r341604) @@ -718,9 +718,7 @@ static void start_init(void *dummy) { struct image_args args; - int options, error; - size_t pathlen; - char flags[8], *flagp; + int error; char *var, *path; char *free_init_path, *tmp_init_path; struct thread *td; @@ -744,7 +742,6 @@ start_init(void *dummy) free_init_path = tmp_init_path = strdup(init_path, M_TEMP); while ((path = strsep(&tmp_init_path, ":")) != NULL) { - pathlen = strlen(path) + 1; if (bootverbose) printf("start_init: trying %s\n", path); @@ -757,23 +754,11 @@ start_init(void *dummy) error = exec_args_add_fname(&args, path, UIO_SYSSPACE); if (error != 0) panic("%s: Can't add fname %d", __func__, error); - error = exec_args_add_arg(&args, path, UIO_SYSSPACE); if (error != 0) panic("%s: Can't add argv[0] %d", __func__, error); - - options = 0; - flagp = &flags[0]; - *flagp++ = '-'; - if (boothowto & RB_SINGLE) { - *flagp++ = 's'; - options++; - } - if (options == 0) - *flagp++ = '-'; - *flagp++ = 0; - KASSERT(flagp <= &flags[0] + sizeof(flags), ("Overran flags")); - error = exec_args_add_arg(&args, flags, UIO_SYSSPACE); + if (boothowto & RB_SINGLE) + error = exec_args_add_arg(&args, "-s", UIO_SYSSPACE); if (error != 0) panic("%s: Can't add argv[0] %d", __func__, error); From owner-svn-src-head@freebsd.org Wed Dec 5 19:53:10 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 94C521325CD0; Wed, 5 Dec 2018 19:53:10 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 39D6F86FDB; Wed, 5 Dec 2018 19:53:10 +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 1A9B919196; Wed, 5 Dec 2018 19:53:10 +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 wB5Jr9a3081178; Wed, 5 Dec 2018 19:53:09 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5Jr9Im081177; Wed, 5 Dec 2018 19:53:09 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201812051953.wB5Jr9Im081177@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Wed, 5 Dec 2018 19:53:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341605 - head/tests/sys/netpfil/pf X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/tests/sys/netpfil/pf X-SVN-Commit-Revision: 341605 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 39D6F86FDB X-Spamd-Result: default: False [-0.11 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.45)[-0.445,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_SPAM_SHORT(0.41)[0.414,0]; NEURAL_HAM_LONG(-0.08)[-0.083,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 19:53:10 -0000 Author: kp Date: Wed Dec 5 19:53:09 2018 New Revision: 341605 URL: https://svnweb.freebsd.org/changeset/base/341605 Log: pf tests: Add a defer mode test for pfsync Repeat the pfsync test, this time with the 'defer' option enabled. This exercises slightly different code paths. Modified: head/tests/sys/netpfil/pf/pfsync.sh Modified: head/tests/sys/netpfil/pf/pfsync.sh ============================================================================== --- head/tests/sys/netpfil/pf/pfsync.sh Wed Dec 5 19:18:16 2018 (r341604) +++ head/tests/sys/netpfil/pf/pfsync.sh Wed Dec 5 19:53:09 2018 (r341605) @@ -7,12 +7,16 @@ basic_head() { atf_set descr 'Basic pfsync test' atf_set require.user root - - atf_set require.progs scapy } basic_body() { + common_body +} + +common_body() +{ + defer=$1 pfsynct_init epair_sync=$(pft_mkepair) @@ -28,12 +32,14 @@ basic_body() jexec one ifconfig pfsync0 \ syncdev ${epair_sync}a \ maxupd 1 \ + $defer \ up jexec two ifconfig ${epair_two}a 198.51.100.2/24 up jexec two ifconfig ${epair_sync}b 192.0.2.2/24 up jexec two ifconfig pfsync0 \ syncdev ${epair_sync}b \ maxupd 1 \ + $defer \ up # Enable pf! @@ -64,7 +70,25 @@ basic_cleanup() pfsynct_cleanup } +atf_test_case "defer" "cleanup" +defer_head() +{ + atf_set descr 'Defer mode pfsync test' + atf_set require.user root +} + +defer_body() +{ + common_body defer +} + +defer_cleanup() +{ + pfsynct_cleanup +} + atf_init_test_cases() { atf_add_test_case "basic" + atf_add_test_case "defer" } From owner-svn-src-head@freebsd.org Wed Dec 5 20:23:13 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F374E1326608; Wed, 5 Dec 2018 20:23:12 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by mx1.freebsd.org (Postfix) with ESMTP id 798996A384; Wed, 5 Dec 2018 20:23:10 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id 0EE99435E55; Thu, 6 Dec 2018 07:23:02 +1100 (AEDT) Date: Thu, 6 Dec 2018 07:23:01 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Alan Somers cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r341598 - head/lib/libc/sys In-Reply-To: <201812051728.wB5HSes8099327@repo.freebsd.org> Message-ID: <20181206062019.I3775@besplex.bde.org> References: <201812051728.wB5HSes8099327@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=P6RKvmIu c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=SbwDSD-lIzFxxfcz6sIA:9 a=CjuIK1q_8ugA:10 X-Rspamd-Queue-Id: 798996A384 X-Spamd-Result: default: False [-5.79 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:211.29.132.0/23]; FREEMAIL_FROM(0.00)[optusnet.com.au]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DMARC_NA(0.00)[optusnet.com.au]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; IP_SCORE(-2.50)[ip: (-5.08), ipnet: 211.28.0.0/14(-4.10), asn: 4804(-3.28), country: AU(-0.04)]; MX_GOOD(-0.01)[cached: extmail.optusnet.com.au]; NEURAL_HAM_SHORT(-0.97)[-0.975,0]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[optusnet.com.au]; ASN(0.00)[asn:4804, ipnet:211.28.0.0/14, country:AU]; RCVD_COUNT_TWO(0.00)[2]; RCVD_IN_DNSWL_LOW(-0.10)[246.132.29.211.list.dnswl.org : 127.0.5.1] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 20:23:13 -0000 On Wed, 5 Dec 2018, Alan Somers wrote: > Log: > stat(2): clarify which syscalls modify file timestamps > > The list of syscalls that modify st_atim, st_mtim, and st_ctim was quite out > of date and probably not accurate to begin with. Update it, and make it > clear that the list is open-ended. These fields shouldn't exist. They are misimplemented compatibility cruft. They didn't exist in FreeBSD-4. They were correctly implemented compatibility cruft then. The POSIX fields are still only time_t's with names st_atime, etc., but these fields are timespecs with necessarily different names. In FreeBSD-4, they were named st_atimespec, etc. unless POSIX_SOURCE is defined, which before about 2007 POSIX required struct timespec to not be defined, so the fields were declared as 2 scalars st_atime and st_atimensec, etc. Padding of the scalars caused ABI problems which I fixed in FreeBSD-5 using bit-fields. Now the support for POSIX before about 2007 is broken by declaring struct timespec undonditionally and using it for st_atim, etc. API compatibility with old versions of FreeBSD is broken by renaming st_atimespec to st_atim, etc. All versions that use timespecs use macro hacks of dubious standard conformance to convert from timespecs to POSIX time_t's. All names starting with st_ are reserved if is included. This is what makes it conforming for the implementation to use st_atim, etc. It is less clear if the macros conform because it would be non-conforming for a an application to #undef st_atim or depend on st_atim not being a macro. > Modified: head/lib/libc/sys/stat.2 > ============================================================================== > --- head/lib/libc/sys/stat.2 Wed Dec 5 17:13:33 2018 (r341597) > +++ head/lib/libc/sys/stat.2 Wed Dec 5 17:28:40 2018 (r341598) > ... > @@ -193,45 +193,53 @@ are: > .Bl -tag -width ".Va st_birthtim" > .It Va st_atim > Time when file data was last accessed. > -Changed by the > -.Xr mknod 2 , Not changed by mknod, but set by it. Still set by it. > -.Xr utimes 2 , Not really changed if the change is null, where a null change may be the result of rounding to a representable value. Permissions are still required for making null changes. Similarly for most operations. > +Changed implicitly by syscalls such as > .Xr read 2 > and > -.Xr readv 2 > -system calls. > +.Xr readv 2 , Not changed by reads if the file system is mounted -noatime and the file system supports this (you can't tell if the file system supports this by examining its MNT_NOATIME flag). Not changed if granularity makes the change null. > +and explicitly by > +.Xr utimes 2 . The lists would be even longer if they mentioned utime, lutimes, futimes, futimesat, futimens and futimnsat. > .It Va st_mtim > Time when file data was last modified. > -Changed by the > +Changed implicitly by syscalls such as > +.Xr truncate 2 , > +.Xr write 2 , > +and > +.Xr writev 2 , > +and explicitly by > +.Xr utimes 2 . > +Also, any syscall which modifies directory content changes the > +.Va st_mtim > +for the affected directory. > +For instance, > +.Xr creat 2 , Usually spelled open with O_CREAT. > .Xr mkdir 2 , creat, open with O_CREAT, link, symlink, mkdir and all of the removed mk's also set all times. > -.Xr mkfifo 2 , > -.Xr mknod 2 , > -.Xr utimes 2 , > -.Xr write 2 > +.Xr rename 2 , > +.Xr link 2 , rename to a different directory changes 2 sets of directory times. link is unsorted in this and another list. > ... > +.Xr link 2 , > and > -.Xr writev 2 > -system calls. > +.Xr unlink 2 . > .It Va st_birthtim > Time when the inode was created. > .El st_birthim should be named st_btime. st_birthtim is set by all creation operations. It is changed by changing st_mtim to a value before the current st_birthtim. This is done at the vfs level, so it should work for all file systems that support birthtimes. Changing st_birthtime forwards is not supported by any syscall. There are already about 10 times too many syscalls for setting times, but none of them supports setting birthtimes or ctimes. I use a sysctl hack to set ctimes, as needed to back up and restore them, but don't do anything special for birthtimes. Bruce From owner-svn-src-head@freebsd.org Wed Dec 5 20:36:23 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8F2541326C83; Wed, 5 Dec 2018 20:36:23 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by mx1.freebsd.org (Postfix) with ESMTP id 47CE66AB4D; Wed, 5 Dec 2018 20:36:18 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id 9207D105419D; Thu, 6 Dec 2018 07:36:09 +1100 (AEDT) Date: Thu, 6 Dec 2018 07:36:08 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Bruce Evans cc: Alan Somers , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r341598 - head/lib/libc/sys In-Reply-To: <20181206062019.I3775@besplex.bde.org> Message-ID: <20181206072628.M4013@besplex.bde.org> References: <201812051728.wB5HSes8099327@repo.freebsd.org> <20181206062019.I3775@besplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=DZtnkrlW c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=0pmM3Sw-5W8GaYEX4bUA:9 a=CjuIK1q_8ugA:10 X-Rspamd-Queue-Id: 47CE66AB4D X-Spamd-Result: default: False [-6.48 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[optusnet.com.au]; R_SPF_ALLOW(-0.20)[+ip4:211.29.132.0/23]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[optusnet.com.au]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MX_GOOD(-0.01)[extmail.optusnet.com.au]; NEURAL_HAM_SHORT(-0.98)[-0.977,0]; IP_SCORE(-3.19)[ip: (-8.47), ipnet: 211.28.0.0/14(-4.14), asn: 4804(-3.31), country: AU(-0.04)]; FREEMAIL_TO(0.00)[optusnet.com.au]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[optusnet.com.au]; ASN(0.00)[asn:4804, ipnet:211.28.0.0/14, country:AU]; RCVD_COUNT_TWO(0.00)[2]; RCVD_IN_DNSWL_LOW(-0.10)[249.132.29.211.list.dnswl.org : 127.0.5.1] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 20:36:23 -0000 On Thu, 6 Dec 2018, Bruce Evans wrote: > On Wed, 5 Dec 2018, Alan Somers wrote: > >> Log: >> stat(2): clarify which syscalls modify file timestamps >> ... > > These fields shouldn't exist. They are misimplemented compatibility cruft. > ... > which I fixed in FreeBSD-5 using bit-fields. Now the support for POSIX > before about 2007 is broken by declaring struct timespec undonditionally > and using it for st_atim, etc. API compatibility with old versions of > FreeBSD is broken by renaming st_atimespec to st_atim, etc. API compatibility with old versions of FreeBSD is actually preserved using another macro hack (define st_atimespec as st_atime, etc.). This uses a correct visibility ifdef, but the man page says that it uses a different, incorrect one. The man page only attempts to document the ifdef tangles for st_*tim*. > ... Bruce From owner-svn-src-head@freebsd.org Wed Dec 5 21:03:49 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CA07B13274BD; Wed, 5 Dec 2018 21:03:48 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3D58F6B93D; Wed, 5 Dec 2018 21:03:48 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-2.local (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id 435E210AFD2; Wed, 5 Dec 2018 16:03:47 -0500 (EST) Subject: Re: svn commit: r341375 - head/sys/vm To: Konstantin Belousov , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201812011650.wB1GoD4x047126@repo.freebsd.org> From: John Baldwin Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= xsDiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg80eSm9obiBCYWxk d2luIDxqb2huQGJhbGR3aW4uY3g+wmMEExECACMCGwMGCwkIBwMCBBUCCAMEFgIDAQIeAQIX gAUCRND5wwIZAQAKCRBy3lIGd+N/BNLXAJ9KIb6teuDL1W+FkCgvv+y8PxKTkACeIUfbn3sl cueBzqTcf09idwa8YTbOwU0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Ds gnr31AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh +GojXlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cM SOrHYUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOF QVHOEVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq 1tqzhltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZ TwtXsNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m 7Z164yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioI AjjHaIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbU KWwxQ4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjH uW/CSQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZN wwCfafMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: <723183fb-4d91-ec12-5246-a9b1db07bd28@FreeBSD.org> Date: Wed, 5 Dec 2018 12:18:40 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <201812011650.wB1GoD4x047126@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Wed, 05 Dec 2018 16:03:47 -0500 (EST) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-Rspamd-Queue-Id: 3D58F6B93D X-Spamd-Result: default: False [-0.84 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.79)[-0.788,0]; NEURAL_SPAM_SHORT(0.57)[0.572,0]; NEURAL_HAM_LONG(-0.62)[-0.622,0]; ASN(0.00)[asn:11403, ipnet:96.47.64.0/20, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 05 Dec 2018 21:03:49 -0000 On 12/1/18 8:50 AM, Konstantin Belousov wrote: > Author: kib > Date: Sat Dec 1 16:50:12 2018 > New Revision: 341375 > URL: https://svnweb.freebsd.org/changeset/base/341375 > > Log: > Allow to create swap zone larger than v_page_count / 2. > > If user configured the maxswapzone tunable, just take the literal > value for the initial zone sizing attempt. Before, it was only > possible to reduce the zone by the tunable. Thank you for fixing this. A couple of times I've run into the issue where the tunable can't raise the value which has been super annoying. -- John Baldwin                                                                              From owner-svn-src-head@freebsd.org Thu Dec 6 00:09:43 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E3D98132B4E2; Thu, 6 Dec 2018 00:09:42 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9653C7113D; Thu, 6 Dec 2018 00:09:42 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5D2B11B9E3; Thu, 6 Dec 2018 00:09:42 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB609gk2011142; Thu, 6 Dec 2018 00:09:42 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB609d7G011127; Thu, 6 Dec 2018 00:09:39 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201812060009.wB609d7G011127@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Thu, 6 Dec 2018 00:09:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341608 - in head: lib/libufs sbin/dump sbin/fsck_ffs sbin/fsirand sbin/growfs sbin/quotacheck stand/libsa sys/geom/journal sys/geom/label sys/ufs/ffs usr.sbin/fstyp usr.sbin/quot X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: in head: lib/libufs sbin/dump sbin/fsck_ffs sbin/fsirand sbin/growfs sbin/quotacheck stand/libsa sys/geom/journal sys/geom/label sys/ufs/ffs usr.sbin/fstyp usr.sbin/quot X-SVN-Commit-Revision: 341608 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9653C7113D X-Spamd-Result: default: False [-0.71 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.40)[-0.399,0]; NEURAL_HAM_SHORT(-0.29)[-0.290,0]; NEURAL_HAM_LONG(-0.02)[-0.024,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 06 Dec 2018 00:09:43 -0000 Author: mckusick Date: Thu Dec 6 00:09:39 2018 New Revision: 341608 URL: https://svnweb.freebsd.org/changeset/base/341608 Log: Normally when an attempt is made to mount a UFS/FFS filesystem whose superblock has a check-hash error, an error message noting the superblock check-hash failure is printed and the mount fails. The administrator then runs fsck to repair the filesystem and when successful, the filesystem can once again be mounted. This approach fails if the filesystem in question is a root filesystem from which you are trying to boot. Here, the loader fails when trying to access the filesystem to get the kernel to boot. So it is necessary to allow the loader to ignore the superblock check-hash error and make a best effort to read the kernel. The filesystem may be suffiently corrupted that the read attempt fails, but there is no harm in trying since the loader makes no attempt to write to the filesystem. Once the kernel is loaded and starts to run, it attempts to mount its root filesystem. Once again, failure means that it breaks to its prompt to ask where to get its root filesystem. Unless you have an alternate root filesystem, you are stuck. Since the root filesystem is initially mounted read-only, it is safe to make an attempt to mount the root filesystem with the failed superblock check-hash. Thus, when asked to mount a root filesystem with a failed superblock check-hash, the kernel prints a warning message that the root filesystem superblock check-hash needs repair, but notes that it is ignoring the error and proceeding. It does mark the filesystem as needing an fsck which prevents it from being enabled for writing until fsck has been run on it. The net effect is that the reboot fails to single user, but at least at that point the administrator has the tools at hand to fix the problem. Reported by: Rick Macklem (rmacklem@) Discussed with: Warner Losh (imp@) Sponsored by: Netflix Modified: head/lib/libufs/libufs.h head/lib/libufs/sblock.c head/sbin/dump/main.c head/sbin/fsck_ffs/setup.c head/sbin/fsirand/fsirand.c head/sbin/growfs/growfs.c head/sbin/quotacheck/quotacheck.c head/stand/libsa/ufs.c head/sys/geom/journal/g_journal_ufs.c head/sys/geom/label/g_label_ufs.c head/sys/ufs/ffs/ffs_extern.h head/sys/ufs/ffs/ffs_subr.c head/sys/ufs/ffs/ffs_vfsops.c head/usr.sbin/fstyp/ufs.c head/usr.sbin/quot/quot.c Modified: head/lib/libufs/libufs.h ============================================================================== --- head/lib/libufs/libufs.h Wed Dec 5 21:51:39 2018 (r341607) +++ head/lib/libufs/libufs.h Thu Dec 6 00:09:39 2018 (r341608) @@ -118,6 +118,12 @@ int ffs_sbput(void *, struct fs *, off_t, int (*)(void *, off_t, void *, int)); /* + * Request standard superblock location in ffs_sbget + */ +#define STDSB -1 /* Fail if check-hash is bad */ +#define STDSB_NOHASHFAIL -2 /* Ignore check-hash failure */ + +/* * block.c */ ssize_t bread(struct uufsd *, ufs2_daddr_t, void *, size_t); Modified: head/lib/libufs/sblock.c ============================================================================== --- head/lib/libufs/sblock.c Wed Dec 5 21:51:39 2018 (r341607) +++ head/lib/libufs/sblock.c Thu Dec 6 00:09:39 2018 (r341608) @@ -54,7 +54,7 @@ sbread(struct uufsd *disk) ERROR(disk, NULL); - if ((errno = sbget(disk->d_fd, &fs, -1)) != 0) { + if ((errno = sbget(disk->d_fd, &fs, STDSB)) != 0) { switch (errno) { case EIO: ERROR(disk, "non-existent or truncated superblock"); Modified: head/sbin/dump/main.c ============================================================================== --- head/sbin/dump/main.c Wed Dec 5 21:51:39 2018 (r341607) +++ head/sbin/dump/main.c Thu Dec 6 00:09:39 2018 (r341608) @@ -433,7 +433,7 @@ main(int argc, char *argv[]) msgtail("to %s\n", tape); sync(); - if ((ret = sbget(diskfd, &sblock, -1)) != 0) { + if ((ret = sbget(diskfd, &sblock, STDSB)) != 0) { switch (ret) { case ENOENT: warn("Cannot find file system superblock"); Modified: head/sbin/fsck_ffs/setup.c ============================================================================== --- head/sbin/fsck_ffs/setup.c Wed Dec 5 21:51:39 2018 (r341607) +++ head/sbin/fsck_ffs/setup.c Thu Dec 6 00:09:39 2018 (r341608) @@ -327,7 +327,7 @@ readsb(int listerr) int bad, ret; struct fs *fs; - super = bflag ? bflag * dev_bsize : -1; + super = bflag ? bflag * dev_bsize : STDSB; readcnt[sblk.b_type]++; if ((ret = sbget(fsreadfd, &fs, super)) != 0) { switch (ret) { Modified: head/sbin/fsirand/fsirand.c ============================================================================== --- head/sbin/fsirand/fsirand.c Wed Dec 5 21:51:39 2018 (r341607) +++ head/sbin/fsirand/fsirand.c Thu Dec 6 00:09:39 2018 (r341608) @@ -126,7 +126,7 @@ fsirand(char *device) dp2 = NULL; /* Read in master superblock */ - if ((ret = sbget(devfd, &sblock, -1)) != 0) { + if ((ret = sbget(devfd, &sblock, STDSB)) != 0) { switch (ret) { case ENOENT: warn("Cannot find file system superblock"); Modified: head/sbin/growfs/growfs.c ============================================================================== --- head/sbin/growfs/growfs.c Wed Dec 5 21:51:39 2018 (r341607) +++ head/sbin/growfs/growfs.c Thu Dec 6 00:09:39 2018 (r341608) @@ -1449,7 +1449,7 @@ main(int argc, char **argv) /* * Read the current superblock, and take a backup. */ - if ((ret = sbget(fsi, &fs, -1)) != 0) { + if ((ret = sbget(fsi, &fs, STDSB)) != 0) { switch (ret) { case ENOENT: errx(1, "superblock not recognized"); Modified: head/sbin/quotacheck/quotacheck.c ============================================================================== --- head/sbin/quotacheck/quotacheck.c Wed Dec 5 21:51:39 2018 (r341607) +++ head/sbin/quotacheck/quotacheck.c Thu Dec 6 00:09:39 2018 (r341608) @@ -321,7 +321,7 @@ chkquota(char *specname, struct quotafile *qfu, struct } } sync(); - if ((ret = sbget(fi, &fs, -1)) != 0) { + if ((ret = sbget(fi, &fs, STDSB)) != 0) { switch (ret) { case ENOENT: warn("Cannot find file system superblock"); Modified: head/stand/libsa/ufs.c ============================================================================== --- head/stand/libsa/ufs.c Wed Dec 5 21:51:39 2018 (r341607) +++ head/stand/libsa/ufs.c Thu Dec 6 00:09:39 2018 (r341608) @@ -140,6 +140,11 @@ static int ufs_use_sa_read(void *, off_t, void **, int /* from ffs_subr.c */ int ffs_sbget(void *, struct fs **, off_t, char *, int (*)(void *, off_t, void **, int)); +/* + * Request standard superblock location in ffs_sbget + */ +#define STDSB -1 /* Fail if check-hash is bad */ +#define STDSB_NOHASHFAIL -2 /* Ignore check-hash failure */ /* * Read a new inode into a file structure. @@ -519,7 +524,8 @@ ufs_open(upath, f) /* read super block */ twiddle(1); - if ((rc = ffs_sbget(f, &fs, -1, "stand", ufs_use_sa_read)) != 0) + if ((rc = ffs_sbget(f, &fs, STDSB_NOHASHFAIL, "stand", + ufs_use_sa_read)) != 0) goto out; fp->f_fs = fs; /* Modified: head/sys/geom/journal/g_journal_ufs.c ============================================================================== --- head/sys/geom/journal/g_journal_ufs.c Wed Dec 5 21:51:39 2018 (r341607) +++ head/sys/geom/journal/g_journal_ufs.c Thu Dec 6 00:09:39 2018 (r341608) @@ -72,7 +72,7 @@ g_journal_ufs_dirty(struct g_consumer *cp) fs = NULL; if (SBLOCKSIZE % cp->provider->sectorsize != 0 || - ffs_sbget(cp, &fs, -1, M_GEOM, g_use_g_read_data) != 0) { + ffs_sbget(cp, &fs, STDSB, M_GEOM, g_use_g_read_data) != 0) { GJ_DEBUG(0, "Cannot find superblock to mark file system %s " "as dirty.", cp->provider->name); KASSERT(fs == NULL, Modified: head/sys/geom/label/g_label_ufs.c ============================================================================== --- head/sys/geom/label/g_label_ufs.c Wed Dec 5 21:51:39 2018 (r341607) +++ head/sys/geom/label/g_label_ufs.c Thu Dec 6 00:09:39 2018 (r341608) @@ -77,7 +77,7 @@ g_label_ufs_taste_common(struct g_consumer *cp, char * fs = NULL; if (SBLOCKSIZE % pp->sectorsize != 0 || - ffs_sbget(cp, &fs, -1, M_GEOM, g_use_g_read_data) != 0) { + ffs_sbget(cp, &fs, STDSB, M_GEOM, g_use_g_read_data) != 0) { KASSERT(fs == NULL, ("g_label_ufs_taste_common: non-NULL fs %p\n", fs)); return; Modified: head/sys/ufs/ffs/ffs_extern.h ============================================================================== --- head/sys/ufs/ffs/ffs_extern.h Wed Dec 5 21:51:39 2018 (r341607) +++ head/sys/ufs/ffs/ffs_extern.h Thu Dec 6 00:09:39 2018 (r341608) @@ -126,6 +126,12 @@ void process_deferred_inactive(struct mount *mp); #define FFSR_UNSUSPEND 0x0002 /* + * Request standard superblock location in ffs_sbget + */ +#define STDSB -1 /* Fail if check-hash is bad */ +#define STDSB_NOHASHFAIL -2 /* Ignore check-hash failure */ + +/* * Definitions for TRIM interface * * Special keys and recommended hash table size Modified: head/sys/ufs/ffs/ffs_subr.c ============================================================================== --- head/sys/ufs/ffs/ffs_subr.c Wed Dec 5 21:51:39 2018 (r341607) +++ head/sys/ufs/ffs/ffs_subr.c Thu Dec 6 00:09:39 2018 (r341608) @@ -51,6 +51,11 @@ struct malloc_type; #define UFS_MALLOC(size, type, flags) malloc(size) #define UFS_FREE(ptr, type) free(ptr) #define UFS_TIME time(NULL) +/* + * Request standard superblock location in ffs_sbget + */ +#define STDSB -1 /* Fail if check-hash is bad */ +#define STDSB_NOHASHFAIL -2 /* Ignore check-hash failure */ #else /* _KERNEL */ #include @@ -139,14 +144,14 @@ ffs_load_inode(struct buf *bp, struct inode *ip, struc ip->i_gid = dip2->di_gid; return (0); } -#endif /* KERNEL */ +#endif /* _KERNEL */ /* * These are the low-level functions that actually read and write * the superblock and its associated data. */ static off_t sblock_try[] = SBLOCKSEARCH; -static int readsuper(void *, struct fs **, off_t, int, +static int readsuper(void *, struct fs **, off_t, int, int, int (*)(void *, off_t, void **, int)); /* @@ -177,21 +182,25 @@ ffs_sbget(void *devfd, struct fs **fsp, off_t altsbloc int i, error, size, blks; uint8_t *space; int32_t *lp; + int chkhash; char *buf; fs = NULL; *fsp = NULL; - if (altsblock != -1) { - if ((error = readsuper(devfd, &fs, altsblock, 1, + chkhash = 1; + if (altsblock >= 0) { + if ((error = readsuper(devfd, &fs, altsblock, 1, chkhash, readfunc)) != 0) { if (fs != NULL) UFS_FREE(fs, filltype); return (error); } } else { + if (altsblock == STDSB_NOHASHFAIL) + chkhash = 0; for (i = 0; sblock_try[i] != -1; i++) { if ((error = readsuper(devfd, &fs, sblock_try[i], 0, - readfunc)) == 0) + chkhash, readfunc)) == 0) break; if (fs != NULL) { UFS_FREE(fs, filltype); @@ -255,7 +264,7 @@ ffs_sbget(void *devfd, struct fs **fsp, off_t altsbloc */ static int readsuper(void *devfd, struct fs **fsp, off_t sblockloc, int isaltsblk, - int (*readfunc)(void *devfd, off_t loc, void **bufp, int size)) + int chkhash, int (*readfunc)(void *devfd, off_t loc, void **bufp, int size)) { struct fs *fs; int error, res; @@ -285,8 +294,9 @@ readsuper(void *devfd, struct fs **fsp, off_t sblocklo if (fs->fs_ckhash != (ckhash = ffs_calc_sbhash(fs))) { #ifdef _KERNEL res = uprintf("Superblock check-hash failed: recorded " - "check-hash 0x%x != computed check-hash 0x%x\n", - fs->fs_ckhash, ckhash); + "check-hash 0x%x != computed check-hash 0x%x%s\n", + fs->fs_ckhash, ckhash, + chkhash == 0 ? " (Ignored)" : ""); #else res = 0; #endif @@ -297,7 +307,14 @@ readsuper(void *devfd, struct fs **fsp, off_t sblocklo if (res == 0) printf("Superblock check-hash failed: recorded " "check-hash 0x%x != computed check-hash " - "0x%x\n", fs->fs_ckhash, ckhash); + "0x%x%s\n", fs->fs_ckhash, ckhash, + chkhash == 0 ? " (Ignored)" : ""); + if (chkhash == 0) { + fs->fs_flags |= FS_NEEDSFSCK; + fs->fs_fmod = 1; + return (0); + } + fs->fs_fmod = 0; return (EINVAL); } /* Have to set for old filesystems that predate this field */ Modified: head/sys/ufs/ffs/ffs_vfsops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vfsops.c Wed Dec 5 21:51:39 2018 (r341607) +++ head/sys/ufs/ffs/ffs_vfsops.c Thu Dec 6 00:09:39 2018 (r341608) @@ -774,6 +774,7 @@ ffs_mountfs(devvp, mp, td) struct g_consumer *cp; struct mount *nmp; int candelete; + off_t loc; fs = NULL; ump = NULL; @@ -810,9 +811,11 @@ ffs_mountfs(devvp, mp, td) goto out; } /* fetch the superblock and summary information */ - if ((error = ffs_sbget(devvp, &fs, -1, M_UFSMNT, ffs_use_bread)) != 0) + loc = STDSB; + if ((mp->mnt_flag & MNT_ROOTFS) != 0) + loc = STDSB_NOHASHFAIL; + if ((error = ffs_sbget(devvp, &fs, loc, M_UFSMNT, ffs_use_bread)) != 0) goto out; - fs->fs_fmod = 0; /* none of these types of check-hashes are maintained by this kernel */ fs->fs_metackhash &= ~(CK_INODE | CK_INDIR | CK_DIR); /* no support for any undefined flags */ Modified: head/usr.sbin/fstyp/ufs.c ============================================================================== --- head/usr.sbin/fstyp/ufs.c Wed Dec 5 21:51:39 2018 (r341607) +++ head/usr.sbin/fstyp/ufs.c Thu Dec 6 00:09:39 2018 (r341608) @@ -50,7 +50,7 @@ fstyp_ufs(FILE *fp, char *label, size_t labelsize) { struct fs *fs; - switch (sbget(fileno(fp), &fs, -1)) { + switch (sbget(fileno(fp), &fs, STDSB)) { case 0: strlcpy(label, fs->fs_volname, labelsize); return (0); Modified: head/usr.sbin/quot/quot.c ============================================================================== --- head/usr.sbin/quot/quot.c Wed Dec 5 21:51:39 2018 (r341607) +++ head/usr.sbin/quot/quot.c Thu Dec 6 00:09:39 2018 (r341608) @@ -550,7 +550,7 @@ quot(char *name, char *mp) close(fd); return; } - switch (sbget(fd, &fs, -1)) { + switch (sbget(fd, &fs, STDSB)) { case 0: break; case ENOENT: From owner-svn-src-head@freebsd.org Thu Dec 6 01:04:57 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9CD13132C916; Thu, 6 Dec 2018 01:04:57 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 45A8F730E2; Thu, 6 Dec 2018 01:04:57 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 26B531C3B9; Thu, 6 Dec 2018 01:04:57 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB614vO3042091; Thu, 6 Dec 2018 01:04:57 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB614vKv042090; Thu, 6 Dec 2018 01:04:57 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201812060104.wB614vKv042090@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Thu, 6 Dec 2018 01:04:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341611 - head/sys/ufs/ffs X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: head/sys/ufs/ffs X-SVN-Commit-Revision: 341611 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 45A8F730E2 X-Spamd-Result: default: False [-0.70 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.45)[-0.445,0]; NEURAL_HAM_SHORT(-0.17)[-0.172,0]; NEURAL_HAM_LONG(-0.08)[-0.083,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 06 Dec 2018 01:04:57 -0000 Author: mckusick Date: Thu Dec 6 01:04:56 2018 New Revision: 341611 URL: https://svnweb.freebsd.org/changeset/base/341611 Log: If the vfs.ffs.dotrimcons sysctl option is enabled while a file deletion is active, specifically after a call to ffs_blkrelease_start() but before the call to ffs_blkrelease_finish(), ffs_blkrelease_start() will have handed out SINGLETON_KEY rather than starting a collection sequence. Thus if we get a SINGLETON_KEY passed to ffs_blkrelease_finish(), we just return rather than trying to finish the nonexistent sequence. Reported by: Warner Losh (imp@) Sponsored by: Netflix Modified: head/sys/ufs/ffs/ffs_alloc.c Modified: head/sys/ufs/ffs/ffs_alloc.c ============================================================================== --- head/sys/ufs/ffs/ffs_alloc.c Thu Dec 6 00:13:51 2018 (r341610) +++ head/sys/ufs/ffs/ffs_alloc.c Thu Dec 6 01:04:56 2018 (r341611) @@ -2537,6 +2537,23 @@ ffs_blkrelease_finish(ump, key) if (((ump->um_flags & UM_CANDELETE) == 0) || dotrimcons == 0) return; /* + * If the vfs.ffs.dotrimcons sysctl option is enabled while + * a file deletion is active, specifically after a call + * to ffs_blkrelease_start() but before the call to + * ffs_blkrelease_finish(), ffs_blkrelease_start() will + * have handed out SINGLETON_KEY rather than starting a + * collection sequence. Thus if we get a SINGLETON_KEY + * passed to ffs_blkrelease_finish(), we just return rather + * than trying to finish the nonexistent sequence. + */ + if (key == SINGLETON_KEY) { +#ifdef INVARIANTS + printf("%s: vfs.ffs.dotrimcons enabled on active filesystem\n", + ump->um_mountp->mnt_stat.f_mntonname); +#endif + return; + } + /* * We are done with sending blocks using this key. Look up the key * using the DONE alloctype (in tp) to request that it be unhashed * as we will not be adding to it. If the key has never been used, From owner-svn-src-head@freebsd.org Thu Dec 6 01:15:44 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BFB59132CE20 for ; Thu, 6 Dec 2018 01:15:44 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from sonic304-22.consmr.mail.ne1.yahoo.com (sonic304-22.consmr.mail.ne1.yahoo.com [66.163.191.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5940A7372D for ; Thu, 6 Dec 2018 01:15:44 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1544058936; bh=FqOW1AJFA3wQ0n2DkL4T5BG7NyJebC+L//IHsfLtEEc=; h=Subject:From:To:References:Date:In-Reply-To:From:Subject; b=TGY3G84pzMRDvOGBaGyypOib2Mh38TERKNDbuHveap86+2SH99FWclY75i5X/wi/QGL4TILtTJ+CHEIY0xHn32RFA/3iM74vSvqdfgF2CM/D4Z3EQPOyLWZ9LIzRmftiuUFeJ2J2NLPb6jNWjymjglnQv/skD3jATEF73OpTFcWDeBEiCYBlD7YLSj/5VfCDAoeqd91TiK9irzh8SHmBR6jRpjC0wq1a1vM0qsdjKA00r4wIb4PBv55tq/Ehci4mb4S3RXroO+slhapC4UJ471T+qYpM/Zso/DKSnellTlQr5FPaIPCnKvUGkVJiqs1li+PACsih5/Tgil/FwEXDgg== X-YMail-OSG: DM9zs8cVM1nf5xa7p9TQIyaXULogB7WJfC7zH_tlr.ZYRCX1ie9zKkI7pXY_7cJ hPkdn42iCoXJQxpCmSoU3p4LaYYwPSwmH33jksVGZ7xdvLNgrL5UlG4UOkxAaYGELmYv5IT4XbNr TX4KADMMflcWoxVJv2.TzxlUsEBtchbry1obD8OHcM5yem68O3AcfuTywgshTYsSviBwGsSaCzpa RgkastKeg.yu0lv7Y.pSm0LTvGAdhSWuAzVESww9A.BjmGweTxEpl8lCLjO5_wSWPAPeCowpDJvu 1auN.hP1no9WHPnaNe.rh64HZPHewgrmmd.WLNrk5reJtPCTqGRo2fLCo9KdHz6JsqvC.CzLiUnE LVnzGkRRAXVwkrbvFvqoDwQyKThvSI6LvbMH7G.v5Hfn6A_s_kTdNfAlAOqXGBHVvZnqOzG5xyg_ 1HvFRH.v6F7W0Dr44fXsqgDHq9lW3T4t7fxc22FZPbtF_9PuJ46.xOg0x.CmOD4yJwHkknYjsAMV tYwNm1Gq.xqz0j0Z9PYKoA75jQtr4z5XFx.fVMxcky2ErszO2G8D0ZZuItRs2RBCSHihBQZnDqp4 mkRCfjCHMp7J9m5UGuZtQRyt.ugpX7qfSKYlPpj_Qih8PEI_fQVLtDTwh4IgSNM2J0L11CKVmJS5 5xepkbOMtJxSz988pPyyzHn6l3Zhsy6aY1egP45Zw6q8vOV_qyQwWSYpZzq2VGjYbwecs32apcYi 5Zi0hwI5dq6DZqOkrG5b2nvjOAEOAb49.QUMuGbS_5ejjNN0RcwEEJOZl1L.Ak9SPDqNDypaZk7M rvRDFmaehCwOimqtbpdLQOB5h7GIB_Qj3DO28VB9.yAzSC_Ge8Ta96XfEAEGLiT2RsCJtWXhLImg YOlUcjB2jdpYdud7lt8o4DWldT3cJbMU8eMwipQtibS3ZTBht3cnLJlTFdD7kKMw4oO9WRvHxcp1 sGPNz.V0R05LJilrKGCjixyR0kgeC8p5k0RtbqpWhUcxaVCXEs9xP6b7uAot2VSG9xKDPn4VsRle nghjqRQudGgRK8Np2EhFSJjzJ73vRYw-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic304.consmr.mail.ne1.yahoo.com with HTTP; Thu, 6 Dec 2018 01:15:36 +0000 Received: from 181.52.72.201 (EHLO [192.168.0.6]) ([181.52.72.201]) by smtp428.mail.ne1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 7bb79ac3d83ee89711b0428beb659d1d; Thu, 06 Dec 2018 01:15:31 +0000 (UTC) Subject: Re: svn commit: r341505 - head/share/man/man5 From: Pedro Giffuni To: koobs@FreeBSD.org, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201812042251.wB4MpE2m018782@repo.freebsd.org> <343a2f70-fb4c-bc5c-d32c-789e7797a628@FreeBSD.org> <44199325-5b07-5195-1157-63c197eb5f07@FreeBSD.org> Message-ID: Date: Wed, 5 Dec 2018 20:15:33 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.3.2 MIME-Version: 1.0 In-Reply-To: <44199325-5b07-5195-1157-63c197eb5f07@FreeBSD.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Rspamd-Queue-Id: 5940A7372D X-Spamd-Result: default: False [-0.47 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.11)[-0.105,0]; NEURAL_HAM_SHORT(-0.23)[-0.231,0]; ASN(0.00)[asn:36646, ipnet:66.163.184.0/21, country:US]; NEURAL_HAM_LONG(-0.13)[-0.132,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 06 Dec 2018 01:15:45 -0000 On 12/5/18 10:24 AM, Pedro Giffuni wrote: > > On 12/5/18 12:06 AM, Kubilay Kocak wrote: >> On 5/12/2018 9:51 am, Pedro F. Giffuni wrote: >>> Starting with FreeBSD 12 we fully support writing ext4 filesystems >> ... > >> Seems minor but I think worth it for discovery/pola/obviousness, and >> a good time (early in the 13.0 cycle). >> >> We get a lot of user questions about ext*fs support on FreeBSD and >> pointing to an ext2fs man page also feels a bit weird. >> > This has to be "fixed" through documentation. I will admit that I > haven't been working properly on the documentation, other than trying > to remember some details in the Wiki page. > > >> Happy to get/organise a !committer contributor to take care of this >> if no-one wants to pick it up. >> > > I will be glad to review/commit manpage changes that make things > clearer. We should probably even try to document the format, as I > recall we do for FAT somewhere(?). > I had a first try at making the manpage more precise here: https://reviews.freebsd.org/D18445 I realize other places like the handbook still needs more love but we have to start somewhere. Pedro. From owner-svn-src-head@freebsd.org Thu Dec 6 04:25:13 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DBBA3130D077; Thu, 6 Dec 2018 04:25:13 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 811357B7DA; Thu, 6 Dec 2018 04:25:13 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6222A1E855; Thu, 6 Dec 2018 04:25:13 +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 wB64PDdi045070; Thu, 6 Dec 2018 04:25:13 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB64PDrs045069; Thu, 6 Dec 2018 04:25:13 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201812060425.wB64PDrs045069@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Thu, 6 Dec 2018 04:25:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341614 - head/sys/powerpc/powermac X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/powermac X-SVN-Commit-Revision: 341614 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 811357B7DA X-Spamd-Result: default: False [-0.64 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.45)[-0.445,0]; NEURAL_HAM_LONG(-0.08)[-0.083,0]; NEURAL_HAM_SHORT(-0.12)[-0.115,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 06 Dec 2018 04:25:14 -0000 Author: jhibbits Date: Thu Dec 6 04:25:12 2018 New Revision: 341614 URL: https://svnweb.freebsd.org/changeset/base/341614 Log: powerpc/powermac: Fix macgpio(4) child interrupt resource handling The 'interrupts' property is actually 2 words, not one, on macgpio child nodes. Open Firmware's getprop function might be returning the value copied, not the total size of the property, but FDT's returns the total size. Prior to this patch, this would cause the SYS_RES_IRQ resource list to not be populated when running with the 'usefdt' loader variable set, to convert the OFW device tree to a FDT. Since the property is always 2 words, read both words, and ignore the second. Tested by: Dennis Clarke (previous attempt) MFC after: 2 weeks Modified: head/sys/powerpc/powermac/macgpio.c Modified: head/sys/powerpc/powermac/macgpio.c ============================================================================== --- head/sys/powerpc/powermac/macgpio.c Thu Dec 6 02:38:42 2018 (r341613) +++ head/sys/powerpc/powermac/macgpio.c Thu Dec 6 04:25:12 2018 (r341614) @@ -160,7 +160,7 @@ macgpio_attach(device_t dev) struct macgpio_devinfo *dinfo; phandle_t root, child, iparent; device_t cdev; - uint32_t irq; + uint32_t irq[2]; sc = device_get_softc(dev); root = sc->sc_node = ofw_bus_get_node(dev); @@ -193,13 +193,13 @@ macgpio_attach(device_t dev) resource_list_init(&dinfo->mdi_resources); - if (OF_getencprop(child, "interrupts", &irq, sizeof(irq)) == + if (OF_getencprop(child, "interrupts", irq, sizeof(irq)) == sizeof(irq)) { OF_searchencprop(child, "interrupt-parent", &iparent, sizeof(iparent)); resource_list_add(&dinfo->mdi_resources, SYS_RES_IRQ, - 0, MAP_IRQ(iparent, irq), MAP_IRQ(iparent, irq), - 1); + 0, MAP_IRQ(iparent, irq[0]), + MAP_IRQ(iparent, irq[0]), 1); } /* Fix messed-up offsets */ From owner-svn-src-head@freebsd.org Thu Dec 6 04:30:25 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 29CDE130D259; Thu, 6 Dec 2018 04:30:25 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C52CD7BC78; Thu, 6 Dec 2018 04:30:24 +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 A3DE61E878; Thu, 6 Dec 2018 04:30:24 +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 wB64UOSA045429; Thu, 6 Dec 2018 04:30:24 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB64UOZF045428; Thu, 6 Dec 2018 04:30:24 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201812060430.wB64UOZF045428@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Thu, 6 Dec 2018 04:30:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341616 - head/sys/powerpc/powerpc X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/powerpc X-SVN-Commit-Revision: 341616 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C52CD7BC78 X-Spamd-Result: default: False [-0.64 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.45)[-0.445,0]; NEURAL_HAM_SHORT(-0.12)[-0.115,0]; NEURAL_HAM_LONG(-0.08)[-0.083,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 06 Dec 2018 04:30:25 -0000 Author: jhibbits Date: Thu Dec 6 04:30:24 2018 New Revision: 341616 URL: https://svnweb.freebsd.org/changeset/base/341616 Log: powerpc: Fix ELFv2 JMP_SLOT relocation fixup The jump slot is a function pointer, not a descriptor pointer, in ELFv2. Just write the pointer itself over, not the contents of the pointer, which would be the first instruction of the function. Modified: head/sys/powerpc/powerpc/elf64_machdep.c Modified: head/sys/powerpc/powerpc/elf64_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/elf64_machdep.c Thu Dec 6 04:28:39 2018 (r341615) +++ head/sys/powerpc/powerpc/elf64_machdep.c Thu Dec 6 04:30:24 2018 (r341616) @@ -332,7 +332,7 @@ elf_reloc_internal(linker_file_t lf, Elf_Addr relocbas #if !defined(_CALL_ELF) || _CALL_ELF == 1 memcpy(where, (Elf_Addr *)addr, 3*sizeof(Elf_Addr)); #else - memcpy(where, (Elf_Addr *)addr, sizeof(Elf_Addr)); + *where = addr; #endif __asm __volatile("dcbst 0,%0; sync" :: "r"(where) : "memory"); break; From owner-svn-src-head@freebsd.org Thu Dec 6 04:36:03 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 757B9130D728; Thu, 6 Dec 2018 04:36:03 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1D1DA7C176; Thu, 6 Dec 2018 04:36:03 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EDFCC1EA0B; Thu, 6 Dec 2018 04:36:02 +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 wB64a2J4050155; Thu, 6 Dec 2018 04:36:02 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB64a2UF050154; Thu, 6 Dec 2018 04:36:02 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201812060436.wB64a2UF050154@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Thu, 6 Dec 2018 04:36:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341617 - head/sys/powerpc/powerpc X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/powerpc X-SVN-Commit-Revision: 341617 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1D1DA7C176 X-Spamd-Result: default: False [-0.64 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.45)[-0.445,0]; NEURAL_HAM_LONG(-0.08)[-0.083,0]; NEURAL_HAM_SHORT(-0.12)[-0.115,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 06 Dec 2018 04:36:03 -0000 Author: jhibbits Date: Thu Dec 6 04:36:02 2018 New Revision: 341617 URL: https://svnweb.freebsd.org/changeset/base/341617 Log: powerpc: Set very low priority mode while waiting for AP unleash event The POWER9 does not recognize 'or 27,27,27' as a thread priority NOP. On earlier POWER architectures, this NOP would note to the processor to give up resources if able, to improve performance of other threads. All processors that support the thread priority NOPs recognize the 'or 31,31,31' NOP as very low priority, so use this to perform a similar function, and not burn cycles on POWER9. Modified: head/sys/powerpc/powerpc/mp_machdep.c Modified: head/sys/powerpc/powerpc/mp_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/mp_machdep.c Thu Dec 6 04:30:24 2018 (r341616) +++ head/sys/powerpc/powerpc/mp_machdep.c Thu Dec 6 04:36:02 2018 (r341617) @@ -78,7 +78,7 @@ machdep_ap_bootstrap(void) __asm __volatile("msync; isync"); while (ap_letgo == 0) - __asm __volatile("or 27,27,27"); + __asm __volatile("or 31,31,31"); __asm __volatile("or 6,6,6"); /* From owner-svn-src-head@freebsd.org Thu Dec 6 06:18:22 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 903331313D85; Thu, 6 Dec 2018 06:18:22 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 32B58806C7; Thu, 6 Dec 2018 06:18:22 +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 0EF0F1FA9A; Thu, 6 Dec 2018 06:18:22 +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 wB66IMFx001727; Thu, 6 Dec 2018 06:18:22 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB66ILeU001723; Thu, 6 Dec 2018 06:18:21 GMT (envelope-from np@FreeBSD.org) Message-Id: <201812060618.wB66ILeU001723@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Thu, 6 Dec 2018 06:18:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341620 - in head/sys/dev/cxgbe: . common X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: in head/sys/dev/cxgbe: . common X-SVN-Commit-Revision: 341620 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 32B58806C7 X-Spamd-Result: default: False [-0.01 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.35)[-0.349,0]; NEURAL_SPAM_SHORT(0.30)[0.301,0]; NEURAL_SPAM_LONG(0.04)[0.035,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 06 Dec 2018 06:18:23 -0000 Author: np Date: Thu Dec 6 06:18:21 2018 New Revision: 341620 URL: https://svnweb.freebsd.org/changeset/base/341620 Log: cxgbe(4): Fall back to a basic configuration in case of any error during card initialization. This is an expanded version of r333682. Break up prep_firmware into simpler routines while here. Load the firmware/config KLD only if needed. MFC after: 1 month Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/common/common.h head/sys/dev/cxgbe/common/t4_hw.c head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/adapter.h ============================================================================== --- head/sys/dev/cxgbe/adapter.h Thu Dec 6 05:06:14 2018 (r341619) +++ head/sys/dev/cxgbe/adapter.h Thu Dec 6 06:18:21 2018 (r341620) @@ -174,6 +174,7 @@ enum { DF_DUMP_MBOX = (1 << 0), /* Log all mbox cmd/rpl. */ DF_LOAD_FW_ANYTIME = (1 << 1), /* Allow LOAD_FW after init */ DF_DISABLE_TCB_CACHE = (1 << 2), /* Disable TCB cache (T6+) */ + DF_DISABLE_CFG_RETRY = (1 << 3), /* Disable fallback config */ }; #define IS_DOOMED(vi) ((vi)->flags & DOOMED) Modified: head/sys/dev/cxgbe/common/common.h ============================================================================== --- head/sys/dev/cxgbe/common/common.h Thu Dec 6 05:06:14 2018 (r341619) +++ head/sys/dev/cxgbe/common/common.h Thu Dec 6 06:18:21 2018 (r341620) @@ -605,6 +605,7 @@ int t4_flash_erase_sectors(struct adapter *adapter, in int t4_flash_cfg_addr(struct adapter *adapter); int t4_load_cfg(struct adapter *adapter, const u8 *cfg_data, unsigned int size); int t4_get_fw_version(struct adapter *adapter, u32 *vers); +int t4_get_fw_hdr(struct adapter *adapter, struct fw_hdr *hdr); int t4_get_bs_version(struct adapter *adapter, u32 *vers); int t4_get_tp_version(struct adapter *adapter, u32 *vers); int t4_get_exprom_version(struct adapter *adapter, u32 *vers); @@ -736,11 +737,9 @@ int t4_fw_hello(struct adapter *adap, unsigned int mbo int t4_fw_bye(struct adapter *adap, unsigned int mbox); int t4_fw_reset(struct adapter *adap, unsigned int mbox, int reset); int t4_fw_halt(struct adapter *adap, unsigned int mbox, int force); -int t4_fw_restart(struct adapter *adap, unsigned int mbox, int reset); +int t4_fw_restart(struct adapter *adap, unsigned int mbox); int t4_fw_upgrade(struct adapter *adap, unsigned int mbox, const u8 *fw_data, unsigned int size, int force); -int t4_fw_forceinstall(struct adapter *adap, const u8 *fw_data, - unsigned int size); int t4_fw_initialize(struct adapter *adap, unsigned int mbox); int t4_query_params(struct adapter *adap, unsigned int mbox, unsigned int pf, unsigned int vf, unsigned int nparams, const u32 *params, Modified: head/sys/dev/cxgbe/common/t4_hw.c ============================================================================== --- head/sys/dev/cxgbe/common/t4_hw.c Thu Dec 6 05:06:14 2018 (r341619) +++ head/sys/dev/cxgbe/common/t4_hw.c Thu Dec 6 06:18:21 2018 (r341620) @@ -3321,6 +3321,19 @@ int t4_get_fw_version(struct adapter *adapter, u32 *ve } /** + * t4_get_fw_hdr - read the firmware header + * @adapter: the adapter + * @hdr: where to place the version + * + * Reads the FW header from flash into caller provided buffer. + */ +int t4_get_fw_hdr(struct adapter *adapter, struct fw_hdr *hdr) +{ + return t4_read_flash(adapter, FLASH_FW_START, + sizeof (*hdr) / sizeof (uint32_t), (uint32_t *)hdr, 1); +} + +/** * t4_get_bs_version - read the firmware bootstrap version * @adapter: the adapter * @vers: where to place the version @@ -6900,7 +6913,7 @@ int t4_fw_halt(struct adapter *adap, unsigned int mbox * If a legitimate mailbox is provided, issue a RESET command * with a HALT indication. */ - if (mbox <= M_PCIE_FW_MASTER) { + if (adap->flags & FW_OK && mbox <= M_PCIE_FW_MASTER) { struct fw_reset_cmd c; memset(&c, 0, sizeof(c)); @@ -6939,64 +6952,24 @@ int t4_fw_halt(struct adapter *adap, unsigned int mbox /** * t4_fw_restart - restart the firmware by taking the uP out of RESET * @adap: the adapter - * @reset: if we want to do a RESET to restart things * * Restart firmware previously halted by t4_fw_halt(). On successful * return the previous PF Master remains as the new PF Master and there * is no need to issue a new HELLO command, etc. - * - * We do this in two ways: - * - * 1. If we're dealing with newer firmware we'll simply want to take - * the chip's microprocessor out of RESET. This will cause the - * firmware to start up from its start vector. And then we'll loop - * until the firmware indicates it's started again (PCIE_FW.HALT - * reset to 0) or we timeout. - * - * 2. If we're dealing with older firmware then we'll need to RESET - * the chip since older firmware won't recognize the PCIE_FW.HALT - * flag and automatically RESET itself on startup. */ -int t4_fw_restart(struct adapter *adap, unsigned int mbox, int reset) +int t4_fw_restart(struct adapter *adap, unsigned int mbox) { - if (reset) { - /* - * Since we're directing the RESET instead of the firmware - * doing it automatically, we need to clear the PCIE_FW.HALT - * bit. - */ - t4_set_reg_field(adap, A_PCIE_FW, F_PCIE_FW_HALT, 0); + int ms; - /* - * If we've been given a valid mailbox, first try to get the - * firmware to do the RESET. If that works, great and we can - * return success. Otherwise, if we haven't been given a - * valid mailbox or the RESET command failed, fall back to - * hitting the chip with a hammer. - */ - if (mbox <= M_PCIE_FW_MASTER) { - t4_set_reg_field(adap, A_CIM_BOOT_CFG, F_UPCRST, 0); - msleep(100); - if (t4_fw_reset(adap, mbox, - F_PIORST | F_PIORSTMODE) == 0) - return 0; - } - - t4_write_reg(adap, A_PL_RST, F_PIORST | F_PIORSTMODE); - msleep(2000); - } else { - int ms; - - t4_set_reg_field(adap, A_CIM_BOOT_CFG, F_UPCRST, 0); - for (ms = 0; ms < FW_CMD_MAX_TIMEOUT; ) { - if (!(t4_read_reg(adap, A_PCIE_FW) & F_PCIE_FW_HALT)) - return FW_SUCCESS; - msleep(100); - ms += 100; - } - return -ETIMEDOUT; + t4_set_reg_field(adap, A_CIM_BOOT_CFG, F_UPCRST, 0); + for (ms = 0; ms < FW_CMD_MAX_TIMEOUT; ) { + if (!(t4_read_reg(adap, A_PCIE_FW) & F_PCIE_FW_HALT)) + return FW_SUCCESS; + msleep(100); + ms += 100; } - return 0; + + return -ETIMEDOUT; } /** @@ -7026,7 +6999,7 @@ int t4_fw_upgrade(struct adapter *adap, unsigned int m const struct fw_hdr *fw_hdr = (const struct fw_hdr *)fw_data; unsigned int bootstrap = be32_to_cpu(fw_hdr->magic) == FW_HDR_MAGIC_BOOTSTRAP; - int reset, ret; + int ret; if (!t4_fw_matches_chip(adap, fw_hdr)) return -EINVAL; @@ -7041,41 +7014,7 @@ int t4_fw_upgrade(struct adapter *adap, unsigned int m if (ret < 0 || bootstrap) return ret; - /* - * Older versions of the firmware don't understand the new - * PCIE_FW.HALT flag and so won't know to perform a RESET when they - * restart. So for newly loaded older firmware we'll have to do the - * RESET for it so it starts up on a clean slate. We can tell if - * the newly loaded firmware will handle this right by checking - * its header flags to see if it advertises the capability. - */ - reset = ((be32_to_cpu(fw_hdr->flags) & FW_HDR_FLAGS_RESET_HALT) == 0); - return t4_fw_restart(adap, mbox, reset); -} - -/* - * Card doesn't have a firmware, install one. - */ -int t4_fw_forceinstall(struct adapter *adap, const u8 *fw_data, - unsigned int size) -{ - const struct fw_hdr *fw_hdr = (const struct fw_hdr *)fw_data; - unsigned int bootstrap = - be32_to_cpu(fw_hdr->magic) == FW_HDR_MAGIC_BOOTSTRAP; - int ret; - - if (!t4_fw_matches_chip(adap, fw_hdr) || bootstrap) - return -EINVAL; - - t4_set_reg_field(adap, A_CIM_BOOT_CFG, F_UPCRST, F_UPCRST); - t4_write_reg(adap, A_PCIE_FW, 0); /* Clobber internal state */ - ret = t4_load_fw(adap, fw_data, size); - if (ret < 0) - return ret; - t4_write_reg(adap, A_PL_RST, F_PIORST | F_PIORSTMODE); - msleep(1000); - - return (0); + return t4_fw_restart(adap, mbox); } /** Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Thu Dec 6 05:06:14 2018 (r341619) +++ head/sys/dev/cxgbe/t4_main.c Thu Dec 6 06:18:21 2018 (r341620) @@ -604,9 +604,8 @@ static int validate_mt_off_len(struct adapter *, int, uint32_t *); static int fixup_devlog_params(struct adapter *); static int cfg_itype_and_nqueues(struct adapter *, struct intrs_and_queues *); -static int prep_firmware(struct adapter *); -static int partition_resources(struct adapter *, const struct firmware *, - const char *); +static int contact_firmware(struct adapter *); +static int partition_resources(struct adapter *); static int get_params__pre_init(struct adapter *); static int get_params__post_init(struct adapter *); static int set_params__post_init(struct adapter *); @@ -1059,11 +1058,22 @@ t4_attach(device_t dev) } #endif - /* Prepare the firmware for operation */ - rc = prep_firmware(sc); + /* Contact the firmware and try to become the master driver. */ + rc = contact_firmware(sc); if (rc != 0) goto done; /* error message displayed already */ + MPASS(sc->flags & FW_OK); + rc = get_params__pre_init(sc); + if (rc != 0) + goto done; /* error message displayed already */ + + if (sc->flags & MASTER_PF) { + rc = partition_resources(sc); + if (rc != 0) + goto done; /* error message displayed already */ + } + rc = get_params__post_init(sc); if (rc != 0) goto done; /* error message displayed already */ @@ -3405,27 +3415,85 @@ fw_compatible(const struct fw_hdr *hdr1, const struct return (0); } +static int +load_fw_module(struct adapter *sc, const struct firmware **dcfg, + const struct firmware **fw) +{ + struct fw_info *fw_info; + + *dcfg = NULL; + if (fw != NULL) + *fw = NULL; + + fw_info = find_fw_info(chip_id(sc)); + if (fw_info == NULL) { + device_printf(sc->dev, + "unable to look up firmware information for chip %d.\n", + chip_id(sc)); + return (EINVAL); + } + + *dcfg = firmware_get(fw_info->kld_name); + if (*dcfg != NULL) { + if (fw != NULL) + *fw = firmware_get(fw_info->fw_mod_name); + return (0); + } + + return (ENOENT); +} + +static void +unload_fw_module(struct adapter *sc, const struct firmware *dcfg, + const struct firmware *fw) +{ + + if (fw != NULL) + firmware_put(fw, FIRMWARE_UNLOAD); + if (dcfg != NULL) + firmware_put(dcfg, FIRMWARE_UNLOAD); +} + /* - * The firmware in the KLD is usable, but should it be installed? This routine - * explains itself in detail if it indicates the KLD firmware should be - * installed. + * Return values: + * 0 means no firmware install attempted. + * ERESTART means a firmware install was attempted and was successful. + * +ve errno means a firmware install was attempted but failed. */ static int -should_install_kld_fw(struct adapter *sc, int card_fw_usable, int k, int c) +install_kld_firmware(struct adapter *sc, struct fw_hdr *card_fw, + const struct fw_hdr *drv_fw, const char *reason, int *already) { - const char *reason; + const struct firmware *cfg, *fw; + const uint32_t c = be32toh(card_fw->fw_ver); + const uint32_t d = be32toh(drv_fw->fw_ver); + uint32_t k; + int rc; - if (!card_fw_usable) { + if (reason != NULL) + goto install; + + if ((sc->flags & FW_OK) == 0) { + + if (c == 0xffffffff) { + reason = "missing"; + goto install; + } + + return (0); + } + + if (!fw_compatible(card_fw, drv_fw)) { reason = "incompatible or unusable"; goto install; } - if (k > c) { + if (d > c) { reason = "older than the version bundled with this driver"; goto install; } - if (t4_fw_install == 2 && k != c) { + if (t4_fw_install == 2 && d != c) { reason = "different than the version bundled with this driver"; goto install; } @@ -3433,10 +3501,13 @@ should_install_kld_fw(struct adapter *sc, int card_fw_ return (0); install: + if ((*already)++) + return (0); + if (t4_fw_install == 0) { device_printf(sc->dev, "firmware on card (%u.%u.%u.%u) is %s, " - "but the driver is prohibited from installing a different " - "firmware on the card.\n", + "but the driver is prohibited from installing a firmware " + "on the card.\n", G_FW_HDR_FW_VER_MAJOR(c), G_FW_HDR_FW_VER_MINOR(c), G_FW_HDR_FW_VER_MICRO(c), G_FW_HDR_FW_VER_BUILD(c), reason); @@ -3447,29 +3518,57 @@ install: "installing firmware %u.%u.%u.%u on card.\n", G_FW_HDR_FW_VER_MAJOR(c), G_FW_HDR_FW_VER_MINOR(c), G_FW_HDR_FW_VER_MICRO(c), G_FW_HDR_FW_VER_BUILD(c), reason, - G_FW_HDR_FW_VER_MAJOR(k), G_FW_HDR_FW_VER_MINOR(k), - G_FW_HDR_FW_VER_MICRO(k), G_FW_HDR_FW_VER_BUILD(k)); + G_FW_HDR_FW_VER_MAJOR(d), G_FW_HDR_FW_VER_MINOR(d), + G_FW_HDR_FW_VER_MICRO(d), G_FW_HDR_FW_VER_BUILD(d)); - return (1); + rc = load_fw_module(sc, &cfg, &fw); + if (rc != 0 || fw == NULL) { + device_printf(sc->dev, + "failed to load firmware module: %d. cfg %p, fw %p\n", rc, + cfg, fw); + rc = sc->flags & FW_OK ? 0 : ENOENT; + goto done; + } + k = be32toh(((const struct fw_hdr *)fw->data)->fw_ver); + if (k != d) { + device_printf(sc->dev, + "firmware in KLD (%u.%u.%u.%u) is not what the driver was " + "compiled with and will not be used.\n", + G_FW_HDR_FW_VER_MAJOR(k), G_FW_HDR_FW_VER_MINOR(k), + G_FW_HDR_FW_VER_MICRO(k), G_FW_HDR_FW_VER_BUILD(k)); + rc = sc->flags & FW_OK ? 0 : EINVAL; + goto done; + } + + rc = -t4_fw_upgrade(sc, sc->mbox, fw->data, fw->datasize, 0); + if (rc != 0) { + device_printf(sc->dev, "failed to install firmware: %d\n", rc); + } else { + /* Installed successfully, update the cached header too. */ + rc = ERESTART; + memcpy(card_fw, fw->data, sizeof(*card_fw)); + } +done: + unload_fw_module(sc, cfg, fw); + + return (rc); } /* - * Establish contact with the firmware and determine if we are the master driver - * or not, and whether we are responsible for chip initialization. + * Establish contact with the firmware and attempt to become the master driver. + * + * A firmware will be installed to the card if needed (if the driver is allowed + * to do so). */ static int -prep_firmware(struct adapter *sc) +contact_firmware(struct adapter *sc) { - const struct firmware *fw = NULL, *default_cfg; - int rc, pf, card_fw_usable, kld_fw_usable, need_fw_reset = 1; + int rc, already = 0; enum dev_state state; struct fw_info *fw_info; struct fw_hdr *card_fw; /* fw on the card */ - const struct fw_hdr *kld_fw; /* fw in the KLD */ - const struct fw_hdr *drv_fw; /* fw header the driver was compiled - against */ + const struct fw_hdr *drv_fw; /* fw bundled with the driver */ - /* This is the firmware whose headers the driver was compiled against */ fw_info = find_fw_info(chip_id(sc)); if (fw_info == NULL) { device_printf(sc->dev, @@ -3479,186 +3578,167 @@ prep_firmware(struct adapter *sc) } drv_fw = &fw_info->fw_hdr; - /* - * The firmware KLD contains many modules. The KLD name is also the - * name of the module that contains the default config file. - */ - default_cfg = firmware_get(fw_info->kld_name); - - /* This is the firmware in the KLD */ - fw = firmware_get(fw_info->fw_mod_name); - if (fw != NULL) { - kld_fw = (const void *)fw->data; - kld_fw_usable = fw_compatible(drv_fw, kld_fw); - } else { - kld_fw = NULL; - kld_fw_usable = 0; - } - /* Read the header of the firmware on the card */ card_fw = malloc(sizeof(*card_fw), M_CXGBE, M_ZERO | M_WAITOK); - rc = -t4_read_flash(sc, FLASH_FW_START, - sizeof (*card_fw) / sizeof (uint32_t), (uint32_t *)card_fw, 1); - if (rc == 0) { - card_fw_usable = fw_compatible(drv_fw, (const void*)card_fw); - if (card_fw->fw_ver == be32toh(0xffffffff)) { - uint32_t d = be32toh(kld_fw->fw_ver); - - if (!kld_fw_usable) { - device_printf(sc->dev, - "no firmware on the card and no usable " - "firmware bundled with the driver.\n"); - rc = EIO; - goto done; - } else if (t4_fw_install == 0) { - device_printf(sc->dev, - "no firmware on the card and the driver " - "is prohibited from installing new " - "firmware.\n"); - rc = EIO; - goto done; - } - - device_printf(sc->dev, "no firmware on the card, " - "installing firmware %d.%d.%d.%d\n", - G_FW_HDR_FW_VER_MAJOR(d), G_FW_HDR_FW_VER_MINOR(d), - G_FW_HDR_FW_VER_MICRO(d), G_FW_HDR_FW_VER_BUILD(d)); - rc = t4_fw_forceinstall(sc, fw->data, fw->datasize); - if (rc < 0) { - rc = -rc; - device_printf(sc->dev, - "firmware install failed: %d.\n", rc); - goto done; - } - memcpy(card_fw, kld_fw, sizeof(*card_fw)); - card_fw_usable = 1; - need_fw_reset = 0; - } - } else { +restart: + rc = -t4_get_fw_hdr(sc, card_fw); + if (rc != 0) { device_printf(sc->dev, - "Unable to read card's firmware header: %d\n", rc); - card_fw_usable = 0; + "unable to read firmware header from card's flash: %d\n", + rc); + goto done; } - /* Contact firmware. */ + rc = install_kld_firmware(sc, card_fw, drv_fw, NULL, &already); + if (rc == ERESTART) + goto restart; + if (rc != 0) + goto done; + rc = t4_fw_hello(sc, sc->mbox, sc->mbox, MASTER_MAY, &state); if (rc < 0 || state == DEV_STATE_ERR) { rc = -rc; device_printf(sc->dev, - "failed to connect to the firmware: %d, %d.\n", rc, state); + "failed to connect to the firmware: %d, %d. " + "PCIE_FW 0x%08x\n", rc, state, t4_read_reg(sc, A_PCIE_FW)); +#if 0 + if (install_kld_firmware(sc, card_fw, drv_fw, + "not responding properly to HELLO", &already) == ERESTART) + goto restart; +#endif goto done; } - pf = rc; - if (pf == sc->mbox) + MPASS(be32toh(card_fw->flags) & FW_HDR_FLAGS_RESET_HALT); + sc->flags |= FW_OK; /* The firmware responded to the FW_HELLO. */ + + if (rc == sc->pf) { sc->flags |= MASTER_PF; - else if (state == DEV_STATE_UNINIT) { + rc = install_kld_firmware(sc, card_fw, drv_fw, NULL, &already); + if (rc == ERESTART) + rc = 0; + else if (rc != 0) + goto done; + } else if (state == DEV_STATE_UNINIT) { /* * We didn't get to be the master so we definitely won't be * configuring the chip. It's a bug if someone else hasn't * configured it already. */ device_printf(sc->dev, "couldn't be master(%d), " - "device not already initialized either(%d).\n", rc, state); + "device not already initialized either(%d). " + "PCIE_FW 0x%08x\n", rc, state, t4_read_reg(sc, A_PCIE_FW)); rc = EPROTO; goto done; - } - - if (card_fw_usable && card_fw->fw_ver == drv_fw->fw_ver && - (!kld_fw_usable || kld_fw->fw_ver == drv_fw->fw_ver)) { + } else { /* - * Common case: the firmware on the card is an exact match and - * the KLD is an exact match too, or the KLD is - * absent/incompatible. Note that t4_fw_install = 2 is ignored - * here -- use cxgbetool loadfw if you want to reinstall the - * same firmware as the one on the card. + * Some other PF is the master and has configured the chip. + * This is allowed but untested. */ - } else if (kld_fw_usable && state == DEV_STATE_UNINIT && - should_install_kld_fw(sc, card_fw_usable, be32toh(kld_fw->fw_ver), - be32toh(card_fw->fw_ver))) { + device_printf(sc->dev, "PF%d is master, device state %d. " + "PCIE_FW 0x%08x\n", rc, state, t4_read_reg(sc, A_PCIE_FW)); + snprintf(sc->cfg_file, sizeof(sc->cfg_file), "pf%d", rc); + sc->cfcsum = 0; + rc = 0; + } +done: + if (rc != 0 && sc->flags & FW_OK) { + t4_fw_bye(sc, sc->mbox); + sc->flags &= ~FW_OK; + } + free(card_fw, M_CXGBE); + return (rc); +} - rc = -t4_fw_upgrade(sc, sc->mbox, fw->data, fw->datasize, 0); - if (rc != 0) { +static int +copy_cfg_file_to_card(struct adapter *sc, char *cfg_file, + uint32_t mtype, uint32_t moff) +{ + struct fw_info *fw_info; + const struct firmware *dcfg, *rcfg = NULL; + const uint32_t *cfdata; + uint32_t cflen, addr; + int rc; + + load_fw_module(sc, &dcfg, NULL); + + /* Card specific interpretation of "default". */ + if (strncmp(cfg_file, DEFAULT_CF, sizeof(t4_cfg_file)) == 0) { + if (pci_get_device(sc->dev) == 0x440a) + snprintf(cfg_file, sizeof(t4_cfg_file), UWIRE_CF); + if (is_fpga(sc)) + snprintf(cfg_file, sizeof(t4_cfg_file), FPGA_CF); + } + + if (strncmp(cfg_file, DEFAULT_CF, sizeof(t4_cfg_file)) == 0) { + if (dcfg == NULL) { device_printf(sc->dev, - "failed to install firmware: %d\n", rc); + "KLD with default config is not available.\n"); + rc = ENOENT; goto done; } + cfdata = dcfg->data; + cflen = dcfg->datasize & ~3; + } else { + char s[32]; - /* Installed successfully, update the cached header too. */ - memcpy(card_fw, kld_fw, sizeof(*card_fw)); - card_fw_usable = 1; - need_fw_reset = 0; /* already reset as part of load_fw */ + fw_info = find_fw_info(chip_id(sc)); + if (fw_info == NULL) { + device_printf(sc->dev, + "unable to look up firmware information for chip %d.\n", + chip_id(sc)); + rc = EINVAL; + goto done; + } + snprintf(s, sizeof(s), "%s_%s", fw_info->kld_name, cfg_file); + + rcfg = firmware_get(s); + if (rcfg == NULL) { + device_printf(sc->dev, + "unable to load module \"%s\" for configuration " + "profile \"%s\".\n", s, cfg_file); + rc = ENOENT; + goto done; + } + cfdata = rcfg->data; + cflen = rcfg->datasize & ~3; } - if (!card_fw_usable) { - uint32_t d, c, k; - - d = ntohl(drv_fw->fw_ver); - c = ntohl(card_fw->fw_ver); - k = kld_fw ? ntohl(kld_fw->fw_ver) : 0; - - device_printf(sc->dev, "Cannot find a usable firmware: " - "fw_install %d, chip state %d, " - "driver compiled with %d.%d.%d.%d, " - "card has %d.%d.%d.%d, KLD has %d.%d.%d.%d\n", - t4_fw_install, state, - G_FW_HDR_FW_VER_MAJOR(d), G_FW_HDR_FW_VER_MINOR(d), - G_FW_HDR_FW_VER_MICRO(d), G_FW_HDR_FW_VER_BUILD(d), - G_FW_HDR_FW_VER_MAJOR(c), G_FW_HDR_FW_VER_MINOR(c), - G_FW_HDR_FW_VER_MICRO(c), G_FW_HDR_FW_VER_BUILD(c), - G_FW_HDR_FW_VER_MAJOR(k), G_FW_HDR_FW_VER_MINOR(k), - G_FW_HDR_FW_VER_MICRO(k), G_FW_HDR_FW_VER_BUILD(k)); + if (cflen > FLASH_CFG_MAX_SIZE) { + device_printf(sc->dev, + "config file too long (%d, max allowed is %d).\n", + cflen, FLASH_CFG_MAX_SIZE); rc = EINVAL; goto done; } - /* Reset device */ - if (need_fw_reset && - (rc = -t4_fw_reset(sc, sc->mbox, F_PIORSTMODE | F_PIORST)) != 0) { - device_printf(sc->dev, "firmware reset failed: %d.\n", rc); - if (rc != ETIMEDOUT && rc != EIO) - t4_fw_bye(sc, sc->mbox); + rc = validate_mt_off_len(sc, mtype, moff, cflen, &addr); + if (rc != 0) { + device_printf(sc->dev, + "%s: addr (%d/0x%x) or len %d is not valid: %d.\n", + __func__, mtype, moff, cflen, rc); + rc = EINVAL; goto done; } - sc->flags |= FW_OK; - - rc = get_params__pre_init(sc); - if (rc != 0) - goto done; /* error message displayed already */ - - /* Partition adapter resources as specified in the config file. */ - if (state == DEV_STATE_UNINIT) { - - KASSERT(sc->flags & MASTER_PF, - ("%s: trying to change chip settings when not master.", - __func__)); - - rc = partition_resources(sc, default_cfg, fw_info->kld_name); - if (rc != 0) - goto done; /* error message displayed already */ - - t4_tweak_chip_settings(sc); - - /* get basic stuff going */ - rc = -t4_fw_initialize(sc, sc->mbox); - if (rc != 0) { - device_printf(sc->dev, "fw init failed: %d.\n", rc); - goto done; - } - } else { - snprintf(sc->cfg_file, sizeof(sc->cfg_file), "pf%d", pf); - sc->cfcsum = 0; - } - + write_via_memwin(sc, 2, addr, cfdata, cflen); done: - free(card_fw, M_CXGBE); - if (fw != NULL) - firmware_put(fw, FIRMWARE_UNLOAD); - if (default_cfg != NULL) - firmware_put(default_cfg, FIRMWARE_UNLOAD); - + if (rcfg != NULL) + firmware_put(rcfg, FIRMWARE_UNLOAD); + unload_fw_module(sc, dcfg, NULL); return (rc); } +struct caps_allowed { + uint16_t nbmcaps; + uint16_t linkcaps; + uint16_t switchcaps; + uint16_t niccaps; + uint16_t toecaps; + uint16_t rdmacaps; + uint16_t cryptocaps; + uint16_t iscsicaps; + uint16_t fcoecaps; +}; + #define FW_PARAM_DEV(param) \ (V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) | \ V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DEV_##param)) @@ -3667,78 +3747,39 @@ done: V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_PFVF_##param)) /* - * Partition chip resources for use between various PFs, VFs, etc. + * Provide a configuration profile to the firmware and have it initialize the + * chip accordingly. This may involve uploading a configuration file to the + * card. */ static int -partition_resources(struct adapter *sc, const struct firmware *default_cfg, - const char *name_prefix) +apply_cfg_and_initialize(struct adapter *sc, char *cfg_file, + const struct caps_allowed *caps_allowed) { - const struct firmware *cfg = NULL; - int rc = 0; + int rc; struct fw_caps_config_cmd caps; - uint32_t mtype, moff, finicsum, cfcsum; + uint32_t mtype, moff, finicsum, cfcsum, param, val; - /* - * Figure out what configuration file to use. Pick the default config - * file for the card if the user hasn't specified one explicitly. - */ - snprintf(sc->cfg_file, sizeof(sc->cfg_file), "%s", t4_cfg_file); - if (strncmp(t4_cfg_file, DEFAULT_CF, sizeof(t4_cfg_file)) == 0) { - /* Card specific overrides go here. */ - if (pci_get_device(sc->dev) == 0x440a) - snprintf(sc->cfg_file, sizeof(sc->cfg_file), UWIRE_CF); - if (is_fpga(sc)) - snprintf(sc->cfg_file, sizeof(sc->cfg_file), FPGA_CF); - } else if (strncmp(t4_cfg_file, BUILTIN_CF, sizeof(t4_cfg_file)) == 0) - goto use_built_in_config; /* go straight to config. */ - - /* - * We need to load another module if the profile is anything except - * "default" or "flash". - */ - if (strncmp(sc->cfg_file, DEFAULT_CF, sizeof(sc->cfg_file)) != 0 && - strncmp(sc->cfg_file, FLASH_CF, sizeof(sc->cfg_file)) != 0) { - char s[32]; - - snprintf(s, sizeof(s), "%s_%s", name_prefix, sc->cfg_file); - cfg = firmware_get(s); - if (cfg == NULL) { - if (default_cfg != NULL) { - device_printf(sc->dev, - "unable to load module \"%s\" for " - "configuration profile \"%s\", will use " - "the default config file instead.\n", - s, sc->cfg_file); - snprintf(sc->cfg_file, sizeof(sc->cfg_file), - "%s", DEFAULT_CF); - } else { - device_printf(sc->dev, - "unable to load module \"%s\" for " - "configuration profile \"%s\", will use " - "the config file on the card's flash " - "instead.\n", s, sc->cfg_file); - snprintf(sc->cfg_file, sizeof(sc->cfg_file), - "%s", FLASH_CF); - } - } + rc = -t4_fw_reset(sc, sc->mbox, F_PIORSTMODE | F_PIORST); + if (rc != 0) { + device_printf(sc->dev, "firmware reset failed: %d.\n", rc); + return (rc); } - if (strncmp(sc->cfg_file, DEFAULT_CF, sizeof(sc->cfg_file)) == 0 && - default_cfg == NULL) { - device_printf(sc->dev, - "default config file not available, will use the config " - "file on the card's flash instead.\n"); - snprintf(sc->cfg_file, sizeof(sc->cfg_file), "%s", FLASH_CF); - } - - if (strncmp(sc->cfg_file, FLASH_CF, sizeof(sc->cfg_file)) != 0) { - u_int cflen; - const uint32_t *cfdata; - uint32_t param, val, addr; - - KASSERT(cfg != NULL || default_cfg != NULL, - ("%s: no config to upload", __func__)); - + bzero(&caps, sizeof(caps)); + caps.op_to_write = htobe32(V_FW_CMD_OP(FW_CAPS_CONFIG_CMD) | + F_FW_CMD_REQUEST | F_FW_CMD_READ); + if (strncmp(cfg_file, BUILTIN_CF, sizeof(t4_cfg_file)) == 0) { + mtype = 0; + moff = 0; + caps.cfvalid_to_len16 = htobe32(FW_LEN16(caps)); + } else if (strncmp(cfg_file, FLASH_CF, sizeof(t4_cfg_file)) == 0) { + mtype = FW_MEMTYPE_FLASH; + moff = t4_flash_cfg_addr(sc); + caps.cfvalid_to_len16 = htobe32(F_FW_CAPS_CONFIG_CMD_CFVALID | + V_FW_CAPS_CONFIG_CMD_MEMTYPE_CF(mtype) | + V_FW_CAPS_CONFIG_CMD_MEMADDR64K_CF(moff >> 16) | + FW_LEN16(caps)); + } else { /* * Ask the firmware where it wants us to upload the config file. */ @@ -3752,110 +3793,52 @@ partition_resources(struct adapter *sc, const struct f } mtype = G_FW_PARAMS_PARAM_Y(val); moff = G_FW_PARAMS_PARAM_Z(val) << 16; + caps.cfvalid_to_len16 = htobe32(F_FW_CAPS_CONFIG_CMD_CFVALID | + V_FW_CAPS_CONFIG_CMD_MEMTYPE_CF(mtype) | + V_FW_CAPS_CONFIG_CMD_MEMADDR64K_CF(moff >> 16) | + FW_LEN16(caps)); - /* - * XXX: sheer laziness. We deliberately added 4 bytes of - * useless stuffing/comments at the end of the config file so - * it's ok to simply throw away the last remaining bytes when - * the config file is not an exact multiple of 4. This also - * helps with the validate_mt_off_len check. - */ - if (cfg != NULL) { - cflen = cfg->datasize & ~3; - cfdata = cfg->data; - } else { - cflen = default_cfg->datasize & ~3; - cfdata = default_cfg->data; - } - - if (cflen > FLASH_CFG_MAX_SIZE) { - device_printf(sc->dev, - "config file too long (%d, max allowed is %d). " - "Will try to use the config on the card, if any.\n", - cflen, FLASH_CFG_MAX_SIZE); - goto use_config_on_flash; - } - - rc = validate_mt_off_len(sc, mtype, moff, cflen, &addr); + rc = copy_cfg_file_to_card(sc, cfg_file, mtype, moff); if (rc != 0) { device_printf(sc->dev, - "%s: addr (%d/0x%x) or len %d is not valid: %d. " - "Will try to use the config on the card, if any.\n", - __func__, mtype, moff, cflen, rc); - goto use_config_on_flash; + "failed to upload config file to card: %d.\n", rc); + goto done; } - write_via_memwin(sc, 2, addr, cfdata, cflen); - } else { -use_config_on_flash: - mtype = FW_MEMTYPE_FLASH; - moff = t4_flash_cfg_addr(sc); } - - bzero(&caps, sizeof(caps)); - caps.op_to_write = htobe32(V_FW_CMD_OP(FW_CAPS_CONFIG_CMD) | - F_FW_CMD_REQUEST | F_FW_CMD_READ); - caps.cfvalid_to_len16 = htobe32(F_FW_CAPS_CONFIG_CMD_CFVALID | - V_FW_CAPS_CONFIG_CMD_MEMTYPE_CF(mtype) | - V_FW_CAPS_CONFIG_CMD_MEMADDR64K_CF(moff >> 16) | FW_LEN16(caps)); rc = -t4_wr_mbox(sc, sc->mbox, &caps, sizeof(caps), &caps); if (rc != 0) { - device_printf(sc->dev, - "failed to pre-process config file: %d " - "(mtype %d, moff 0x%x). Will reset the firmware and retry " - "with the built-in configuration.\n", rc, mtype, moff); - - rc = -t4_fw_reset(sc, sc->mbox, F_PIORSTMODE | F_PIORST); - if (rc != 0) { - device_printf(sc->dev, - "firmware reset failed: %d.\n", rc); - if (rc != ETIMEDOUT && rc != EIO) { - t4_fw_bye(sc, sc->mbox); - sc->flags &= ~FW_OK; - } - goto done; - } - snprintf(sc->cfg_file, sizeof(sc->cfg_file), "%s", "built-in"); -use_built_in_config: - bzero(&caps, sizeof(caps)); - caps.op_to_write = htobe32(V_FW_CMD_OP(FW_CAPS_CONFIG_CMD) | - F_FW_CMD_REQUEST | F_FW_CMD_READ); - caps.cfvalid_to_len16 = htobe32(FW_LEN16(caps)); - rc = t4_wr_mbox(sc, sc->mbox, &caps, sizeof(caps), &caps); - if (rc != 0) { - device_printf(sc->dev, - "built-in configuration failed: %d.\n", rc); - goto done; - } + device_printf(sc->dev, "failed to pre-process config file: %d " + "(mtype %d, moff 0x%x).\n", rc, mtype, moff); + goto done; } finicsum = be32toh(caps.finicsum); - cfcsum = be32toh(caps.cfcsum); + cfcsum = be32toh(caps.cfcsum); /* actual */ if (finicsum != cfcsum) { device_printf(sc->dev, "WARNING: config file checksum mismatch: %08x %08x\n", finicsum, cfcsum); } sc->cfcsum = cfcsum; + snprintf(sc->cfg_file, sizeof(sc->cfg_file), "%s", cfg_file); -#define LIMIT_CAPS(x) do { \ - caps.x &= htobe16(t4_##x##_allowed); \ -} while (0) - /* * Let the firmware know what features will (not) be used so it can tune * things accordingly. */ - LIMIT_CAPS(nbmcaps); - LIMIT_CAPS(linkcaps); - LIMIT_CAPS(switchcaps); - LIMIT_CAPS(niccaps); - LIMIT_CAPS(toecaps); - LIMIT_CAPS(rdmacaps); - LIMIT_CAPS(cryptocaps); - LIMIT_CAPS(iscsicaps); - LIMIT_CAPS(fcoecaps); +#define LIMIT_CAPS(x) do { \ + caps.x##caps &= htobe16(caps_allowed->x##caps); \ +} while (0) + LIMIT_CAPS(nbm); + LIMIT_CAPS(link); + LIMIT_CAPS(switch); + LIMIT_CAPS(nic); + LIMIT_CAPS(toe); + LIMIT_CAPS(rdma); + LIMIT_CAPS(crypto); + LIMIT_CAPS(iscsi); + LIMIT_CAPS(fcoe); #undef LIMIT_CAPS - if (caps.niccaps & htobe16(FW_CAPS_CONFIG_NIC_HASHFILTER)) { /* * TOE and hashfilters are mutually exclusive. It is a config @@ -3877,10 +3860,67 @@ use_built_in_config: if (rc != 0) { device_printf(sc->dev, "failed to process config file: %d.\n", rc); + goto done; } + + t4_tweak_chip_settings(sc); + + /* get basic stuff going */ + rc = -t4_fw_initialize(sc, sc->mbox); + if (rc != 0) { + device_printf(sc->dev, "fw_initialize failed: %d.\n", rc); + goto done; + } done: - if (cfg != NULL) - firmware_put(cfg, FIRMWARE_UNLOAD); + return (rc); +} + +/* + * Partition chip resources for use between various PFs, VFs, etc. + */ +static int +partition_resources(struct adapter *sc) +{ + char cfg_file[sizeof(t4_cfg_file)]; + struct caps_allowed caps_allowed; + int rc; + bool fallback; + + /* Only the master driver gets to configure the chip resources. */ + MPASS(sc->flags & MASTER_PF); + +#define COPY_CAPS(x) do { \ + caps_allowed.x##caps = t4_##x##caps_allowed; \ +} while (0) + bzero(&caps_allowed, sizeof(caps_allowed)); + COPY_CAPS(nbm); + COPY_CAPS(link); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Thu Dec 6 08:29:14 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 697F013231DC; Thu, 6 Dec 2018 08:29:14 +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)) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0E40485B2E; Thu, 6 Dec 2018 08:29:14 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id F078A5385; Thu, 6 Dec 2018 08:29:13 +0000 (UTC) Date: Thu, 6 Dec 2018 08:29:13 +0000 From: Alexey Dokuchaev To: Pedro Giffuni Cc: cem@freebsd.org, svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers Subject: Re: svn commit: r341505 - head/share/man/man5 Message-ID: <20181206082913.GA76892@FreeBSD.org> References: <201812042251.wB4MpE2m018782@repo.freebsd.org> <343a2f70-fb4c-bc5c-d32c-789e7797a628@FreeBSD.org> <44199325-5b07-5195-1157-63c197eb5f07@FreeBSD.org> <2b9783a8-9254-4b70-65c8-7e27b43b0726@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2b9783a8-9254-4b70-65c8-7e27b43b0726@FreeBSD.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Rspamd-Queue-Id: 0E40485B2E X-Spamd-Result: default: False [0.16 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.13)[-0.125,0]; NEURAL_HAM_SHORT(-0.12)[-0.125,0]; NEURAL_SPAM_LONG(0.41)[0.413,0]; ASN(0.00)[asn:11403, ipnet:96.47.64.0/20, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 06 Dec 2018 08:29:14 -0000 On Wed, Dec 05, 2018 at 01:46:54PM -0500, Pedro Giffuni wrote: > On 05/12/2018 12:41, Conrad Meyer wrote: > > The Linux model is that the current incarnation of the ext2/3/4 driver > > is named "ext4," and that's what Linux users expect. You can mount > > any ext2/3/4 filesystem with the Linux ext4 driver. For ext4, it was > > a result of wanting to keep ext3 stable while developing ext4 in-tree. > > (For a while, it was called "ext4dev"). ext4 is long-since stabilized > > and ext3 became fully redundant with ext4, so I guess they dropped it. > > From a linux user/marketing perspective you are right. > > Are we sure there will never be an ext5fs? I would hate to start moving > a filesystem in the tree every time a new release comes out. +1. I really hate it how Linux stirs things around, including naming, and I'd advise against it. Current name is fine; update the manpage and move on. We do expect our users to read documentation, don't we? ./danfe From owner-svn-src-head@freebsd.org Thu Dec 6 09:22:36 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 78C3413251E7; Thu, 6 Dec 2018 09:22:36 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1F5D3886D1; Thu, 6 Dec 2018 09:22:36 +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 00656219A4; Thu, 6 Dec 2018 09:22:36 +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 wB69MZZh098649; Thu, 6 Dec 2018 09:22:35 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB69MZLf098647; Thu, 6 Dec 2018 09:22:35 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201812060922.wB69MZLf098647@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Thu, 6 Dec 2018 09:22:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341623 - in head: tests/sys/kqueue/libkqueue usr.bin/procstat/tests X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: in head: tests/sys/kqueue/libkqueue usr.bin/procstat/tests X-SVN-Commit-Revision: 341623 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1F5D3886D1 X-Spamd-Result: default: False [-0.44 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.45)[-0.445,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_SPAM_SHORT(0.09)[0.087,0]; NEURAL_HAM_LONG(-0.08)[-0.083,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 06 Dec 2018 09:22:36 -0000 Author: lwhsu Date: Thu Dec 6 09:22:35 2018 New Revision: 341623 URL: https://svnweb.freebsd.org/changeset/base/341623 Log: Temporarily skip flakey test cases PR: 233586, 233587, 233588 Approved by: markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D18362 Modified: head/tests/sys/kqueue/libkqueue/kqueue_test.sh head/usr.bin/procstat/tests/procstat_test.sh Modified: head/tests/sys/kqueue/libkqueue/kqueue_test.sh ============================================================================== --- head/tests/sys/kqueue/libkqueue/kqueue_test.sh Thu Dec 6 08:27:56 2018 (r341622) +++ head/tests/sys/kqueue/libkqueue/kqueue_test.sh Thu Dec 6 09:22:35 2018 (r341623) @@ -2,7 +2,8 @@ # $FreeBSD$ i=1 -"$(dirname $0)/kqtest" | while read line; do +# Temporarily disable evfilt_proc tests: https://bugs.freebsd.org/233586 +"$(dirname $0)/kqtest" --no-proc | while read line; do echo $line | grep -q passed if [ $? -eq 0 ]; then echo "ok - $i $line" Modified: head/usr.bin/procstat/tests/procstat_test.sh ============================================================================== --- head/usr.bin/procstat/tests/procstat_test.sh Thu Dec 6 08:27:56 2018 (r341622) +++ head/usr.bin/procstat/tests/procstat_test.sh Thu Dec 6 09:22:35 2018 (r341623) @@ -79,6 +79,8 @@ command_line_arguments_head() } command_line_arguments_body() { + atf_skip "https://bugs.freebsd.org/233587" + arguments="my arguments" start_program $arguments @@ -103,6 +105,8 @@ environment_head() } environment_body() { + atf_skip "https://bugs.freebsd.org/233588" + var="MY_VARIABLE=foo" eval "export $var" From owner-svn-src-head@freebsd.org Thu Dec 6 09:45:26 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1C12B1325A70; Thu, 6 Dec 2018 09:45:26 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B5F2C893C8; Thu, 6 Dec 2018 09:45:25 +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 9725221D05; Thu, 6 Dec 2018 09:45:25 +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 wB69jPUv009596; Thu, 6 Dec 2018 09:45:25 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB69jPCp009595; Thu, 6 Dec 2018 09:45:25 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201812060945.wB69jPCp009595@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Thu, 6 Dec 2018 09:45:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341624 - 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: 341624 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B5F2C893C8 X-Spamd-Result: default: False [-0.83 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.45)[-0.445,0]; NEURAL_HAM_SHORT(-0.30)[-0.301,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.08)[-0.083,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 06 Dec 2018 09:45:26 -0000 Author: vmaffione Date: Thu Dec 6 09:45:25 2018 New Revision: 341624 URL: https://svnweb.freebsd.org/changeset/base/341624 Log: netmap: netmap_transmit should honor bpf packet tap hook This allows tcpdump to capture outbound kernel packets while in netmap mode Submitted by: Marc de la Gueronniere Reviewed by: vmaffione MFC after: 1 week Sponsored by: Verisign, Inc. Differential Revision: https://reviews.freebsd.org/D17896 Modified: head/sys/dev/netmap/netmap.c Modified: head/sys/dev/netmap/netmap.c ============================================================================== --- head/sys/dev/netmap/netmap.c Thu Dec 6 09:22:35 2018 (r341623) +++ head/sys/dev/netmap/netmap.c Thu Dec 6 09:45:25 2018 (r341624) @@ -449,6 +449,7 @@ ports attached to the switch) #include /* bus_dmamap_* */ #include #include +#include /* ETHER_BPF_MTAP */ #elif defined(linux) @@ -3859,6 +3860,10 @@ netmap_transmit(struct ifnet *ifp, struct mbuf *m) RD(1, "%s drop mbuf that needs generic segmentation offload", na->name); goto done; } + +#ifdef __FreeBSD__ + ETHER_BPF_MTAP(ifp, m); +#endif /* __FreeBSD__ */ /* protect against netmap_rxsync_from_host(), netmap_sw_to_nic() * and maybe other instances of netmap_transmit (the latter From owner-svn-src-head@freebsd.org Thu Dec 6 12:34:35 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4D9EE132B51A; Thu, 6 Dec 2018 12:34:35 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E839E8F955; Thu, 6 Dec 2018 12:34:34 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B096A23914; Thu, 6 Dec 2018 12:34:34 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB6CYYtn000635; Thu, 6 Dec 2018 12:34:34 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB6CYY51000634; Thu, 6 Dec 2018 12:34:34 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201812061234.wB6CYY51000634@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 6 Dec 2018 12:34:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341632 - head/sys/dev/acpica X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/dev/acpica X-SVN-Commit-Revision: 341632 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E839E8F955 X-Spamd-Result: default: False [-1.57 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.87)[-0.865,0]; NEURAL_HAM_SHORT(-0.65)[-0.648,0]; NEURAL_HAM_LONG(-0.05)[-0.054,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 06 Dec 2018 12:34:35 -0000 Author: avg Date: Thu Dec 6 12:34:34 2018 New Revision: 341632 URL: https://svnweb.freebsd.org/changeset/base/341632 Log: acpi_{Device,Battery}IsPresent: restore pre-r330957 behaviour Specifically, assume that the device is present if evaluation of _STA method fails. Before r330957 we ignored any _STA evaluation failure (which was performed by AcpiGetObjectInfo in ACPICA contrib code) for the purpose of acpi_DeviceIsPresent and acpi_BatteryIsPresent. ACPICA 20180313 removed evaluation of _STA from AcpiGetObjectInfo. So, we added evaluation of _STA to acpi_DeviceIsPresent and acpi_BatteryIsPresent. One important difference is that the new code ignored a failure only if _STA did not exist (AE_NOT_FOUND). Any other kind of failure was treated as a fatal failure. Apparently, on some systems we can get AE_NOT_EXIST when evaluating _STA. And that error is not an evil twin of AE_NOT_FOUND, despite a very similar name, but a distinct error related to a missing handler for an ACPI operation region. It's possible that for some people the problem was already fixed by changes in ACPICA and/or in acpi_ec driver (or even in BIOS) that fixed the AE_NOT_EXIST failure related to EC operation region. This work is based on a great analysis by cem and an earlier patch by Ali Abdallah . PR: 227191 Reported by: 0mp MFC after: 2 weeks Modified: head/sys/dev/acpica/acpi.c Modified: head/sys/dev/acpica/acpi.c ============================================================================== --- head/sys/dev/acpica/acpi.c Thu Dec 6 11:52:07 2018 (r341631) +++ head/sys/dev/acpica/acpi.c Thu Dec 6 12:34:34 2018 (r341632) @@ -2203,8 +2203,6 @@ acpi_DeviceIsPresent(device_t dev) h = acpi_get_handle(dev); if (h == NULL) return (FALSE); - status = acpi_GetInteger(h, "_STA", &s); - /* * Certain Treadripper boards always returns 0 for FreeBSD because it * only returns non-zero for the OS string "Windows 2015". Otherwise it @@ -2214,9 +2212,14 @@ acpi_DeviceIsPresent(device_t dev) if (acpi_MatchHid(h, "AMDI0020") || acpi_MatchHid(h, "AMDI0010")) return (TRUE); - /* If no _STA method, must be present */ + status = acpi_GetInteger(h, "_STA", &s); + + /* + * If no _STA method or if it failed, then assume that + * the device is present. + */ if (ACPI_FAILURE(status)) - return (status == AE_NOT_FOUND ? TRUE : FALSE); + return (TRUE); return (ACPI_DEVICE_PRESENT(s) ? TRUE : FALSE); } @@ -2236,9 +2239,12 @@ acpi_BatteryIsPresent(device_t dev) return (FALSE); status = acpi_GetInteger(h, "_STA", &s); - /* If no _STA method, must be present */ + /* + * If no _STA method or if it failed, then assume that + * the device is present. + */ if (ACPI_FAILURE(status)) - return (status == AE_NOT_FOUND ? TRUE : FALSE); + return (TRUE); return (ACPI_BATTERY_PRESENT(s) ? TRUE : FALSE); } From owner-svn-src-head@freebsd.org Thu Dec 6 13:46:19 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C9300132DE21; Thu, 6 Dec 2018 13:46:19 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 711B06C2BD; Thu, 6 Dec 2018 13:46:19 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 524CF24505; Thu, 6 Dec 2018 13:46:19 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB6DkJVR037039; Thu, 6 Dec 2018 13:46:19 GMT (envelope-from yuripv@FreeBSD.org) Received: (from yuripv@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB6DkJTv037038; Thu, 6 Dec 2018 13:46:19 GMT (envelope-from yuripv@FreeBSD.org) Message-Id: <201812061346.wB6DkJTv037038@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: yuripv set sender to yuripv@FreeBSD.org using -f From: Yuri Pankov Date: Thu, 6 Dec 2018 13:46:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341634 - head/share/termcap X-SVN-Group: head X-SVN-Commit-Author: yuripv X-SVN-Commit-Paths: head/share/termcap X-SVN-Commit-Revision: 341634 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 711B06C2BD X-Spamd-Result: default: False [-1.86 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.86)[-0.863,0]; NEURAL_HAM_SHORT(-0.91)[-0.912,0]; NEURAL_HAM_LONG(-0.08)[-0.083,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 06 Dec 2018 13:46:20 -0000 Author: yuripv Date: Thu Dec 6 13:46:18 2018 New Revision: 341634 URL: https://svnweb.freebsd.org/changeset/base/341634 Log: termcap: add italics and tmux entries - add "ecma+italics" cap - use it in "xterm-basic" - add "tmux"/"tmux-256color" caps, fixing "so" and "se" caps, and sourcing "ecma+italics" and "screen"/"screen-256color" Reviewed by: bapt Differential revision: https://reviews.freebsd.org/D18363 Modified: head/share/termcap/termcap Modified: head/share/termcap/termcap ============================================================================== --- head/share/termcap/termcap Thu Dec 6 13:32:51 2018 (r341633) +++ head/share/termcap/termcap Thu Dec 6 13:46:18 2018 (r341634) @@ -2787,6 +2787,17 @@ SW|screen-w|VT 100/ANSI X3.64 virtual terminal with 13 screen-256color|VT 100/ANSI X3.64 terminal with 256 colors:\ :Co#256:pa#32767:\ :AB=\E[48;5;%dm:AF=\E[38;5;%dm:tc=screen: + +ecma+italics|ECMA-48 italics:\ + :ZH=\E[3m:ZR=\E[23m: + +tmux|tmux terminal multiplexer:\ + :so=\E[7m:se=\E[27m:\ + :tc=ecma+italics:tc=screen: +tmux-256color|tmux with 256 colors:\ + :so=\E[7m:se=\E[27m:\ + :tc=ecma+italics:tc=screen-256color: + # $XTermId: termcap,v 1.78 2009/11/09 00:24:26 tom Exp $ # # Note: @@ -2829,7 +2840,8 @@ xterm-basic|modern xterm common:\ :me=\E[m:ml=\El:mr=\E[7m:mu=\Em:nd=\E[C:op=\E[39;49m:\ :rc=\E8:rs=\E[!p\E[?3;4l\E[4l\E>:sc=\E7:se=\E[27m:sf=^J:\ :so=\E[7m:sr=\EM:st=\EH:\ - :ue=\E[24m:up=\E[A:us=\E[4m:ve=\E[?12l\E[?25h:vi=\E[?25l:vs=\E[?12;25h: + :ue=\E[24m:up=\E[A:us=\E[4m:ve=\E[?12l\E[?25h:vi=\E[?25l:vs=\E[?12;25h:\ + :tc=ecma+italics: # The xterm-new description has all of the features, but is not completely # compatible with vt220. If you are using a Sun or PC keyboard, set the From owner-svn-src-head@freebsd.org Thu Dec 6 13:52:03 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 984A4132E14E; Thu, 6 Dec 2018 13:52: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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3B6B26C9B4; Thu, 6 Dec 2018 13:52: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 1C25324691; Thu, 6 Dec 2018 13:52: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 wB6Dq24I039169; Thu, 6 Dec 2018 13:52:02 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB6Dq2XR039168; Thu, 6 Dec 2018 13:52:02 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201812061352.wB6Dq2XR039168@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 6 Dec 2018 13:52:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341635 - head/share/man/man7 X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/share/man/man7 X-SVN-Commit-Revision: 341635 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3B6B26C9B4 X-Spamd-Result: default: False [-1.86 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.86)[-0.863,0]; NEURAL_HAM_SHORT(-0.91)[-0.912,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.08)[-0.083,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 06 Dec 2018 13:52:03 -0000 Author: trasz Date: Thu Dec 6 13:52:02 2018 New Revision: 341635 URL: https://svnweb.freebsd.org/changeset/base/341635 Log: Add examples for "make buildenv". MFC after: 2 weeks Sponsored by: DARPA, AFRL Modified: head/share/man/man7/development.7 Modified: head/share/man/man7/development.7 ============================================================================== --- head/share/man/man7/development.7 Thu Dec 6 13:46:18 2018 (r341634) +++ head/share/man/man7/development.7 Thu Dec 6 13:52:02 2018 (r341635) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 30, 2018 +.Dd December 6, 2018 .Dt DEVELOPMENT 7 .Os .Sh NAME @@ -134,6 +134,29 @@ build has been completed in the past, not on a fresh s .Bd -literal -offset indent cd src make -sj8 kernel KERNFAST=1 +.Ed +.Pp +To rebuild parts of +.Fx +for another CPU architecture, +first prepare your source tree by building the cross-toolchain: +.Bd -literal -offset indent +cd src +make -sj8 toolchain TARGET_ARCH=armv6 +.Ed +.Pp +Afterwards, to build and install a single piece of userspace, use: +.Bd -literal -offset indent +cd src/bin/ls +make buildenv TARGET_ARCH=armv6 +make clean all install DESTDIR=/clients/arm +.Ed +.Pp +Likewise, to quickly rebuild and reinstall the kernel, use: +.Bd -literal -offset indent +cd src +make buildenv TARGET_ARCH=armv6 +make -sj8 kernel KERNFAST=1 DESTDIR=/clients/arm .Ed .Sh SEE ALSO .Xr svnlite 1 , From owner-svn-src-head@freebsd.org Thu Dec 6 17:29:38 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1429D130C529; Thu, 6 Dec 2018 17:29:38 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AF59C768DE; Thu, 6 Dec 2018 17:29:37 +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 904FA26C56; Thu, 6 Dec 2018 17:29:37 +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 wB6HTbDv053780; Thu, 6 Dec 2018 17:29:37 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB6HTbvr053779; Thu, 6 Dec 2018 17:29:37 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201812061729.wB6HTbvr053779@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 6 Dec 2018 17:29:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341638 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 341638 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: AF59C768DE X-Spamd-Result: default: False [-1.88 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.86)[-0.863,0]; NEURAL_HAM_LONG(-0.08)[-0.083,0]; NEURAL_HAM_SHORT(-0.93)[-0.932,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 06 Dec 2018 17:29:38 -0000 Author: markj Date: Thu Dec 6 17:29:37 2018 New Revision: 341638 URL: https://svnweb.freebsd.org/changeset/base/341638 Log: Let kern.trap_enotcap be set as a tunable. This is handy for testing programs that are run by rc. MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/sys_capability.c Modified: head/sys/kern/sys_capability.c ============================================================================== --- head/sys/kern/sys_capability.c Thu Dec 6 16:10:39 2018 (r341637) +++ head/sys/kern/sys_capability.c Thu Dec 6 17:29:37 2018 (r341638) @@ -86,7 +86,7 @@ __FBSDID("$FreeBSD$"); #include bool __read_frequently trap_enotcap; -SYSCTL_BOOL(_kern, OID_AUTO, trap_enotcap, CTLFLAG_RW, &trap_enotcap, 0, +SYSCTL_BOOL(_kern, OID_AUTO, trap_enotcap, CTLFLAG_RWTUN, &trap_enotcap, 0, "Deliver SIGTRAP on ENOTCAPABLE"); #ifdef CAPABILITY_MODE From owner-svn-src-head@freebsd.org Thu Dec 6 18:03:19 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2E7F8130D694; Thu, 6 Dec 2018 18:03:19 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C7F7178180; Thu, 6 Dec 2018 18:03:18 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A314E27321; Thu, 6 Dec 2018 18:03:18 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB6I3IrD074182; Thu, 6 Dec 2018 18:03:18 GMT (envelope-from yuripv@FreeBSD.org) Received: (from yuripv@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB6I3IgZ074181; Thu, 6 Dec 2018 18:03:18 GMT (envelope-from yuripv@FreeBSD.org) Message-Id: <201812061803.wB6I3IgZ074181@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: yuripv set sender to yuripv@FreeBSD.org using -f From: Yuri Pankov Date: Thu, 6 Dec 2018 18:03:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341639 - head/lib/libc/gen X-SVN-Group: head X-SVN-Commit-Author: yuripv X-SVN-Commit-Paths: head/lib/libc/gen X-SVN-Commit-Revision: 341639 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C7F7178180 X-Spamd-Result: default: False [-1.79 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.86)[-0.863,0]; NEURAL_HAM_LONG(-0.08)[-0.083,0]; NEURAL_HAM_SHORT(-0.84)[-0.844,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 06 Dec 2018 18:03:19 -0000 Author: yuripv Date: Thu Dec 6 18:03:18 2018 New Revision: 341639 URL: https://svnweb.freebsd.org/changeset/base/341639 Log: syslog(3): stdarg.h is needed only for vsyslog() Reported by: Brian Wood Reviewed by: asomers, ngie Differential revision: https://reviews.freebsd.org/D18334 Modified: head/lib/libc/gen/syslog.3 Modified: head/lib/libc/gen/syslog.3 ============================================================================== --- head/lib/libc/gen/syslog.3 Thu Dec 6 17:29:37 2018 (r341638) +++ head/lib/libc/gen/syslog.3 Thu Dec 6 18:03:18 2018 (r341639) @@ -28,7 +28,7 @@ .\" @(#)syslog.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd April 12, 2018 +.Dd November 25, 2018 .Dt SYSLOG 3 .Os .Sh NAME @@ -42,17 +42,18 @@ .Lb libc .Sh SYNOPSIS .In syslog.h -.In stdarg.h .Ft void .Fn syslog "int priority" "const char *message" "..." .Ft void -.Fn vsyslog "int priority" "const char *message" "va_list args" -.Ft void .Fn openlog "const char *ident" "int logopt" "int facility" .Ft void .Fn closelog void .Ft int .Fn setlogmask "int maskpri" +.In syslog.h +.In stdarg.h +.Ft void +.Fn vsyslog "int priority" "const char *message" "va_list args" .Sh DESCRIPTION The .Fn syslog From owner-svn-src-head@freebsd.org Thu Dec 6 18:12:51 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DD63E130DB66; Thu, 6 Dec 2018 18:12:51 +0000 (UTC) (envelope-from sobomax@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 661A0788F2; Thu, 6 Dec 2018 18:12:51 +0000 (UTC) (envelope-from sobomax@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 46B53274D1; Thu, 6 Dec 2018 18:12:51 +0000 (UTC) (envelope-from sobomax@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB6ICpD4079420; Thu, 6 Dec 2018 18:12:51 GMT (envelope-from sobomax@FreeBSD.org) Received: (from sobomax@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB6ICpis079419; Thu, 6 Dec 2018 18:12:51 GMT (envelope-from sobomax@FreeBSD.org) Message-Id: <201812061812.wB6ICpis079419@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sobomax set sender to sobomax@FreeBSD.org using -f From: Maxim Sobolev Date: Thu, 6 Dec 2018 18:12:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341640 - head/share/misc X-SVN-Group: head X-SVN-Commit-Author: sobomax X-SVN-Commit-Paths: head/share/misc X-SVN-Commit-Revision: 341640 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 661A0788F2 X-Spamd-Result: default: False [-1.88 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_SHORT(-0.94)[-0.937,0]; NEURAL_HAM_MEDIUM(-0.86)[-0.863,0]; NEURAL_HAM_LONG(-0.08)[-0.083,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 06 Dec 2018 18:12:52 -0000 Author: sobomax Date: Thu Dec 6 18:12:50 2018 New Revision: 341640 URL: https://svnweb.freebsd.org/changeset/base/341640 Log: Apparently @portmgr does not feel like my current level of contribution warrants me a repo access to the ports tree anymore. Move myself into alumni at least for a time being. Modified: head/share/misc/committers-ports.dot Modified: head/share/misc/committers-ports.dot ============================================================================== --- head/share/misc/committers-ports.dot Thu Dec 6 18:03:18 2018 (r341639) +++ head/share/misc/committers-ports.dot Thu Dec 6 18:12:50 2018 (r341640) @@ -33,6 +33,7 @@ asami [label="Satoshi Asami\nasami@FreeBSD.org\n1994/1 billf [label="Bill Fumerola\nbillf@FreeBSD.org\n1998/11/11\n2006/12/14"] jmallett [label="Juli Mallett\njmallett@FreeBSD.org\n2003/01/16\n2006/08/10"] marcel [label="Marcel Moolenaar\nmarcel@FreeBSD.org\n1999/07/03\n2007/07/01"] +sobomax[label="Maxim Sobolev\nsobomax@FreeBSD.org\n2000/05/17\n2018/12/03"] steve [label="Steve Price\nsteve@FreeBSD.org\nxxxx/xx/xx\nxxxx/xx/xx"] will [label="Will Andrews\nwill@FreeBSD.org\n2000/03/20\n2006/09/01"] @@ -240,7 +241,6 @@ shurd [label="Stephen Hurd\nshurd@FreeBSD.org\n2014/06 simon [label="Simon L. Nielsen\nsimon@FreeBSD.org\n2005/01/08"] skozlov [label="Sergey Kozlov\nskozlov@FreeBSD.org\n2018/09/21"] skreuzer [label="Steven Kreuzer\nskreuzer@FreeBSD.org\n2009/03/25"] -sobomax[label="Maxim Sobolev\nsobomax@FreeBSD.org\n2000/05/17"] sperber[label="Armin Pirkovitsch\nsperber@FreeBSD.org\n2012/04/15"] stas [label="Stanislav Sedov\nstas@FreeBSD.org\n2006/09/18"] stefan [label="Stefan Walter\nstefan@FreeBSD.org\n2006/05/07"] From owner-svn-src-head@freebsd.org Thu Dec 6 18:21:49 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7A58D130E069; Thu, 6 Dec 2018 18:21:49 +0000 (UTC) (envelope-from sef@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1FA34791E3; Thu, 6 Dec 2018 18:21:49 +0000 (UTC) (envelope-from sef@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 01D2527550; Thu, 6 Dec 2018 18:21:49 +0000 (UTC) (envelope-from sef@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB6ILmQc081494; Thu, 6 Dec 2018 18:21:48 GMT (envelope-from sef@FreeBSD.org) Received: (from sef@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB6ILmIK081493; Thu, 6 Dec 2018 18:21:48 GMT (envelope-from sef@FreeBSD.org) Message-Id: <201812061821.wB6ILmIK081493@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sef set sender to sef@FreeBSD.org using -f From: Sean Eric Fagan Date: Thu, 6 Dec 2018 18:21:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341641 - head/usr.sbin/mountd X-SVN-Group: head X-SVN-Commit-Author: sef X-SVN-Commit-Paths: head/usr.sbin/mountd X-SVN-Commit-Revision: 341641 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1FA34791E3 X-Spamd-Result: default: False [-1.88 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.86)[-0.863,0]; NEURAL_HAM_SHORT(-0.94)[-0.937,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.08)[-0.083,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 06 Dec 2018 18:21:49 -0000 Author: sef Date: Thu Dec 6 18:21:48 2018 New Revision: 341641 URL: https://svnweb.freebsd.org/changeset/base/341641 Log: Reduce number of DNS queries in mountd. As reported by a FreeNAS user (see https://redmine.ixsystems.com/issues/55728), mountd does more calls to getnameinfo() than it needs to; this changes it to only call it for the RPC calls it needs the name information for. Reported by: Dave Flowers Reviewed by: imp, mav Approved by: mav (mentor) MFC after: 2 weeks Sponsored by: iXsystems Inc Differential Revision: https://reviews.freebsd.org/D18430 Modified: head/usr.sbin/mountd/mountd.c Modified: head/usr.sbin/mountd/mountd.c ============================================================================== --- head/usr.sbin/mountd/mountd.c Thu Dec 6 18:12:50 2018 (r341640) +++ head/usr.sbin/mountd/mountd.c Thu Dec 6 18:21:48 2018 (r341641) @@ -1026,8 +1026,13 @@ mntsrv(struct svc_req *rqstp, SVCXPRT *transp) syslog(LOG_ERR, "request from unknown address family"); return; } - lookup_failed = getnameinfo(saddr, saddr->sa_len, host, sizeof host, - NULL, 0, 0); + switch (rqstp->rq_proc) { + case MOUNTPROC_MNT: + case MOUNTPROC_UMNT: + case MOUNTPROC_UMNTALL: + lookup_failed = getnameinfo(saddr, saddr->sa_len, host, + sizeof host, NULL, 0, 0); + } getnameinfo(saddr, saddr->sa_len, numerichost, sizeof numerichost, NULL, 0, NI_NUMERICHOST); switch (rqstp->rq_proc) { From owner-svn-src-head@freebsd.org Thu Dec 6 18:58:55 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D029130F545; Thu, 6 Dec 2018 18:58:55 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1480B7AB7A; Thu, 6 Dec 2018 18:58:55 +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 EA84827BCA; Thu, 6 Dec 2018 18:58:54 +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 wB6IwsWk099882; Thu, 6 Dec 2018 18:58:54 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB6IwsvJ099881; Thu, 6 Dec 2018 18:58:54 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201812061858.wB6IwsvJ099881@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Thu, 6 Dec 2018 18:58:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341642 - head/sys/netpfil/pf X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/sys/netpfil/pf X-SVN-Commit-Revision: 341642 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1480B7AB7A X-Spamd-Result: default: False [-1.90 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.86)[-0.863,0]; NEURAL_HAM_SHORT(-0.95)[-0.953,0]; NEURAL_HAM_LONG(-0.08)[-0.083,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 06 Dec 2018 18:58:55 -0000 Author: kp Date: Thu Dec 6 18:58:54 2018 New Revision: 341642 URL: https://svnweb.freebsd.org/changeset/base/341642 Log: pf: add a comment describing why do we call pf_map_addr again if port selection process fails Obtained from: OpenBSD Modified: head/sys/netpfil/pf/pf_lb.c Modified: head/sys/netpfil/pf/pf_lb.c ============================================================================== --- head/sys/netpfil/pf/pf_lb.c Thu Dec 6 18:21:48 2018 (r341641) +++ head/sys/netpfil/pf/pf_lb.c Thu Dec 6 18:58:54 2018 (r341642) @@ -293,6 +293,10 @@ pf_get_sport(sa_family_t af, u_int8_t proto, struct pf switch (r->rpool.opts & PF_POOL_TYPEMASK) { case PF_POOL_RANDOM: case PF_POOL_ROUNDROBIN: + /* + * pick a different source address since we're out + * of free port choices for the current one. + */ if (pf_map_addr(af, r, saddr, naddr, &init_addr, sn)) return (1); break; From owner-svn-src-head@freebsd.org Thu Dec 6 18:59:34 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 64711130F5BE; Thu, 6 Dec 2018 18:59:34 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0DE6A7ACC6; Thu, 6 Dec 2018 18:59:34 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E305E27BCC; Thu, 6 Dec 2018 18:59:33 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB6IxXad099955; Thu, 6 Dec 2018 18:59:33 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB6IxXN0099954; Thu, 6 Dec 2018 18:59:33 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201812061859.wB6IxXN0099954@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Thu, 6 Dec 2018 18:59:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341643 - head/sys/dev/mlx5 X-SVN-Group: head X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: head/sys/dev/mlx5 X-SVN-Commit-Revision: 341643 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0DE6A7ACC6 X-Spamd-Result: default: False [-1.90 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.86)[-0.863,0]; NEURAL_HAM_SHORT(-0.95)[-0.953,0]; NEURAL_HAM_LONG(-0.08)[-0.083,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 06 Dec 2018 18:59:34 -0000 Author: sbruno Date: Thu Dec 6 18:59:33 2018 New Revision: 341643 URL: https://svnweb.freebsd.org/changeset/base/341643 Log: Change u32 to uint32_t to allow the native-xtools target to build libsysdecode. Submitted by: kib Modified: head/sys/dev/mlx5/mlx5io.h Modified: head/sys/dev/mlx5/mlx5io.h ============================================================================== --- head/sys/dev/mlx5/mlx5io.h Thu Dec 6 18:58:54 2018 (r341642) +++ head/sys/dev/mlx5/mlx5io.h Thu Dec 6 18:59:33 2018 (r341643) @@ -132,7 +132,7 @@ struct mlx5_fpga_temperature { #define MLX5_FPGA_RESET _IO('m', 0x82) #define MLX5_FPGA_IMAGE_SEL _IOWINT('m', 0x83) #define MLX5_FPGA_QUERY _IOR('m', 0x84, struct mlx5_fpga_query) -#define MLX5_FPGA_CAP _IOR('m', 0x85, u32[MLX5_FPGA_CAP_ARR_SZ]) +#define MLX5_FPGA_CAP _IOR('m', 0x85, uint32_t[MLX5_FPGA_CAP_ARR_SZ]) #define MLX5_FPGA_TEMPERATURE _IOWR('m', 0x86, struct mlx5_fpga_temperature) #define MLX5_FPGA_CONNECT _IOWR('m', 0x87, enum mlx5_fpga_connect) From owner-svn-src-head@freebsd.org Thu Dec 6 19:08:53 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 98ABA130F906; Thu, 6 Dec 2018 19:08:53 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-it1-x141.google.com (mail-it1-x141.google.com [IPv6:2607:f8b0:4864:20::141]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EA91A7B37B; Thu, 6 Dec 2018 19:08:52 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by mail-it1-x141.google.com with SMTP id p197so3262304itp.0; Thu, 06 Dec 2018 11:08:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BfBPbcUNYyH/rAtxBLtWh/5/QCL/4/KWg3FlQMfNZAU=; b=iR8YynyT3ax8YEUWuOs/6/troaT+HIKIkqHKKj4lM+/LbvPbJ2mKMBKiIVy81U6BBM staO8hwrtYRcvHY2AQTw9FlpmUXsrkIGmmFoPNuaPOsbAmaQlMp+St+w6zZdfP1zS9eP Hs5tVXB4yx2FQntCy0PH/3ylp+rhwqLz2YCLOdP1yEDNrrfk+Kg6Kcgv3f/vujYti/Er pkpCcTVbg4uqhr4Y05IjVGDKcqas4xQE/tLXncKLZF9g/hpvpQA6L5rLoHwBNkNfewoY 95HlK4WN0NZIq8Rm0z/AMjY1ql8/dhUADu5J/EJrd/VFZRB19+oG+FSTCYqswUNwYdPn zY5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=BfBPbcUNYyH/rAtxBLtWh/5/QCL/4/KWg3FlQMfNZAU=; b=CKzwq5jDXb2D9F4iKQqzjSL4JpuW98wD34lpFanMrkeQ5LSiZAQjZGUNTqci9hQFzP tktql2evUr1+94KZEh9+NVphnc1tgmI9UkL4xsnce31QtXrNhs7XgiSbfbtTF45wYHL8 rzVzaifFZjJ4OAdjtBk4b2PI2w4eaiIeEMkZ7M4kABrg4k1LcDo0F5SU2kjo2p5fr/Rx 0pfijwd57gv8NmmuM/ItDh91+lXeESKhIDOYOZgQRRYC+0eVBiGVKyOJayPTeNWhnSef pFb9ziyDWGMfFWiWIJN8FtuYLfRRYVKsIo7utJ0YK3vkz/LfVktWsTrgE9igFLfA7EBE D4PQ== X-Gm-Message-State: AA+aEWb6+cBJ6EdUYSCCejgsWLahZbiFd1p0xfMdeESLfkLOi5u0FoC4 vhEsfqydUYvGayIZy1UT+5C63fCE150= X-Google-Smtp-Source: AFSGD/Wt/yPUiZWgjPb34XUqs9otnlyI6EUzOcwqYdMbajYj1prQO9aVTSSbGDvDrgUnyAIPG9iWiw== X-Received: by 2002:a02:c891:: with SMTP id m17mr26793081jao.45.1544123331877; Thu, 06 Dec 2018 11:08:51 -0800 (PST) Received: from ralga.knownspace (173-25-245-129.client.mchsi.com. [173.25.245.129]) by smtp.gmail.com with ESMTPSA id r16sm463174ioa.16.2018.12.06.11.08.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 06 Dec 2018 11:08:51 -0800 (PST) Sender: Justin Hibbits Date: Thu, 6 Dec 2018 13:08:45 -0600 From: Justin Hibbits To: Mark Johnston Cc: Kyle Evans , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, Li-Wen Hsu Subject: Re: svn commit: r339516 - head/sys/cddl/dev/dtrace/powerpc Message-ID: <20181206130845.6088ea55@ralga.knownspace> In-Reply-To: <20181122071629.GA96830@raichu> References: <201810210208.w9L28vVc080088@repo.freebsd.org> <20181122071629.GA96830@raichu> X-Mailer: Claws Mail 3.17.1 (GTK+ 2.24.32; powerpc64-portbld-freebsd13.0) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: EA91A7B37B X-Spamd-Result: default: False [-1.45 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com]; NEURAL_HAM_MEDIUM(-0.69)[-0.686,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[FreeBSD.org]; NEURAL_HAM_LONG(-0.86)[-0.858,0]; RCPT_COUNT_FIVE(0.00)[6]; RCVD_COUNT_THREE(0.00)[3]; IP_SCORE(0.18)[ip: (3.80), ipnet: 2607:f8b0::/32(-1.53), asn: 15169(-1.31), country: US(-0.09)]; NEURAL_SPAM_SHORT(0.13)[0.128,0]; DKIM_TRACE(0.00)[gmail.com:+]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; RCVD_IN_DNSWL_NONE(0.00)[1.4.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; FORGED_SENDER(0.30)[jhibbits@FreeBSD.org,chmeeedalf@gmail.com]; RCVD_TLS_LAST(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[jhibbits@FreeBSD.org,chmeeedalf@gmail.com] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 06 Dec 2018 19:08:53 -0000 On Thu, 22 Nov 2018 02:16:29 -0500 Mark Johnston wrote: > On Wed, Nov 21, 2018 at 10:02:15PM -0600, Kyle Evans wrote: > > On Wed, Nov 21, 2018 at 9:42 PM Kyle Evans > > wrote: > > > > > > On Sat, Oct 20, 2018 at 9:09 PM Justin Hibbits > > > wrote: > > > > > > > > Author: jhibbits > > > > Date: Sun Oct 21 02:08:57 2018 > > > > New Revision: 339516 > > > > URL: https://svnweb.freebsd.org/changeset/base/339516 > > > > > > > > Log: > > > > powerpc/dtrace: Use explicit bit numbers to mask out PSL_EE > > > > > > > > There seems to be a race in CI, such that dtrace_asm.S might > > > > be assembled before the genassym is completed. This causes a > > > > build failure when PSL_EE doesn't exist, and is read as 0. Get > > > > around this by explicitly specifying the bits in the mask > > > > instead. > > > > > > Hi, > > > > > > CI on the stable/12 branch still hits this, so I'm tempted to MFC > > > this if you don't object. OTOH, the correct solution should be a > > > `dependency "genassym.o"` in ^/sys/conf/files.powerpc for > > > dtrace_asm.S, no? > > I believe that dtrace_asm.S will be built as part of dtrace.ko, not > the kernel. dtrace/Makefile already specifies a dependency on > assym.inc. Maybe this is the same issue as PR 233339? > > > Sorry, that should have read "genassym.inc" -- my naive > > understanding of 'dependency' is that config(8) will turn it > > directly into a makefile dependency that will alleviate this. > > Yep, looks a lot like PR 233339. - Justin From owner-svn-src-head@freebsd.org Thu Dec 6 19:20:01 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7038E130FE2A; Thu, 6 Dec 2018 19:20:01 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1707B7BB30; Thu, 6 Dec 2018 19:20:01 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EBC5B27F38; Thu, 6 Dec 2018 19:20:00 +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 wB6JK0sY010672; Thu, 6 Dec 2018 19:20:00 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB6JK0oS010671; Thu, 6 Dec 2018 19:20:00 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201812061920.wB6JK0oS010671@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 6 Dec 2018 19:20:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341645 - head/sys/dev/mlx5/mlx5_en X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 341645 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1707B7BB30 X-Spamd-Result: default: False [-1.91 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.86)[-0.863,0]; NEURAL_HAM_SHORT(-0.96)[-0.964,0]; NEURAL_HAM_LONG(-0.08)[-0.083,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 06 Dec 2018 19:20:01 -0000 Author: kib Date: Thu Dec 6 19:20:00 2018 New Revision: 341645 URL: https://svnweb.freebsd.org/changeset/base/341645 Log: Appease gcc build, remove duplicated declaration. Reported by: np Sponsored by: Mellanox Technologies MFC after: 1 week Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Dec 6 19:18:51 2018 (r341644) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Dec 6 19:20:00 2018 (r341645) @@ -160,8 +160,6 @@ static const struct { MALLOC_DEFINE(M_MLX5EN, "MLX5EN", "MLX5 Ethernet"); -SYSCTL_DECL(_hw_mlx5); - static void mlx5e_update_carrier(struct mlx5e_priv *priv) { From owner-svn-src-head@freebsd.org Thu Dec 6 19:27:16 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2A86B13100A6; Thu, 6 Dec 2018 19:27:16 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CBBA87C089; Thu, 6 Dec 2018 19:27:15 +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 AC10910A; Thu, 6 Dec 2018 19:27:15 +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 wB6JRFCI015422; Thu, 6 Dec 2018 19:27:15 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB6JRFD0015420; Thu, 6 Dec 2018 19:27:15 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201812061927.wB6JRFD0015420@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Thu, 6 Dec 2018 19:27:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341646 - in head: share/man/man4 sys/netpfil/pf X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: in head: share/man/man4 sys/netpfil/pf X-SVN-Commit-Revision: 341646 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: CBBA87C089 X-Spamd-Result: default: False [-1.80 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.87)[-0.872,0]; NEURAL_HAM_SHORT(-0.97)[-0.968,0]; NEURAL_SPAM_LONG(0.04)[0.035,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 06 Dec 2018 19:27:16 -0000 Author: kp Date: Thu Dec 6 19:27:15 2018 New Revision: 341646 URL: https://svnweb.freebsd.org/changeset/base/341646 Log: pfsync: Performance improvement pfsync code is called for every new state, state update and state deletion in pf. While pf itself can operate on multiple states at the same time (on different cores, assuming the states hash to a different hashrow), pfsync only had a single lock. This greatly reduced throughput on multicore systems. Address this by splitting the pfsync queues into buckets, based on the state id. This ensures that updates for a given connection always end up in the same bucket, which allows pfsync to still collapse multiple updates into one, while allowing multiple cores to proceed at the same time. The number of buckets is tunable, but defaults to 2 x number of cpus. Benchmarking has shown improvement, depending on hardware and setup, from ~30% to ~100%. MFC after: 1 week Sponsored by: Orange Business Services Differential Revision: https://reviews.freebsd.org/D18373 Modified: head/share/man/man4/pfsync.4 head/sys/netpfil/pf/if_pfsync.c Modified: head/share/man/man4/pfsync.4 ============================================================================== --- head/share/man/man4/pfsync.4 Thu Dec 6 19:20:00 2018 (r341645) +++ head/share/man/man4/pfsync.4 Thu Dec 6 19:27:15 2018 (r341646) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 18, 2017 +.Dd December 6, 2018 .Dt PFSYNC 4 .Os .Sh NAME @@ -130,6 +130,13 @@ See .Xr carp 4 for more information. Default value is 240. +.It Va net.pfsync.pfsync_buckets +The number of +.Nm +buckets. +This affects the performance and memory tradeoff. +Defaults to twice the number of CPUs. +Change only if benchmarks show this helps on your workload. .El .Sh EXAMPLES .Nm Modified: head/sys/netpfil/pf/if_pfsync.c ============================================================================== --- head/sys/netpfil/pf/if_pfsync.c Thu Dec 6 19:20:00 2018 (r341645) +++ head/sys/netpfil/pf/if_pfsync.c Thu Dec 6 19:27:15 2018 (r341646) @@ -77,6 +77,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -106,6 +107,8 @@ __FBSDID("$FreeBSD$"); sizeof(struct pfsync_header) + \ sizeof(struct pfsync_subheader) ) +struct pfsync_bucket; + struct pfsync_pkt { struct ip *ip; struct in_addr src; @@ -164,7 +167,7 @@ static struct pfsync_q pfsync_qs[] = { }; static void pfsync_q_ins(struct pf_state *, int, bool); -static void pfsync_q_del(struct pf_state *, bool); +static void pfsync_q_del(struct pf_state *, bool, struct pfsync_bucket *); static void pfsync_update_state(struct pf_state *); @@ -183,6 +186,28 @@ struct pfsync_deferral { struct mbuf *pd_m; }; +struct pfsync_sofct; + +struct pfsync_bucket +{ + int b_id; + struct pfsync_softc *b_sc; + struct mtx b_mtx; + struct callout b_tmo; + int b_flags; +#define PFSYNCF_BUCKET_PUSH 0x00000001 + + size_t b_len; + TAILQ_HEAD(, pf_state) b_qs[PFSYNC_S_COUNT]; + TAILQ_HEAD(, pfsync_upd_req_item) b_upd_req_list; + TAILQ_HEAD(, pfsync_deferral) b_deferrals; + u_int b_deferred; + void *b_plus; + size_t b_pluslen; + + struct ifaltq b_snd; +}; + struct pfsync_softc { /* Configuration */ struct ifnet *sc_ifp; @@ -192,20 +217,12 @@ struct pfsync_softc { uint32_t sc_flags; #define PFSYNCF_OK 0x00000001 #define PFSYNCF_DEFER 0x00000002 -#define PFSYNCF_PUSH 0x00000004 uint8_t sc_maxupdates; struct ip sc_template; - struct callout sc_tmo; struct mtx sc_mtx; /* Queued data */ - size_t sc_len; - TAILQ_HEAD(, pf_state) sc_qs[PFSYNC_S_COUNT]; - TAILQ_HEAD(, pfsync_upd_req_item) sc_upd_req_list; - TAILQ_HEAD(, pfsync_deferral) sc_deferrals; - u_int sc_deferred; - void *sc_plus; - size_t sc_pluslen; + struct pfsync_bucket *sc_buckets; /* Bulk update info */ struct mtx sc_bulk_mtx; @@ -223,6 +240,10 @@ struct pfsync_softc { #define PFSYNC_UNLOCK(sc) mtx_unlock(&(sc)->sc_mtx) #define PFSYNC_LOCK_ASSERT(sc) mtx_assert(&(sc)->sc_mtx, MA_OWNED) +#define PFSYNC_BUCKET_LOCK(b) mtx_lock(&(b)->b_mtx) +#define PFSYNC_BUCKET_UNLOCK(b) mtx_unlock(&(b)->b_mtx) +#define PFSYNC_BUCKET_LOCK_ASSERT(b) mtx_assert(&(b)->b_mtx, MA_OWNED) + #define PFSYNC_BLOCK(sc) mtx_lock(&(sc)->sc_bulk_mtx) #define PFSYNC_BUNLOCK(sc) mtx_unlock(&(sc)->sc_bulk_mtx) #define PFSYNC_BLOCK_ASSERT(sc) mtx_assert(&(sc)->sc_bulk_mtx, MA_OWNED) @@ -239,7 +260,8 @@ VNET_DEFINE_STATIC(int, pfsync_carp_adj) = CARP_MAXSKE #define V_pfsync_carp_adj VNET(pfsync_carp_adj) static void pfsync_timeout(void *); -static void pfsync_push(struct pfsync_softc *); +static void pfsync_push(struct pfsync_bucket *); +static void pfsync_push_all(struct pfsync_softc *); static void pfsyncintr(void *); static int pfsync_multicast_setup(struct pfsync_softc *, struct ifnet *, void *); @@ -249,12 +271,16 @@ static void pfsync_pointers_uninit(void); static int pfsync_init(void); static void pfsync_uninit(void); +static unsigned long pfsync_buckets; + SYSCTL_NODE(_net, OID_AUTO, pfsync, CTLFLAG_RW, 0, "PFSYNC"); SYSCTL_STRUCT(_net_pfsync, OID_AUTO, stats, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(pfsyncstats), pfsyncstats, "PFSYNC statistics (struct pfsyncstats, net/if_pfsync.h)"); SYSCTL_INT(_net_pfsync, OID_AUTO, carp_demotion_factor, CTLFLAG_RW, &VNET_NAME(pfsync_carp_adj), 0, "pfsync's CARP demotion factor adjustment"); +SYSCTL_ULONG(_net_pfsync, OID_AUTO, pfsync_buckets, CTLFLAG_RDTUN, + &pfsync_buckets, 0, "Number of pfsync hash buckets"); static int pfsync_clone_create(struct if_clone *, int, caddr_t); static void pfsync_clone_destroy(struct ifnet *); @@ -270,10 +296,10 @@ static void pfsync_undefer_state(struct pf_state *, in static void pfsync_defer_tmo(void *); static void pfsync_request_update(u_int32_t, u_int64_t); -static void pfsync_update_state_req(struct pf_state *); +static bool pfsync_update_state_req(struct pf_state *); static void pfsync_drop(struct pfsync_softc *); -static void pfsync_sendout(int); +static void pfsync_sendout(int, int); static void pfsync_send_plus(void *, size_t); static void pfsync_bulk_start(void); @@ -285,7 +311,10 @@ static void pfsync_detach_ifnet(struct ifnet *); #ifdef IPSEC static void pfsync_update_net_tdb(struct pfsync_tdb *); #endif +static struct pfsync_bucket *pfsync_get_bucket(struct pfsync_softc *, + struct pf_state *); + #define PFSYNC_MAX_BULKTRIES 12 VNET_DEFINE(struct if_clone *, pfsync_cloner); @@ -296,21 +325,16 @@ pfsync_clone_create(struct if_clone *ifc, int unit, ca { struct pfsync_softc *sc; struct ifnet *ifp; - int q; + struct pfsync_bucket *b; + int c, q; if (unit != 0) return (EINVAL); - sc = malloc(sizeof(struct pfsync_softc), M_PFSYNC, M_WAITOK | M_ZERO); - sc->sc_flags |= PFSYNCF_OK; + if (! pfsync_buckets) + pfsync_buckets = mp_ncpus * 2; - for (q = 0; q < PFSYNC_S_COUNT; q++) - TAILQ_INIT(&sc->sc_qs[q]); - - TAILQ_INIT(&sc->sc_upd_req_list); - TAILQ_INIT(&sc->sc_deferrals); - - sc->sc_len = PFSYNC_MINPKT; + sc = malloc(sizeof(struct pfsync_softc), M_PFSYNC, M_WAITOK | M_ZERO); sc->sc_maxupdates = 128; ifp = sc->sc_ifp = if_alloc(IFT_PFSYNC); @@ -323,12 +347,10 @@ pfsync_clone_create(struct if_clone *ifc, int unit, ca ifp->if_ioctl = pfsyncioctl; ifp->if_output = pfsyncoutput; ifp->if_type = IFT_PFSYNC; - ifp->if_snd.ifq_maxlen = ifqmaxlen; ifp->if_hdrlen = sizeof(struct pfsync_header); ifp->if_mtu = ETHERMTU; mtx_init(&sc->sc_mtx, pfsyncname, NULL, MTX_DEF); mtx_init(&sc->sc_bulk_mtx, "pfsync bulk", NULL, MTX_DEF); - callout_init(&sc->sc_tmo, 1); callout_init_mtx(&sc->sc_bulk_tmo, &sc->sc_bulk_mtx, 0); callout_init_mtx(&sc->sc_bulkfail_tmo, &sc->sc_bulk_mtx, 0); @@ -336,6 +358,27 @@ pfsync_clone_create(struct if_clone *ifc, int unit, ca bpfattach(ifp, DLT_PFSYNC, PFSYNC_HDRLEN); + sc->sc_buckets = mallocarray(pfsync_buckets, sizeof(*sc->sc_buckets), + M_PFSYNC, M_ZERO | M_WAITOK); + for (c = 0; c < pfsync_buckets; c++) { + b = &sc->sc_buckets[c]; + mtx_init(&b->b_mtx, pfsyncname, NULL, MTX_DEF); + + b->b_id = c; + b->b_sc = sc; + b->b_len = PFSYNC_MINPKT; + + for (q = 0; q < PFSYNC_S_COUNT; q++) + TAILQ_INIT(&b->b_qs[q]); + + TAILQ_INIT(&b->b_upd_req_list); + TAILQ_INIT(&b->b_deferrals); + + callout_init(&b->b_tmo, 1); + + b->b_snd.ifq_maxlen = ifqmaxlen; + } + V_pfsyncif = sc; return (0); @@ -345,29 +388,36 @@ static void pfsync_clone_destroy(struct ifnet *ifp) { struct pfsync_softc *sc = ifp->if_softc; + struct pfsync_bucket *b; + int c; - /* - * At this stage, everything should have already been - * cleared by pfsync_uninit(), and we have only to - * drain callouts. - */ - while (sc->sc_deferred > 0) { - struct pfsync_deferral *pd = TAILQ_FIRST(&sc->sc_deferrals); + for (c = 0; c < pfsync_buckets; c++) { + b = &sc->sc_buckets[c]; + /* + * At this stage, everything should have already been + * cleared by pfsync_uninit(), and we have only to + * drain callouts. + */ + while (b->b_deferred > 0) { + struct pfsync_deferral *pd = + TAILQ_FIRST(&b->b_deferrals); - TAILQ_REMOVE(&sc->sc_deferrals, pd, pd_entry); - sc->sc_deferred--; - if (callout_stop(&pd->pd_tmo) > 0) { - pf_release_state(pd->pd_st); - m_freem(pd->pd_m); - free(pd, M_PFSYNC); - } else { - pd->pd_refs++; - callout_drain(&pd->pd_tmo); - free(pd, M_PFSYNC); + TAILQ_REMOVE(&b->b_deferrals, pd, pd_entry); + b->b_deferred--; + if (callout_stop(&pd->pd_tmo) > 0) { + pf_release_state(pd->pd_st); + m_freem(pd->pd_m); + free(pd, M_PFSYNC); + } else { + pd->pd_refs++; + callout_drain(&pd->pd_tmo); + free(pd, M_PFSYNC); + } } + + callout_drain(&b->b_tmo); } - callout_drain(&sc->sc_tmo); callout_drain(&sc->sc_bulkfail_tmo); callout_drain(&sc->sc_bulk_tmo); @@ -383,6 +433,8 @@ pfsync_clone_destroy(struct ifnet *ifp) pfsync_multicast_cleanup(sc); mtx_destroy(&sc->sc_mtx); mtx_destroy(&sc->sc_bulk_mtx); + + free(sc->sc_buckets, M_PFSYNC); free(sc, M_PFSYNC); V_pfsyncif = NULL; @@ -546,7 +598,7 @@ pfsync_state_import(struct pfsync_state *sp, u_int8_t st->state_flags &= ~PFSTATE_NOSYNC; if (st->state_flags & PFSTATE_ACK) { pfsync_q_ins(st, PFSYNC_S_IACK, true); - pfsync_push(sc); + pfsync_push_all(sc); } } st->state_flags &= ~PFSTATE_ACK; @@ -785,9 +837,7 @@ pfsync_in_iack(struct pfsync_pkt *pkt, struct mbuf *m, continue; if (st->state_flags & PFSTATE_ACK) { - PFSYNC_LOCK(V_pfsyncif); pfsync_undefer_state(st, 0); - PFSYNC_UNLOCK(V_pfsyncif); } PF_STATE_UNLOCK(st); } @@ -876,9 +926,7 @@ pfsync_in_upd(struct pfsync_pkt *pkt, struct mbuf *m, } if (st->state_flags & PFSTATE_ACK) { - PFSYNC_LOCK(sc); pfsync_undefer_state(st, 1); - PFSYNC_UNLOCK(sc); } if (st->key[PF_SK_WIRE]->proto == IPPROTO_TCP) @@ -912,9 +960,7 @@ pfsync_in_upd(struct pfsync_pkt *pkt, struct mbuf *m, pfsync_update_state(st); PF_STATE_UNLOCK(st); - PFSYNC_LOCK(sc); - pfsync_push(sc); - PFSYNC_UNLOCK(sc); + pfsync_push_all(sc); continue; } PF_STATE_UNLOCK(st); @@ -960,16 +1006,14 @@ pfsync_in_upd_c(struct pfsync_pkt *pkt, struct mbuf *m st = pf_find_state_byid(up->id, up->creatorid); if (st == NULL) { /* We don't have this state. Ask for it. */ - PFSYNC_LOCK(sc); + PFSYNC_BUCKET_LOCK(&sc->sc_buckets[0]); pfsync_request_update(up->creatorid, up->id); - PFSYNC_UNLOCK(sc); + PFSYNC_BUCKET_UNLOCK(&sc->sc_buckets[0]); continue; } if (st->state_flags & PFSTATE_ACK) { - PFSYNC_LOCK(sc); pfsync_undefer_state(st, 1); - PFSYNC_UNLOCK(sc); } if (st->key[PF_SK_WIRE]->proto == IPPROTO_TCP) @@ -1003,9 +1047,7 @@ pfsync_in_upd_c(struct pfsync_pkt *pkt, struct mbuf *m pfsync_update_state(st); PF_STATE_UNLOCK(st); - PFSYNC_LOCK(sc); - pfsync_push(sc); - PFSYNC_UNLOCK(sc); + pfsync_push_all(sc); continue; } PF_STATE_UNLOCK(st); @@ -1283,6 +1325,7 @@ pfsyncioctl(struct ifnet *ifp, u_long cmd, caddr_t dat struct ifreq *ifr = (struct ifreq *)data; struct pfsyncreq pfsyncr; int error; + int c; switch (cmd) { case SIOCSIFFLAGS: @@ -1303,10 +1346,12 @@ pfsyncioctl(struct ifnet *ifp, u_long cmd, caddr_t dat ifr->ifr_mtu > sc->sc_sync_if->if_mtu) return (EINVAL); if (ifr->ifr_mtu < ifp->if_mtu) { - PFSYNC_LOCK(sc); - if (sc->sc_len > PFSYNC_MINPKT) - pfsync_sendout(1); - PFSYNC_UNLOCK(sc); + for (c = 0; c < pfsync_buckets; c++) { + PFSYNC_BUCKET_LOCK(&sc->sc_buckets[c]); + if (sc->sc_buckets[c].b_len > PFSYNC_MINPKT) + pfsync_sendout(1, c); + PFSYNC_BUCKET_UNLOCK(&sc->sc_buckets[c]); + } } ifp->if_mtu = ifr->ifr_mtu; break; @@ -1379,12 +1424,16 @@ pfsyncioctl(struct ifnet *ifp, u_long cmd, caddr_t dat break; } - if (sc->sc_len > PFSYNC_MINPKT && - (sifp->if_mtu < sc->sc_ifp->if_mtu || - (sc->sc_sync_if != NULL && - sifp->if_mtu < sc->sc_sync_if->if_mtu) || - sifp->if_mtu < MCLBYTES - sizeof(struct ip))) - pfsync_sendout(1); + for (c = 0; c < pfsync_buckets; c++) { + PFSYNC_BUCKET_LOCK(&sc->sc_buckets[c]); + if (sc->sc_buckets[c].b_len > PFSYNC_MINPKT && + (sifp->if_mtu < sc->sc_ifp->if_mtu || + (sc->sc_sync_if != NULL && + sifp->if_mtu < sc->sc_sync_if->if_mtu) || + sifp->if_mtu < MCLBYTES - sizeof(struct ip))) + pfsync_sendout(1, c); + PFSYNC_BUCKET_UNLOCK(&sc->sc_buckets[c]); + } if (imo->imo_membership) pfsync_multicast_cleanup(sc); @@ -1421,8 +1470,10 @@ pfsyncioctl(struct ifnet *ifp, u_long cmd, caddr_t dat sc->sc_flags &= ~PFSYNCF_OK; if (V_pf_status.debug >= PF_DEBUG_MISC) printf("pfsync: requesting bulk update\n"); - pfsync_request_update(0, 0); PFSYNC_UNLOCK(sc); + PFSYNC_BUCKET_LOCK(&sc->sc_buckets[0]); + pfsync_request_update(0, 0); + PFSYNC_BUCKET_UNLOCK(&sc->sc_buckets[0]); PFSYNC_BLOCK(sc); sc->sc_ureq_sent = time_uptime; callout_reset(&sc->sc_bulkfail_tmo, 5 * hz, pfsync_bulk_fail, @@ -1483,33 +1534,37 @@ pfsync_drop(struct pfsync_softc *sc) { struct pf_state *st, *next; struct pfsync_upd_req_item *ur; - int q; + struct pfsync_bucket *b; + int c, q; - for (q = 0; q < PFSYNC_S_COUNT; q++) { - if (TAILQ_EMPTY(&sc->sc_qs[q])) - continue; + for (c = 0; c < pfsync_buckets; c++) { + b = &sc->sc_buckets[c]; + for (q = 0; q < PFSYNC_S_COUNT; q++) { + if (TAILQ_EMPTY(&b->b_qs[q])) + continue; - TAILQ_FOREACH_SAFE(st, &sc->sc_qs[q], sync_list, next) { - KASSERT(st->sync_state == q, - ("%s: st->sync_state == q", - __func__)); - st->sync_state = PFSYNC_S_NONE; - pf_release_state(st); + TAILQ_FOREACH_SAFE(st, &b->b_qs[q], sync_list, next) { + KASSERT(st->sync_state == q, + ("%s: st->sync_state == q", + __func__)); + st->sync_state = PFSYNC_S_NONE; + pf_release_state(st); + } + TAILQ_INIT(&b->b_qs[q]); } - TAILQ_INIT(&sc->sc_qs[q]); - } - while ((ur = TAILQ_FIRST(&sc->sc_upd_req_list)) != NULL) { - TAILQ_REMOVE(&sc->sc_upd_req_list, ur, ur_entry); - free(ur, M_PFSYNC); - } + while ((ur = TAILQ_FIRST(&b->b_upd_req_list)) != NULL) { + TAILQ_REMOVE(&b->b_upd_req_list, ur, ur_entry); + free(ur, M_PFSYNC); + } - sc->sc_plus = NULL; - sc->sc_len = PFSYNC_MINPKT; + b->b_len = PFSYNC_MINPKT; + b->b_plus = NULL; + } } static void -pfsync_sendout(int schedswi) +pfsync_sendout(int schedswi, int c) { struct pfsync_softc *sc = V_pfsyncif; struct ifnet *ifp = sc->sc_ifp; @@ -1519,27 +1574,28 @@ pfsync_sendout(int schedswi) struct pfsync_subheader *subh; struct pf_state *st, *st_next; struct pfsync_upd_req_item *ur; + struct pfsync_bucket *b = &sc->sc_buckets[c]; int offset; int q, count = 0; KASSERT(sc != NULL, ("%s: null sc", __func__)); - KASSERT(sc->sc_len > PFSYNC_MINPKT, - ("%s: sc_len %zu", __func__, sc->sc_len)); - PFSYNC_LOCK_ASSERT(sc); + KASSERT(b->b_len > PFSYNC_MINPKT, + ("%s: sc_len %zu", __func__, b->b_len)); + PFSYNC_BUCKET_LOCK_ASSERT(b); if (ifp->if_bpf == NULL && sc->sc_sync_if == NULL) { pfsync_drop(sc); return; } - m = m_get2(max_linkhdr + sc->sc_len, M_NOWAIT, MT_DATA, M_PKTHDR); + m = m_get2(max_linkhdr + b->b_len, M_NOWAIT, MT_DATA, M_PKTHDR); if (m == NULL) { if_inc_counter(sc->sc_ifp, IFCOUNTER_OERRORS, 1); V_pfsyncstats.pfsyncs_onomem++; return; } m->m_data += max_linkhdr; - m->m_len = m->m_pkthdr.len = sc->sc_len; + m->m_len = m->m_pkthdr.len = b->b_len; /* build the ip header */ ip = (struct ip *)m->m_data; @@ -1555,19 +1611,19 @@ pfsync_sendout(int schedswi) offset += sizeof(*ph); ph->version = PFSYNC_VERSION; - ph->len = htons(sc->sc_len - sizeof(*ip)); + ph->len = htons(b->b_len - sizeof(*ip)); bcopy(V_pf_status.pf_chksum, ph->pfcksum, PF_MD5_DIGEST_LENGTH); /* walk the queues */ for (q = 0; q < PFSYNC_S_COUNT; q++) { - if (TAILQ_EMPTY(&sc->sc_qs[q])) + if (TAILQ_EMPTY(&b->b_qs[q])) continue; subh = (struct pfsync_subheader *)(m->m_data + offset); offset += sizeof(*subh); count = 0; - TAILQ_FOREACH_SAFE(st, &sc->sc_qs[q], sync_list, st_next) { + TAILQ_FOREACH_SAFE(st, &b->b_qs[q], sync_list, st_next) { KASSERT(st->sync_state == q, ("%s: st->sync_state == q", __func__)); @@ -1581,7 +1637,7 @@ pfsync_sendout(int schedswi) pf_release_state(st); count++; } - TAILQ_INIT(&sc->sc_qs[q]); + TAILQ_INIT(&b->b_qs[q]); bzero(subh, sizeof(*subh)); subh->action = pfsync_qs[q].action; @@ -1589,13 +1645,13 @@ pfsync_sendout(int schedswi) V_pfsyncstats.pfsyncs_oacts[pfsync_qs[q].action] += count; } - if (!TAILQ_EMPTY(&sc->sc_upd_req_list)) { + if (!TAILQ_EMPTY(&b->b_upd_req_list)) { subh = (struct pfsync_subheader *)(m->m_data + offset); offset += sizeof(*subh); count = 0; - while ((ur = TAILQ_FIRST(&sc->sc_upd_req_list)) != NULL) { - TAILQ_REMOVE(&sc->sc_upd_req_list, ur, ur_entry); + while ((ur = TAILQ_FIRST(&b->b_upd_req_list)) != NULL) { + TAILQ_REMOVE(&b->b_upd_req_list, ur, ur_entry); bcopy(&ur->ur_msg, m->m_data + offset, sizeof(ur->ur_msg)); @@ -1611,11 +1667,11 @@ pfsync_sendout(int schedswi) } /* has someone built a custom region for us to add? */ - if (sc->sc_plus != NULL) { - bcopy(sc->sc_plus, m->m_data + offset, sc->sc_pluslen); - offset += sc->sc_pluslen; + if (b->b_plus != NULL) { + bcopy(b->b_plus, m->m_data + offset, b->b_pluslen); + offset += b->b_pluslen; - sc->sc_plus = NULL; + b->b_plus = NULL; } subh = (struct pfsync_subheader *)(m->m_data + offset); @@ -1629,24 +1685,24 @@ pfsync_sendout(int schedswi) /* we're done, let's put it on the wire */ if (ifp->if_bpf) { m->m_data += sizeof(*ip); - m->m_len = m->m_pkthdr.len = sc->sc_len - sizeof(*ip); + m->m_len = m->m_pkthdr.len = b->b_len - sizeof(*ip); BPF_MTAP(ifp, m); m->m_data -= sizeof(*ip); - m->m_len = m->m_pkthdr.len = sc->sc_len; + m->m_len = m->m_pkthdr.len = b->b_len; } if (sc->sc_sync_if == NULL) { - sc->sc_len = PFSYNC_MINPKT; + b->b_len = PFSYNC_MINPKT; m_freem(m); return; } if_inc_counter(sc->sc_ifp, IFCOUNTER_OPACKETS, 1); if_inc_counter(sc->sc_ifp, IFCOUNTER_OBYTES, m->m_pkthdr.len); - sc->sc_len = PFSYNC_MINPKT; + b->b_len = PFSYNC_MINPKT; - if (!_IF_QFULL(&sc->sc_ifp->if_snd)) - _IF_ENQUEUE(&sc->sc_ifp->if_snd, m); + if (!_IF_QFULL(&b->b_snd)) + _IF_ENQUEUE(&b->b_snd, m); else { m_freem(m); if_inc_counter(sc->sc_ifp, IFCOUNTER_OQDROPS, 1); @@ -1659,6 +1715,7 @@ static void pfsync_insert_state(struct pf_state *st) { struct pfsync_softc *sc = V_pfsyncif; + struct pfsync_bucket *b = pfsync_get_bucket(sc, st); if (st->state_flags & PFSTATE_NOSYNC) return; @@ -1672,12 +1729,12 @@ pfsync_insert_state(struct pf_state *st) KASSERT(st->sync_state == PFSYNC_S_NONE, ("%s: st->sync_state %u", __func__, st->sync_state)); - PFSYNC_LOCK(sc); - if (sc->sc_len == PFSYNC_MINPKT) - callout_reset(&sc->sc_tmo, 1 * hz, pfsync_timeout, V_pfsyncif); + PFSYNC_BUCKET_LOCK(b); + if (b->b_len == PFSYNC_MINPKT) + callout_reset(&b->b_tmo, 1 * hz, pfsync_timeout, b); pfsync_q_ins(st, PFSYNC_S_INS, true); - PFSYNC_UNLOCK(sc); + PFSYNC_BUCKET_UNLOCK(b); st->sync_updates = 0; } @@ -1687,6 +1744,7 @@ pfsync_defer(struct pf_state *st, struct mbuf *m) { struct pfsync_softc *sc = V_pfsyncif; struct pfsync_deferral *pd; + struct pfsync_bucket *b = pfsync_get_bucket(sc, st); if (m->m_flags & (M_BCAST|M_MCAST)) return (0); @@ -1699,13 +1757,13 @@ pfsync_defer(struct pf_state *st, struct mbuf *m) return (0); } - if (sc->sc_deferred >= 128) - pfsync_undefer(TAILQ_FIRST(&sc->sc_deferrals), 0); + if (b->b_deferred >= 128) + pfsync_undefer(TAILQ_FIRST(&b->b_deferrals), 0); pd = malloc(sizeof(*pd), M_PFSYNC, M_NOWAIT); if (pd == NULL) return (0); - sc->sc_deferred++; + b->b_deferred++; m->m_flags |= M_SKIP_FIREWALL; st->state_flags |= PFSTATE_ACK; @@ -1716,11 +1774,11 @@ pfsync_defer(struct pf_state *st, struct mbuf *m) pf_ref_state(st); pd->pd_m = m; - TAILQ_INSERT_TAIL(&sc->sc_deferrals, pd, pd_entry); - callout_init_mtx(&pd->pd_tmo, &sc->sc_mtx, CALLOUT_RETURNUNLOCKED); + TAILQ_INSERT_TAIL(&b->b_deferrals, pd, pd_entry); + callout_init_mtx(&pd->pd_tmo, &b->b_mtx, CALLOUT_RETURNUNLOCKED); callout_reset(&pd->pd_tmo, 10, pfsync_defer_tmo, pd); - pfsync_push(sc); + pfsync_push(b); return (1); } @@ -1731,11 +1789,12 @@ pfsync_undefer(struct pfsync_deferral *pd, int drop) struct pfsync_softc *sc = pd->pd_sc; struct mbuf *m = pd->pd_m; struct pf_state *st = pd->pd_st; + struct pfsync_bucket *b = pfsync_get_bucket(sc, st); - PFSYNC_LOCK_ASSERT(sc); + PFSYNC_BUCKET_LOCK_ASSERT(b); - TAILQ_REMOVE(&sc->sc_deferrals, pd, pd_entry); - sc->sc_deferred--; + TAILQ_REMOVE(&b->b_deferrals, pd, pd_entry); + b->b_deferred--; pd->pd_st->state_flags &= ~PFSTATE_ACK; /* XXX: locking! */ free(pd, M_PFSYNC); pf_release_state(st); @@ -1743,8 +1802,8 @@ pfsync_undefer(struct pfsync_deferral *pd, int drop) if (drop) m_freem(m); else { - _IF_ENQUEUE(&sc->sc_ifp->if_snd, m); - pfsync_push(sc); + _IF_ENQUEUE(&b->b_snd, m); + pfsync_push(b); } } @@ -1755,13 +1814,14 @@ pfsync_defer_tmo(void *arg) struct pfsync_softc *sc = pd->pd_sc; struct mbuf *m = pd->pd_m; struct pf_state *st = pd->pd_st; + struct pfsync_bucket *b = pfsync_get_bucket(sc, st); - PFSYNC_LOCK_ASSERT(sc); + PFSYNC_BUCKET_LOCK_ASSERT(b); CURVNET_SET(m->m_pkthdr.rcvif->if_vnet); - TAILQ_REMOVE(&sc->sc_deferrals, pd, pd_entry); - sc->sc_deferred--; + TAILQ_REMOVE(&b->b_deferrals, pd, pd_entry); + b->b_deferred--; pd->pd_st->state_flags &= ~PFSTATE_ACK; /* XXX: locking! */ if (pd->pd_refs == 0) free(pd, M_PFSYNC); @@ -1779,40 +1839,52 @@ pfsync_undefer_state(struct pf_state *st, int drop) { struct pfsync_softc *sc = V_pfsyncif; struct pfsync_deferral *pd; + struct pfsync_bucket *b = pfsync_get_bucket(sc, st); - PFSYNC_LOCK_ASSERT(sc); + PFSYNC_BUCKET_LOCK(b); - TAILQ_FOREACH(pd, &sc->sc_deferrals, pd_entry) { + TAILQ_FOREACH(pd, &b->b_deferrals, pd_entry) { if (pd->pd_st == st) { if (callout_stop(&pd->pd_tmo) > 0) pfsync_undefer(pd, drop); + + PFSYNC_BUCKET_UNLOCK(b); return; } } + PFSYNC_BUCKET_UNLOCK(b); panic("%s: unable to find deferred state", __func__); } +static struct pfsync_bucket* +pfsync_get_bucket(struct pfsync_softc *sc, struct pf_state *st) +{ + int c = PF_IDHASH(st) % pfsync_buckets; + return &sc->sc_buckets[c]; +} + static void pfsync_update_state(struct pf_state *st) { struct pfsync_softc *sc = V_pfsyncif; bool sync = false, ref = true; + struct pfsync_bucket *b = pfsync_get_bucket(sc, st); PF_STATE_LOCK_ASSERT(st); - PFSYNC_LOCK(sc); + PFSYNC_BUCKET_LOCK(b); if (st->state_flags & PFSTATE_ACK) pfsync_undefer_state(st, 0); if (st->state_flags & PFSTATE_NOSYNC) { if (st->sync_state != PFSYNC_S_NONE) - pfsync_q_del(st, true); - PFSYNC_UNLOCK(sc); + pfsync_q_del(st, true, b); + PFSYNC_BUCKET_UNLOCK(b); return; } - if (sc->sc_len == PFSYNC_MINPKT) - callout_reset(&sc->sc_tmo, 1 * hz, pfsync_timeout, V_pfsyncif); + if (b->b_len == PFSYNC_MINPKT) + callout_reset(&b->b_tmo, 1 * hz, pfsync_timeout, b); switch (st->sync_state) { case PFSYNC_S_UPD_C: @@ -1828,7 +1900,7 @@ pfsync_update_state(struct pf_state *st) break; case PFSYNC_S_IACK: - pfsync_q_del(st, false); + pfsync_q_del(st, false, b); ref = false; /* FALLTHROUGH */ @@ -1842,26 +1914,27 @@ pfsync_update_state(struct pf_state *st) } if (sync || (time_uptime - st->pfsync_time) < 2) - pfsync_push(sc); + pfsync_push(b); - PFSYNC_UNLOCK(sc); + PFSYNC_BUCKET_UNLOCK(b); } static void pfsync_request_update(u_int32_t creatorid, u_int64_t id) { struct pfsync_softc *sc = V_pfsyncif; + struct pfsync_bucket *b = &sc->sc_buckets[0]; struct pfsync_upd_req_item *item; size_t nlen = sizeof(struct pfsync_upd_req); - PFSYNC_LOCK_ASSERT(sc); + PFSYNC_BUCKET_LOCK_ASSERT(b); /* * This code does a bit to prevent multiple update requests for the * same state being generated. It searches current subheader queue, * but it doesn't lookup into queue of already packed datagrams. */ - TAILQ_FOREACH(item, &sc->sc_upd_req_list, ur_entry) + TAILQ_FOREACH(item, &b->b_upd_req_list, ur_entry) if (item->ur_msg.id == id && item->ur_msg.creatorid == creatorid) return; @@ -1873,46 +1946,47 @@ pfsync_request_update(u_int32_t creatorid, u_int64_t i item->ur_msg.id = id; item->ur_msg.creatorid = creatorid; - if (TAILQ_EMPTY(&sc->sc_upd_req_list)) + if (TAILQ_EMPTY(&b->b_upd_req_list)) nlen += sizeof(struct pfsync_subheader); - if (sc->sc_len + nlen > sc->sc_ifp->if_mtu) { - pfsync_sendout(1); + if (b->b_len + nlen > sc->sc_ifp->if_mtu) { + pfsync_sendout(1, 0); nlen = sizeof(struct pfsync_subheader) + sizeof(struct pfsync_upd_req); } - TAILQ_INSERT_TAIL(&sc->sc_upd_req_list, item, ur_entry); - sc->sc_len += nlen; + TAILQ_INSERT_TAIL(&b->b_upd_req_list, item, ur_entry); + b->b_len += nlen; } -static void +static bool pfsync_update_state_req(struct pf_state *st) { struct pfsync_softc *sc = V_pfsyncif; - bool ref = true; + bool ref = true, full = false; + struct pfsync_bucket *b = pfsync_get_bucket(sc, st); PF_STATE_LOCK_ASSERT(st); - PFSYNC_LOCK(sc); + PFSYNC_BUCKET_LOCK(b); if (st->state_flags & PFSTATE_NOSYNC) { if (st->sync_state != PFSYNC_S_NONE) - pfsync_q_del(st, true); - PFSYNC_UNLOCK(sc); - return; + pfsync_q_del(st, true, b); + PFSYNC_BUCKET_UNLOCK(b); + return (full); } switch (st->sync_state) { case PFSYNC_S_UPD_C: case PFSYNC_S_IACK: - pfsync_q_del(st, false); + pfsync_q_del(st, false, b); ref = false; /* FALLTHROUGH */ case PFSYNC_S_NONE: pfsync_q_ins(st, PFSYNC_S_UPD, ref); - pfsync_push(sc); + pfsync_push(b); break; case PFSYNC_S_INS: @@ -1925,38 +1999,44 @@ pfsync_update_state_req(struct pf_state *st) panic("%s: unexpected sync state %d", __func__, st->sync_state); } - PFSYNC_UNLOCK(sc); + if ((sc->sc_ifp->if_mtu - b->b_len) < sizeof(struct pfsync_state)) + full = true; + + PFSYNC_BUCKET_UNLOCK(b); + + return (full); } static void pfsync_delete_state(struct pf_state *st) { struct pfsync_softc *sc = V_pfsyncif; + struct pfsync_bucket *b = pfsync_get_bucket(sc, st); bool ref = true; - PFSYNC_LOCK(sc); + PFSYNC_BUCKET_LOCK(b); if (st->state_flags & PFSTATE_ACK) pfsync_undefer_state(st, 1); if (st->state_flags & PFSTATE_NOSYNC) { if (st->sync_state != PFSYNC_S_NONE) - pfsync_q_del(st, true); - PFSYNC_UNLOCK(sc); + pfsync_q_del(st, true, b); + PFSYNC_BUCKET_UNLOCK(b); return; } - if (sc->sc_len == PFSYNC_MINPKT) - callout_reset(&sc->sc_tmo, 1 * hz, pfsync_timeout, V_pfsyncif); + if (b->b_len == PFSYNC_MINPKT) + callout_reset(&b->b_tmo, 1 * hz, pfsync_timeout, b); switch (st->sync_state) { case PFSYNC_S_INS: /* We never got to tell the world so just forget about it. */ - pfsync_q_del(st, true); + pfsync_q_del(st, true, b); break; case PFSYNC_S_UPD_C: case PFSYNC_S_UPD: case PFSYNC_S_IACK: - pfsync_q_del(st, false); + pfsync_q_del(st, false, b); ref = false; /* FALLTHROUGH */ @@ -1968,13 +2048,12 @@ pfsync_delete_state(struct pf_state *st) panic("%s: unexpected sync state %d", __func__, st->sync_state); } - PFSYNC_UNLOCK(sc); + PFSYNC_BUCKET_UNLOCK(b); } static void pfsync_clear_states(u_int32_t creatorid, const char *ifname) { - struct pfsync_softc *sc = V_pfsyncif; struct { struct pfsync_subheader subh; struct pfsync_clr clr; @@ -1989,9 +2068,7 @@ pfsync_clear_states(u_int32_t creatorid, const char *i strlcpy(r.clr.ifname, ifname, sizeof(r.clr.ifname)); r.clr.creatorid = creatorid; - PFSYNC_LOCK(sc); pfsync_send_plus(&r, sizeof(r)); - PFSYNC_UNLOCK(sc); } static void @@ -1999,48 +2076,48 @@ pfsync_q_ins(struct pf_state *st, int q, bool ref) { struct pfsync_softc *sc = V_pfsyncif; size_t nlen = pfsync_qs[q].len; + struct pfsync_bucket *b = pfsync_get_bucket(sc, st); - PFSYNC_LOCK_ASSERT(sc); + PFSYNC_BUCKET_LOCK_ASSERT(b); KASSERT(st->sync_state == PFSYNC_S_NONE, ("%s: st->sync_state %u", __func__, st->sync_state)); - KASSERT(sc->sc_len >= PFSYNC_MINPKT, ("pfsync pkt len is too low %zu", - sc->sc_len)); + KASSERT(b->b_len >= PFSYNC_MINPKT, ("pfsync pkt len is too low %zu", + b->b_len)); - if (TAILQ_EMPTY(&sc->sc_qs[q])) + if (TAILQ_EMPTY(&b->b_qs[q])) nlen += sizeof(struct pfsync_subheader); - if (sc->sc_len + nlen > sc->sc_ifp->if_mtu) { - pfsync_sendout(1); + if (b->b_len + nlen > sc->sc_ifp->if_mtu) { + pfsync_sendout(1, b->b_id); nlen = sizeof(struct pfsync_subheader) + pfsync_qs[q].len; } - sc->sc_len += nlen; - TAILQ_INSERT_TAIL(&sc->sc_qs[q], st, sync_list); + b->b_len += nlen; + TAILQ_INSERT_TAIL(&b->b_qs[q], st, sync_list); st->sync_state = q; if (ref) pf_ref_state(st); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Thu Dec 6 19:49:09 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7B6BF1310BAD; Thu, 6 Dec 2018 19:49:09 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1E2597CF33; Thu, 6 Dec 2018 19:49:09 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ED8274AC; Thu, 6 Dec 2018 19:49:08 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB6Jn8Ej025754; Thu, 6 Dec 2018 19:49:08 GMT (envelope-from joel@FreeBSD.org) Received: (from joel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB6Jn8Dd025753; Thu, 6 Dec 2018 19:49:08 GMT (envelope-from joel@FreeBSD.org) Message-Id: <201812061949.wB6Jn8Dd025753@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: joel set sender to joel@FreeBSD.org using -f From: Joel Dahl Date: Thu, 6 Dec 2018 19:49:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341647 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: joel X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 341647 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1E2597CF33 X-Spamd-Result: default: False [-1.89 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.86)[-0.863,0]; NEURAL_HAM_LONG(-0.08)[-0.083,0]; NEURAL_HAM_SHORT(-0.95)[-0.949,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 06 Dec 2018 19:49:09 -0000 Author: joel (doc committer) Date: Thu Dec 6 19:49:08 2018 New Revision: 341647 URL: https://svnweb.freebsd.org/changeset/base/341647 Log: Sort .Xr Modified: head/share/man/man4/vmci.4 Modified: head/share/man/man4/vmci.4 ============================================================================== --- head/share/man/man4/vmci.4 Thu Dec 6 19:27:15 2018 (r341646) +++ head/share/man/man4/vmci.4 Thu Dec 6 19:49:08 2018 (r341647) @@ -54,8 +54,8 @@ In addition to this, the VMCI kernel API provides supp events related to the state of the VMCI communication channels, and the virtual machine itself. .Sh SEE ALSO -.Xr pci 9 , -.Xr socket 2 +.Xr socket 2 , +.Xr pci 9 .Rs .%T "VMware vSockets Documentation" .%U https://www.vmware.com/support/developer/vmci-sdk/ From owner-svn-src-head@freebsd.org Thu Dec 6 20:03:08 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2AB0413113D4; Thu, 6 Dec 2018 20:03:08 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BE9DF7DA42; Thu, 6 Dec 2018 20:03:07 +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 984C67F9; Thu, 6 Dec 2018 20:03:07 +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 wB6K379q035814; Thu, 6 Dec 2018 20:03:07 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB6K36NC035810; Thu, 6 Dec 2018 20:03:06 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201812062003.wB6K36NC035810@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 6 Dec 2018 20:03:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341648 - head/lib/libz X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/lib/libz X-SVN-Commit-Revision: 341648 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: BE9DF7DA42 X-Spamd-Result: default: False [-1.87 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.87)[-0.865,0]; NEURAL_HAM_SHORT(-0.95)[-0.951,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.05)[-0.054,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 06 Dec 2018 20:03:08 -0000 Author: markj Date: Thu Dec 6 20:03:06 2018 New Revision: 341648 URL: https://svnweb.freebsd.org/changeset/base/341648 Log: Add zdopen(3) to complement zopen(3). zdopen() can be used in capability mode. Update zopen.3 accordingly and fix some grammar nits while I'm here. Reviewed by: delphij MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D18456 Modified: head/lib/libz/Makefile head/lib/libz/Symbol.map head/lib/libz/Versions.def head/lib/libz/zopen.3 head/lib/libz/zopen.c Modified: head/lib/libz/Makefile ============================================================================== --- head/lib/libz/Makefile Thu Dec 6 19:49:08 2018 (r341647) +++ head/lib/libz/Makefile Thu Dec 6 20:03:06 2018 (r341648) @@ -7,6 +7,7 @@ LIB= z SHLIBDIR?= /lib SHLIB_MAJOR= 6 MAN= zlib.3 zopen.3 +MLINKS+= zopen.3 zdopen.3 ZLIBSRC= ${SRCTOP}/contrib/zlib Modified: head/lib/libz/Symbol.map ============================================================================== --- head/lib/libz/Symbol.map Thu Dec 6 19:49:08 2018 (r341647) +++ head/lib/libz/Symbol.map Thu Dec 6 20:03:06 2018 (r341648) @@ -103,6 +103,10 @@ FBSD_1.2 { zopen; }; +FBSD_1.6 { + zdopen; +}; + ZLIBprivate_1.0 { _tr_align; _tr_flush_block; Modified: head/lib/libz/Versions.def ============================================================================== --- head/lib/libz/Versions.def Thu Dec 6 19:49:08 2018 (r341647) +++ head/lib/libz/Versions.def Thu Dec 6 20:03:06 2018 (r341648) @@ -15,6 +15,9 @@ ZLIB_1.2.9 { FBSD_1.2 { } ZLIB_1.2.4.0; +FBSD_1.6 { +} FBSD_1.2; + ZLIBprivate_1.0 { } ZLIB_1.2.4.0; Modified: head/lib/libz/zopen.3 ============================================================================== --- head/lib/libz/zopen.3 Thu Dec 6 19:49:08 2018 (r341647) +++ head/lib/libz/zopen.3 Thu Dec 6 20:03:06 2018 (r341648) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 5, 2014 +.Dd December 6, 2018 .Dt ZOPEN 3 .Os .Sh NAME @@ -34,33 +34,44 @@ .Sh SYNOPSIS .Ft FILE * .Fn zopen "const char *path" "const char *mode" +.Ft FILE * +.Fn zdopen "int fd" "const char *mode" .Sh DESCRIPTION The .Fn zopen -opens a gzip file whose name is the string pointed to by +function opens a gzip file whose name is the string pointed to by .Fa path -and associates a stream with it. -It is a wrapper around +and returns a stream which can be used to access the uncompressed contents +of the file. +The +.Fn zdopen +variant takes a gzip file referenced by the file descriptor +.Fa fd , +analogous to +.Xr fdopen 3 . +They are wrappers around .Xr zlib 3 -and standard stream I/O APIs. +and the standard stream I/O APIs. .Pp The argument .Fa mode -have the same meaning as it does in +has the same meaning as it does in .Xr fopen 3 . .Pp The -.Nm -function will associate read, write, seek and close +.Fn zopen +and +.Fn zdopen +functions will associate the read, write, seek and close functions of .Xr zlib 3 -after successfully opened a file with -.Xr funopen 3 -so that they will be used to read or write the new stream. +with the returned stream. .Sh RETURN VALUES Upon successful completion -.Nm -returns a +.Fn zopen +and +.Fn zdopen +return a .Tn FILE pointer. Otherwise, @@ -70,26 +81,28 @@ is returned and the global variable is set to indicate the error. .Sh ERRORS In addition to the errors documented for -.Xr fopen 3 , -the -.Nm -function may also fail for: +.Xr fopen 3 +and +.Xr fdopen 3 , +the functions may also fail for: .Bl -tag -width Er .It Bq Er ENOMEM Insufficient memory is available. .El .Sh COMPATIBILITY -This implementation of -.Nm +The implementation of +.Fn zopen function first appeared in .Nx 1.6 and .Fx 4.5 . -The -.Nm -function may not be portable to systems other than +.Fn zdopen +first appeared in +.Fx 13.0 . +These functions may not be portable to systems other than .Fx . .Sh SEE ALSO +.Xr fdopen 3 , .Xr fopen 3 , .Xr funopen 3 , .Xr zlib 3 Modified: head/lib/libz/zopen.c ============================================================================== --- head/lib/libz/zopen.c Thu Dec 6 19:49:08 2018 (r341647) +++ head/lib/libz/zopen.c Thu Dec 6 20:03:06 2018 (r341648) @@ -9,6 +9,7 @@ __FBSDID("$FreeBSD$"); #include FILE *zopen(const char *fname, const char *mode); +FILE *zdopen(int fd, const char *mode); /* convert arguments */ static int @@ -46,4 +47,19 @@ zopen(const char *fname, const char *mode) return (funopen(gz, xgzread, NULL, xgzseek, xgzclose)); else return (funopen(gz, NULL, xgzwrite, xgzseek, xgzclose)); +} + +FILE * +zdopen(int fd, const char *mode) +{ + gzFile gz; + + gz = gzdopen(fd, mode); + if (gz == NULL) + return (NULL); + + if (*mode == 'r') + return (funopen(gz, xgzread, NULL, xgzseek, xgzclose)); + else + return (funopen(gz, NULL, xgzwrite, xgzseek, xgzclose)); } From owner-svn-src-head@freebsd.org Thu Dec 6 20:04:02 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 44ABA1311449; Thu, 6 Dec 2018 20:04:02 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D05497DBCB; Thu, 6 Dec 2018 20:04:01 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AA8C2819; Thu, 6 Dec 2018 20:04:01 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB6K412g035895; Thu, 6 Dec 2018 20:04:01 GMT (envelope-from joel@FreeBSD.org) Received: (from joel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB6K41YD035894; Thu, 6 Dec 2018 20:04:01 GMT (envelope-from joel@FreeBSD.org) Message-Id: <201812062004.wB6K41YD035894@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: joel set sender to joel@FreeBSD.org using -f From: Joel Dahl Date: Thu, 6 Dec 2018 20:04:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341649 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: joel X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 341649 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D05497DBCB X-Spamd-Result: default: False [-1.89 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.86)[-0.863,0]; NEURAL_HAM_SHORT(-0.95)[-0.949,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.08)[-0.083,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 06 Dec 2018 20:04:02 -0000 Author: joel (doc committer) Date: Thu Dec 6 20:04:01 2018 New Revision: 341649 URL: https://svnweb.freebsd.org/changeset/base/341649 Log: Minor mandoc fixes. Modified: head/share/man/man4/muge.4 head/share/man/man4/vxlan.4 Modified: head/share/man/man4/muge.4 ============================================================================== --- head/share/man/man4/muge.4 Thu Dec 6 20:03:06 2018 (r341648) +++ head/share/man/man4/muge.4 Thu Dec 6 20:04:01 2018 (r341649) @@ -35,10 +35,6 @@ To load the driver as a module at boot time, place the .Bd -literal -offset indent if_muge_load="YES" .Ed -.Pp -.\" Alternatively, to compile this driver into the kernel, place the -.\" following lines in your kernel configuration file: -.Ed .Sh DESCRIPTION The .Nm Modified: head/share/man/man4/vxlan.4 ============================================================================== --- head/share/man/man4/vxlan.4 Thu Dec 6 20:03:06 2018 (r341648) +++ head/share/man/man4/vxlan.4 Thu Dec 6 20:04:01 2018 (r341649) @@ -108,7 +108,7 @@ forwarding table entry. When the .Nm interface is brought up, a -.Xr UDP 4 +.Xr udp 4 .Xr socket 9 is created based on the configuration, such as the local address for unicast mode or @@ -214,7 +214,6 @@ Once created, the .Nm interface can be configured with .Xr ifconfig 8 . -.Ed .Pp The following when placed in the file .Pa /etc/rc.conf @@ -224,6 +223,7 @@ to be created, and will configure the interface in uni .Bd -literal -offset indent cloned_interfaces="vxlan0" create_args_vxlan0="vxlanid 108 vxlanlocal 192.168.100.1 vxlanremote 192.168.100.2" +.Ed .Sh SEE ALSO .Xr inet 4 , .Xr inet6 4 , @@ -238,7 +238,7 @@ create_args_vxlan0="vxlanid 108 vxlanlocal 192.168.100 .%D August 2014 .%O "RFC 7348" .Re -.Sh AUTHOR +.Sh AUTHORS .An -nosplit The .Nm From owner-svn-src-head@freebsd.org Thu Dec 6 20:15:56 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 242681311A69; Thu, 6 Dec 2018 20:15:56 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BEE6D7E434; Thu, 6 Dec 2018 20:15:55 +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 A0EA4A0E; Thu, 6 Dec 2018 20:15:55 +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 wB6KFtZR041549; Thu, 6 Dec 2018 20:15:55 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB6KFtXU041546; Thu, 6 Dec 2018 20:15:55 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201812062015.wB6KFtXU041546@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Thu, 6 Dec 2018 20:15:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341650 - in head: contrib/ipfilter/ipsend sys/contrib/ipfilter/netinet X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in head: contrib/ipfilter/ipsend sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 341650 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: BEE6D7E434 X-Spamd-Result: default: False [-1.89 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_SHORT(-0.97)[-0.974,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_MEDIUM(-0.87)[-0.865,0]; NEURAL_HAM_LONG(-0.05)[-0.054,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 06 Dec 2018 20:15:56 -0000 Author: cy Date: Thu Dec 6 20:15:54 2018 New Revision: 341650 URL: https://svnweb.freebsd.org/changeset/base/341650 Log: Remove an ugly Ultrix hack. Ultrix has been AWOL since the last ice age, more to come. MFC after: 1 week Modified: head/contrib/ipfilter/ipsend/ip.c head/contrib/ipfilter/ipsend/resend.c head/sys/contrib/ipfilter/netinet/ip_compat.h Modified: head/contrib/ipfilter/ipsend/ip.c ============================================================================== --- head/contrib/ipfilter/ipsend/ip.c Thu Dec 6 20:04:01 2018 (r341649) +++ head/contrib/ipfilter/ipsend/ip.c Thu Dec 6 20:15:54 2018 (r341650) @@ -67,9 +67,9 @@ int send_ether(nfd, buf, len, gwip) bcopy((char *)buf, s + sizeof(*eh), len); if (gwip.s_addr == last_gw.s_addr) { - bcopy(last_arp, (char *)A_A eh->ether_dhost, 6); + bcopy(last_arp, (char *) &eh->ether_dhost, 6); } - else if (arp((char *)&gwip, (char *)A_A eh->ether_dhost) == -1) + else if (arp((char *)&gwip, (char *) &eh->ether_dhost) == -1) { perror("arp"); return -2; @@ -109,17 +109,17 @@ int send_ip(nfd, mtu, ip, gwip, frag) eh = (ether_header_t *)ipbuf; - bzero((char *)A_A eh->ether_shost, sizeof(eh->ether_shost)); + bzero((char *) &eh->ether_shost, sizeof(eh->ether_shost)); if (last_gw.s_addr && (gwip.s_addr == last_gw.s_addr)) { - bcopy(last_arp, (char *)A_A eh->ether_dhost, 6); + bcopy(last_arp, (char *) &eh->ether_dhost, 6); } - else if (arp((char *)&gwip, (char *)A_A eh->ether_dhost) == -1) + else if (arp((char *)&gwip, (char *) &eh->ether_dhost) == -1) { perror("arp"); return -2; } - bcopy((char *)A_A eh->ether_dhost, last_arp, sizeof(last_arp)); + bcopy((char *) &eh->ether_dhost, last_arp, sizeof(last_arp)); eh->ether_type = htons(ETHERTYPE_IP); bcopy((char *)ip, (char *)&ipsv, sizeof(*ip)); @@ -136,11 +136,11 @@ int send_ip(nfd, mtu, ip, gwip, frag) } if (ip->ip_src.s_addr != local_ip.s_addr) { - (void) arp((char *)&ip->ip_src, (char *)A_A local_arp); - bcopy(local_arp, (char *)A_A eh->ether_shost,sizeof(last_arp)); + (void) arp((char *)&ip->ip_src, (char *) &local_arp); + bcopy(local_arp, (char *) &eh->ether_shost,sizeof(last_arp)); local_ip = ip->ip_src; } else - bcopy(local_arp, (char *)A_A eh->ether_shost, 6); + bcopy(local_arp, (char *) &eh->ether_shost, 6); if (!frag || (sizeof(*eh) + iplen < mtu)) { Modified: head/contrib/ipfilter/ipsend/resend.c ============================================================================== --- head/contrib/ipfilter/ipsend/resend.c Thu Dec 6 20:04:01 2018 (r341649) +++ head/contrib/ipfilter/ipsend/resend.c Thu Dec 6 20:15:54 2018 (r341650) @@ -97,7 +97,7 @@ int ip_resend(dev, mtu, r, gwip, datain) return -2; } - bzero((char *)A_A eh->ether_shost, sizeof(eh->ether_shost)); + bzero((char *) &eh->ether_shost, sizeof(eh->ether_shost)); if (gwip.s_addr && (arp((char *)&gwip, dhost) == -1)) { perror("arp"); @@ -113,12 +113,12 @@ int ip_resend(dev, mtu, r, gwip, datain) eh->ether_type = htons((u_short)ETHERTYPE_IP); if (!gwip.s_addr) { if (arp((char *)&gwip, - (char *)A_A eh->ether_dhost) == -1) { + (char *) &eh->ether_dhost) == -1) { perror("arp"); continue; } } else - bcopy(dhost, (char *)A_A eh->ether_dhost, + bcopy(dhost, (char *) &eh->ether_dhost, sizeof(dhost)); if (!ip->ip_sum) ip->ip_sum = chksum((u_short *)ip, Modified: head/sys/contrib/ipfilter/netinet/ip_compat.h ============================================================================== --- head/sys/contrib/ipfilter/netinet/ip_compat.h Thu Dec 6 20:04:01 2018 (r341649) +++ head/sys/contrib/ipfilter/netinet/ip_compat.h Thu Dec 6 20:15:54 2018 (r341650) @@ -758,16 +758,6 @@ typedef struct tcpiphdr tcpiphdr_t; #endif #define IPMINLEN(i, h) ((i)->ip_len >= (IP_HL(i) * 4 + sizeof(struct h))) - -/* - * XXX - This is one of those *awful* hacks which nobody likes - */ -#ifdef ultrix -#define A_A -#else -#define A_A & -#endif - #define TCPF_ALL (TH_FIN|TH_SYN|TH_RST|TH_PUSH|TH_ACK|TH_URG|\ TH_ECN|TH_CWR) From owner-svn-src-head@freebsd.org Thu Dec 6 20:28:10 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 73B6A1311F7C; Thu, 6 Dec 2018 20:28:10 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 151677EA77; Thu, 6 Dec 2018 20:28:10 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E1AA5BAF; Thu, 6 Dec 2018 20:28:09 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB6KS9Ee046796; Thu, 6 Dec 2018 20:28:09 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB6KS9DS046795; Thu, 6 Dec 2018 20:28:09 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201812062028.wB6KS9DS046795@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Thu, 6 Dec 2018 20:28:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341651 - head/stand/i386/loader X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/stand/i386/loader X-SVN-Commit-Revision: 341651 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 151677EA77 X-Spamd-Result: default: False [-1.92 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.86)[-0.863,0]; NEURAL_HAM_SHORT(-0.97)[-0.973,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.08)[-0.083,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 06 Dec 2018 20:28:10 -0000 Author: ian Date: Thu Dec 6 20:28:09 2018 New Revision: 341651 URL: https://svnweb.freebsd.org/changeset/base/341651 Log: Don't reference zfs-specific variables if LOADER_ZFS_SUPPORT is undefined because the variables will be undefined too. Reported by: sjg@ Pointy hat: ian@ Modified: head/stand/i386/loader/main.c Modified: head/stand/i386/loader/main.c ============================================================================== --- head/stand/i386/loader/main.c Thu Dec 6 20:15:54 2018 (r341650) +++ head/stand/i386/loader/main.c Thu Dec 6 20:28:09 2018 (r341651) @@ -195,11 +195,14 @@ main(void) */ #define LEGACY_GELI_ARGS_SIZE 260 /* This can never change */ +#ifdef LOADER_ZFS_SUPPORT if (zargs != NULL) { if (zargs->size > offsetof(struct zfs_boot_args, gelidata)) { gbdata = &zargs->gelidata; } - } else if ((kargs->bootflags & KARGS_FLAGS_EXTARG) != 0) { + } else +#endif /* LOADER_ZFS_SUPPORT */ + if ((kargs->bootflags & KARGS_FLAGS_EXTARG) != 0) { gargs = (struct geli_boot_args *)(kargs + 1); if ((kargs->bootflags & KARGS_FLAGS_GELI) || gargs->size == LEGACY_GELI_ARGS_SIZE) { From owner-svn-src-head@freebsd.org Thu Dec 6 20:56:24 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CE85013131D8; Thu, 6 Dec 2018 20:56:23 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 720F6812F8; Thu, 6 Dec 2018 20:56:23 +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 4CC4110E4; Thu, 6 Dec 2018 20:56:23 +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 wB6KuNTX065251; Thu, 6 Dec 2018 20:56:23 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB6KuJxT065229; Thu, 6 Dec 2018 20:56:19 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201812062056.wB6KuJxT065229@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Thu, 6 Dec 2018 20:56:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341652 - in head: contrib/bmake contrib/bmake/mk contrib/bmake/unit-tests usr.bin/bmake usr.bin/bmake/unit-tests X-SVN-Group: head X-SVN-Commit-Author: sjg X-SVN-Commit-Paths: in head: contrib/bmake contrib/bmake/mk contrib/bmake/unit-tests usr.bin/bmake usr.bin/bmake/unit-tests X-SVN-Commit-Revision: 341652 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 720F6812F8 X-Spamd-Result: default: False [-1.84 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.87)[-0.870,0]; NEURAL_SPAM_LONG(0.01)[0.005,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_SHORT(-0.98)[-0.977,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 06 Dec 2018 20:56:24 -0000 Author: sjg Date: Thu Dec 6 20:56:19 2018 New Revision: 341652 URL: https://svnweb.freebsd.org/changeset/base/341652 Log: Update bmake to version 20180919 Cleanup of stats cache and new :q modifier. Added: head/contrib/bmake/unit-tests/varquote.exp - copied unchanged from r341610, vendor/NetBSD/bmake/dist/unit-tests/varquote.exp head/contrib/bmake/unit-tests/varquote.mk - copied unchanged from r341610, vendor/NetBSD/bmake/dist/unit-tests/varquote.mk Modified: head/contrib/bmake/ChangeLog head/contrib/bmake/FILES head/contrib/bmake/Makefile.config.in head/contrib/bmake/VERSION head/contrib/bmake/bmake.1 head/contrib/bmake/dir.c head/contrib/bmake/make.1 head/contrib/bmake/mk/ChangeLog head/contrib/bmake/mk/dirdeps-options.mk head/contrib/bmake/mk/dirdeps.mk head/contrib/bmake/mk/gendirdeps.mk head/contrib/bmake/mk/install-mk head/contrib/bmake/mk/meta.autodep.mk head/contrib/bmake/mk/meta.stage.mk head/contrib/bmake/unit-tests/Makefile.in head/contrib/bmake/var.c head/usr.bin/bmake/Makefile.config head/usr.bin/bmake/unit-tests/Makefile Directory Properties: head/contrib/bmake/ (props changed) Modified: head/contrib/bmake/ChangeLog ============================================================================== --- head/contrib/bmake/ChangeLog Thu Dec 6 20:28:09 2018 (r341651) +++ head/contrib/bmake/ChangeLog Thu Dec 6 20:56:19 2018 (r341652) @@ -1,3 +1,14 @@ +2018-09-21 Simon J. Gerraty + + * VERSION: 20180919 + Merge with NetBSD make, pick up + o var.c: add :q + o dir.c: cleanup caching of stats + +2018-09-21 Simon J Gerraty + + * Makefile.config.in: use += where it makes sense. + 2018-05-12 Simon J. Gerraty * VERSION: 20180512 Modified: head/contrib/bmake/FILES ============================================================================== --- head/contrib/bmake/FILES Thu Dec 6 20:28:09 2018 (r341651) +++ head/contrib/bmake/FILES Thu Dec 6 20:56:19 2018 (r341652) @@ -163,6 +163,8 @@ unit-tests/varcmd.exp unit-tests/varcmd.mk unit-tests/varmisc.exp unit-tests/varmisc.mk +unit-tests/varquote.exp +unit-tests/varquote.mk unit-tests/varshell.exp unit-tests/varshell.mk util.c Modified: head/contrib/bmake/Makefile.config.in ============================================================================== --- head/contrib/bmake/Makefile.config.in Thu Dec 6 20:28:09 2018 (r341651) +++ head/contrib/bmake/Makefile.config.in Thu Dec 6 20:56:19 2018 (r341652) @@ -1,6 +1,6 @@ # things set by configure -_MAKE_VERSION=@_MAKE_VERSION@ +_MAKE_VERSION?=@_MAKE_VERSION@ prefix?= @prefix@ srcdir= @srcdir@ @@ -11,9 +11,9 @@ DEFAULT_SYS_PATH?= @default_sys_path@ CPPFLAGS+= @CPPFLAGS@ CFLAGS+= ${CPPFLAGS} @DEFS@ -LDFLAGS= @LDFLAGS@ -LIBOBJS= @LIBOBJS@ -LDADD= @LIBS@ +LDFLAGS+= @LDFLAGS@ +LIBOBJS+= @LIBOBJS@ +LDADD+= @LIBS@ USE_META= @use_meta@ FILEMON_H?= @filemon_h@ BMAKE_PATH_MAX?= @bmake_path_max@ Modified: head/contrib/bmake/VERSION ============================================================================== --- head/contrib/bmake/VERSION Thu Dec 6 20:28:09 2018 (r341651) +++ head/contrib/bmake/VERSION Thu Dec 6 20:56:19 2018 (r341652) @@ -1,2 +1,2 @@ # keep this compatible with sh and make -_MAKE_VERSION=20180512 +_MAKE_VERSION=20180919 Modified: head/contrib/bmake/bmake.1 ============================================================================== --- head/contrib/bmake/bmake.1 Thu Dec 6 20:28:09 2018 (r341651) +++ head/contrib/bmake/bmake.1 Thu Dec 6 20:56:19 2018 (r341652) @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.272 2018/04/02 04:26:17 dholland Exp $ +.\" $NetBSD: make.1,v 1.273 2018/05/27 01:14:51 christos Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" -.Dd June 22, 2017 +.Dd May 26, 2018 .Dt BMAKE 1 .Os .Sh NAME @@ -1227,8 +1227,15 @@ due uno quattro tre .Ed .It Cm \&:Q Quotes every shell meta-character in the variable, so that it can be passed +safely to the shell. +.It Cm \&:q +Quotes every shell meta-character in the variable, and also doubles +.Sq $ +characters so that it can be passed safely through recursive invocations of .Nm . +This is equivalent to: +.Sq \&:S/\e\&$/&&/g:Q . .It Cm \&:R Replaces each word in the variable with everything but its suffix. .It Cm \&:range[=count] Modified: head/contrib/bmake/dir.c ============================================================================== --- head/contrib/bmake/dir.c Thu Dec 6 20:28:09 2018 (r341651) +++ head/contrib/bmake/dir.c Thu Dec 6 20:56:19 2018 (r341652) @@ -1,4 +1,4 @@ -/* $NetBSD: dir.c,v 1.71 2017/04/16 21:14:47 riastradh Exp $ */ +/* $NetBSD: dir.c,v 1.73 2018/07/12 18:03:31 christos Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: dir.c,v 1.71 2017/04/16 21:14:47 riastradh Exp $"; +static char rcsid[] = "$NetBSD: dir.c,v 1.73 2018/07/12 18:03:31 christos Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)dir.c 8.2 (Berkeley) 1/2/94"; #else -__RCSID("$NetBSD: dir.c,v 1.71 2017/04/16 21:14:47 riastradh Exp $"); +__RCSID("$NetBSD: dir.c,v 1.73 2018/07/12 18:03:31 christos Exp $"); #endif #endif /* not lint */ #endif @@ -268,15 +268,6 @@ struct cache_st { }; /* minimize changes below */ -static time_t -Hash_GetTimeValue(Hash_Entry *entry) -{ - struct cache_st *cst; - - cst = entry->clientPtr; - return cst->mtime; -} - #define CST_LSTAT 1 #define CST_UPDATE 2 @@ -298,6 +289,10 @@ cached_stats(Hash_Table *htp, const char *pathname, st memset(st, 0, sizeof(*st)); st->st_mtime = cst->mtime; st->st_mode = cst->mode; + if (DEBUG(DIR)) { + fprintf(debug_file, "Using cached time %s for %s\n", + Targ_FmtTime(st->st_mtime), pathname); + } return 0; } @@ -315,6 +310,10 @@ cached_stats(Hash_Table *htp, const char *pathname, st cst = entry->clientPtr; cst->mtime = st->st_mtime; cst->mode = st->st_mode; + if (DEBUG(DIR)) { + fprintf(debug_file, " Caching %s for %s\n", + Targ_FmtTime(st->st_mtime), pathname); + } return 0; } @@ -995,14 +994,6 @@ DirLookupSubdir(Path *p, const char *name) } if (cached_stat(file, &stb) == 0) { - /* - * Save the modification time so if it's needed, we don't have - * to fetch it again. - */ - if (DEBUG(DIR)) { - fprintf(debug_file, " Caching %s for %s\n", Targ_FmtTime(stb.st_mtime), - file); - } nearmisses += 1; return (file); } @@ -1134,7 +1125,6 @@ Dir_FindFile(const char *name, Lst path) Boolean hasLastDot = FALSE; /* true we should search dot last */ Boolean hasSlash; /* true if 'name' contains a / */ struct stat stb; /* Buffer for stat, if necessary */ - Hash_Entry *entry; /* Entry for mtimes table */ const char *trailing_dot = "."; /* @@ -1395,24 +1385,14 @@ Dir_FindFile(const char *name, Lst path) } bigmisses += 1; - entry = Hash_FindEntry(&mtimes, name); - if (entry != NULL) { - if (DEBUG(DIR)) { - fprintf(debug_file, " got it (in mtime cache)\n"); - } - return(bmake_strdup(name)); - } else if (cached_stat(name, &stb) == 0) { - if (DEBUG(DIR)) { - fprintf(debug_file, " Caching %s for %s\n", Targ_FmtTime(stb.st_mtime), - name); - } + if (cached_stat(name, &stb) == 0) { return (bmake_strdup(name)); - } else { - if (DEBUG(DIR)) { - fprintf(debug_file, " failed. Returning NULL\n"); - } - return NULL; } + + if (DEBUG(DIR)) { + fprintf(debug_file, " failed. Returning NULL\n"); + } + return NULL; #endif /* notdef */ } @@ -1518,7 +1498,6 @@ Dir_MTime(GNode *gn, Boolean recheck) { char *fullName; /* the full pathname of name */ struct stat stb; /* buffer for finding the mod time */ - Hash_Entry *entry; if (gn->type & OP_ARCHV) { return Arch_MTime(gn); @@ -1569,17 +1548,7 @@ Dir_MTime(GNode *gn, Boolean recheck) fullName = bmake_strdup(gn->name); } - if (!recheck) - entry = Hash_FindEntry(&mtimes, fullName); - else - entry = NULL; - if (entry != NULL) { - stb.st_mtime = Hash_GetTimeValue(entry); - if (DEBUG(DIR)) { - fprintf(debug_file, "Using cached time %s for %s\n", - Targ_FmtTime(stb.st_mtime), fullName); - } - } else if (cached_stats(&mtimes, fullName, &stb, recheck ? CST_UPDATE : 0) < 0) { + if (cached_stats(&mtimes, fullName, &stb, recheck ? CST_UPDATE : 0) < 0) { if (gn->type & OP_MEMBER) { if (fullName != gn->path) free(fullName); Modified: head/contrib/bmake/make.1 ============================================================================== --- head/contrib/bmake/make.1 Thu Dec 6 20:28:09 2018 (r341651) +++ head/contrib/bmake/make.1 Thu Dec 6 20:56:19 2018 (r341652) @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.272 2018/04/02 04:26:17 dholland Exp $ +.\" $NetBSD: make.1,v 1.273 2018/05/27 01:14:51 christos Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" -.Dd September 27, 2018 +.Dd December 5, 2018 .Dt MAKE 1 .Os .Sh NAME @@ -1238,8 +1238,15 @@ due uno quattro tre .Ed .It Cm \&:Q Quotes every shell meta-character in the variable, so that it can be passed +safely to the shell. +.It Cm \&:q +Quotes every shell meta-character in the variable, and also doubles +.Sq $ +characters so that it can be passed safely through recursive invocations of .Nm . +This is equivalent to: +.Sq \&:S/\e\&$/&&/g:Q . .It Cm \&:R Replaces each word in the variable with everything but its suffix. .It Cm \&:range[=count] Modified: head/contrib/bmake/mk/ChangeLog ============================================================================== --- head/contrib/bmake/mk/ChangeLog Thu Dec 6 20:28:09 2018 (r341651) +++ head/contrib/bmake/mk/ChangeLog Thu Dec 6 20:56:19 2018 (r341652) @@ -1,3 +1,25 @@ +2018-09-19 Simon J Gerraty + + * install-mk (MK_VERSION): 20180919 + + * dirdeps-options.mk: .undef cannot handle var that expands to + more than one var. + +2018-07-08 Simon J Gerraty + + * meta.stage.mk: allow wildcards in STAGE_FILES.* etc. + +2018-06-01 Simon J Gerraty + + * meta.autodep.mk: export META_FILES to avoid command line limit + * gendirdeps.mk: if we have lots of .meta files put them in + an @list + +2018-05-28 Simon J Gerraty + + * dirdeps-options.mk: use local.dirdeps-options.mk + not local.dirdeps-option.mk + 2018-04-20 Simon J Gerraty * install-mk (MK_VERSION): 20180420 Modified: head/contrib/bmake/mk/dirdeps-options.mk ============================================================================== --- head/contrib/bmake/mk/dirdeps-options.mk Thu Dec 6 20:28:09 2018 (r341651) +++ head/contrib/bmake/mk/dirdeps-options.mk Thu Dec 6 20:56:19 2018 (r341652) @@ -1,4 +1,4 @@ -# $Id: dirdeps-options.mk,v 1.5 2018/04/18 15:53:57 sjg Exp $ +# $Id: dirdeps-options.mk,v 1.9 2018/09/20 00:07:19 sjg Exp $ # # @(#) Copyright (c) 2018, Simon J. Gerraty # @@ -25,7 +25,7 @@ # If a Makefile.depend.options file exists, it will be included by # dirdeps.mk and meta.autodep.mk # -# We include local.dirdeps-option.mk which may also define DIRDEPS.* +# We include local.dirdeps-options.mk which may also define DIRDEPS.* # for options. # # Thus a directory, that is affected by an option FOO would have @@ -35,7 +35,7 @@ # DIRDEPS.FOO.yes # DIRDEPS.FOO.no # to whatever applies for that dir, or it can rely on globals -# set in local.dirdeps-option.mk +# set in local.dirdeps-options.mk # Either way, we will .undef DIRDEPS.* when done. # This should have been set by Makefile.depend.options @@ -43,7 +43,7 @@ DIRDEPS_OPTIONS ?= # pickup any DIRDEPS.* we need -.-include +.-include .if ${.MAKE.LEVEL} == 0 # :U below avoids potential errors when we := @@ -52,7 +52,10 @@ DIRDEPS += ${DIRDEPS.$o.${MK_$o:U}:U} .endfor DIRDEPS := ${DIRDEPS:O:u} # avoid cross contamination -.undef ${DIRDEPS_OPTIONS:tu:@o@DIRDEPS.$o.yes DIRDEPS.$o.no@} +.for o in ${DIRDEPS_OPTIONS:tu} +.undef DIRDEPS.$o.yes +.undef DIRDEPS.$o.no +.endfor .else # whether options are enabled or not, # we want to filter out the relevant DIRDEPS.* Modified: head/contrib/bmake/mk/dirdeps.mk ============================================================================== --- head/contrib/bmake/mk/dirdeps.mk Thu Dec 6 20:28:09 2018 (r341651) +++ head/contrib/bmake/mk/dirdeps.mk Thu Dec 6 20:56:19 2018 (r341652) @@ -1,4 +1,4 @@ -# $Id: dirdeps.mk,v 1.95 2018/04/23 17:53:56 sjg Exp $ +# $Id: dirdeps.mk,v 1.96 2018/06/20 22:26:39 sjg Exp $ # Copyright (c) 2010-2013, Juniper Networks, Inc. # All rights reserved. @@ -731,6 +731,8 @@ DIRDEPS = .info loading ${_m} for ${d:E} .endif .include <${_m}> +.else +.-include .endif .endif .endif @@ -746,7 +748,7 @@ DIRDEPS = DEP_RELDIR := ${RELDIR} _DEP_RELDIR := ${RELDIR} # Since we are/should be included by .MAKE.DEPENDFILE -# is is a final opportunity to add/hook global rules. +# This is a final opportunity to add/hook global rules. .-include # pickup local dependencies Modified: head/contrib/bmake/mk/gendirdeps.mk ============================================================================== --- head/contrib/bmake/mk/gendirdeps.mk Thu Dec 6 20:28:09 2018 (r341651) +++ head/contrib/bmake/mk/gendirdeps.mk Thu Dec 6 20:56:19 2018 (r341652) @@ -1,4 +1,4 @@ -# $Id: gendirdeps.mk,v 1.38 2018/03/10 00:53:52 sjg Exp $ +# $Id: gendirdeps.mk,v 1.39 2018/06/08 01:25:31 sjg Exp $ # Copyright (c) 2010-2013, Juniper Networks, Inc. # All rights reserved. @@ -171,11 +171,27 @@ GENDIRDEPS_SEDCMDS += \ # we canonicalize them to keep things simple # if we are using a split-fs sandbox, it gets a little messier. _objtop := ${_OBJTOP:tA} + +# some people put *.meta in META_XTRAS to make sure we get here +_meta_files := ${META_FILES:N\*.meta:O:u} +# assume a big list +_meta_files_arg= @meta.list +.if empty(_meta_files) && ${META_FILES:M\*.meta} != "" +# XXX this should be considered a bad idea, +# since we cannot ignore stale .meta +x != cd ${_OBJDIR} && find . -name '*.meta' -print -o \( -type d ! -name . -prune \) | sed 's,^./,,' > meta.list; echo +.elif ${_meta_files:[#]} > 500 +.export _meta_files +x != echo; for m in $$_meta_files; do echo $$m; done > meta.list +.else +_meta_files_arg:= ${_meta_files} +.endif + dir_list != cd ${_OBJDIR} && \ ${META2DEPS_CMD} MACHINE=${MACHINE} \ SRCTOP=${SRCTOP} RELDIR=${RELDIR} CURDIR=${_CURDIR} \ ${META2DEPS_ARGS} \ - ${META_FILES:O:u} | ${META2DEPS_FILTER} ${_skip_gendirdeps} \ + ${_meta_files_arg} | ${META2DEPS_FILTER} ${_skip_gendirdeps} \ sed ${GENDIRDEPS_SEDCMDS} .if ${dir_list:M*ERROR\:*} != "" Modified: head/contrib/bmake/mk/install-mk ============================================================================== --- head/contrib/bmake/mk/install-mk Thu Dec 6 20:28:09 2018 (r341651) +++ head/contrib/bmake/mk/install-mk Thu Dec 6 20:56:19 2018 (r341652) @@ -55,7 +55,7 @@ # Simon J. Gerraty # RCSid: -# $Id: install-mk,v 1.156 2018/04/22 04:42:47 sjg Exp $ +# $Id: install-mk,v 1.160 2018/09/20 00:07:19 sjg Exp $ # # @(#) Copyright (c) 1994 Simon J. Gerraty # @@ -70,7 +70,7 @@ # sjg@crufty.net # -MK_VERSION=20180420 +MK_VERSION=20180919 OWNER= GROUP= MODE=444 Modified: head/contrib/bmake/mk/meta.autodep.mk ============================================================================== --- head/contrib/bmake/mk/meta.autodep.mk Thu Dec 6 20:28:09 2018 (r341651) +++ head/contrib/bmake/mk/meta.autodep.mk Thu Dec 6 20:56:19 2018 (r341652) @@ -1,4 +1,4 @@ -# $Id: meta.autodep.mk,v 1.48 2018/04/15 06:30:04 sjg Exp $ +# $Id: meta.autodep.mk,v 1.50 2018/06/08 01:25:31 sjg Exp $ # # @(#) Copyright (c) 2010, Simon J. Gerraty @@ -20,9 +20,11 @@ __${_this}__: .NOTMAIN .-include +PICO?= .pico + .if defined(SRCS) # it would be nice to be able to query .SUFFIXES -OBJ_EXTENSIONS+= .o .po .lo .So +OBJ_EXTENSIONS+= .o .po .lo ${PICO} # explicit dependencies help short-circuit .SUFFIX searches SRCS_DEP_FILTER+= N*.[hly] @@ -178,7 +180,7 @@ DEPEND_SUFFIXES += .c .h .cpp .hpp .cxx .hxx .cc .hh @case "${.MAKE.META.FILES:T:M*.po.*}" in \ *.po.*) mv $@.${.MAKE.PID} $@;; \ *) { cat $@.${.MAKE.PID}; \ - sed 's,\.So:,.o:,;s,\.o:,.po:,' $@.${.MAKE.PID}; } | sort -u > $@; \ + sed 's,\${PICO}:,.o:,;s,\.o:,.po:,' $@.${.MAKE.PID}; } | sort -u > $@; \ rm -f $@.${.MAKE.PID};; \ esac .else @@ -243,7 +245,7 @@ META_FILES = *.meta .elif ${OPTIMIZE_OBJECT_META_FILES:Uno:tl} == "no" META_FILES = ${.MAKE.META.FILES:T:N.depend*:O:u} .else -# if we have 1000's of .o.meta, .So.meta etc we need only look at one set +# if we have 1000's of .o.meta, ${PICO}.meta etc we need only look at one set # it is left as an exercise for the reader to work out what this does META_FILES = ${.MAKE.META.FILES:T:N.depend*:N*o.meta:O:u} \ ${.MAKE.META.FILES:T:M*.${.MAKE.META.FILES:M*o.meta:R:E:O:u:[1]}.meta:O:u} @@ -260,6 +262,9 @@ META_FILES = ${.MAKE.META.FILES:T:N.depend*:N*o.meta:O .if !empty(GENDIRDEPS_FILTER) .export GENDIRDEPS_FILTER .endif +# export to avoid blowing command line limit +META_FILES := ${META_XTRAS:U:O:u} ${META_FILES:U:T:O:u:${META_FILE_FILTER:ts:}} +.export META_FILES .endif # we might have .../ in MAKESYSPATH @@ -270,8 +275,7 @@ ${_DEPENDFILE}: ${_depend} ${.PARSEDIR}/gendirdeps.mk SKIP_GENDIRDEPS='${SKIP_GENDIRDEPS:O:u}' \ DPADD='${FORCE_DPADD:O:u}' ${_gendirdeps_mutex} \ MAKESYSPATH=${_makesyspath} \ - ${.MAKE} -f gendirdeps.mk RELDIR=${RELDIR} _DEPENDFILE=${_DEPENDFILE} \ - META_FILES='${META_XTRAS:O:u} ${META_FILES:T:O:u:${META_FILE_FILTER:ts:}}') + ${.MAKE} -f gendirdeps.mk RELDIR=${RELDIR} _DEPENDFILE=${_DEPENDFILE}) @test -s $@ && touch $@; : .endif Modified: head/contrib/bmake/mk/meta.stage.mk ============================================================================== --- head/contrib/bmake/mk/meta.stage.mk Thu Dec 6 20:28:09 2018 (r341651) +++ head/contrib/bmake/mk/meta.stage.mk Thu Dec 6 20:56:19 2018 (r341652) @@ -1,4 +1,4 @@ -# $Id: meta.stage.mk,v 1.55 2017/10/27 01:17:09 sjg Exp $ +# $Id: meta.stage.mk,v 1.56 2018/07/08 17:12:54 sjg Exp $ # # @(#) Copyright (c) 2011-2017, Simon J. Gerraty # @@ -141,7 +141,7 @@ _STAGE_AS_BASENAME_USE: .USE .dirdep ${.TARGET: .if !empty(STAGE_INCSDIR) .if !empty(STAGE_INCS) -stage_incs: ${STAGE_INCS} +stage_incs: ${STAGE_INCS:N*\**} .endif .if target(stage_incs) || !empty(.ALLTARGETS:Mstage_includes) STAGE_TARGETS += stage_incs @@ -156,7 +156,7 @@ stage_incs: .dirdep .if !empty(STAGE_LIBDIR) .if !empty(STAGE_LIBS) -stage_libs: ${STAGE_LIBS} +stage_libs: ${STAGE_LIBS:N*\**} .endif .if target(stage_libs) STAGE_TARGETS += stage_libs @@ -191,7 +191,7 @@ CLEANFILES += ${STAGE_SETS:@s@stage*$s@} # some makefiles need to populate multiple directories .for s in ${STAGE_SETS:O:u} .if !empty(STAGE_FILES.$s) -stage_files.$s: ${STAGE_FILES.$s} +stage_files.$s: ${STAGE_FILES.$s:N*\**} .endif .if target(stage_files.$s) || target(stage_files${s:S,^,.,:N._default}) STAGE_TARGETS += stage_files @@ -262,7 +262,7 @@ CLEANFILES += ${STAGE_AS_SETS:@s@stage*$s@} # both operations happen together .for s in ${STAGE_AS_SETS:O:u} .if !empty(STAGE_AS.$s) -stage_as.$s: ${STAGE_AS.$s} +stage_as.$s: ${STAGE_AS.$s:N*\**} .endif .if target(stage_as.$s) STAGE_TARGETS += stage_as @@ -277,7 +277,7 @@ stage_as.$s: .dirdep .endif .if !empty(STAGE_AS_AND_SYMLINK.$s) -stage_as_and_symlink.$s: ${STAGE_AS_AND_SYMLINK.$s} +stage_as_and_symlink.$s: ${STAGE_AS_AND_SYMLINK.$s:N*\**} .endif .if target(stage_as_and_symlink.$s) STAGE_TARGETS += stage_as_and_symlink Modified: head/contrib/bmake/unit-tests/Makefile.in ============================================================================== --- head/contrib/bmake/unit-tests/Makefile.in Thu Dec 6 20:28:09 2018 (r341651) +++ head/contrib/bmake/unit-tests/Makefile.in Thu Dec 6 20:56:19 2018 (r341652) @@ -1,6 +1,6 @@ -# $Id: Makefile.in,v 1.48 2015/12/07 04:06:29 sjg Exp $ +# $Id: Makefile.in,v 1.49 2018/09/21 21:39:05 sjg Exp $ # -# $NetBSD: Makefile,v 1.52 2015/05/05 21:51:09 sjg Exp $ +# $NetBSD: Makefile,v 1.53 2018/05/24 00:25:44 christos Exp $ # # Unit tests for make(1) # The main targets are: @@ -54,6 +54,7 @@ TESTNAMES= \ unexport-env \ varcmd \ varmisc \ + varquote \ varshell # these tests were broken by referting POSIX chanegs Copied: head/contrib/bmake/unit-tests/varquote.exp (from r341610, vendor/NetBSD/bmake/dist/unit-tests/varquote.exp) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/bmake/unit-tests/varquote.exp Thu Dec 6 20:56:19 2018 (r341652, copy of r341610, vendor/NetBSD/bmake/dist/unit-tests/varquote.exp) @@ -0,0 +1,3 @@ +-fdebug-prefix-map=$NETBSDSRCDIR=/usr/src -fdebug-regex-map=/usr/src/(.*)/obj$=/usr/obj/\1 +-fdebug-prefix-map=$NETBSDSRCDIR=/usr/src -fdebug-regex-map=/usr/src/(.*)/obj$=/usr/obj/\1 +exit status 0 Copied: head/contrib/bmake/unit-tests/varquote.mk (from r341610, vendor/NetBSD/bmake/dist/unit-tests/varquote.mk) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/bmake/unit-tests/varquote.mk Thu Dec 6 20:56:19 2018 (r341652, copy of r341610, vendor/NetBSD/bmake/dist/unit-tests/varquote.mk) @@ -0,0 +1,14 @@ +# $NetBSD: varquote.mk,v 1.2 2018/05/27 01:14:51 christos Exp $ +# +# Test VAR:q modifier + +.if !defined(REPROFLAGS) +REPROFLAGS+= -fdebug-prefix-map=\$$NETBSDSRCDIR=/usr/src +REPROFLAGS+= -fdebug-regex-map='/usr/src/(.*)/obj$$=/usr/obj/\1' +all: + @${MAKE} -f ${MAKEFILE} REPROFLAGS=${REPROFLAGS:S/\$/&&/g:Q} + @${MAKE} -f ${MAKEFILE} REPROFLAGS=${REPROFLAGS:q} +.else +all: + @echo ${REPROFLAGS} +.endif Modified: head/contrib/bmake/var.c ============================================================================== --- head/contrib/bmake/var.c Thu Dec 6 20:28:09 2018 (r341651) +++ head/contrib/bmake/var.c Thu Dec 6 20:56:19 2018 (r341652) @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.218 2018/02/18 00:52:42 sjg Exp $ */ +/* $NetBSD: var.c,v 1.220 2018/05/27 01:14:51 christos Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: var.c,v 1.218 2018/02/18 00:52:42 sjg Exp $"; +static char rcsid[] = "$NetBSD: var.c,v 1.220 2018/05/27 01:14:51 christos Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: var.c,v 1.218 2018/02/18 00:52:42 sjg Exp $"); +__RCSID("$NetBSD: var.c,v 1.220 2018/05/27 01:14:51 christos Exp $"); #endif #endif /* not lint */ #endif @@ -324,7 +324,7 @@ static Boolean VarLoopExpand(GNode *, Var_Parse_State static char *VarGetPattern(GNode *, Var_Parse_State *, int, const char **, int, int *, int *, VarPattern *); -static char *VarQuote(char *); +static char *VarQuote(char *, Boolean); static char *VarHash(char *); static char *VarModify(GNode *, Var_Parse_State *, const char *, @@ -2315,6 +2315,7 @@ VarGetPattern(GNode *ctxt, Var_Parse_State *vpstate MA *----------------------------------------------------------------------- * VarQuote -- * Quote shell meta-characters and space characters in the string + * if quoteDollar is set, also quote and double any '$' characters. * * Results: * The quoted string @@ -2325,7 +2326,7 @@ VarGetPattern(GNode *ctxt, Var_Parse_State *vpstate MA *----------------------------------------------------------------------- */ static char * -VarQuote(char *str) +VarQuote(char *str, Boolean quoteDollar) { Buffer buf; @@ -2346,6 +2347,8 @@ VarQuote(char *str) if (isspace((unsigned char)*str) || ismeta((unsigned char)*str)) Buf_AddByte(&buf, '\\'); Buf_AddByte(&buf, *str); + if (quoteDollar && *str == '$') + Buf_AddBytes(&buf, 2, "\\$"); } str = Buf_Destroy(&buf, FALSE); @@ -3485,9 +3488,10 @@ ApplyModifiers(char *nstr, const char *tstr, break; } #endif + case 'q': case 'Q': if (tstr[1] == endc || tstr[1] == ':') { - newStr = VarQuote(nstr); + newStr = VarQuote(nstr, modifier == 'q'); cp = tstr + 1; termc = *cp; break; Modified: head/usr.bin/bmake/Makefile.config ============================================================================== --- head/usr.bin/bmake/Makefile.config Thu Dec 6 20:28:09 2018 (r341651) +++ head/usr.bin/bmake/Makefile.config Thu Dec 6 20:56:19 2018 (r341652) @@ -7,7 +7,7 @@ SRCTOP?= ${.CURDIR:H:H} # things set by configure -_MAKE_VERSION=20180512 +_MAKE_VERSION?=20180919 prefix?= /usr srcdir= ${SRCTOP}/contrib/bmake @@ -17,8 +17,8 @@ DEFAULT_SYS_PATH?= .../share/mk:/usr/share/mk CPPFLAGS+= CFLAGS+= ${CPPFLAGS} -DHAVE_CONFIG_H LDFLAGS+= -LIBOBJS= ${LIBOBJDIR}stresep$U.o -LDADD= +LIBOBJS+= ${LIBOBJDIR}stresep$U.o +LDADD+= USE_META= yes FILEMON_H?= /usr/include/dev/filemon/filemon.h BMAKE_PATH_MAX?= 1024 Modified: head/usr.bin/bmake/unit-tests/Makefile ============================================================================== --- head/usr.bin/bmake/unit-tests/Makefile Thu Dec 6 20:28:09 2018 (r341651) +++ head/usr.bin/bmake/unit-tests/Makefile Thu Dec 6 20:56:19 2018 (r341652) @@ -5,9 +5,9 @@ SRCTOP?= ${.CURDIR:H:H:H} -# $Id: Makefile.in,v 1.48 2015/12/07 04:06:29 sjg Exp $ +# $Id: Makefile.in,v 1.49 2018/09/21 21:39:05 sjg Exp $ # -# $NetBSD: Makefile,v 1.52 2015/05/05 21:51:09 sjg Exp $ +# $NetBSD: Makefile,v 1.53 2018/05/24 00:25:44 christos Exp $ # # Unit tests for make(1) # The main targets are: @@ -61,6 +61,7 @@ TESTNAMES= \ unexport-env \ varcmd \ varmisc \ + varquote \ varshell # these tests were broken by referting POSIX chanegs From owner-svn-src-head@freebsd.org Thu Dec 6 21:27:37 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E10521314419; Thu, 6 Dec 2018 21:27:36 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8916E82CF3; Thu, 6 Dec 2018 21:27:36 +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 6A38F1603; Thu, 6 Dec 2018 21:27:36 +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 wB6LRabW080598; Thu, 6 Dec 2018 21:27:36 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB6LRabt080597; Thu, 6 Dec 2018 21:27:36 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201812062127.wB6LRabt080597@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 6 Dec 2018 21:27:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341653 - head/share/man/man7 X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/share/man/man7 X-SVN-Commit-Revision: 341653 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8916E82CF3 X-Spamd-Result: default: False [-1.90 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.86)[-0.863,0]; NEURAL_HAM_SHORT(-0.96)[-0.955,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.08)[-0.083,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 06 Dec 2018 21:27:37 -0000 Author: emaste Date: Thu Dec 6 21:27:36 2018 New Revision: 341653 URL: https://svnweb.freebsd.org/changeset/base/341653 Log: hier.7: add /lib/casper directory Reported by: imp MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/share/man/man7/hier.7 Modified: head/share/man/man7/hier.7 ============================================================================== --- head/share/man/man7/hier.7 Thu Dec 6 20:56:19 2018 (r341652) +++ head/share/man/man7/hier.7 Thu Dec 6 21:27:36 2018 (r341653) @@ -28,7 +28,7 @@ .\" @(#)hier.7 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd June 18, 2018 +.Dd December 6, 2018 .Dt HIER 7 .Os .Sh NAME @@ -144,6 +144,10 @@ and .Pa /sbin .Pp .Bl -tag -width "defaults/" -compact +.It Pa casper/ +service-specific +.Xr libcasper 3 +Capsicum support libraries .It Pa geom/ class-specific libraries for the .Xr geom 8 From owner-svn-src-head@freebsd.org Thu Dec 6 21:33:09 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D8ADA13147D8; Thu, 6 Dec 2018 21:33:09 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7DC9283252; Thu, 6 Dec 2018 21:33:09 +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 5EC1417B4; Thu, 6 Dec 2018 21:33:09 +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 wB6LX9HT085582; Thu, 6 Dec 2018 21:33:09 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB6LX95U085581; Thu, 6 Dec 2018 21:33:09 GMT (envelope-from np@FreeBSD.org) Message-Id: <201812062133.wB6LX95U085581@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Thu, 6 Dec 2018 21:33:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341654 - head/sys/dev/cxgbe X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe X-SVN-Commit-Revision: 341654 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7DC9283252 X-Spamd-Result: default: False [-1.90 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.86)[-0.863,0]; NEURAL_HAM_LONG(-0.08)[-0.083,0]; NEURAL_HAM_SHORT(-0.96)[-0.955,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 06 Dec 2018 21:33:10 -0000 Author: np Date: Thu Dec 6 21:33:08 2018 New Revision: 341654 URL: https://svnweb.freebsd.org/changeset/base/341654 Log: cxgbe(4): Get Linux cxgb4vf working in bhyve VMs with VFs passed through. cxgb4vf doesn't own the buffer size list but still expects the first two entries to be 4K and some power of 2 respectively. The BSD cxgbe doesn't care where its preferred buffer sizes are as long as they're in the list somewhere, so just move its entries towards the end as a workaround. MFC after: 1 month Sponsored by: Chelsio Communicatons Modified: head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/t4_sge.c ============================================================================== --- head/sys/dev/cxgbe/t4_sge.c Thu Dec 6 21:27:36 2018 (r341653) +++ head/sys/dev/cxgbe/t4_sge.c Thu Dec 6 21:33:08 2018 (r341654) @@ -701,8 +701,10 @@ t4_tweak_chip_settings(struct adapter *sc) KASSERT(nitems(sge_flbuf_sizes) <= SGE_FLBUF_SIZES, ("%s: hw buffer size table too big", __func__)); + t4_write_reg(sc, A_SGE_FL_BUFFER_SIZE0, 4096); + t4_write_reg(sc, A_SGE_FL_BUFFER_SIZE1, 65536); for (i = 0; i < min(nitems(sge_flbuf_sizes), SGE_FLBUF_SIZES); i++) { - t4_write_reg(sc, A_SGE_FL_BUFFER_SIZE0 + (4 * i), + t4_write_reg(sc, A_SGE_FL_BUFFER_SIZE15 - (4 * i), sge_flbuf_sizes[i]); } From owner-svn-src-head@freebsd.org Thu Dec 6 21:52:41 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3EC3E131510A; Thu, 6 Dec 2018 21:52:41 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D674A83D7F; Thu, 6 Dec 2018 21:52:40 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B8EF41AF3; Thu, 6 Dec 2018 21:52:40 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB6Lqe7x095802; Thu, 6 Dec 2018 21:52:40 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB6LqeYl095801; Thu, 6 Dec 2018 21:52:40 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201812062152.wB6LqeYl095801@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 6 Dec 2018 21:52:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341655 - head/sys/dev/mlx5/mlx5_en X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 341655 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D674A83D7F X-Spamd-Result: default: False [-1.90 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.86)[-0.863,0]; NEURAL_HAM_SHORT(-0.96)[-0.955,0]; NEURAL_HAM_LONG(-0.08)[-0.083,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 06 Dec 2018 21:52:41 -0000 Author: kib Date: Thu Dec 6 21:52:40 2018 New Revision: 341655 URL: https://svnweb.freebsd.org/changeset/base/341655 Log: Fix build with option RSS, removing unused variables. Reported by: np Sponsored by: Mellanox Technologies MFC after: 1 week Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Dec 6 21:33:08 2018 (r341654) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Dec 6 21:52:40 2018 (r341655) @@ -1212,13 +1212,8 @@ mlx5e_create_sq(struct mlx5e_channel *c, struct mlx5e_priv *priv = c->priv; struct mlx5_core_dev *mdev = priv->mdev; char buffer[16]; - void *sqc = param->sqc; void *sqc_wq = MLX5_ADDR_OF(sqc, sqc, wq); -#ifdef RSS - cpuset_t cpu_mask; - int cpu_id; -#endif int err; /* Create DMA descriptor TAG */ From owner-svn-src-head@freebsd.org Thu Dec 6 22:35:08 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 06A981316715; Thu, 6 Dec 2018 22:35:08 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A124D8540C; Thu, 6 Dec 2018 22:35:07 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 821C021C4; Thu, 6 Dec 2018 22:35:07 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB6MZ7gB016141; Thu, 6 Dec 2018 22:35:07 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB6MZ70E016140; Thu, 6 Dec 2018 22:35:07 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201812062235.wB6MZ70E016140@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 6 Dec 2018 22:35:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341656 - head/usr.bin/truss X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/usr.bin/truss X-SVN-Commit-Revision: 341656 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A124D8540C X-Spamd-Result: default: False [-1.91 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.86)[-0.863,0]; NEURAL_HAM_SHORT(-0.97)[-0.969,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.08)[-0.083,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 06 Dec 2018 22:35:08 -0000 Author: jhb Date: Thu Dec 6 22:35:07 2018 New Revision: 341656 URL: https://svnweb.freebsd.org/changeset/base/341656 Log: Rename riscv64-freebsd.c to riscv-freebsd.c. This fixes truss when built as part of a riscv64sf world. Additionally, if FreeBSD ever supports RV32 RISC-V most of this file can be used as-is just as a single file is used for all of the MIPS ABIs. Sponsored by: DARPA Added: head/usr.bin/truss/riscv-freebsd.c - copied, changed from r341655, head/usr.bin/truss/riscv64-freebsd.c Deleted: head/usr.bin/truss/riscv64-freebsd.c Copied and modified: head/usr.bin/truss/riscv-freebsd.c (from r341655, head/usr.bin/truss/riscv64-freebsd.c) ============================================================================== --- head/usr.bin/truss/riscv64-freebsd.c Thu Dec 6 21:52:40 2018 (r341655, copy source) +++ head/usr.bin/truss/riscv-freebsd.c Thu Dec 6 22:35:07 2018 (r341656) @@ -26,7 +26,7 @@ #include __FBSDID("$FreeBSD$"); -/* FreeBSD/riscv64-specific system call handling. */ +/* FreeBSD/riscv-specific system call handling. */ #include #include @@ -41,7 +41,7 @@ __FBSDID("$FreeBSD$"); #include "truss.h" static int -riscv64_fetch_args(struct trussinfo *trussinfo, u_int narg) +riscv_fetch_args(struct trussinfo *trussinfo, u_int narg) { struct reg regs; struct current_syscall *cs; @@ -77,7 +77,7 @@ riscv64_fetch_args(struct trussinfo *trussinfo, u_int } static int -riscv64_fetch_retval(struct trussinfo *trussinfo, long *retval, int *errorp) +riscv_fetch_retval(struct trussinfo *trussinfo, long *retval, int *errorp) { struct reg regs; lwpid_t tid; @@ -94,13 +94,13 @@ riscv64_fetch_retval(struct trussinfo *trussinfo, long return (0); } -static struct procabi riscv64_freebsd = { +static struct procabi riscv_freebsd = { "FreeBSD ELF64", SYSDECODE_ABI_FREEBSD, - riscv64_fetch_args, - riscv64_fetch_retval, - STAILQ_HEAD_INITIALIZER(riscv64_freebsd.extra_syscalls), + riscv_fetch_args, + riscv_fetch_retval, + STAILQ_HEAD_INITIALIZER(riscv_freebsd.extra_syscalls), { NULL } }; -PROCABI(riscv64_freebsd); +PROCABI(riscv_freebsd); From owner-svn-src-head@freebsd.org Thu Dec 6 22:58:29 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DD2CB1317496; Thu, 6 Dec 2018 22:58:28 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7DE2886374; Thu, 6 Dec 2018 22:58:28 +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 5E8952578; Thu, 6 Dec 2018 22:58:28 +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 wB6MwS4x026282; Thu, 6 Dec 2018 22:58:28 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB6MwQKb026274; Thu, 6 Dec 2018 22:58:26 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201812062258.wB6MwQKb026274@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 6 Dec 2018 22:58:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341657 - in head: etc/mtree sbin/nvmecontrol share/man/man7 X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head: etc/mtree sbin/nvmecontrol share/man/man7 X-SVN-Commit-Revision: 341657 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7DE2886374 X-Spamd-Result: default: False [-1.86 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.87)[-0.868,0]; NEURAL_HAM_SHORT(-0.97)[-0.971,0]; NEURAL_HAM_LONG(-0.02)[-0.024,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 06 Dec 2018 22:58:29 -0000 Author: imp Date: Thu Dec 6 22:58:26 2018 New Revision: 341657 URL: https://svnweb.freebsd.org/changeset/base/341657 Log: Dynamically load .so modules to expand functionality o Dynamically load all the .so files found in /libexec/nvmecontrol and /usr/local/libexec/nvmecontrol. o Link nvmecontrol -rdynamic so that its symbols are visible to the libraries we load. o Create concatinated linker sets that we dynamically expand. o Add the linked-in top and logpage linker sets to the mirrors for them and add those sets to the mirrors when we load a new .so. o Add some macros to help hide the names of the linker sets. o Update the man page. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D18455 fold Modified: head/etc/mtree/BSD.root.dist head/sbin/nvmecontrol/Makefile head/sbin/nvmecontrol/logpage.c head/sbin/nvmecontrol/ns.c head/sbin/nvmecontrol/nvmecontrol.8 head/sbin/nvmecontrol/nvmecontrol.c head/sbin/nvmecontrol/nvmecontrol.h head/sbin/nvmecontrol/wdc.c head/share/man/man7/hier.7 Modified: head/etc/mtree/BSD.root.dist ============================================================================== --- head/etc/mtree/BSD.root.dist Thu Dec 6 22:35:07 2018 (r341656) +++ head/etc/mtree/BSD.root.dist Thu Dec 6 22:58:26 2018 (r341657) @@ -88,6 +88,8 @@ .. geom .. + nvmecontrol + .. .. libexec resolvconf Modified: head/sbin/nvmecontrol/Makefile ============================================================================== --- head/sbin/nvmecontrol/Makefile Thu Dec 6 22:35:07 2018 (r341656) +++ head/sbin/nvmecontrol/Makefile Thu Dec 6 22:58:26 2018 (r341657) @@ -6,6 +6,7 @@ SRCS= nvmecontrol.c devlist.c firmware.c format.c iden perftest.c reset.c ns.c nvme_util.c power.c nc_util.c SRCS+= wdc.c intel.c MAN= nvmecontrol.8 +LDFLAGS+= -rdynamic .PATH: ${SRCTOP}/sys/dev/nvme Modified: head/sbin/nvmecontrol/logpage.c ============================================================================== --- head/sbin/nvmecontrol/logpage.c Thu Dec 6 22:35:07 2018 (r341656) +++ head/sbin/nvmecontrol/logpage.c Thu Dec 6 22:58:26 2018 (r341657) @@ -48,13 +48,13 @@ __FBSDID("$FreeBSD$"); #include "nvmecontrol.h" -SET_DECLARE(logpage, struct logpage_function); - #define LOGPAGE_USAGE \ "logpage <-p page_id> [-b] [-v vendor] [-x] \n" \ #define MAX_FW_SLOTS (7) +SET_CONCAT_DEF(logpage, struct logpage_function); + const char * kv_lookup(const struct kv_name *kv, size_t kv_count, uint32_t key) { @@ -332,7 +332,7 @@ logpage_help(void) fprintf(stderr, "\n"); fprintf(stderr, "%-8s %-10s %s\n", "Page", "Vendor","Page Name"); fprintf(stderr, "-------- ---------- ----------\n"); - for (f = SET_BEGIN(logpage); f < SET_LIMIT(logpage); f++) { + for (f = logpage_begin(); f < logpage_limit(); f++) { v = (*f)->vendor == NULL ? "-" : (*f)->vendor; fprintf(stderr, "0x%02x %-10s %s\n", (*f)->log_page, v, (*f)->name); } @@ -438,7 +438,7 @@ logpage(struct nvme_function *nf, int argc, char *argv * the page is vendor specific, don't match the print function * unless the vendors match. */ - for (f = SET_BEGIN(logpage); f < SET_LIMIT(logpage); f++) { + for (f = logpage_begin(); f < logpage_limit(); f++) { if ((*f)->vendor != NULL && vendor != NULL && strcmp((*f)->vendor, vendor) != 0) continue; Modified: head/sbin/nvmecontrol/ns.c ============================================================================== --- head/sbin/nvmecontrol/ns.c Thu Dec 6 22:35:07 2018 (r341656) +++ head/sbin/nvmecontrol/ns.c Thu Dec 6 22:58:26 2018 (r341657) @@ -41,7 +41,7 @@ __FBSDID("$FreeBSD$"); #include "nvmecontrol.h" -SET_DECLARE(ns, struct nvme_function); +NVME_CMD_DECLARE(ns, struct nvme_function); #define NS_USAGE \ "ns (create|delete|attach|detach)\n" Modified: head/sbin/nvmecontrol/nvmecontrol.8 ============================================================================== --- head/sbin/nvmecontrol/nvmecontrol.8 Thu Dec 6 22:35:07 2018 (r341656) +++ head/sbin/nvmecontrol/nvmecontrol.8 Thu Dec 6 22:58:26 2018 (r341657) @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 12, 2018 +.Dd December 7, 2018 .Dt NVMECONTROL 8 .Os .Sh NAME @@ -230,6 +230,19 @@ Set the current power mode. .Dl nvmecontrol power nvme0 .Pp Get the current power mode. +.Sh DYNAMIC LOADING +The directories +.Pa /libexec/nvmecontrol +and +.Pa /usr/local/libexec/nvmecontrol +are scanned for any .so files. +These files are loaded. +The members of the +.Va top +linker set are added to the top-level commands. +The members of the +.Va logpage +linker set are added to the logpage parsers. .Sh HISTORY The .Nm Modified: head/sbin/nvmecontrol/nvmecontrol.c ============================================================================== --- head/sbin/nvmecontrol/nvmecontrol.c Thu Dec 6 22:35:07 2018 (r341656) +++ head/sbin/nvmecontrol/nvmecontrol.c Thu Dec 6 22:58:26 2018 (r341657) @@ -34,6 +34,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #include #include @@ -47,7 +49,7 @@ __FBSDID("$FreeBSD$"); #include "nvmecontrol.h" -SET_DECLARE(top, struct nvme_function); +SET_CONCAT_DEF(top, struct nvme_function); static void print_usage(const struct nvme_function *f) @@ -116,6 +118,32 @@ dispatch_set(int argc, char *argv[], struct nvme_funct gen_usage_set(tbl, tbl_limit); } +void +set_concat_add(struct set_concat *m, void *b, void *e) +{ + void **bp, **ep; + int add_n, cur_n; + + if (b == NULL) + return; + /* + * Args are really pointers to arrays of pointers, but C's + * casting rules kinda suck since you can't directly cast + * struct foo ** to a void **. + */ + bp = (void **)b; + ep = (void **)e; + add_n = ep - bp; + cur_n = 0; + if (m->begin != NULL) + cur_n = m->limit - m->begin; + m->begin = reallocarray(m->begin, cur_n + add_n, sizeof(void *)); + if (m->begin == NULL) + err(1, "expanding concat set"); + memcpy(m->begin + cur_n, bp, add_n * sizeof(void *)); + m->limit = m->begin + cur_n + add_n; +} + static void print_bytes(void *data, uint32_t length) { @@ -260,14 +288,64 @@ parse_ns_str(const char *ns_str, char *ctrlr_str, uint snprintf(ctrlr_str, nsloc - ns_str + 1, "%s", ns_str); } +/* + * Loads all the .so's from the specified directory. + */ +static void +load_dir(const char *dir) +{ + DIR *d; + struct dirent *dent; + char *path = NULL; + void *h; + + d = opendir(dir); + if (d == NULL) + return; + for (dent = readdir(d); dent != NULL; dent = readdir(d)) { + if (strcmp(".so", dent->d_name + dent->d_namlen - 3) != 0) + continue; + asprintf(&path, "%s/%s", dir, dent->d_name); + if (path == NULL) + err(1, "Can't malloc for path, giving up."); + if ((h = dlopen(path, RTLD_NOW | RTLD_GLOBAL)) == NULL) + warnx("Can't load %s: %s", path, dlerror()); + else { + /* + * Add in the top (for cli commands) and logpage (for + * logpage parsing) linker sets. We have to do this by + * hand because linker sets aren't automatically merged. + */ + void *begin, *limit; + begin = dlsym(h, "__start_set_top"); + limit = dlsym(h, "__stop_set_top"); + if (begin) + add_to_top(begin, limit); + begin = dlsym(h, "__start_set_logpage"); + limit = dlsym(h, "__stop_set_logpage"); + if (begin) + add_to_logpage(begin, limit); + } + free(path); + path = NULL; + } + closedir(d); +} + int main(int argc, char *argv[]) { + add_to_top(NVME_CMD_BEGIN(top), NVME_CMD_LIMIT(top)); + add_to_logpage(NVME_LOGPAGE_BEGIN, NVME_LOGPAGE_LIMIT); + + load_dir("/lib/nvmecontrol"); + load_dir("/usr/local/lib/nvmecontrol"); + if (argc < 2) - gen_usage_set(SET_BEGIN(top), SET_LIMIT(top)); + gen_usage_set(top_begin(), top_limit()); - DISPATCH(argc, argv, top); + dispatch_set(argc, argv, top_begin(), top_limit()); return (0); } Modified: head/sbin/nvmecontrol/nvmecontrol.h ============================================================================== --- head/sbin/nvmecontrol/nvmecontrol.h Thu Dec 6 22:35:07 2018 (r341656) +++ head/sbin/nvmecontrol/nvmecontrol.h Thu Dec 6 22:58:26 2018 (r341657) @@ -43,11 +43,15 @@ struct nvme_function { const char *usage; }; -#define NVME_CMDSET(set, sym) DATA_SET(set, sym) +#define NVME_SETNAME(set) set +#define NVME_CMDSET(set, sym) DATA_SET(NVME_SETNAME(set), sym) #define NVME_COMMAND(set, nam, function, usage_str) \ static struct nvme_function function ## _nvme_cmd = \ { .name = #nam, .fn = function, .usage = usage_str }; \ NVME_CMDSET(set, function ## _nvme_cmd) +#define NVME_CMD_BEGIN(set) SET_BEGIN(NVME_SETNAME(set)) +#define NVME_CMD_LIMIT(set) SET_LIMIT(NVME_SETNAME(set)) +#define NVME_CMD_DECLARE(set, t) SET_DECLARE(NVME_SETNAME(set), t) typedef void (*print_fn_t)(const struct nvme_controller_data *cdata, void *buf, uint32_t size); @@ -59,7 +63,8 @@ struct logpage_function { size_t size; }; -#define NVME_LOGPAGESET(sym) DATA_SET(logpage, sym) + +#define NVME_LOGPAGESET(sym) DATA_SET(NVME_SETNAME(logpage), sym) #define NVME_LOGPAGE(unique, lp, vend, nam, fn, sz) \ static struct logpage_function unique ## _lpf = { \ .log_page = lp, \ @@ -69,6 +74,9 @@ struct logpage_function { .size = sz, \ } ; \ NVME_LOGPAGESET(unique ## _lpf) +#define NVME_LOGPAGE_BEGIN SET_BEGIN(NVME_SETNAME(logpage)) +#define NVME_LOGPAGE_LIMIT SET_LIMIT(NVME_SETNAME(logpage)) +#define NVME_LOGPAGE_DECLARE(t) SET_DECLARE(NVME_SETNAME(logpage), t) #define DEFAULT_SIZE (4096) struct kv_name { @@ -78,6 +86,27 @@ struct kv_name { const char *kv_lookup(const struct kv_name *kv, size_t kv_count, uint32_t key); +NVME_CMD_DECLARE(top, struct nvme_function); +NVME_LOGPAGE_DECLARE(struct logpage_function); + +struct set_concat { + void **begin; + void **limit; +}; +void set_concat_add(struct set_concat *m, void *begin, void *end); +#define SET_CONCAT_DEF(set, t) \ +static struct set_concat set ## _concat; \ +static inline t **set ## _begin() { return ((t **)set ## _concat.begin); } \ +static inline t **set ## _limit() { return ((t **)set ## _concat.limit); } \ +void add_to_ ## set(t **b, t **e) \ +{ \ + set_concat_add(&set ## _concat, b, e); \ +} +#define SET_CONCAT_DECL(set, t) \ + void add_to_ ## set(t **b, t **e) +SET_CONCAT_DECL(top, struct nvme_function); +SET_CONCAT_DECL(logpage, struct logpage_function); + #define NVME_CTRLR_PREFIX "nvme" #define NVME_NS_PREFIX "ns" @@ -95,7 +124,7 @@ void dispatch_set(int argc, char *argv[], struct nvme_ struct nvme_function **tbl_limit); #define DISPATCH(argc, argv, set) \ - dispatch_set(argc, argv, SET_BEGIN(set), SET_LIMIT(set)) + dispatch_set(argc, argv, NVME_CMD_BEGIN(set), NVME_CMD_LIMIT(set)) /* Utility Routines */ /* Modified: head/sbin/nvmecontrol/wdc.c ============================================================================== --- head/sbin/nvmecontrol/wdc.c Thu Dec 6 22:35:07 2018 (r341656) +++ head/sbin/nvmecontrol/wdc.c Thu Dec 6 22:58:26 2018 (r341657) @@ -45,7 +45,7 @@ __FBSDID("$FreeBSD$"); #define WDC_USAGE \ "wdc (cap-diag)\n" -SET_DECLARE(wdc, struct nvme_function); +NVME_CMD_DECLARE(wdc, struct nvme_function); #define WDC_NVME_TOC_SIZE 8 Modified: head/share/man/man7/hier.7 ============================================================================== --- head/share/man/man7/hier.7 Thu Dec 6 22:35:07 2018 (r341656) +++ head/share/man/man7/hier.7 Thu Dec 6 22:58:26 2018 (r341657) @@ -152,6 +152,10 @@ Capsicum support libraries class-specific libraries for the .Xr geom 8 utility +.It Pa nvmecontrol/ +vendor-specific libraries to extend the +.Xr nvmecontrol 8 +utility .El .It Pa /libexec/ critical system utilities needed for binaries in From owner-svn-src-head@freebsd.org Thu Dec 6 22:58:58 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4241213174BF; Thu, 6 Dec 2018 22:58:58 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D910F8654D; Thu, 6 Dec 2018 22:58:57 +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 B9FC62589; Thu, 6 Dec 2018 22:58:57 +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 wB6Mwvud026418; Thu, 6 Dec 2018 22:58:57 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB6MwuHi026412; Thu, 6 Dec 2018 22:58:56 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201812062258.wB6MwuHi026412@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 6 Dec 2018 22:58:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341659 - in head/sbin/nvmecontrol: . modules modules/intel modules/wdc X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sbin/nvmecontrol: . modules modules/intel modules/wdc X-SVN-Commit-Revision: 341659 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D910F8654D X-Spamd-Result: default: False [-1.89 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.87)[-0.865,0]; NEURAL_HAM_SHORT(-0.97)[-0.970,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.05)[-0.054,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 06 Dec 2018 22:58:58 -0000 Author: imp Date: Thu Dec 6 22:58:55 2018 New Revision: 341659 URL: https://svnweb.freebsd.org/changeset/base/341659 Log: Move intel and wdc files to their own modules Move the intel and wdc vendor specific stuff to their own modules. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D18460 Added: head/sbin/nvmecontrol/modules/ head/sbin/nvmecontrol/modules/Makefile (contents, props changed) head/sbin/nvmecontrol/modules/Makefile.inc (contents, props changed) head/sbin/nvmecontrol/modules/intel/ head/sbin/nvmecontrol/modules/intel/Makefile (contents, props changed) head/sbin/nvmecontrol/modules/intel/intel.c (contents, props changed) - copied, changed from r341658, head/sbin/nvmecontrol/intel.c head/sbin/nvmecontrol/modules/wdc/ head/sbin/nvmecontrol/modules/wdc/Makefile (contents, props changed) head/sbin/nvmecontrol/modules/wdc/wdc.c (contents, props changed) - copied, changed from r341658, head/sbin/nvmecontrol/wdc.c Deleted: head/sbin/nvmecontrol/intel.c head/sbin/nvmecontrol/wdc.c Modified: head/sbin/nvmecontrol/Makefile Modified: head/sbin/nvmecontrol/Makefile ============================================================================== --- head/sbin/nvmecontrol/Makefile Thu Dec 6 22:58:42 2018 (r341658) +++ head/sbin/nvmecontrol/Makefile Thu Dec 6 22:58:55 2018 (r341659) @@ -4,10 +4,11 @@ PACKAGE=runtime PROG= nvmecontrol SRCS= nvmecontrol.c devlist.c firmware.c format.c identify.c identify_ext.c logpage.c \ perftest.c reset.c ns.c nvme_util.c power.c nc_util.c -SRCS+= wdc.c intel.c MAN= nvmecontrol.8 LDFLAGS+= -rdynamic +SUBDIR= modules .PATH: ${SRCTOP}/sys/dev/nvme .include +.include Added: head/sbin/nvmecontrol/modules/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/nvmecontrol/modules/Makefile Thu Dec 6 22:58:55 2018 (r341659) @@ -0,0 +1,5 @@ +# $FreeBSD$ + +SUBDIR= intel wdc + +.include Added: head/sbin/nvmecontrol/modules/Makefile.inc ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/nvmecontrol/modules/Makefile.inc Thu Dec 6 22:58:55 2018 (r341659) @@ -0,0 +1,12 @@ +# $FreeBSD$ + +PACKAGE=runtime +NVMECONTROLDIR= ${SRCTOP}/sbin/nvmecontrol + +MK_INSTALLLIB= no +MK_PROFILE= no + +CFLAGS+= -I${NVMECONTROLDIR} + +SHLIB_NAME?= ${LIB}.so +LIBDIR= /lib/nvmecontrol Added: head/sbin/nvmecontrol/modules/intel/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/nvmecontrol/modules/intel/Makefile Thu Dec 6 22:58:55 2018 (r341659) @@ -0,0 +1,6 @@ +# $FreeBSD$ + +LIB= intel +SRCS= intel.c + +.include Copied and modified: head/sbin/nvmecontrol/modules/intel/intel.c (from r341658, head/sbin/nvmecontrol/intel.c) ============================================================================== Added: head/sbin/nvmecontrol/modules/wdc/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/nvmecontrol/modules/wdc/Makefile Thu Dec 6 22:58:55 2018 (r341659) @@ -0,0 +1,6 @@ +# $FreeBSD$ + +LIB= wdc +SRCS= wdc.c + +.include Copied and modified: head/sbin/nvmecontrol/modules/wdc/wdc.c (from r341658, head/sbin/nvmecontrol/wdc.c) ============================================================================== From owner-svn-src-head@freebsd.org Thu Dec 6 22:58:45 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AD7AA13174B1; Thu, 6 Dec 2018 22:58:45 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4EA5D86470; Thu, 6 Dec 2018 22:58:45 +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 185BA2588; Thu, 6 Dec 2018 22:58:45 +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 wB6MwiQT026354; Thu, 6 Dec 2018 22:58:44 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB6MwgIn026340; Thu, 6 Dec 2018 22:58:42 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201812062258.wB6MwgIn026340@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 6 Dec 2018 22:58:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341658 - head/sbin/nvmecontrol X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sbin/nvmecontrol X-SVN-Commit-Revision: 341658 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4EA5D86470 X-Spamd-Result: default: False [-1.86 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.87)[-0.868,0]; NEURAL_HAM_SHORT(-0.97)[-0.971,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.02)[-0.024,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 06 Dec 2018 22:58:45 -0000 Author: imp Date: Thu Dec 6 22:58:42 2018 New Revision: 341658 URL: https://svnweb.freebsd.org/changeset/base/341658 Log: Const poison the command interface Make the pointers we pass into the commands const, also make the linker set mirrors const. Suggested by: cem@ Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D18459 Modified: head/sbin/nvmecontrol/devlist.c head/sbin/nvmecontrol/firmware.c head/sbin/nvmecontrol/format.c head/sbin/nvmecontrol/identify.c head/sbin/nvmecontrol/logpage.c head/sbin/nvmecontrol/ns.c head/sbin/nvmecontrol/nvmecontrol.c head/sbin/nvmecontrol/nvmecontrol.h head/sbin/nvmecontrol/perftest.c head/sbin/nvmecontrol/power.c head/sbin/nvmecontrol/reset.c head/sbin/nvmecontrol/wdc.c Modified: head/sbin/nvmecontrol/devlist.c ============================================================================== --- head/sbin/nvmecontrol/devlist.c Thu Dec 6 22:58:26 2018 (r341657) +++ head/sbin/nvmecontrol/devlist.c Thu Dec 6 22:58:42 2018 (r341658) @@ -60,7 +60,7 @@ ns_get_sector_size(struct nvme_namespace_data *nsdata) } static void -devlist(struct nvme_function *nf, int argc, char *argv[]) +devlist(const struct nvme_function *nf, int argc, char *argv[]) { struct nvme_controller_data cdata; struct nvme_namespace_data nsdata; Modified: head/sbin/nvmecontrol/firmware.c ============================================================================== --- head/sbin/nvmecontrol/firmware.c Thu Dec 6 22:58:26 2018 (r341657) +++ head/sbin/nvmecontrol/firmware.c Thu Dec 6 22:58:42 2018 (r341658) @@ -174,7 +174,7 @@ activate_firmware(int fd, int slot, int activate_actio } static void -firmware(struct nvme_function *nf, int argc, char *argv[]) +firmware(const struct nvme_function *nf, int argc, char *argv[]) { int fd = -1, slot = 0; int a_flag, s_flag, f_flag; Modified: head/sbin/nvmecontrol/format.c ============================================================================== --- head/sbin/nvmecontrol/format.c Thu Dec 6 22:58:26 2018 (r341657) +++ head/sbin/nvmecontrol/format.c Thu Dec 6 22:58:42 2018 (r341658) @@ -47,7 +47,7 @@ __FBSDID("$FreeBSD$"); "format [-f fmt] [-m mset] [-p pi] [-l pil] [-E] [-C] \n" static void -format(struct nvme_function *nf, int argc, char *argv[]) +format(const struct nvme_function *nf, int argc, char *argv[]) { struct nvme_controller_data cd; struct nvme_namespace_data nsd; Modified: head/sbin/nvmecontrol/identify.c ============================================================================== --- head/sbin/nvmecontrol/identify.c Thu Dec 6 22:58:26 2018 (r341657) +++ head/sbin/nvmecontrol/identify.c Thu Dec 6 22:58:42 2018 (r341658) @@ -150,7 +150,7 @@ print_namespace(struct nvme_namespace_data *nsdata) } static void -identify_ctrlr(struct nvme_function *nf, int argc, char *argv[]) +identify_ctrlr(const struct nvme_function *nf, int argc, char *argv[]) { struct nvme_controller_data cdata; int ch, fd, hexflag = 0, hexlength; @@ -197,7 +197,7 @@ identify_ctrlr(struct nvme_function *nf, int argc, cha } static void -identify_ns(struct nvme_function *nf,int argc, char *argv[]) +identify_ns(const struct nvme_function *nf,int argc, char *argv[]) { struct nvme_namespace_data nsdata; char path[64]; @@ -261,7 +261,7 @@ identify_ns(struct nvme_function *nf,int argc, char *a } static void -identify(struct nvme_function *nf, int argc, char *argv[]) +identify(const struct nvme_function *nf, int argc, char *argv[]) { char *target; Modified: head/sbin/nvmecontrol/logpage.c ============================================================================== --- head/sbin/nvmecontrol/logpage.c Thu Dec 6 22:58:26 2018 (r341657) +++ head/sbin/nvmecontrol/logpage.c Thu Dec 6 22:58:42 2018 (r341658) @@ -326,7 +326,7 @@ NVME_LOGPAGE(fw, static void logpage_help(void) { - struct logpage_function **f; + const struct logpage_function * const *f; const char *v; fprintf(stderr, "\n"); @@ -341,7 +341,7 @@ logpage_help(void) } static void -logpage(struct nvme_function *nf, int argc, char *argv[]) +logpage(const struct nvme_function *nf, int argc, char *argv[]) { int fd; int log_page = 0, pageflag = false; @@ -352,7 +352,7 @@ logpage(struct nvme_function *nf, int argc, char *argv uint32_t nsid, size; void *buf; const char *vendor = NULL; - struct logpage_function **f; + const struct logpage_function * const *f; struct nvme_controller_data cdata; print_fn_t print_fn; uint8_t ns_smart; Modified: head/sbin/nvmecontrol/ns.c ============================================================================== --- head/sbin/nvmecontrol/ns.c Thu Dec 6 22:58:26 2018 (r341657) +++ head/sbin/nvmecontrol/ns.c Thu Dec 6 22:58:42 2018 (r341658) @@ -60,10 +60,10 @@ NVME_CMD_DECLARE(ns, struct nvme_function); #define NSDETACH_USAGE \ "ns detach -n nsid [-c ctrlrid] nvmeN\n" -void nscreate(struct nvme_function *nf, int argc, char *argv[]); -void nsdelete(struct nvme_function *nf, int argc, char *argv[]); -void nsattach(struct nvme_function *nf, int argc, char *argv[]); -void nsdetach(struct nvme_function *nf, int argc, char *argv[]); +static void nscreate(const struct nvme_function *nf, int argc, char *argv[]); +static void nsdelete(const struct nvme_function *nf, int argc, char *argv[]); +static void nsattach(const struct nvme_function *nf, int argc, char *argv[]); +static void nsdetach(const struct nvme_function *nf, int argc, char *argv[]); NVME_COMMAND(ns, create, nscreate, NSCREATE_USAGE); NVME_COMMAND(ns, delete, nsdelete, NSDELETE_USAGE); @@ -109,8 +109,8 @@ get_res_str(uint16_t res) * 0x16 = Namespace ID unavailable (number namespaces exceeded) * 0xb = Thin Provisioning Not supported */ -void -nscreate(struct nvme_function *nf, int argc, char *argv[]) +static void +nscreate(const struct nvme_function *nf, int argc, char *argv[]) { struct nvme_pt_command pt; struct nvme_controller_data cd; @@ -204,8 +204,8 @@ nscreate(struct nvme_function *nf, int argc, char *arg exit(0); } -void -nsdelete(struct nvme_function *nf, int argc, char *argv[]) +static void +nsdelete(const struct nvme_function *nf, int argc, char *argv[]) { struct nvme_pt_command pt; struct nvme_controller_data cd; @@ -271,8 +271,8 @@ nsdelete(struct nvme_function *nf, int argc, char *arg * * 0x2 Invalid Field can occur if ctrlrid d.n.e in system. */ -void -nsattach(struct nvme_function *nf, int argc, char *argv[]) +static void +nsattach(const struct nvme_function *nf, int argc, char *argv[]) { struct nvme_pt_command pt; struct nvme_controller_data cd; @@ -350,8 +350,8 @@ nsattach(struct nvme_function *nf, int argc, char *arg exit(0); } -void -nsdetach(struct nvme_function *nf, int argc, char *argv[]) +static void +nsdetach(const struct nvme_function *nf, int argc, char *argv[]) { struct nvme_pt_command pt; struct nvme_controller_data cd; @@ -437,7 +437,7 @@ nsdetach(struct nvme_function *nf, int argc, char *arg } static void -ns(struct nvme_function *nf __unused, int argc, char *argv[]) +ns(const struct nvme_function *nf __unused, int argc, char *argv[]) { DISPATCH(argc, argv, ns); Modified: head/sbin/nvmecontrol/nvmecontrol.c ============================================================================== --- head/sbin/nvmecontrol/nvmecontrol.c Thu Dec 6 22:58:26 2018 (r341657) +++ head/sbin/nvmecontrol/nvmecontrol.c Thu Dec 6 22:58:42 2018 (r341658) @@ -75,7 +75,7 @@ print_usage(const struct nvme_function *f) } static void -gen_usage_set(struct nvme_function **f, struct nvme_function **flimit) +gen_usage_set(const struct nvme_function * const *f, const struct nvme_function * const *flimit) { fprintf(stderr, "usage:\n"); @@ -96,10 +96,10 @@ usage(const struct nvme_function *f) } void -dispatch_set(int argc, char *argv[], struct nvme_function **tbl, - struct nvme_function **tbl_limit) +dispatch_set(int argc, char *argv[], const struct nvme_function * const *tbl, + const struct nvme_function * const *tbl_limit) { - struct nvme_function **f = tbl; + const struct nvme_function * const *f = tbl; if (argv[1] == NULL) { gen_usage_set(tbl, tbl_limit); Modified: head/sbin/nvmecontrol/nvmecontrol.h ============================================================================== --- head/sbin/nvmecontrol/nvmecontrol.h Thu Dec 6 22:58:26 2018 (r341657) +++ head/sbin/nvmecontrol/nvmecontrol.h Thu Dec 6 22:58:42 2018 (r341658) @@ -35,7 +35,7 @@ #include struct nvme_function; -typedef void (*nvme_fn_t)(struct nvme_function *nf, int argc, char *argv[]); +typedef void (*nvme_fn_t)(const struct nvme_function *nf, int argc, char *argv[]); struct nvme_function { const char *name; @@ -96,8 +96,8 @@ struct set_concat { void set_concat_add(struct set_concat *m, void *begin, void *end); #define SET_CONCAT_DEF(set, t) \ static struct set_concat set ## _concat; \ -static inline t **set ## _begin() { return ((t **)set ## _concat.begin); } \ -static inline t **set ## _limit() { return ((t **)set ## _concat.limit); } \ +static inline const t * const *set ## _begin() { return ((const t * const *)set ## _concat.begin); } \ +static inline const t * const *set ## _limit() { return ((const t * const *)set ## _concat.limit); } \ void add_to_ ## set(t **b, t **e) \ { \ set_concat_add(&set ## _concat, b, e); \ @@ -120,11 +120,13 @@ void read_logpage(int fd, uint8_t log_page, uint32_t n void print_temp(uint16_t t); void usage(const struct nvme_function *f); -void dispatch_set(int argc, char *argv[], struct nvme_function **tbl, - struct nvme_function **tbl_limit); +void dispatch_set(int argc, char *argv[], const struct nvme_function * const *tbl, + const struct nvme_function * const *tbl_limit); -#define DISPATCH(argc, argv, set) \ - dispatch_set(argc, argv, NVME_CMD_BEGIN(set), NVME_CMD_LIMIT(set)) +#define DISPATCH(argc, argv, set) \ + dispatch_set(argc, argv, \ + (const struct nvme_function * const *)NVME_CMD_BEGIN(set), \ + (const struct nvme_function * const *)NVME_CMD_LIMIT(set)) \ /* Utility Routines */ /* Modified: head/sbin/nvmecontrol/perftest.c ============================================================================== --- head/sbin/nvmecontrol/perftest.c Thu Dec 6 22:58:26 2018 (r341657) +++ head/sbin/nvmecontrol/perftest.c Thu Dec 6 22:58:42 2018 (r341658) @@ -75,7 +75,7 @@ print_perftest(struct nvme_io_test *io_test, bool pert } static void -perftest(struct nvme_function *nf, int argc, char *argv[]) +perftest(const struct nvme_function *nf, int argc, char *argv[]) { struct nvme_io_test io_test; int fd; Modified: head/sbin/nvmecontrol/power.c ============================================================================== --- head/sbin/nvmecontrol/power.c Thu Dec 6 22:58:26 2018 (r341657) +++ head/sbin/nvmecontrol/power.c Thu Dec 6 22:58:42 2018 (r341658) @@ -129,7 +129,7 @@ power_show(int fd) } static void -power(struct nvme_function *nf, int argc, char *argv[]) +power(const struct nvme_function *nf, int argc, char *argv[]) { struct nvme_controller_data cdata; int ch, listflag = 0, powerflag = 0, power_val = 0, fd; Modified: head/sbin/nvmecontrol/reset.c ============================================================================== --- head/sbin/nvmecontrol/reset.c Thu Dec 6 22:58:26 2018 (r341657) +++ head/sbin/nvmecontrol/reset.c Thu Dec 6 22:58:42 2018 (r341658) @@ -45,7 +45,7 @@ __FBSDID("$FreeBSD$"); "reset \n" static void -reset(struct nvme_function *nf, int argc, char *argv[]) +reset(const struct nvme_function *nf, int argc, char *argv[]) { int ch, fd; Modified: head/sbin/nvmecontrol/wdc.c ============================================================================== --- head/sbin/nvmecontrol/wdc.c Thu Dec 6 22:58:26 2018 (r341657) +++ head/sbin/nvmecontrol/wdc.c Thu Dec 6 22:58:42 2018 (r341658) @@ -52,7 +52,7 @@ NVME_CMD_DECLARE(wdc, struct nvme_function); #define WDC_NVME_CAP_DIAG_OPCODE 0xe6 #define WDC_NVME_CAP_DIAG_CMD 0x0000 -static void wdc_cap_diag(struct nvme_function *nf, int argc, char *argv[]); +static void wdc_cap_diag(const struct nvme_function *nf, int argc, char *argv[]); #define WDC_CAP_DIAG_USAGE "wdc cap-diag [-o path-template]\n" @@ -154,7 +154,7 @@ wdc_do_dump(int fd, char *tmpl, const char *suffix, ui } static void -wdc_cap_diag(struct nvme_function *nf, int argc, char *argv[]) +wdc_cap_diag(const struct nvme_function *nf, int argc, char *argv[]) { char path_tmpl[MAXPATHLEN]; int ch, fd; @@ -183,7 +183,7 @@ wdc_cap_diag(struct nvme_function *nf, int argc, char } static void -wdc(struct nvme_function *nf __unused, int argc, char *argv[]) +wdc(const struct nvme_function *nf __unused, int argc, char *argv[]) { DISPATCH(argc, argv, wdc); From owner-svn-src-head@freebsd.org Thu Dec 6 22:59:11 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0A42313174DD; Thu, 6 Dec 2018 22:59: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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A68D58662D; Thu, 6 Dec 2018 22:59: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 86CFD258D; Thu, 6 Dec 2018 22:59:08 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB6Mx8f8026479; Thu, 6 Dec 2018 22:59:08 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB6Mx8R8026478; Thu, 6 Dec 2018 22:59:08 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201812062259.wB6Mx8R8026478@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 6 Dec 2018 22:59:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341660 - head/sbin/nvmecontrol/modules/intel X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sbin/nvmecontrol/modules/intel X-SVN-Commit-Revision: 341660 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A68D58662D X-Spamd-Result: default: False [-1.91 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.86)[-0.863,0]; NEURAL_HAM_SHORT(-0.97)[-0.969,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.08)[-0.083,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 06 Dec 2018 22:59:11 -0000 Author: imp Date: Thu Dec 6 22:59:08 2018 New Revision: 341660 URL: https://svnweb.freebsd.org/changeset/base/341660 Log: This is not a samsung standard, so remove that alias. This was never documented, and isn't needed, so it's best removed to avoid confusion. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D18460 Modified: head/sbin/nvmecontrol/modules/intel/intel.c Modified: head/sbin/nvmecontrol/modules/intel/intel.c ============================================================================== --- head/sbin/nvmecontrol/modules/intel/intel.c Thu Dec 6 22:58:55 2018 (r341659) +++ head/sbin/nvmecontrol/modules/intel/intel.c Thu Dec 6 22:59:08 2018 (r341660) @@ -117,7 +117,7 @@ print_intel_write_lat_log(const struct nvme_controller } /* - * Table 19. 5.4 SMART Attributes. Samsung also implements this and some extra data not documented. + * Table 19. 5.4 SMART Attributes. Others also implement this and some extra data not documented. */ static void print_intel_add_smart(const struct nvme_controller_data *cdata __unused, void *buf, uint32_t size __unused) @@ -192,7 +192,4 @@ NVME_LOGPAGE(intel_wlat, print_intel_write_lat_log, DEFAULT_SIZE); NVME_LOGPAGE(intel_smart, INTEL_LOG_ADD_SMART, "intel", "Extra Health/SMART Data", - print_intel_add_smart, DEFAULT_SIZE); -NVME_LOGPAGE(samsung_smart, /* NOTE, this will be deleted before 13.0 */ - INTEL_LOG_ADD_SMART, "samsung", "Extra Health/SMART Data", print_intel_add_smart, DEFAULT_SIZE); From owner-svn-src-head@freebsd.org Thu Dec 6 22:59:22 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8955213174E0; Thu, 6 Dec 2018 22:59:22 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 31350866E7; Thu, 6 Dec 2018 22:59:22 +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 36A5A258E; Thu, 6 Dec 2018 22:59:19 +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 wB6MxJm5026533; Thu, 6 Dec 2018 22:59:19 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB6MxJ0x026532; Thu, 6 Dec 2018 22:59:19 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201812062259.wB6MxJ0x026532@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 6 Dec 2018 22:59:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341661 - head/sbin/nvmecontrol/modules/intel X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sbin/nvmecontrol/modules/intel X-SVN-Commit-Revision: 341661 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 31350866E7 X-Spamd-Result: default: False [-1.91 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.86)[-0.863,0]; NEURAL_HAM_SHORT(-0.97)[-0.969,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.08)[-0.083,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 06 Dec 2018 22:59:22 -0000 Author: imp Date: Thu Dec 6 22:59:18 2018 New Revision: 341661 URL: https://svnweb.freebsd.org/changeset/base/341661 Log: It's useful to have this be a global function. Other vendors base their additional smart info pages on what Intel did plus some other bits. So it's convenient to have this be global. Sponsored by: Netflix Modified: head/sbin/nvmecontrol/modules/intel/intel.c Modified: head/sbin/nvmecontrol/modules/intel/intel.c ============================================================================== --- head/sbin/nvmecontrol/modules/intel/intel.c Thu Dec 6 22:59:08 2018 (r341660) +++ head/sbin/nvmecontrol/modules/intel/intel.c Thu Dec 6 22:59:18 2018 (r341661) @@ -119,7 +119,7 @@ print_intel_write_lat_log(const struct nvme_controller /* * Table 19. 5.4 SMART Attributes. Others also implement this and some extra data not documented. */ -static void +void print_intel_add_smart(const struct nvme_controller_data *cdata __unused, void *buf, uint32_t size __unused) { uint8_t *walker = buf; From owner-svn-src-head@freebsd.org Thu Dec 6 23:28:56 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D5BBB1318E77; Thu, 6 Dec 2018 23:28:56 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 74AF46A6C7; Thu, 6 Dec 2018 23:28:56 +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 55E9A2AED; Thu, 6 Dec 2018 23:28:56 +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 wB6NSuql041899; Thu, 6 Dec 2018 23:28:56 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB6NSubD041898; Thu, 6 Dec 2018 23:28:56 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201812062328.wB6NSubD041898@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 6 Dec 2018 23:28:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341662 - head/sbin/nvmecontrol X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sbin/nvmecontrol X-SVN-Commit-Revision: 341662 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 74AF46A6C7 X-Spamd-Result: default: False [-1.89 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.86)[-0.863,0]; NEURAL_HAM_SHORT(-0.95)[-0.948,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.08)[-0.083,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 06 Dec 2018 23:28:57 -0000 Author: imp Date: Thu Dec 6 23:28:55 2018 New Revision: 341662 URL: https://svnweb.freebsd.org/changeset/base/341662 Log: Use proper prototypes. Modified: head/sbin/nvmecontrol/nvmecontrol.h Modified: head/sbin/nvmecontrol/nvmecontrol.h ============================================================================== --- head/sbin/nvmecontrol/nvmecontrol.h Thu Dec 6 22:59:18 2018 (r341661) +++ head/sbin/nvmecontrol/nvmecontrol.h Thu Dec 6 23:28:55 2018 (r341662) @@ -96,8 +96,8 @@ struct set_concat { void set_concat_add(struct set_concat *m, void *begin, void *end); #define SET_CONCAT_DEF(set, t) \ static struct set_concat set ## _concat; \ -static inline const t * const *set ## _begin() { return ((const t * const *)set ## _concat.begin); } \ -static inline const t * const *set ## _limit() { return ((const t * const *)set ## _concat.limit); } \ +static inline const t * const *set ## _begin(void) { return ((const t * const *)set ## _concat.begin); } \ +static inline const t * const *set ## _limit(void) { return ((const t * const *)set ## _concat.limit); } \ void add_to_ ## set(t **b, t **e) \ { \ set_concat_add(&set ## _concat, b, e); \ From owner-svn-src-head@freebsd.org Thu Dec 6 23:23:39 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D720F131899D; Thu, 6 Dec 2018 23:23:38 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 521EB6A09D; Thu, 6 Dec 2018 23:23:38 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-2.local (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id ED83A10B707; Thu, 6 Dec 2018 18:23:36 -0500 (EST) Subject: Re: svn commit: r341657 - in head: etc/mtree sbin/nvmecontrol share/man/man7 To: Warner Losh , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201812062258.wB6MwQKb026274@repo.freebsd.org> From: John Baldwin Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= xsDiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg80eSm9obiBCYWxk d2luIDxqb2huQGJhbGR3aW4uY3g+wmMEExECACMCGwMGCwkIBwMCBBUCCAMEFgIDAQIeAQIX gAUCRND5wwIZAQAKCRBy3lIGd+N/BNLXAJ9KIb6teuDL1W+FkCgvv+y8PxKTkACeIUfbn3sl cueBzqTcf09idwa8YTbOwU0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Ds gnr31AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh +GojXlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cM SOrHYUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOF QVHOEVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq 1tqzhltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZ TwtXsNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m 7Z164yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioI AjjHaIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbU KWwxQ4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjH uW/CSQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZN wwCfafMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: <0b90e8e4-ce69-9caf-21f2-bb76bdfd2635@FreeBSD.org> Date: Thu, 6 Dec 2018 15:23:34 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <201812062258.wB6MwQKb026274@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Thu, 06 Dec 2018 18:23:37 -0500 (EST) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-Rspamd-Queue-Id: 521EB6A09D X-Spamd-Result: default: False [-2.52 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.93)[-0.931,0]; NEURAL_HAM_LONG(-0.61)[-0.607,0]; NEURAL_HAM_SHORT(-0.98)[-0.980,0]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 06 Dec 2018 23:23:39 -0000 On 12/6/18 2:58 PM, Warner Losh wrote: > Author: imp > Date: Thu Dec 6 22:58:26 2018 > New Revision: 341657 > URL: https://svnweb.freebsd.org/changeset/base/341657 > > Log: > Dynamically load .so modules to expand functionality > > o Dynamically load all the .so files found in /libexec/nvmecontrol and > /usr/local/libexec/nvmecontrol. > o Link nvmecontrol -rdynamic so that its symbols are visible to the > libraries we load. > o Create concatinated linker sets that we dynamically expand. > o Add the linked-in top and logpage linker sets to the mirrors for them > and add those sets to the mirrors when we load a new .so. > o Add some macros to help hide the names of the linker sets. > o Update the man page. > > Sponsored by: Netflix > Differential Revision: https://reviews.freebsd.org/D18455 While linker sets are cool and all (and I used them in mfiutil and mptutil to build the command tree), it seems like in this case where you want to deal with dynamic registration, etc. you would be better served by just using something like STL C++ containers to maintain the command tree. New commands can be associated with a static object whose constructor invokes a "register_command" function or some such. You could also do this in C via explicit ctor attributes, but just using static constructors in C++ seems like a less obscure way to do this. -- John Baldwin                                                                              From owner-svn-src-head@freebsd.org Thu Dec 6 23:25:06 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3BD4D1318AFF for ; Thu, 6 Dec 2018 23:25:06 +0000 (UTC) (envelope-from andy@fud.org.nz) Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0E3516A28D for ; Thu, 6 Dec 2018 23:25:03 +0000 (UTC) (envelope-from andy@fud.org.nz) Received: by mail-wr1-x42b.google.com with SMTP id j2so2158627wrw.1 for ; Thu, 06 Dec 2018 15:25:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fud-org-nz.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=m7ASANAgByuN+V6Ljpj5h8Z5130d3pByiVdU2hLlMes=; b=0PhMQth0DHvKxZ/+GADH+zPHmC86RYgYVYaDVscD71xxDfzmkELksPqGOm6kSZT9in OMb49NOmdy8n1NsE6HtKnxigv5OHqN6OD+gA/75vZ/jIXP3ucX6N1raYo5Lph8e32sWN y0uT7ogw34DoVlvVWGiHfD347TbWqdzl6uUlCdyeTlsdmMKJtgXj8qOoyLlNhN5bEqpV butmu5OPOGGUcDyaXmbZU0rR1sBHf7Y0gAyaXwGg65j5f06B3BMPXcfJfpP8LtYZgItw QKnpz8E6auQ0utezJn2L/HVHLeHOsjMTf8R7/72yfaIxdKxN5HYhe+EG9/6Jq/S+5WvF lPbg== 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=m7ASANAgByuN+V6Ljpj5h8Z5130d3pByiVdU2hLlMes=; b=gosKx/1YleBN72CQC4CIZmLMQaxLcUw2uUikFPln6ucLvs3qLQqiCzlefksm0fAtJl RFBhT7KvhNz5y6wDkqlXeP8xH91L5rIeuYTf/KLE6Rp7d2xwrnez61nRg8LLBkLJNbru fU9bgSvNhOdwn/6tj7g8kdM8u1RoZg6PhuHwPCpScYbPxsiPWFkEMIJiA8ou86kQ7rsq IZII21XpUqHpThW6wIaPMbbzzuHrXWMWFOcU2iBT830yBK/DegV5iWNm/K0CvmFstm+3 wSySm+pMS/UQPEzNxWbOENrrE7SvPXWGGZgkGhpJhFU3ZFhoyVpLnbfW5G9HpmeKUPv3 gq9A== X-Gm-Message-State: AA+aEWb6lG5FTBVRr4BDcR73weO/s/DPL75MfOgy7tLWLzJBv6KctWiM z2PPs38UGIepKKEXY7PU/mgB7grDvNV8nW+hu/XCUg== X-Google-Smtp-Source: AFSGD/WMe2DU7sPLqfl+SZh1+3mmguxAMCf83f7+3nLgg8LK3+Qpe/MynYdfxUyrbKj6RguKBkdvlobGuBZ8rkFOgZo= X-Received: by 2002:a5d:4dc8:: with SMTP id f8mr27691149wru.45.1544138702173; Thu, 06 Dec 2018 15:25:02 -0800 (PST) MIME-Version: 1.0 References: <201812062258.wB6MwQKb026274@repo.freebsd.org> In-Reply-To: <201812062258.wB6MwQKb026274@repo.freebsd.org> From: Andrew Thompson Date: Fri, 7 Dec 2018 12:24:50 +1300 Message-ID: Subject: Re: svn commit: r341657 - in head: etc/mtree sbin/nvmecontrol share/man/man7 To: Warner Losh Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-Rspamd-Queue-Id: 0E3516A28D X-Spamd-Result: default: False [-3.73 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.99)[-0.989,0]; R_DKIM_ALLOW(-0.20)[fud-org-nz.20150623.gappssmtp.com]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-0.998,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[fud.org.nz]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[fud-org-nz.20150623.gappssmtp.com:+]; MX_GOOD(-0.01)[aspmx.l.google.com]; RCVD_IN_DNSWL_NONE(0.00)[b.2.4.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.5.4.1.0.0.a.2.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_SHORT(-0.85)[-0.848,0]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; IP_SCORE(-0.59)[ipnet: 2a00:1450::/32(-1.53), asn: 15169(-1.31), country: US(-0.09)]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; RCVD_COUNT_TWO(0.00)[2] X-Rspamd-Server: mx1.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: Thu, 06 Dec 2018 23:25:06 -0000 On Fri, 7 Dec 2018 at 11:58, Warner Losh wrote: > Author: imp > Date: Thu Dec 6 22:58:26 2018 > New Revision: 341657 > URL: https://svnweb.freebsd.org/changeset/base/341657 > > Log: > Dynamically load .so modules to expand functionality > > o Dynamically load all the .so files found in /libexec/nvmecontrol and > /usr/local/libexec/nvmecontrol. > o Link nvmecontrol -rdynamic so that its symbols are visible to the > libraries we load. > o Create concatinated linker sets that we dynamically expand. > o Add the linked-in top and logpage linker sets to the mirrors for them > and add those sets to the mirrors when we load a new .so. > o Add some macros to help hide the names of the linker sets. > o Update the man page. > ... > > Modified: head/sbin/nvmecontrol/nvmecontrol.c > > ============================================================================== > --- head/sbin/nvmecontrol/nvmecontrol.c Thu Dec 6 22:35:07 2018 > (r341656) > +++ head/sbin/nvmecontrol/nvmecontrol.c Thu Dec 6 22:58:26 2018 > (r341657) > @@ -34,6 +34,8 @@ __FBSDID("$FreeBSD$"); > #include > ... > int > main(int argc, char *argv[]) > { > > + add_to_top(NVME_CMD_BEGIN(top), NVME_CMD_LIMIT(top)); > + add_to_logpage(NVME_LOGPAGE_BEGIN, NVME_LOGPAGE_LIMIT); > + > + load_dir("/lib/nvmecontrol"); > + load_dir("/usr/local/lib/nvmecontrol"); > > You have /libexec/nvmecontrol in some places and /lib/nvmecontrol in others. It seems it actually loads from the latter. Andrew From owner-svn-src-head@freebsd.org Thu Dec 6 23:29:09 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8FF6D1318EAE; Thu, 6 Dec 2018 23:29:09 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2A1DC6A79A; Thu, 6 Dec 2018 23:29:09 +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 5B2B32AEE; Thu, 6 Dec 2018 23:29:07 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB6NT7l3041962; Thu, 6 Dec 2018 23:29:07 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB6NT7qV041961; Thu, 6 Dec 2018 23:29:07 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201812062329.wB6NT7qV041961@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 6 Dec 2018 23:29:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341663 - head/sbin/nvmecontrol X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sbin/nvmecontrol X-SVN-Commit-Revision: 341663 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2A1DC6A79A X-Spamd-Result: default: False [-1.89 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.86)[-0.863,0]; NEURAL_HAM_SHORT(-0.95)[-0.948,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.08)[-0.083,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 06 Dec 2018 23:29:09 -0000 Author: imp Date: Thu Dec 6 23:29:06 2018 New Revision: 341663 URL: https://svnweb.freebsd.org/changeset/base/341663 Log: Declare global function print_intel_add_smart in header Modified: head/sbin/nvmecontrol/nvmecontrol.h Modified: head/sbin/nvmecontrol/nvmecontrol.h ============================================================================== --- head/sbin/nvmecontrol/nvmecontrol.h Thu Dec 6 23:28:55 2018 (r341662) +++ head/sbin/nvmecontrol/nvmecontrol.h Thu Dec 6 23:29:06 2018 (r341663) @@ -118,6 +118,7 @@ void print_hex(void *data, uint32_t length); void read_logpage(int fd, uint8_t log_page, uint32_t nsid, void *payload, uint32_t payload_size); void print_temp(uint16_t t); +void print_intel_add_smart(const struct nvme_controller_data *cdata __unused, void *buf, uint32_t size __unused); void usage(const struct nvme_function *f); void dispatch_set(int argc, char *argv[], const struct nvme_function * const *tbl, From owner-svn-src-head@freebsd.org Thu Dec 6 23:39:55 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 61BDE131A986 for ; Thu, 6 Dec 2018 23:39:55 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x830.google.com (mail-qt1-x830.google.com [IPv6:2607:f8b0:4864:20::830]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A96346B2CB for ; Thu, 6 Dec 2018 23:39:54 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x830.google.com with SMTP id n32so2573691qte.11 for ; Thu, 06 Dec 2018 15:39:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Q9mofm43l/ZUhLl+pHRX/3HxuCI4x/nzcvLFSjnL/T8=; b=BfPnzuY+zIPf4mZ9wyJQliZh4y50T3kShbXb4uTdOMQZqwY4TpE5PatPnHqV9hP/A5 y6AJEYdnyzN4Z57gklihOeudafl3hTP2LAdOcafVFNCyjxU5AJh3klC6HtNTJDpAUYik tp11z5sksGvwsIiOX949qlbPUPHD//1YdxOBJ0rpZ6W/gX8DQtAq5PMitBPCwigdF0YR 7yaFQ8A0tK1WdJ+t41H/aqvuDROZWhxNwVmmRTXwA+rJY1BG9P1iBKpHUP+SKGglTV3M jNQgge7xSiqWalYTcZk339FDYeO5M73lehFmiD96wzpsD0ky3vDzNfWhXGbLjgNP0UMw zwpA== 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=Q9mofm43l/ZUhLl+pHRX/3HxuCI4x/nzcvLFSjnL/T8=; b=PqNNqp89/f+bIO2SyqZxkqPU8w5xABGgYFmrVvbs9f0cYg+7hsQiPhTJ0mtaM3k0su 3u8olbjLps49EzgZjvKotUmZG0GJS9XOHZApQ25ZbRP13Yl+9RRvmgxTItPcs110zuTx tGDXUIta57ynlstDQ1uAO/ksupNTir6BcwUudBUl/VCeSG3dUaCt+NEExV5Fx4L7PT+3 p2B87oDYP5ZZaEouKSqYHsBvQNFeevvWtYFFIqv4kEpTxeBcKJJw871uqq/RhSc6wllI yLoBYR8isCfsrDqzwLrU8SHSlgoEYo1vByynEWYr7ZJIY2ruCQemDrhY7CjRk11jV8eo P5ZQ== X-Gm-Message-State: AA+aEWbn5X3wa5u3QsjJ6S5Cq39NaFiQlF80k81ppLD29/3yzq7ei8r0 uio/teKJ+ycYye0rUvW2FW/BRlMdvCfxkf7pkopKaw== X-Google-Smtp-Source: AFSGD/WEnoVYHkgHqXZrEPIG7bDyuOGojgt7AJw6COnrj1vAEi4rcqpUGn/PBIwQnFbVPj4/RqK/Kil4J3s49b/+RqE= X-Received: by 2002:ac8:3f2d:: with SMTP id c42mr29436467qtk.33.1544139594122; Thu, 06 Dec 2018 15:39:54 -0800 (PST) MIME-Version: 1.0 References: <201812062258.wB6MwQKb026274@repo.freebsd.org> <0b90e8e4-ce69-9caf-21f2-bb76bdfd2635@FreeBSD.org> In-Reply-To: <0b90e8e4-ce69-9caf-21f2-bb76bdfd2635@FreeBSD.org> From: Warner Losh Date: Thu, 6 Dec 2018 16:39:43 -0700 Message-ID: Subject: Re: svn commit: r341657 - in head: etc/mtree sbin/nvmecontrol share/man/man7 To: John Baldwin Cc: Warner Losh , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org X-Rspamd-Queue-Id: A96346B2CB 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)[bsdimp-com.20150623.gappssmtp.com]; 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)[bsdimp.com]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; MX_GOOD(-0.01)[cached: ALT1.aspmx.l.google.com]; RCVD_IN_DNSWL_NONE(0.00)[0.3.8.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_SHORT(-0.96)[-0.960,0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_LAST(0.00)[]; IP_SCORE(-1.90)[ip: (-6.55), ipnet: 2607:f8b0::/32(-1.54), asn: 15169(-1.31), country: US(-0.09)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_COUNT_TWO(0.00)[2] X-Rspamd-Server: mx1.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: Thu, 06 Dec 2018 23:39:55 -0000 On Thu, Dec 6, 2018 at 4:23 PM John Baldwin wrote: > On 12/6/18 2:58 PM, Warner Losh wrote: > > Author: imp > > Date: Thu Dec 6 22:58:26 2018 > > New Revision: 341657 > > URL: https://svnweb.freebsd.org/changeset/base/341657 > > > > Log: > > Dynamically load .so modules to expand functionality > > > > o Dynamically load all the .so files found in /libexec/nvmecontrol and > > /usr/local/libexec/nvmecontrol. > > o Link nvmecontrol -rdynamic so that its symbols are visible to the > > libraries we load. > > o Create concatinated linker sets that we dynamically expand. > > o Add the linked-in top and logpage linker sets to the mirrors for them > > and add those sets to the mirrors when we load a new .so. > > o Add some macros to help hide the names of the linker sets. > > o Update the man page. > > > > Sponsored by: Netflix > > Differential Revision: https://reviews.freebsd.org/D18455 > > While linker sets are cool and all (and I used them in mfiutil and mptutil > to build the command tree), it seems like in this case where you want to > deal > with dynamic registration, etc. you would be better served by just using > something like STL C++ containers to maintain the command tree. New > commands can be associated with a static object whose constructor invokes a > "register_command" function or some such. You could also do this in C via > explicit ctor attributes, but just using static constructors in C++ seems > like > a less obscure way to do this. > I thought about doing it that way. I had it mostly coded up, but it turned out to be a bigger pain and required more source changes between modules and non-module builds. I didn't want to make C++ anything. And the ctor stuff runs at 'random times' that I didn't want to deal with. And linker sets aren't that obscure. So in the end, I went with linker sets because it seemed like the right tool for the job. Warner From owner-svn-src-head@freebsd.org Thu Dec 6 23:42:55 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A5092131AD36 for ; Thu, 6 Dec 2018 23:42:55 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x82b.google.com (mail-qt1-x82b.google.com [IPv6:2607:f8b0:4864:20::82b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A88726B9B9 for ; Thu, 6 Dec 2018 23:42:54 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x82b.google.com with SMTP id p17so2614536qtl.5 for ; Thu, 06 Dec 2018 15:42:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=IrJfoO6/dfrW9Jx7tiUPji/bOhYMKQ20dQkwIzZEPb4=; b=v2foaw+a67RjxjezchnOgVbDYW2F65wdzTJIXb1wtlTBvVyPUn+XfjjI37CtrH15Nz HWF69KiWRN20DHZ6nBRl2T3EbIgKP2qOIUxD2uodNcnnz5Yh8Bf/MYmuq5l6JpjjeTKi jtShSnasORHXwf0dTV1cqpAW9Q9ORhV2OsLsvr+J6rLga4n4h4Jl/1NKtbl8gPjq7XW5 hVaJiV/g3OUXt3Z5r8ingYjGyaB59QthH+JautdHwuITWtm4aDD3RyxLmEJFidwWc3wi XrSSEJO3Advd8KIuMW7ifKM1AIeTWCvhxQnf0w+sBZe0WIsHVVZP86esqPrEL71mvwSH IJng== 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=IrJfoO6/dfrW9Jx7tiUPji/bOhYMKQ20dQkwIzZEPb4=; b=X6yobjQ+6uhEypAKM8KHVmVmQU9CiB1Ee9WmPqlYlUanBh8+ZsZDoo0CIS5bzDPBWa 7h4+8+F7wayk643gN1ICMOHmoC4cCwTs4CCjP6Ykm9uBLQkSc3yB5OEAOZxy7eEVZ+oi 30ifoalCWwlYdHoX9rx0DAzdovVwofGgTF38V9aMfTHP3PKr0pkqsuUydpGcuY8SU1t/ ETX+9cu8UDUz/eJ0lo62iRFLz7AQoFuUwZQaEudhkV8UR1TNBHAF3bkMPMV/z2lQybzf +yA+w4M5hSzAyXSBySe/fLI49xUTM9Agzj/3kFSUilGKkTdRc+6+ImYQIpg+gWDUPbPK PG7A== X-Gm-Message-State: AA+aEWZJ36PCNdPDCYgfLbEhkBUxLUAf0tYPZFspChYdlckm3eBPPeCF tWpnHQczlsDEOgQX+8zUBwBqG1IF4CxidebHUoqQRyoT X-Google-Smtp-Source: AFSGD/WypNcN095WrWYMKrBOZl+ovk/XfPr+ureEUH/mBMRa6WgkNjMeCvj3u2SJ/w/lbqBAwqWBvVV4ef+w72GxVY8= X-Received: by 2002:a05:6214:1087:: with SMTP id o7mr29708071qvr.115.1544139774173; Thu, 06 Dec 2018 15:42:54 -0800 (PST) MIME-Version: 1.0 References: <201812062258.wB6MwQKb026274@repo.freebsd.org> In-Reply-To: From: Warner Losh Date: Thu, 6 Dec 2018 16:42:43 -0700 Message-ID: Subject: Re: svn commit: r341657 - in head: etc/mtree sbin/nvmecontrol share/man/man7 To: Andrew Thompson Cc: Warner Losh , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org X-Rspamd-Queue-Id: A88726B9B9 X-Spamd-Result: default: False [-4.54 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com]; 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)[bsdimp.com]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; MX_GOOD(-0.01)[cached: ALT1.aspmx.l.google.com]; RCVD_IN_DNSWL_NONE(0.00)[b.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]; NEURAL_HAM_SHORT(-0.96)[-0.959,0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_LAST(0.00)[]; IP_SCORE(-1.57)[ip: (-4.92), ipnet: 2607:f8b0::/32(-1.54), asn: 15169(-1.31), country: US(-0.09)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_COUNT_TWO(0.00)[2] X-Rspamd-Server: mx1.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: Thu, 06 Dec 2018 23:42:55 -0000 On Thu, Dec 6, 2018 at 4:25 PM Andrew Thompson wrote: > On Fri, 7 Dec 2018 at 11:58, Warner Losh wrote: > >> Author: imp >> Date: Thu Dec 6 22:58:26 2018 >> New Revision: 341657 >> URL: https://svnweb.freebsd.org/changeset/base/341657 >> >> Log: >> Dynamically load .so modules to expand functionality >> >> o Dynamically load all the .so files found in /libexec/nvmecontrol and >> /usr/local/libexec/nvmecontrol. >> o Link nvmecontrol -rdynamic so that its symbols are visible to the >> libraries we load. >> o Create concatinated linker sets that we dynamically expand. >> o Add the linked-in top and logpage linker sets to the mirrors for them >> and add those sets to the mirrors when we load a new .so. >> o Add some macros to help hide the names of the linker sets. >> o Update the man page. >> > ... > >> >> Modified: head/sbin/nvmecontrol/nvmecontrol.c >> >> ============================================================================== >> --- head/sbin/nvmecontrol/nvmecontrol.c Thu Dec 6 22:35:07 2018 >> (r341656) >> +++ head/sbin/nvmecontrol/nvmecontrol.c Thu Dec 6 22:58:26 2018 >> (r341657) >> @@ -34,6 +34,8 @@ __FBSDID("$FreeBSD$"); >> #include >> ... >> int >> main(int argc, char *argv[]) >> { >> >> + add_to_top(NVME_CMD_BEGIN(top), NVME_CMD_LIMIT(top)); >> + add_to_logpage(NVME_LOGPAGE_BEGIN, NVME_LOGPAGE_LIMIT); >> + >> + load_dir("/lib/nvmecontrol"); >> + load_dir("/usr/local/lib/nvmecontrol"); >> >> > You have /libexec/nvmecontrol in some places and /lib/nvmecontrol in > others. It seems it actually loads from the latter. > It does. I had libexec for most of my development, but in the review it was pointed out that this should be lib, so I changed it most, but not all, places. Thanks for catching the mismatch. I've corrected it. Warner From owner-svn-src-head@freebsd.org Thu Dec 6 23:40:57 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 090BF131AA2D; Thu, 6 Dec 2018 23:40:57 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A0B0B6B53F; Thu, 6 Dec 2018 23:40:56 +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 82B342CBC; Thu, 6 Dec 2018 23:40:56 +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 wB6NeukB048858; Thu, 6 Dec 2018 23:40:56 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB6Neu37048857; Thu, 6 Dec 2018 23:40:56 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201812062340.wB6Neu37048857@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 6 Dec 2018 23:40:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341664 - head/sbin/nvmecontrol X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sbin/nvmecontrol X-SVN-Commit-Revision: 341664 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A0B0B6B53F X-Spamd-Result: default: False [-1.89 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.86)[-0.863,0]; NEURAL_HAM_SHORT(-0.95)[-0.948,0]; NEURAL_HAM_LONG(-0.08)[-0.083,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 06 Dec 2018 23:40:57 -0000 Author: imp Date: Thu Dec 6 23:40:56 2018 New Revision: 341664 URL: https://svnweb.freebsd.org/changeset/base/341664 Log: Update paths based on last-minute changes from libexec to lib. Modified: head/sbin/nvmecontrol/nvmecontrol.8 Modified: head/sbin/nvmecontrol/nvmecontrol.8 ============================================================================== --- head/sbin/nvmecontrol/nvmecontrol.8 Thu Dec 6 23:29:06 2018 (r341663) +++ head/sbin/nvmecontrol/nvmecontrol.8 Thu Dec 6 23:40:56 2018 (r341664) @@ -232,9 +232,9 @@ Set the current power mode. Get the current power mode. .Sh DYNAMIC LOADING The directories -.Pa /libexec/nvmecontrol +.Pa /lib/nvmecontrol and -.Pa /usr/local/libexec/nvmecontrol +.Pa /usr/local/lib/nvmecontrol are scanned for any .so files. These files are loaded. The members of the From owner-svn-src-head@freebsd.org Thu Dec 6 23:55:41 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8E457131B6F0; Thu, 6 Dec 2018 23:55:41 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 405F16C332; Thu, 6 Dec 2018 23:55:41 +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 1CE5D2FED; Thu, 6 Dec 2018 23:55:41 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB6NtfmB057420; Thu, 6 Dec 2018 23:55:41 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB6NteFW057415; Thu, 6 Dec 2018 23:55:40 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201812062355.wB6NteFW057415@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Thu, 6 Dec 2018 23:55:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341665 - in head: sys/geom/mirror tests/sys/geom/class/mirror X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head: sys/geom/mirror tests/sys/geom/class/mirror X-SVN-Commit-Revision: 341665 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 405F16C332 X-Spamd-Result: default: False [-1.82 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.87)[-0.870,0]; NEURAL_SPAM_LONG(0.01)[0.005,0]; NEURAL_HAM_SHORT(-0.95)[-0.954,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 06 Dec 2018 23:55:41 -0000 Author: cem Date: Thu Dec 6 23:55:39 2018 New Revision: 341665 URL: https://svnweb.freebsd.org/changeset/base/341665 Log: gmirror: Evaluate mirror components against newest metadata copy If we happen to taste a stale mirror component first, don't reject valid, newer components that have differing metadata from the stale component (during STARTING). Instead, update our view of the most recent metadata as we taste components. Like mediasize beforehand, remove some checks from g_mirror_check_metadata which would evict valid components due to metadata that can change over a mirror's lifetime. g_mirror_check_metadata is invoked long before we check genid/syncid and decide which component(s) are newest and whether or not we have quorum. Before checking if we can enter RUNNING (i.e., we have quorum) after a NEW component is added, first remove any known stale or inconsistent disks from the mirrorset, rather than removing them *after* deciding we have quorum. Check if we have quorum after removing these components. Additionally, add a knob, kern.geom.mirror.launch_mirror_before_timeout, to force gmirrors to wait out the full timeout (kern.geom.mirror.timeout) before transitioning from STARTING to RUNNING. This is a kludge to help ensure all eligible, boot-time available mirror components are tasted before RUNNING a gmirror. When we are instructed to forget mirror components, bump the generation id to avoid confusion with such stale components later. Add a basic test case for STARTING -> RUNNING startup behavior around stale genids. PR: 232671, 232835 Submitted by: Cindy Yang (previous version) Reviewed by: markj (kernel portions) Discussed with: asomers, Cindy Yang Tested by: pho Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D18062 Added: head/tests/sys/geom/class/mirror/component_selection.sh (contents, props changed) Modified: head/sys/geom/mirror/g_mirror.c head/sys/geom/mirror/g_mirror.h head/tests/sys/geom/class/mirror/Makefile head/tests/sys/geom/class/mirror/conf.sh Modified: head/sys/geom/mirror/g_mirror.c ============================================================================== --- head/sys/geom/mirror/g_mirror.c Thu Dec 6 23:40:56 2018 (r341664) +++ head/sys/geom/mirror/g_mirror.c Thu Dec 6 23:55:39 2018 (r341665) @@ -59,6 +59,11 @@ static SYSCTL_NODE(_kern_geom, OID_AUTO, mirror, CTLFL int g_mirror_debug = 0; SYSCTL_INT(_kern_geom_mirror, OID_AUTO, debug, CTLFLAG_RWTUN, &g_mirror_debug, 0, "Debug level"); +bool g_launch_mirror_before_timeout = true; +SYSCTL_BOOL(_kern_geom_mirror, OID_AUTO, launch_mirror_before_timeout, + CTLFLAG_RWTUN, &g_launch_mirror_before_timeout, 0, + "If false, force gmirror to wait out the full kern.geom.mirror.timeout " + "before launching mirrors"); static u_int g_mirror_timeout = 4; SYSCTL_UINT(_kern_geom_mirror, OID_AUTO, timeout, CTLFLAG_RWTUN, &g_mirror_timeout, 0, "Time to wait on all mirror components"); @@ -110,6 +115,8 @@ static int g_mirror_update_disk(struct g_mirror_disk * static void g_mirror_update_device(struct g_mirror_softc *sc, bool force); static void g_mirror_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp, struct g_consumer *cp, struct g_provider *pp); +static int g_mirror_refresh_device(struct g_mirror_softc *sc, + const struct g_provider *pp, const struct g_mirror_metadata *md); static void g_mirror_sync_reinit(const struct g_mirror_disk *disk, struct bio *bp, off_t offset); static void g_mirror_sync_stop(struct g_mirror_disk *disk, int type); @@ -472,6 +479,10 @@ g_mirror_init_disk(struct g_mirror_softc *sc, struct g disk->d_sync.ds_update_ts = time_uptime; disk->d_genid = md->md_genid; disk->d_sync.ds_syncid = md->md_syncid; + disk->d_init_ndisks = md->md_all; + disk->d_init_slice = md->md_slice; + disk->d_init_balance = md->md_balance; + disk->d_init_mediasize = md->md_mediasize; if (errorp != NULL) *errorp = 0; return (disk); @@ -2362,17 +2373,74 @@ g_mirror_update_device(struct g_mirror_softc *sc, bool case G_MIRROR_DEVICE_STATE_STARTING: { struct g_mirror_disk *pdisk, *tdisk; - u_int dirty, ndisks, genid, syncid; - bool broken; + const char *mismatch; + uintmax_t found, newest; + u_int dirty, ndisks; + /* Pre-flight checks */ + LIST_FOREACH_SAFE(disk, &sc->sc_disks, d_next, tdisk) { + /* + * Confirm we already detected the newest genid. + */ + KASSERT(sc->sc_genid >= disk->d_genid, + ("%s: found newer genid %u (sc:%p had %u).", __func__, + disk->d_genid, sc, sc->sc_genid)); + + /* Kick out any previously tasted stale components. */ + if (disk->d_genid < sc->sc_genid) { + G_MIRROR_DEBUG(0, "Stale 'genid' field on %s " + "(device %s) (component=%u latest=%u), skipping.", + g_mirror_get_diskname(disk), sc->sc_name, + disk->d_genid, sc->sc_genid); + g_mirror_destroy_disk(disk); + sc->sc_bump_id |= G_MIRROR_BUMP_SYNCID; + continue; + } + + /* + * Confirm we already detected the newest syncid. + */ + KASSERT(sc->sc_syncid >= disk->d_sync.ds_syncid, + ("%s: found newer syncid %u (sc:%p had %u).", + __func__, disk->d_sync.ds_syncid, sc, + sc->sc_syncid)); + +#define DETECT_MISMATCH(field, name) \ + if (mismatch == NULL && \ + disk->d_init_ ## field != sc->sc_ ## field) { \ + mismatch = name; \ + found = (intmax_t)disk->d_init_ ## field; \ + newest = (intmax_t)sc->sc_ ## field; \ + } + mismatch = NULL; + DETECT_MISMATCH(ndisks, "md_all"); + DETECT_MISMATCH(balance, "md_balance"); + DETECT_MISMATCH(slice, "md_slice"); + DETECT_MISMATCH(mediasize, "md_mediasize"); +#undef DETECT_MISMATCH + if (mismatch != NULL) { + G_MIRROR_DEBUG(0, "Found a mismatching '%s' " + "field on %s (device %s) (found=%ju " + "newest=%ju).", mismatch, + g_mirror_get_diskname(disk), sc->sc_name, + found, newest); + g_mirror_destroy_disk(disk); + sc->sc_bump_id |= G_MIRROR_BUMP_SYNCID; + continue; + } + } + KASSERT(sc->sc_provider == NULL, ("Non-NULL provider in STARTING state (%s).", sc->sc_name)); /* - * Are we ready? We are, if all disks are connected or - * if we have any disks and 'force' is true. + * Are we ready? If the timeout (force is true) has expired, and + * any disks are present, then yes. If we're permitted to launch + * before the timeout has expired and the expected number of + * current-generation mirror disks have been tasted, then yes. */ ndisks = g_mirror_ndisks(sc, -1); - if (sc->sc_ndisks == ndisks || (force && ndisks > 0)) { + if ((force && ndisks > 0) || + (g_launch_mirror_before_timeout && ndisks == sc->sc_ndisks)) { ; } else if (ndisks == 0) { /* @@ -2420,42 +2488,6 @@ g_mirror_update_device(struct g_mirror_softc *sc, bool } /* - * Find the biggest genid. - */ - genid = 0; - LIST_FOREACH(disk, &sc->sc_disks, d_next) { - if (disk->d_genid > genid) - genid = disk->d_genid; - } - sc->sc_genid = genid; - /* - * Remove all disks without the biggest genid. - */ - broken = false; - LIST_FOREACH_SAFE(disk, &sc->sc_disks, d_next, tdisk) { - if (disk->d_genid < genid) { - G_MIRROR_DEBUG(0, - "Component %s (device %s) broken, skipping.", - g_mirror_get_diskname(disk), sc->sc_name); - g_mirror_destroy_disk(disk); - /* - * Bump the syncid in case we discover a healthy - * replacement disk after starting the mirror. - */ - broken = true; - } - } - - /* - * Find the biggest syncid. - */ - syncid = 0; - LIST_FOREACH(disk, &sc->sc_disks, d_next) { - if (disk->d_sync.ds_syncid > syncid) - syncid = disk->d_sync.ds_syncid; - } - - /* * Here we need to look for dirty disks and if all disks * with the biggest syncid are dirty, we have to choose * one with the biggest priority and rebuild the rest. @@ -2468,7 +2500,7 @@ g_mirror_update_device(struct g_mirror_softc *sc, bool dirty = ndisks = 0; pdisk = NULL; LIST_FOREACH(disk, &sc->sc_disks, d_next) { - if (disk->d_sync.ds_syncid != syncid) + if (disk->d_sync.ds_syncid != sc->sc_syncid) continue; if ((disk->d_flags & G_MIRROR_DISK_FLAG_SYNCHRONIZING) != 0) { @@ -2495,7 +2527,7 @@ g_mirror_update_device(struct g_mirror_softc *sc, bool "master disk for synchronization.", g_mirror_get_diskname(pdisk), sc->sc_name); LIST_FOREACH(disk, &sc->sc_disks, d_next) { - if (disk->d_sync.ds_syncid != syncid) + if (disk->d_sync.ds_syncid != sc->sc_syncid) continue; if ((disk->d_flags & G_MIRROR_DISK_FLAG_SYNCHRONIZING) != 0) { @@ -2516,7 +2548,7 @@ g_mirror_update_device(struct g_mirror_softc *sc, bool * We have some non-dirty disks. */ LIST_FOREACH(disk, &sc->sc_disks, d_next) { - if (disk->d_sync.ds_syncid != syncid) + if (disk->d_sync.ds_syncid != sc->sc_syncid) continue; if ((disk->d_flags & G_MIRROR_DISK_FLAG_SYNCHRONIZING) != 0) { @@ -2532,8 +2564,7 @@ g_mirror_update_device(struct g_mirror_softc *sc, bool /* Reset hint. */ sc->sc_hint = NULL; - sc->sc_syncid = syncid; - if (force || broken) { + if (force) { /* Remember to bump syncid on first write. */ sc->sc_bump_id |= G_MIRROR_BUMP_SYNCID; } @@ -2870,37 +2901,23 @@ g_mirror_check_metadata(struct g_mirror_softc *sc, str struct g_mirror_metadata *md) { + G_MIRROR_DEBUG(2, "%s: md_did 0x%u disk %s device %s md_all 0x%x " + "sc_ndisks 0x%x md_slice 0x%x sc_slice 0x%x md_balance 0x%x " + "sc_balance 0x%x sc_mediasize 0x%lx pp_mediasize 0x%lx " + "md_sectorsize 0x%x sc_sectorsize 0x%x md_mflags 0x%lx " + "md_dflags 0x%lx md_syncid 0x%x md_genid 0x%x md_priority 0x%x " + "sc_state 0x%x.", + __func__, md->md_did, pp->name, sc->sc_name, md->md_all, + sc->sc_ndisks, md->md_slice, sc->sc_slice, md->md_balance, + sc->sc_balance, sc->sc_mediasize, pp->mediasize, md->md_sectorsize, + sc->sc_sectorsize, md->md_mflags, md->md_dflags, md->md_syncid, + md->md_genid, md->md_priority, sc->sc_state); + if (g_mirror_id2disk(sc, md->md_did) != NULL) { G_MIRROR_DEBUG(1, "Disk %s (id=%u) already exists, skipping.", pp->name, md->md_did); return (EEXIST); } - if (md->md_all != sc->sc_ndisks) { - G_MIRROR_DEBUG(1, - "Invalid '%s' field on disk %s (device %s), skipping.", - "md_all", pp->name, sc->sc_name); - return (EINVAL); - } - if (md->md_slice != sc->sc_slice) { - G_MIRROR_DEBUG(1, - "Invalid '%s' field on disk %s (device %s), skipping.", - "md_slice", pp->name, sc->sc_name); - return (EINVAL); - } - if (md->md_balance != sc->sc_balance) { - G_MIRROR_DEBUG(1, - "Invalid '%s' field on disk %s (device %s), skipping.", - "md_balance", pp->name, sc->sc_name); - return (EINVAL); - } -#if 0 - if (md->md_mediasize != sc->sc_mediasize) { - G_MIRROR_DEBUG(1, - "Invalid '%s' field on disk %s (device %s), skipping.", - "md_mediasize", pp->name, sc->sc_name); - return (EINVAL); - } -#endif if (sc->sc_mediasize > pp->mediasize) { G_MIRROR_DEBUG(1, "Invalid size of disk %s (device %s), skipping.", pp->name, @@ -2947,12 +2964,21 @@ g_mirror_add_disk(struct g_mirror_softc *sc, struct g_ error = g_mirror_check_metadata(sc, pp, md); if (error != 0) return (error); - if (sc->sc_state == G_MIRROR_DEVICE_STATE_RUNNING && - md->md_genid < sc->sc_genid) { + + if (md->md_genid < sc->sc_genid) { G_MIRROR_DEBUG(0, "Component %s (device %s) broken, skipping.", pp->name, sc->sc_name); return (EINVAL); } + + /* + * If the component disk we're tasting has newer metadata than the + * STARTING gmirror device, refresh the device from the component. + */ + error = g_mirror_refresh_device(sc, pp, md); + if (error != 0) + return (error); + disk = g_mirror_init_disk(sc, pp, md, &error); if (disk == NULL) return (error); @@ -3029,6 +3055,21 @@ end: return (error); } +static void +g_mirror_reinit_from_metadata(struct g_mirror_softc *sc, + const struct g_mirror_metadata *md) +{ + + sc->sc_genid = md->md_genid; + sc->sc_syncid = md->md_syncid; + + sc->sc_slice = md->md_slice; + sc->sc_balance = md->md_balance; + sc->sc_mediasize = md->md_mediasize; + sc->sc_ndisks = md->md_all; + sc->sc_flags = md->md_mflags; +} + struct g_geom * g_mirror_create(struct g_class *mp, const struct g_mirror_metadata *md, u_int type) @@ -3056,12 +3097,8 @@ g_mirror_create(struct g_class *mp, const struct g_mir sc->sc_type = type; sc->sc_id = md->md_mid; - sc->sc_slice = md->md_slice; - sc->sc_balance = md->md_balance; - sc->sc_mediasize = md->md_mediasize; + g_mirror_reinit_from_metadata(sc, md); sc->sc_sectorsize = md->md_sectorsize; - sc->sc_ndisks = md->md_all; - sc->sc_flags = md->md_mflags; sc->sc_bump_id = 0; sc->sc_idle = 1; sc->sc_last_write = time_uptime; @@ -3482,6 +3519,52 @@ g_mirror_fini(struct g_class *mp) if (g_mirror_post_sync != NULL) EVENTHANDLER_DEREGISTER(shutdown_post_sync, g_mirror_post_sync); +} + +/* + * Refresh the mirror device's metadata when gmirror encounters a newer + * generation as the individual components are being added to the mirror set. + */ +static int +g_mirror_refresh_device(struct g_mirror_softc *sc, const struct g_provider *pp, + const struct g_mirror_metadata *md) +{ + + g_topology_assert_not(); + sx_assert(&sc->sc_lock, SX_XLOCKED); + + KASSERT(sc->sc_genid <= md->md_genid, + ("%s: attempted to refresh from stale component %s (device %s) " + "(%u < %u).", __func__, pp->name, sc->sc_name, md->md_genid, + sc->sc_genid)); + + if (sc->sc_genid > md->md_genid || (sc->sc_genid == md->md_genid && + sc->sc_syncid >= md->md_syncid)) + return (0); + + G_MIRROR_DEBUG(0, "Found newer version for device %s (genid: curr=%u " + "new=%u; syncid: curr=%u new=%u; ndisks: curr=%u new=%u; " + "provider=%s).", sc->sc_name, sc->sc_genid, md->md_genid, + sc->sc_syncid, md->md_syncid, sc->sc_ndisks, md->md_all, pp->name); + + if (sc->sc_state != G_MIRROR_DEVICE_STATE_STARTING) { + /* Probable data corruption detected */ + G_MIRROR_DEBUG(0, "Cannot refresh metadata in %s state " + "(device=%s genid=%u). A stale mirror device was launched.", + g_mirror_device_state2str(sc->sc_state), sc->sc_name, + sc->sc_genid); + return (EINVAL); + } + + /* Update softc */ + g_mirror_reinit_from_metadata(sc, md); + + G_MIRROR_DEBUG(1, "Refresh device %s (id=%u, state=%s) from disk %s " + "(genid=%u syncid=%u md_all=%u).", sc->sc_name, md->md_mid, + g_mirror_device_state2str(sc->sc_state), pp->name, md->md_genid, + md->md_syncid, (unsigned)md->md_all); + + return (0); } DECLARE_GEOM_CLASS(g_mirror_class, g_mirror); Modified: head/sys/geom/mirror/g_mirror.h ============================================================================== --- head/sys/geom/mirror/g_mirror.h Thu Dec 6 23:40:56 2018 (r341664) +++ head/sys/geom/mirror/g_mirror.h Thu Dec 6 23:55:39 2018 (r341665) @@ -148,6 +148,10 @@ struct g_mirror_disk { u_int d_genid; /* Disk's generation ID. */ struct g_mirror_disk_sync d_sync;/* Sync information. */ LIST_ENTRY(g_mirror_disk) d_next; + u_int d_init_ndisks; /* Initial number of mirror components */ + uint32_t d_init_slice; /* Initial slice size */ + uint8_t d_init_balance;/* Initial balance */ + uint64_t d_init_mediasize;/* Initial mediasize */ }; #define d_name d_consumer->provider->name Modified: head/tests/sys/geom/class/mirror/Makefile ============================================================================== --- head/tests/sys/geom/class/mirror/Makefile Thu Dec 6 23:40:56 2018 (r341664) +++ head/tests/sys/geom/class/mirror/Makefile Thu Dec 6 23:55:39 2018 (r341665) @@ -18,6 +18,7 @@ TAP_TESTS_SH+= 11_test TAP_TESTS_SH+= 12_test TAP_TESTS_SH+= 13_test +ATF_TESTS_SH+= component_selection ATF_TESTS_SH+= sync_error ${PACKAGE}FILES+= conf.sh Added: head/tests/sys/geom/class/mirror/component_selection.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/geom/class/mirror/component_selection.sh Thu Dec 6 23:55:39 2018 (r341665) @@ -0,0 +1,133 @@ +# $FreeBSD$ + +atf_test_case run_latest_genid cleanup +run_latest_genid_head() +{ + atf_set "descr" \ + "Ensure that we properly select components (latest genid) during STARTING." + atf_set "require.user" "root" +} +run_latest_genid_body() +{ + . $(atf_get_srcdir)/conf.sh + + f1=$(mktemp ${base}.XXXXXX) + f2=$(mktemp ${base}.XXXXXX) + f3=$(mktemp ${base}.XXXXXX) + rnd1=$(mktemp ${base}.XXXXXX) + rnd2=$(mktemp ${base}.XXXXXX) + + atf_check truncate -s 2M $f1 + atf_check truncate -s 2M $f2 + atf_check truncate -s 2M $f3 + dd if=/dev/urandom bs=512 count=1 of="$rnd1" + dd if=/dev/urandom bs=512 count=1 of="$rnd2" + + md1=$(attach_md -t vnode -f ${f1}) + md2=$(attach_md -t vnode -f ${f2}) + md3=$(attach_md -t vnode -f ${f3}) + + # Use a gnop for md1 just for consistency; it's not used for anything. + atf_check gnop create $md1 + atf_check gnop create $md2 + atf_check gnop create $md3 + # Hardcode component names so that the non-.nop device isn't tasted + # instead. + atf_check gmirror label -h $name ${md1}.nop + devwait + + atf_check gmirror insert -h $name ${md2}.nop + atf_check gmirror insert -h $name ${md3}.nop + syncwait + + # Fail mirror 3, writing known contents to mirror 1+2 block 1 + atf_check -s exit:0 -e empty -o empty \ + gnop configure -w 100 ${md3}.nop + atf_check -s exit:0 dd if="$rnd1" bs=512 count=1 oseek=1 conv=notrunc \ + of=/dev/mirror/$name status=none + + disconnectwait nop "${md3}.nop" + + # Should have two mirrors remaining after md3 was evicted + atf_check [ $(gmirror status -s $name | wc -l) -eq 2 ] + atf_check -s exit:0 -o match:"DEGRADED ${md1}.nop \(ACTIVE\)" \ + gmirror status -s $name + atf_check -s exit:0 -o match:"DEGRADED ${md2}.nop \(ACTIVE\)" \ + gmirror status -s $name + + # Repeat: + # Fail mirror 2, writing known contents to mirror 1 block 2 + atf_check -s exit:0 -e empty -o empty \ + gnop configure -w 100 ${md2}.nop + atf_check -s exit:0 dd if="$rnd2" bs=512 count=2 oseek=1 conv=notrunc \ + of=/dev/mirror/$name status=none + + disconnectwait nop "${md2}.nop" + + # Should have one mirror remaining after md2 was evicted + atf_check [ $(gmirror status -s $name | wc -l) -eq 1 ] + atf_check -s exit:0 -o match:"DEGRADED ${md1}.nop \(ACTIVE\)" \ + gmirror status -s $name + + # Stop the mirror and remove the pieces so gmirror can't see them. + atf_check gmirror stop $name + atf_check gnop destroy ${md1}.nop + atf_check gnop destroy ${md2}.nop + atf_check gnop destroy ${md3}.nop + + # Rebuild; spin up "disk" with lowest genid + atf_check gnop create $md3 + md3gen=$(gmirror dump /dev/${md3}.nop | grep genid | cut -d: -f2) + # Assert gmirror is referencing this component for now: + atf_check [ $(consumerrefs nop ${md3}.nop) = "r1w1e1" ] + + # Adding newer genid should kick out old component + atf_check gnop create $md2 + md2gen=$(gmirror dump /dev/${md2}.nop | grep genid | cut -d: -f2) + atf_check [ $md2gen -gt $md3gen ] + + disconnectwait nop "${md3}.nop" + + # Can't test this because 'status' doesn't exist until RUNNING: + #atf_check [ $(gmirror status -s $name | wc -l) -eq 1 ] + # But as a substitute, assert gmirror has dropped reference to staler + # component in favor of newer component: + atf_check [ $(consumerrefs nop ${md2}.nop) = "r1w1e1" ] + + # ditto + atf_check gnop create $md1 + md1gen=$(gmirror dump /dev/${md1}.nop | grep genid | cut -d: -f2) + atf_check [ $md1gen -gt $md2gen ] + + disconnectwait nop "${md2}.nop" + + # Assert gmirror has dropped reference to stale component in favor of + # newer component: + atf_check [ $(consumerrefs nop ${md1}.nop) = "r1w1e1" ] + + # gmirror won't start the mirror automatically with only one component + # ($md0) of configured three, so this waits out the + # kern.geom.mirror.timeout: + devwait + + atf_check [ $(gmirror status -s $name | wc -l) -eq 1 ] + atf_check -s exit:0 -o match:"DEGRADED ${md1}.nop \(ACTIVE\)" \ + gmirror status -s $name +} +run_latest_genid_cleanup() +{ + . $(atf_get_srcdir)/conf.sh + + if [ -f "$TEST_MDS_FILE" ]; then + while read test_md; do + echo "# Removing test gnop: ${test_md}.nop" + gnop destroy -f "${test_md}.nop" 2>/dev/null || : + done < "$TEST_MDS_FILE" + fi + gmirror_test_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case run_latest_genid +} Modified: head/tests/sys/geom/class/mirror/conf.sh ============================================================================== --- head/tests/sys/geom/class/mirror/conf.sh Thu Dec 6 23:40:56 2018 (r341664) +++ head/tests/sys/geom/class/mirror/conf.sh Thu Dec 6 23:55:39 2018 (r341665) @@ -19,4 +19,35 @@ syncwait() done } +consumerrefs() +{ + gclass=$1 + geom=$2 + + if [ $# -ne 2 ]; then + echo "Bad usage consumerrefs" >&2 + exit 1 + fi + + geom "${gclass}" list "${geom}" | \ + grep -A5 ^Consumers | \ + grep Mode | \ + cut -d: -f2 +} + +disconnectwait() +{ + gclass=$1 + geom=$2 + + if [ $# -ne 2 ]; then + echo "Bad usage disconnectwait" >&2 + exit 1 + fi + + while [ $(consumerrefs "$gclass" "$geom") != r0w0e0 ]; do + sleep 0.05 + done +} + . `dirname $0`/../geom_subr.sh From owner-svn-src-head@freebsd.org Fri Dec 7 00:06:37 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 415A5132135A; Fri, 7 Dec 2018 00:06:37 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-it1-f182.google.com (mail-it1-f182.google.com [209.85.166.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A13646CFF9; Fri, 7 Dec 2018 00:06:36 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-it1-f182.google.com with SMTP id g85so4348290ita.3; Thu, 06 Dec 2018 16:06:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=JvlwXcKpFM6bbg+IYp80r0FyGkCyJ3/V4xGZ3Td/Lao=; b=di+K2/B3M4BRakBKkCyPFht2NUQtiTpn+e/bQDuUFk6GDVP21TzVfdV3lAoyWit1Py q2/XHLr/BbT4R18N2sQvqHjh/R56d3f4Vj1yKBgD98xALsJe4HLU+ou3iEMUy7ov2Kew 9KaSUtgeQTAxRpNqvDa1kbxYu2zYis5ZtPdCJ5A1Wfu3BEt6BNiqWq20ZnUutRaUL65g MueDfmfIr3xmmMTn8a7P9BlRh8i23TrONm8KjtAn9sA9gNl93lXcC2r7dbt7mgmpESxt Wd9ENo2bH9ovojPp4R6yOJ31PU8tbvB6lDLAORJXhUeBdLYiw+FifOLUgoF26qG5kJfA Igaw== X-Gm-Message-State: AA+aEWa4pYa6Jq8P99/gH8YscCYv+X4RM2DFKAMDBu6XhBTPW1EjnlC9 H6vNnu/PF8BHsGpTZOJksDOL39of X-Google-Smtp-Source: AFSGD/VNk6V81hiQnK25bp2ASub/DPh0XejJheEBREhY77vRjvEO9ELIMftRc8Fq9zqLnFjJEm1XfQ== X-Received: by 2002:a24:5fc3:: with SMTP id r186mr387644itb.79.1544141189643; Thu, 06 Dec 2018 16:06:29 -0800 (PST) Received: from mail-it1-f178.google.com (mail-it1-f178.google.com. [209.85.166.178]) by smtp.gmail.com with ESMTPSA id r85sm831933iod.13.2018.12.06.16.06.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Dec 2018 16:06:29 -0800 (PST) Received: by mail-it1-f178.google.com with SMTP id o19so4321068itg.5; Thu, 06 Dec 2018 16:06:29 -0800 (PST) X-Received: by 2002:a24:5411:: with SMTP id t17mr409065ita.32.1544141189172; Thu, 06 Dec 2018 16:06:29 -0800 (PST) MIME-Version: 1.0 References: <201812062355.wB6NteFW057415@repo.freebsd.org> In-Reply-To: <201812062355.wB6NteFW057415@repo.freebsd.org> Reply-To: cem@freebsd.org From: Conrad Meyer Date: Thu, 6 Dec 2018 16:06:18 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r341665 - in head: sys/geom/mirror tests/sys/geom/class/mirror To: svn-src-head@freebsd.org Cc: src-committers , svn-src-all@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: A13646CFF9 X-Spamd-Result: default: False [-5.82 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; HAS_REPLYTO(0.00)[cem@freebsd.org]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; REPLYTO_ADDR_EQ_FROM(0.00)[]; RCVD_COUNT_THREE(0.00)[4]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; NEURAL_HAM_SHORT(-0.97)[-0.971,0]; FORGED_SENDER(0.30)[cem@freebsd.org,csecem@gmail.com]; RCVD_TLS_LAST(0.00)[]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; TAGGED_FROM(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; FROM_NEQ_ENVFROM(0.00)[cem@freebsd.org,csecem@gmail.com]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.org]; IP_SCORE(-2.84)[ip: (-9.37), ipnet: 209.85.128.0/17(-3.44), asn: 15169(-1.31), country: US(-0.09)]; RCVD_IN_DNSWL_NONE(0.00)[182.166.85.209.list.dnswl.org : 127.0.5.0]; RWL_MAILSPIKE_POSSIBLE(0.00)[182.166.85.209.rep.mailspike.net : 127.0.0.17] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 07 Dec 2018 00:06:37 -0000 This minor part was removed from the revision during review, but I forgot to remove it from the commit message. Sorry about the mistake, and please disregard: On Thu, Dec 6, 2018 at 3:55 PM Conrad Meyer wrote: > When we are instructed to forget mirror components, bump the generation id > to avoid confusion with such stale components later. Thanks, Conrad From owner-svn-src-head@freebsd.org Fri Dec 7 00:27:40 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DB2651322838; Fri, 7 Dec 2018 00:27:39 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 822776E55C; Fri, 7 Dec 2018 00:27:39 +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 62B743868; Fri, 7 Dec 2018 00:27:39 +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 wB70RdQI073435; Fri, 7 Dec 2018 00:27:39 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB70RdQX073433; Fri, 7 Dec 2018 00:27:39 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201812070027.wB70RdQX073433@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 7 Dec 2018 00:27:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341667 - in head/tests/sys/geom/class: . eli X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in head/tests/sys/geom/class: . eli X-SVN-Commit-Revision: 341667 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 822776E55C X-Spamd-Result: default: False [-1.90 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.86)[-0.863,0]; NEURAL_HAM_LONG(-0.08)[-0.083,0]; NEURAL_HAM_SHORT(-0.96)[-0.956,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 07 Dec 2018 00:27:40 -0000 Author: asomers Date: Fri Dec 7 00:27:38 2018 New Revision: 341667 URL: https://svnweb.freebsd.org/changeset/base/341667 Log: geom tests: Fix cleanup of ATF tests since r341392 r341392 changed common test cleanup routines in a way that allowed them to be used by TAP tests as well as ATF tests. However, a late change made during code review resulted in cleanup being broken for ATF tests, which source geom_subr.sh separately during the body and cleanup phases of the test. The result was that md(4) devices wouldn't get cleaned up. MFC after: 2 weeks X-MFC-With: 341392 Modified: head/tests/sys/geom/class/eli/conf.sh head/tests/sys/geom/class/geom_subr.sh Modified: head/tests/sys/geom/class/eli/conf.sh ============================================================================== --- head/tests/sys/geom/class/eli/conf.sh Fri Dec 7 00:00:12 2018 (r341666) +++ head/tests/sys/geom/class/eli/conf.sh Fri Dec 7 00:27:38 2018 (r341667) @@ -4,7 +4,6 @@ class="eli" base=$(atf_get ident) MAX_SECSIZE=8192 -TEST_MDS_FILE=md.devs attach_md() { Modified: head/tests/sys/geom/class/geom_subr.sh ============================================================================== --- head/tests/sys/geom/class/geom_subr.sh Fri Dec 7 00:00:12 2018 (r341666) +++ head/tests/sys/geom/class/geom_subr.sh Fri Dec 7 00:27:38 2018 (r341667) @@ -1,8 +1,7 @@ #!/bin/sh # $FreeBSD$ -# NOTE: existence is sanity-checked in `geom_verify_temp_mds_file_existence(..)` -TEST_MDS_FILE="$(mktemp test_mds.${0##*/}.XXXXXXXX)" +TEST_MDS_FILE="${TMPDIR}/test_mds.$(basename $0)" devwait() { @@ -47,14 +46,6 @@ geom_test_cleanup() fi } -geom_verify_temp_mds_file_existence() -{ - if [ ! -f $TEST_MDS_FILE ]; then - echo "test md(4) devices file creation unsuccessful" - return 1 - fi -} - geom_load_class_if_needed() { local class=$1 @@ -71,9 +62,6 @@ geom_load_class_if_needed() geom_atf_test_setup() { - if ! error_message=$(geom_verify_temp_mds_file_existence); then - atf_skip "$error_message" - fi if ! error_message=$(geom_load_class_if_needed $class); then atf_skip "$error_message" fi @@ -81,10 +69,6 @@ geom_atf_test_setup() geom_tap_test_setup() { - if ! error_message=$(geom_verify_temp_mds_file_existence); then - echo "1..0 # SKIP $error_message" - exit 1 - fi if ! error_message=$(geom_load_class_if_needed $class); then echo "1..0 # SKIP $error_message" exit 0 From owner-svn-src-head@freebsd.org Fri Dec 7 00:47:07 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0F868132340A; Fri, 7 Dec 2018 00:47:07 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B43726F4C8; Fri, 7 Dec 2018 00:47:06 +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 7A7283C54; Fri, 7 Dec 2018 00:47:06 +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 wB70l6NL084071; Fri, 7 Dec 2018 00:47:06 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB70l5YN084067; Fri, 7 Dec 2018 00:47:05 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201812070047.wB70l5YN084067@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Fri, 7 Dec 2018 00:47:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341672 - in head: sys/geom/mirror tests/sys/geom/class/mirror X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head: sys/geom/mirror tests/sys/geom/class/mirror X-SVN-Commit-Revision: 341672 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B43726F4C8 X-Spamd-Result: default: False [-1.85 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.87)[-0.868,0]; NEURAL_HAM_SHORT(-0.96)[-0.960,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.02)[-0.024,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 07 Dec 2018 00:47:07 -0000 Author: cem Date: Fri Dec 7 00:47:05 2018 New Revision: 341672 URL: https://svnweb.freebsd.org/changeset/base/341672 Log: Revert r341665 due to tinderbox breakage I didn't notice that some format strings were non-portable. Will fix and re-commit later. Deleted: head/tests/sys/geom/class/mirror/component_selection.sh Modified: head/sys/geom/mirror/g_mirror.c head/sys/geom/mirror/g_mirror.h head/tests/sys/geom/class/mirror/Makefile head/tests/sys/geom/class/mirror/conf.sh Modified: head/sys/geom/mirror/g_mirror.c ============================================================================== --- head/sys/geom/mirror/g_mirror.c Fri Dec 7 00:39:34 2018 (r341671) +++ head/sys/geom/mirror/g_mirror.c Fri Dec 7 00:47:05 2018 (r341672) @@ -59,11 +59,6 @@ static SYSCTL_NODE(_kern_geom, OID_AUTO, mirror, CTLFL int g_mirror_debug = 0; SYSCTL_INT(_kern_geom_mirror, OID_AUTO, debug, CTLFLAG_RWTUN, &g_mirror_debug, 0, "Debug level"); -bool g_launch_mirror_before_timeout = true; -SYSCTL_BOOL(_kern_geom_mirror, OID_AUTO, launch_mirror_before_timeout, - CTLFLAG_RWTUN, &g_launch_mirror_before_timeout, 0, - "If false, force gmirror to wait out the full kern.geom.mirror.timeout " - "before launching mirrors"); static u_int g_mirror_timeout = 4; SYSCTL_UINT(_kern_geom_mirror, OID_AUTO, timeout, CTLFLAG_RWTUN, &g_mirror_timeout, 0, "Time to wait on all mirror components"); @@ -115,8 +110,6 @@ static int g_mirror_update_disk(struct g_mirror_disk * static void g_mirror_update_device(struct g_mirror_softc *sc, bool force); static void g_mirror_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp, struct g_consumer *cp, struct g_provider *pp); -static int g_mirror_refresh_device(struct g_mirror_softc *sc, - const struct g_provider *pp, const struct g_mirror_metadata *md); static void g_mirror_sync_reinit(const struct g_mirror_disk *disk, struct bio *bp, off_t offset); static void g_mirror_sync_stop(struct g_mirror_disk *disk, int type); @@ -479,10 +472,6 @@ g_mirror_init_disk(struct g_mirror_softc *sc, struct g disk->d_sync.ds_update_ts = time_uptime; disk->d_genid = md->md_genid; disk->d_sync.ds_syncid = md->md_syncid; - disk->d_init_ndisks = md->md_all; - disk->d_init_slice = md->md_slice; - disk->d_init_balance = md->md_balance; - disk->d_init_mediasize = md->md_mediasize; if (errorp != NULL) *errorp = 0; return (disk); @@ -2373,74 +2362,17 @@ g_mirror_update_device(struct g_mirror_softc *sc, bool case G_MIRROR_DEVICE_STATE_STARTING: { struct g_mirror_disk *pdisk, *tdisk; - const char *mismatch; - uintmax_t found, newest; - u_int dirty, ndisks; + u_int dirty, ndisks, genid, syncid; + bool broken; - /* Pre-flight checks */ - LIST_FOREACH_SAFE(disk, &sc->sc_disks, d_next, tdisk) { - /* - * Confirm we already detected the newest genid. - */ - KASSERT(sc->sc_genid >= disk->d_genid, - ("%s: found newer genid %u (sc:%p had %u).", __func__, - disk->d_genid, sc, sc->sc_genid)); - - /* Kick out any previously tasted stale components. */ - if (disk->d_genid < sc->sc_genid) { - G_MIRROR_DEBUG(0, "Stale 'genid' field on %s " - "(device %s) (component=%u latest=%u), skipping.", - g_mirror_get_diskname(disk), sc->sc_name, - disk->d_genid, sc->sc_genid); - g_mirror_destroy_disk(disk); - sc->sc_bump_id |= G_MIRROR_BUMP_SYNCID; - continue; - } - - /* - * Confirm we already detected the newest syncid. - */ - KASSERT(sc->sc_syncid >= disk->d_sync.ds_syncid, - ("%s: found newer syncid %u (sc:%p had %u).", - __func__, disk->d_sync.ds_syncid, sc, - sc->sc_syncid)); - -#define DETECT_MISMATCH(field, name) \ - if (mismatch == NULL && \ - disk->d_init_ ## field != sc->sc_ ## field) { \ - mismatch = name; \ - found = (intmax_t)disk->d_init_ ## field; \ - newest = (intmax_t)sc->sc_ ## field; \ - } - mismatch = NULL; - DETECT_MISMATCH(ndisks, "md_all"); - DETECT_MISMATCH(balance, "md_balance"); - DETECT_MISMATCH(slice, "md_slice"); - DETECT_MISMATCH(mediasize, "md_mediasize"); -#undef DETECT_MISMATCH - if (mismatch != NULL) { - G_MIRROR_DEBUG(0, "Found a mismatching '%s' " - "field on %s (device %s) (found=%ju " - "newest=%ju).", mismatch, - g_mirror_get_diskname(disk), sc->sc_name, - found, newest); - g_mirror_destroy_disk(disk); - sc->sc_bump_id |= G_MIRROR_BUMP_SYNCID; - continue; - } - } - KASSERT(sc->sc_provider == NULL, ("Non-NULL provider in STARTING state (%s).", sc->sc_name)); /* - * Are we ready? If the timeout (force is true) has expired, and - * any disks are present, then yes. If we're permitted to launch - * before the timeout has expired and the expected number of - * current-generation mirror disks have been tasted, then yes. + * Are we ready? We are, if all disks are connected or + * if we have any disks and 'force' is true. */ ndisks = g_mirror_ndisks(sc, -1); - if ((force && ndisks > 0) || - (g_launch_mirror_before_timeout && ndisks == sc->sc_ndisks)) { + if (sc->sc_ndisks == ndisks || (force && ndisks > 0)) { ; } else if (ndisks == 0) { /* @@ -2488,6 +2420,42 @@ g_mirror_update_device(struct g_mirror_softc *sc, bool } /* + * Find the biggest genid. + */ + genid = 0; + LIST_FOREACH(disk, &sc->sc_disks, d_next) { + if (disk->d_genid > genid) + genid = disk->d_genid; + } + sc->sc_genid = genid; + /* + * Remove all disks without the biggest genid. + */ + broken = false; + LIST_FOREACH_SAFE(disk, &sc->sc_disks, d_next, tdisk) { + if (disk->d_genid < genid) { + G_MIRROR_DEBUG(0, + "Component %s (device %s) broken, skipping.", + g_mirror_get_diskname(disk), sc->sc_name); + g_mirror_destroy_disk(disk); + /* + * Bump the syncid in case we discover a healthy + * replacement disk after starting the mirror. + */ + broken = true; + } + } + + /* + * Find the biggest syncid. + */ + syncid = 0; + LIST_FOREACH(disk, &sc->sc_disks, d_next) { + if (disk->d_sync.ds_syncid > syncid) + syncid = disk->d_sync.ds_syncid; + } + + /* * Here we need to look for dirty disks and if all disks * with the biggest syncid are dirty, we have to choose * one with the biggest priority and rebuild the rest. @@ -2500,7 +2468,7 @@ g_mirror_update_device(struct g_mirror_softc *sc, bool dirty = ndisks = 0; pdisk = NULL; LIST_FOREACH(disk, &sc->sc_disks, d_next) { - if (disk->d_sync.ds_syncid != sc->sc_syncid) + if (disk->d_sync.ds_syncid != syncid) continue; if ((disk->d_flags & G_MIRROR_DISK_FLAG_SYNCHRONIZING) != 0) { @@ -2527,7 +2495,7 @@ g_mirror_update_device(struct g_mirror_softc *sc, bool "master disk for synchronization.", g_mirror_get_diskname(pdisk), sc->sc_name); LIST_FOREACH(disk, &sc->sc_disks, d_next) { - if (disk->d_sync.ds_syncid != sc->sc_syncid) + if (disk->d_sync.ds_syncid != syncid) continue; if ((disk->d_flags & G_MIRROR_DISK_FLAG_SYNCHRONIZING) != 0) { @@ -2548,7 +2516,7 @@ g_mirror_update_device(struct g_mirror_softc *sc, bool * We have some non-dirty disks. */ LIST_FOREACH(disk, &sc->sc_disks, d_next) { - if (disk->d_sync.ds_syncid != sc->sc_syncid) + if (disk->d_sync.ds_syncid != syncid) continue; if ((disk->d_flags & G_MIRROR_DISK_FLAG_SYNCHRONIZING) != 0) { @@ -2564,7 +2532,8 @@ g_mirror_update_device(struct g_mirror_softc *sc, bool /* Reset hint. */ sc->sc_hint = NULL; - if (force) { + sc->sc_syncid = syncid; + if (force || broken) { /* Remember to bump syncid on first write. */ sc->sc_bump_id |= G_MIRROR_BUMP_SYNCID; } @@ -2901,23 +2870,37 @@ g_mirror_check_metadata(struct g_mirror_softc *sc, str struct g_mirror_metadata *md) { - G_MIRROR_DEBUG(2, "%s: md_did 0x%u disk %s device %s md_all 0x%x " - "sc_ndisks 0x%x md_slice 0x%x sc_slice 0x%x md_balance 0x%x " - "sc_balance 0x%x sc_mediasize 0x%lx pp_mediasize 0x%lx " - "md_sectorsize 0x%x sc_sectorsize 0x%x md_mflags 0x%lx " - "md_dflags 0x%lx md_syncid 0x%x md_genid 0x%x md_priority 0x%x " - "sc_state 0x%x.", - __func__, md->md_did, pp->name, sc->sc_name, md->md_all, - sc->sc_ndisks, md->md_slice, sc->sc_slice, md->md_balance, - sc->sc_balance, sc->sc_mediasize, pp->mediasize, md->md_sectorsize, - sc->sc_sectorsize, md->md_mflags, md->md_dflags, md->md_syncid, - md->md_genid, md->md_priority, sc->sc_state); - if (g_mirror_id2disk(sc, md->md_did) != NULL) { G_MIRROR_DEBUG(1, "Disk %s (id=%u) already exists, skipping.", pp->name, md->md_did); return (EEXIST); } + if (md->md_all != sc->sc_ndisks) { + G_MIRROR_DEBUG(1, + "Invalid '%s' field on disk %s (device %s), skipping.", + "md_all", pp->name, sc->sc_name); + return (EINVAL); + } + if (md->md_slice != sc->sc_slice) { + G_MIRROR_DEBUG(1, + "Invalid '%s' field on disk %s (device %s), skipping.", + "md_slice", pp->name, sc->sc_name); + return (EINVAL); + } + if (md->md_balance != sc->sc_balance) { + G_MIRROR_DEBUG(1, + "Invalid '%s' field on disk %s (device %s), skipping.", + "md_balance", pp->name, sc->sc_name); + return (EINVAL); + } +#if 0 + if (md->md_mediasize != sc->sc_mediasize) { + G_MIRROR_DEBUG(1, + "Invalid '%s' field on disk %s (device %s), skipping.", + "md_mediasize", pp->name, sc->sc_name); + return (EINVAL); + } +#endif if (sc->sc_mediasize > pp->mediasize) { G_MIRROR_DEBUG(1, "Invalid size of disk %s (device %s), skipping.", pp->name, @@ -2964,21 +2947,12 @@ g_mirror_add_disk(struct g_mirror_softc *sc, struct g_ error = g_mirror_check_metadata(sc, pp, md); if (error != 0) return (error); - - if (md->md_genid < sc->sc_genid) { + if (sc->sc_state == G_MIRROR_DEVICE_STATE_RUNNING && + md->md_genid < sc->sc_genid) { G_MIRROR_DEBUG(0, "Component %s (device %s) broken, skipping.", pp->name, sc->sc_name); return (EINVAL); } - - /* - * If the component disk we're tasting has newer metadata than the - * STARTING gmirror device, refresh the device from the component. - */ - error = g_mirror_refresh_device(sc, pp, md); - if (error != 0) - return (error); - disk = g_mirror_init_disk(sc, pp, md, &error); if (disk == NULL) return (error); @@ -3055,21 +3029,6 @@ end: return (error); } -static void -g_mirror_reinit_from_metadata(struct g_mirror_softc *sc, - const struct g_mirror_metadata *md) -{ - - sc->sc_genid = md->md_genid; - sc->sc_syncid = md->md_syncid; - - sc->sc_slice = md->md_slice; - sc->sc_balance = md->md_balance; - sc->sc_mediasize = md->md_mediasize; - sc->sc_ndisks = md->md_all; - sc->sc_flags = md->md_mflags; -} - struct g_geom * g_mirror_create(struct g_class *mp, const struct g_mirror_metadata *md, u_int type) @@ -3097,8 +3056,12 @@ g_mirror_create(struct g_class *mp, const struct g_mir sc->sc_type = type; sc->sc_id = md->md_mid; - g_mirror_reinit_from_metadata(sc, md); + sc->sc_slice = md->md_slice; + sc->sc_balance = md->md_balance; + sc->sc_mediasize = md->md_mediasize; sc->sc_sectorsize = md->md_sectorsize; + sc->sc_ndisks = md->md_all; + sc->sc_flags = md->md_mflags; sc->sc_bump_id = 0; sc->sc_idle = 1; sc->sc_last_write = time_uptime; @@ -3519,52 +3482,6 @@ g_mirror_fini(struct g_class *mp) if (g_mirror_post_sync != NULL) EVENTHANDLER_DEREGISTER(shutdown_post_sync, g_mirror_post_sync); -} - -/* - * Refresh the mirror device's metadata when gmirror encounters a newer - * generation as the individual components are being added to the mirror set. - */ -static int -g_mirror_refresh_device(struct g_mirror_softc *sc, const struct g_provider *pp, - const struct g_mirror_metadata *md) -{ - - g_topology_assert_not(); - sx_assert(&sc->sc_lock, SX_XLOCKED); - - KASSERT(sc->sc_genid <= md->md_genid, - ("%s: attempted to refresh from stale component %s (device %s) " - "(%u < %u).", __func__, pp->name, sc->sc_name, md->md_genid, - sc->sc_genid)); - - if (sc->sc_genid > md->md_genid || (sc->sc_genid == md->md_genid && - sc->sc_syncid >= md->md_syncid)) - return (0); - - G_MIRROR_DEBUG(0, "Found newer version for device %s (genid: curr=%u " - "new=%u; syncid: curr=%u new=%u; ndisks: curr=%u new=%u; " - "provider=%s).", sc->sc_name, sc->sc_genid, md->md_genid, - sc->sc_syncid, md->md_syncid, sc->sc_ndisks, md->md_all, pp->name); - - if (sc->sc_state != G_MIRROR_DEVICE_STATE_STARTING) { - /* Probable data corruption detected */ - G_MIRROR_DEBUG(0, "Cannot refresh metadata in %s state " - "(device=%s genid=%u). A stale mirror device was launched.", - g_mirror_device_state2str(sc->sc_state), sc->sc_name, - sc->sc_genid); - return (EINVAL); - } - - /* Update softc */ - g_mirror_reinit_from_metadata(sc, md); - - G_MIRROR_DEBUG(1, "Refresh device %s (id=%u, state=%s) from disk %s " - "(genid=%u syncid=%u md_all=%u).", sc->sc_name, md->md_mid, - g_mirror_device_state2str(sc->sc_state), pp->name, md->md_genid, - md->md_syncid, (unsigned)md->md_all); - - return (0); } DECLARE_GEOM_CLASS(g_mirror_class, g_mirror); Modified: head/sys/geom/mirror/g_mirror.h ============================================================================== --- head/sys/geom/mirror/g_mirror.h Fri Dec 7 00:39:34 2018 (r341671) +++ head/sys/geom/mirror/g_mirror.h Fri Dec 7 00:47:05 2018 (r341672) @@ -148,10 +148,6 @@ struct g_mirror_disk { u_int d_genid; /* Disk's generation ID. */ struct g_mirror_disk_sync d_sync;/* Sync information. */ LIST_ENTRY(g_mirror_disk) d_next; - u_int d_init_ndisks; /* Initial number of mirror components */ - uint32_t d_init_slice; /* Initial slice size */ - uint8_t d_init_balance;/* Initial balance */ - uint64_t d_init_mediasize;/* Initial mediasize */ }; #define d_name d_consumer->provider->name Modified: head/tests/sys/geom/class/mirror/Makefile ============================================================================== --- head/tests/sys/geom/class/mirror/Makefile Fri Dec 7 00:39:34 2018 (r341671) +++ head/tests/sys/geom/class/mirror/Makefile Fri Dec 7 00:47:05 2018 (r341672) @@ -18,7 +18,6 @@ TAP_TESTS_SH+= 11_test TAP_TESTS_SH+= 12_test TAP_TESTS_SH+= 13_test -ATF_TESTS_SH+= component_selection ATF_TESTS_SH+= sync_error ${PACKAGE}FILES+= conf.sh Modified: head/tests/sys/geom/class/mirror/conf.sh ============================================================================== --- head/tests/sys/geom/class/mirror/conf.sh Fri Dec 7 00:39:34 2018 (r341671) +++ head/tests/sys/geom/class/mirror/conf.sh Fri Dec 7 00:47:05 2018 (r341672) @@ -19,35 +19,4 @@ syncwait() done } -consumerrefs() -{ - gclass=$1 - geom=$2 - - if [ $# -ne 2 ]; then - echo "Bad usage consumerrefs" >&2 - exit 1 - fi - - geom "${gclass}" list "${geom}" | \ - grep -A5 ^Consumers | \ - grep Mode | \ - cut -d: -f2 -} - -disconnectwait() -{ - gclass=$1 - geom=$2 - - if [ $# -ne 2 ]; then - echo "Bad usage disconnectwait" >&2 - exit 1 - fi - - while [ $(consumerrefs "$gclass" "$geom") != r0w0e0 ]; do - sleep 0.05 - done -} - . `dirname $0`/../geom_subr.sh From owner-svn-src-head@freebsd.org Fri Dec 7 02:44:06 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EFD5C1325FCF; Fri, 7 Dec 2018 02:44:05 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 929BB72981; Fri, 7 Dec 2018 02:44:05 +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 6F6EA5060; Fri, 7 Dec 2018 02:44:05 +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 wB72i5om044722; Fri, 7 Dec 2018 02:44:05 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB72i4LT044716; Fri, 7 Dec 2018 02:44:04 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201812070244.wB72i4LT044716@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Fri, 7 Dec 2018 02:44:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341674 - in head: sys/geom/mirror tests/sys/geom/class/mirror X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head: sys/geom/mirror tests/sys/geom/class/mirror X-SVN-Commit-Revision: 341674 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 929BB72981 X-Spamd-Result: default: False [-1.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.990,0]; NEURAL_SPAM_LONG(0.01)[0.005,0]; NEURAL_HAM_SHORT(-0.96)[-0.963,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 07 Dec 2018 02:44:06 -0000 Author: cem Date: Fri Dec 7 02:44:04 2018 New Revision: 341674 URL: https://svnweb.freebsd.org/changeset/base/341674 Log: gmirror: Evaluate mirror components against newest metadata copy Re-apply r341665 with format strings fixed. If we happen to taste a stale mirror component first, don't reject valid, newer components that have differing metadata from the stale component (during STARTING). Instead, update our view of the most recent metadata as we taste components. Like mediasize beforehand, remove some checks from g_mirror_check_metadata which would evict valid components due to metadata that can change over a mirror's lifetime. g_mirror_check_metadata is invoked long before we check genid/syncid and decide which component(s) are newest and whether or not we have quorum. Before checking if we can enter RUNNING (i.e., we have quorum) after a NEW component is added, first remove any known stale or inconsistent disks from the mirrorset, rather than removing them *after* deciding we have quorum. Check if we have quorum after removing these components. Additionally, add a knob, kern.geom.mirror.launch_mirror_before_timeout, to force gmirrors to wait out the full timeout (kern.geom.mirror.timeout) before transitioning from STARTING to RUNNING. This is a kludge to help ensure all eligible, boot-time available mirror components are tasted before RUNNING a gmirror. Add a basic test case for STARTING -> RUNNING startup behavior around stale genids. PR: 232671, 232835 Submitted by: Cindy Yang (previous version) Reviewed by: markj (kernel portions) Discussed with: asomers, Cindy Yang Tested by: pho Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D18062 Added: head/tests/sys/geom/class/mirror/component_selection.sh - copied unchanged from r341671, head/tests/sys/geom/class/mirror/component_selection.sh Modified: head/sys/geom/mirror/g_mirror.c head/sys/geom/mirror/g_mirror.h head/tests/sys/geom/class/mirror/Makefile head/tests/sys/geom/class/mirror/conf.sh Modified: head/sys/geom/mirror/g_mirror.c ============================================================================== --- head/sys/geom/mirror/g_mirror.c Fri Dec 7 00:50:02 2018 (r341673) +++ head/sys/geom/mirror/g_mirror.c Fri Dec 7 02:44:04 2018 (r341674) @@ -59,6 +59,11 @@ static SYSCTL_NODE(_kern_geom, OID_AUTO, mirror, CTLFL int g_mirror_debug = 0; SYSCTL_INT(_kern_geom_mirror, OID_AUTO, debug, CTLFLAG_RWTUN, &g_mirror_debug, 0, "Debug level"); +bool g_launch_mirror_before_timeout = true; +SYSCTL_BOOL(_kern_geom_mirror, OID_AUTO, launch_mirror_before_timeout, + CTLFLAG_RWTUN, &g_launch_mirror_before_timeout, 0, + "If false, force gmirror to wait out the full kern.geom.mirror.timeout " + "before launching mirrors"); static u_int g_mirror_timeout = 4; SYSCTL_UINT(_kern_geom_mirror, OID_AUTO, timeout, CTLFLAG_RWTUN, &g_mirror_timeout, 0, "Time to wait on all mirror components"); @@ -110,6 +115,8 @@ static int g_mirror_update_disk(struct g_mirror_disk * static void g_mirror_update_device(struct g_mirror_softc *sc, bool force); static void g_mirror_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp, struct g_consumer *cp, struct g_provider *pp); +static int g_mirror_refresh_device(struct g_mirror_softc *sc, + const struct g_provider *pp, const struct g_mirror_metadata *md); static void g_mirror_sync_reinit(const struct g_mirror_disk *disk, struct bio *bp, off_t offset); static void g_mirror_sync_stop(struct g_mirror_disk *disk, int type); @@ -472,6 +479,10 @@ g_mirror_init_disk(struct g_mirror_softc *sc, struct g disk->d_sync.ds_update_ts = time_uptime; disk->d_genid = md->md_genid; disk->d_sync.ds_syncid = md->md_syncid; + disk->d_init_ndisks = md->md_all; + disk->d_init_slice = md->md_slice; + disk->d_init_balance = md->md_balance; + disk->d_init_mediasize = md->md_mediasize; if (errorp != NULL) *errorp = 0; return (disk); @@ -2362,17 +2373,74 @@ g_mirror_update_device(struct g_mirror_softc *sc, bool case G_MIRROR_DEVICE_STATE_STARTING: { struct g_mirror_disk *pdisk, *tdisk; - u_int dirty, ndisks, genid, syncid; - bool broken; + const char *mismatch; + uintmax_t found, newest; + u_int dirty, ndisks; + /* Pre-flight checks */ + LIST_FOREACH_SAFE(disk, &sc->sc_disks, d_next, tdisk) { + /* + * Confirm we already detected the newest genid. + */ + KASSERT(sc->sc_genid >= disk->d_genid, + ("%s: found newer genid %u (sc:%p had %u).", __func__, + disk->d_genid, sc, sc->sc_genid)); + + /* Kick out any previously tasted stale components. */ + if (disk->d_genid < sc->sc_genid) { + G_MIRROR_DEBUG(0, "Stale 'genid' field on %s " + "(device %s) (component=%u latest=%u), skipping.", + g_mirror_get_diskname(disk), sc->sc_name, + disk->d_genid, sc->sc_genid); + g_mirror_destroy_disk(disk); + sc->sc_bump_id |= G_MIRROR_BUMP_SYNCID; + continue; + } + + /* + * Confirm we already detected the newest syncid. + */ + KASSERT(sc->sc_syncid >= disk->d_sync.ds_syncid, + ("%s: found newer syncid %u (sc:%p had %u).", + __func__, disk->d_sync.ds_syncid, sc, + sc->sc_syncid)); + +#define DETECT_MISMATCH(field, name) \ + if (mismatch == NULL && \ + disk->d_init_ ## field != sc->sc_ ## field) { \ + mismatch = name; \ + found = (intmax_t)disk->d_init_ ## field; \ + newest = (intmax_t)sc->sc_ ## field; \ + } + mismatch = NULL; + DETECT_MISMATCH(ndisks, "md_all"); + DETECT_MISMATCH(balance, "md_balance"); + DETECT_MISMATCH(slice, "md_slice"); + DETECT_MISMATCH(mediasize, "md_mediasize"); +#undef DETECT_MISMATCH + if (mismatch != NULL) { + G_MIRROR_DEBUG(0, "Found a mismatching '%s' " + "field on %s (device %s) (found=%ju " + "newest=%ju).", mismatch, + g_mirror_get_diskname(disk), sc->sc_name, + found, newest); + g_mirror_destroy_disk(disk); + sc->sc_bump_id |= G_MIRROR_BUMP_SYNCID; + continue; + } + } + KASSERT(sc->sc_provider == NULL, ("Non-NULL provider in STARTING state (%s).", sc->sc_name)); /* - * Are we ready? We are, if all disks are connected or - * if we have any disks and 'force' is true. + * Are we ready? If the timeout (force is true) has expired, and + * any disks are present, then yes. If we're permitted to launch + * before the timeout has expired and the expected number of + * current-generation mirror disks have been tasted, then yes. */ ndisks = g_mirror_ndisks(sc, -1); - if (sc->sc_ndisks == ndisks || (force && ndisks > 0)) { + if ((force && ndisks > 0) || + (g_launch_mirror_before_timeout && ndisks == sc->sc_ndisks)) { ; } else if (ndisks == 0) { /* @@ -2420,42 +2488,6 @@ g_mirror_update_device(struct g_mirror_softc *sc, bool } /* - * Find the biggest genid. - */ - genid = 0; - LIST_FOREACH(disk, &sc->sc_disks, d_next) { - if (disk->d_genid > genid) - genid = disk->d_genid; - } - sc->sc_genid = genid; - /* - * Remove all disks without the biggest genid. - */ - broken = false; - LIST_FOREACH_SAFE(disk, &sc->sc_disks, d_next, tdisk) { - if (disk->d_genid < genid) { - G_MIRROR_DEBUG(0, - "Component %s (device %s) broken, skipping.", - g_mirror_get_diskname(disk), sc->sc_name); - g_mirror_destroy_disk(disk); - /* - * Bump the syncid in case we discover a healthy - * replacement disk after starting the mirror. - */ - broken = true; - } - } - - /* - * Find the biggest syncid. - */ - syncid = 0; - LIST_FOREACH(disk, &sc->sc_disks, d_next) { - if (disk->d_sync.ds_syncid > syncid) - syncid = disk->d_sync.ds_syncid; - } - - /* * Here we need to look for dirty disks and if all disks * with the biggest syncid are dirty, we have to choose * one with the biggest priority and rebuild the rest. @@ -2468,7 +2500,7 @@ g_mirror_update_device(struct g_mirror_softc *sc, bool dirty = ndisks = 0; pdisk = NULL; LIST_FOREACH(disk, &sc->sc_disks, d_next) { - if (disk->d_sync.ds_syncid != syncid) + if (disk->d_sync.ds_syncid != sc->sc_syncid) continue; if ((disk->d_flags & G_MIRROR_DISK_FLAG_SYNCHRONIZING) != 0) { @@ -2495,7 +2527,7 @@ g_mirror_update_device(struct g_mirror_softc *sc, bool "master disk for synchronization.", g_mirror_get_diskname(pdisk), sc->sc_name); LIST_FOREACH(disk, &sc->sc_disks, d_next) { - if (disk->d_sync.ds_syncid != syncid) + if (disk->d_sync.ds_syncid != sc->sc_syncid) continue; if ((disk->d_flags & G_MIRROR_DISK_FLAG_SYNCHRONIZING) != 0) { @@ -2516,7 +2548,7 @@ g_mirror_update_device(struct g_mirror_softc *sc, bool * We have some non-dirty disks. */ LIST_FOREACH(disk, &sc->sc_disks, d_next) { - if (disk->d_sync.ds_syncid != syncid) + if (disk->d_sync.ds_syncid != sc->sc_syncid) continue; if ((disk->d_flags & G_MIRROR_DISK_FLAG_SYNCHRONIZING) != 0) { @@ -2532,8 +2564,7 @@ g_mirror_update_device(struct g_mirror_softc *sc, bool /* Reset hint. */ sc->sc_hint = NULL; - sc->sc_syncid = syncid; - if (force || broken) { + if (force) { /* Remember to bump syncid on first write. */ sc->sc_bump_id |= G_MIRROR_BUMP_SYNCID; } @@ -2870,37 +2901,24 @@ g_mirror_check_metadata(struct g_mirror_softc *sc, str struct g_mirror_metadata *md) { + G_MIRROR_DEBUG(2, "%s: md_did 0x%u disk %s device %s md_all 0x%x " + "sc_ndisks 0x%x md_slice 0x%x sc_slice 0x%x md_balance 0x%x " + "sc_balance 0x%x sc_mediasize 0x%jx pp_mediasize 0x%jx " + "md_sectorsize 0x%x sc_sectorsize 0x%x md_mflags 0x%jx " + "md_dflags 0x%jx md_syncid 0x%x md_genid 0x%x md_priority 0x%x " + "sc_state 0x%x.", + __func__, md->md_did, pp->name, sc->sc_name, md->md_all, + sc->sc_ndisks, md->md_slice, sc->sc_slice, md->md_balance, + sc->sc_balance, (uintmax_t)sc->sc_mediasize, + (uintmax_t)pp->mediasize, md->md_sectorsize, sc->sc_sectorsize, + (uintmax_t)md->md_mflags, (uintmax_t)md->md_dflags, md->md_syncid, + md->md_genid, md->md_priority, sc->sc_state); + if (g_mirror_id2disk(sc, md->md_did) != NULL) { G_MIRROR_DEBUG(1, "Disk %s (id=%u) already exists, skipping.", pp->name, md->md_did); return (EEXIST); } - if (md->md_all != sc->sc_ndisks) { - G_MIRROR_DEBUG(1, - "Invalid '%s' field on disk %s (device %s), skipping.", - "md_all", pp->name, sc->sc_name); - return (EINVAL); - } - if (md->md_slice != sc->sc_slice) { - G_MIRROR_DEBUG(1, - "Invalid '%s' field on disk %s (device %s), skipping.", - "md_slice", pp->name, sc->sc_name); - return (EINVAL); - } - if (md->md_balance != sc->sc_balance) { - G_MIRROR_DEBUG(1, - "Invalid '%s' field on disk %s (device %s), skipping.", - "md_balance", pp->name, sc->sc_name); - return (EINVAL); - } -#if 0 - if (md->md_mediasize != sc->sc_mediasize) { - G_MIRROR_DEBUG(1, - "Invalid '%s' field on disk %s (device %s), skipping.", - "md_mediasize", pp->name, sc->sc_name); - return (EINVAL); - } -#endif if (sc->sc_mediasize > pp->mediasize) { G_MIRROR_DEBUG(1, "Invalid size of disk %s (device %s), skipping.", pp->name, @@ -2947,12 +2965,21 @@ g_mirror_add_disk(struct g_mirror_softc *sc, struct g_ error = g_mirror_check_metadata(sc, pp, md); if (error != 0) return (error); - if (sc->sc_state == G_MIRROR_DEVICE_STATE_RUNNING && - md->md_genid < sc->sc_genid) { + + if (md->md_genid < sc->sc_genid) { G_MIRROR_DEBUG(0, "Component %s (device %s) broken, skipping.", pp->name, sc->sc_name); return (EINVAL); } + + /* + * If the component disk we're tasting has newer metadata than the + * STARTING gmirror device, refresh the device from the component. + */ + error = g_mirror_refresh_device(sc, pp, md); + if (error != 0) + return (error); + disk = g_mirror_init_disk(sc, pp, md, &error); if (disk == NULL) return (error); @@ -3029,6 +3056,21 @@ end: return (error); } +static void +g_mirror_reinit_from_metadata(struct g_mirror_softc *sc, + const struct g_mirror_metadata *md) +{ + + sc->sc_genid = md->md_genid; + sc->sc_syncid = md->md_syncid; + + sc->sc_slice = md->md_slice; + sc->sc_balance = md->md_balance; + sc->sc_mediasize = md->md_mediasize; + sc->sc_ndisks = md->md_all; + sc->sc_flags = md->md_mflags; +} + struct g_geom * g_mirror_create(struct g_class *mp, const struct g_mirror_metadata *md, u_int type) @@ -3056,12 +3098,8 @@ g_mirror_create(struct g_class *mp, const struct g_mir sc->sc_type = type; sc->sc_id = md->md_mid; - sc->sc_slice = md->md_slice; - sc->sc_balance = md->md_balance; - sc->sc_mediasize = md->md_mediasize; + g_mirror_reinit_from_metadata(sc, md); sc->sc_sectorsize = md->md_sectorsize; - sc->sc_ndisks = md->md_all; - sc->sc_flags = md->md_mflags; sc->sc_bump_id = 0; sc->sc_idle = 1; sc->sc_last_write = time_uptime; @@ -3482,6 +3520,52 @@ g_mirror_fini(struct g_class *mp) if (g_mirror_post_sync != NULL) EVENTHANDLER_DEREGISTER(shutdown_post_sync, g_mirror_post_sync); +} + +/* + * Refresh the mirror device's metadata when gmirror encounters a newer + * generation as the individual components are being added to the mirror set. + */ +static int +g_mirror_refresh_device(struct g_mirror_softc *sc, const struct g_provider *pp, + const struct g_mirror_metadata *md) +{ + + g_topology_assert_not(); + sx_assert(&sc->sc_lock, SX_XLOCKED); + + KASSERT(sc->sc_genid <= md->md_genid, + ("%s: attempted to refresh from stale component %s (device %s) " + "(%u < %u).", __func__, pp->name, sc->sc_name, md->md_genid, + sc->sc_genid)); + + if (sc->sc_genid > md->md_genid || (sc->sc_genid == md->md_genid && + sc->sc_syncid >= md->md_syncid)) + return (0); + + G_MIRROR_DEBUG(0, "Found newer version for device %s (genid: curr=%u " + "new=%u; syncid: curr=%u new=%u; ndisks: curr=%u new=%u; " + "provider=%s).", sc->sc_name, sc->sc_genid, md->md_genid, + sc->sc_syncid, md->md_syncid, sc->sc_ndisks, md->md_all, pp->name); + + if (sc->sc_state != G_MIRROR_DEVICE_STATE_STARTING) { + /* Probable data corruption detected */ + G_MIRROR_DEBUG(0, "Cannot refresh metadata in %s state " + "(device=%s genid=%u). A stale mirror device was launched.", + g_mirror_device_state2str(sc->sc_state), sc->sc_name, + sc->sc_genid); + return (EINVAL); + } + + /* Update softc */ + g_mirror_reinit_from_metadata(sc, md); + + G_MIRROR_DEBUG(1, "Refresh device %s (id=%u, state=%s) from disk %s " + "(genid=%u syncid=%u md_all=%u).", sc->sc_name, md->md_mid, + g_mirror_device_state2str(sc->sc_state), pp->name, md->md_genid, + md->md_syncid, (unsigned)md->md_all); + + return (0); } DECLARE_GEOM_CLASS(g_mirror_class, g_mirror); Modified: head/sys/geom/mirror/g_mirror.h ============================================================================== --- head/sys/geom/mirror/g_mirror.h Fri Dec 7 00:50:02 2018 (r341673) +++ head/sys/geom/mirror/g_mirror.h Fri Dec 7 02:44:04 2018 (r341674) @@ -148,6 +148,10 @@ struct g_mirror_disk { u_int d_genid; /* Disk's generation ID. */ struct g_mirror_disk_sync d_sync;/* Sync information. */ LIST_ENTRY(g_mirror_disk) d_next; + u_int d_init_ndisks; /* Initial number of mirror components */ + uint32_t d_init_slice; /* Initial slice size */ + uint8_t d_init_balance;/* Initial balance */ + uint64_t d_init_mediasize;/* Initial mediasize */ }; #define d_name d_consumer->provider->name Modified: head/tests/sys/geom/class/mirror/Makefile ============================================================================== --- head/tests/sys/geom/class/mirror/Makefile Fri Dec 7 00:50:02 2018 (r341673) +++ head/tests/sys/geom/class/mirror/Makefile Fri Dec 7 02:44:04 2018 (r341674) @@ -18,6 +18,7 @@ TAP_TESTS_SH+= 11_test TAP_TESTS_SH+= 12_test TAP_TESTS_SH+= 13_test +ATF_TESTS_SH+= component_selection ATF_TESTS_SH+= sync_error ${PACKAGE}FILES+= conf.sh Copied: head/tests/sys/geom/class/mirror/component_selection.sh (from r341671, head/tests/sys/geom/class/mirror/component_selection.sh) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/geom/class/mirror/component_selection.sh Fri Dec 7 02:44:04 2018 (r341674, copy of r341671, head/tests/sys/geom/class/mirror/component_selection.sh) @@ -0,0 +1,133 @@ +# $FreeBSD$ + +atf_test_case run_latest_genid cleanup +run_latest_genid_head() +{ + atf_set "descr" \ + "Ensure that we properly select components (latest genid) during STARTING." + atf_set "require.user" "root" +} +run_latest_genid_body() +{ + . $(atf_get_srcdir)/conf.sh + + f1=$(mktemp ${base}.XXXXXX) + f2=$(mktemp ${base}.XXXXXX) + f3=$(mktemp ${base}.XXXXXX) + rnd1=$(mktemp ${base}.XXXXXX) + rnd2=$(mktemp ${base}.XXXXXX) + + atf_check truncate -s 2M $f1 + atf_check truncate -s 2M $f2 + atf_check truncate -s 2M $f3 + dd if=/dev/urandom bs=512 count=1 of="$rnd1" + dd if=/dev/urandom bs=512 count=1 of="$rnd2" + + md1=$(attach_md -t vnode -f ${f1}) + md2=$(attach_md -t vnode -f ${f2}) + md3=$(attach_md -t vnode -f ${f3}) + + # Use a gnop for md1 just for consistency; it's not used for anything. + atf_check gnop create $md1 + atf_check gnop create $md2 + atf_check gnop create $md3 + # Hardcode component names so that the non-.nop device isn't tasted + # instead. + atf_check gmirror label -h $name ${md1}.nop + devwait + + atf_check gmirror insert -h $name ${md2}.nop + atf_check gmirror insert -h $name ${md3}.nop + syncwait + + # Fail mirror 3, writing known contents to mirror 1+2 block 1 + atf_check -s exit:0 -e empty -o empty \ + gnop configure -w 100 ${md3}.nop + atf_check -s exit:0 dd if="$rnd1" bs=512 count=1 oseek=1 conv=notrunc \ + of=/dev/mirror/$name status=none + + disconnectwait nop "${md3}.nop" + + # Should have two mirrors remaining after md3 was evicted + atf_check [ $(gmirror status -s $name | wc -l) -eq 2 ] + atf_check -s exit:0 -o match:"DEGRADED ${md1}.nop \(ACTIVE\)" \ + gmirror status -s $name + atf_check -s exit:0 -o match:"DEGRADED ${md2}.nop \(ACTIVE\)" \ + gmirror status -s $name + + # Repeat: + # Fail mirror 2, writing known contents to mirror 1 block 2 + atf_check -s exit:0 -e empty -o empty \ + gnop configure -w 100 ${md2}.nop + atf_check -s exit:0 dd if="$rnd2" bs=512 count=2 oseek=1 conv=notrunc \ + of=/dev/mirror/$name status=none + + disconnectwait nop "${md2}.nop" + + # Should have one mirror remaining after md2 was evicted + atf_check [ $(gmirror status -s $name | wc -l) -eq 1 ] + atf_check -s exit:0 -o match:"DEGRADED ${md1}.nop \(ACTIVE\)" \ + gmirror status -s $name + + # Stop the mirror and remove the pieces so gmirror can't see them. + atf_check gmirror stop $name + atf_check gnop destroy ${md1}.nop + atf_check gnop destroy ${md2}.nop + atf_check gnop destroy ${md3}.nop + + # Rebuild; spin up "disk" with lowest genid + atf_check gnop create $md3 + md3gen=$(gmirror dump /dev/${md3}.nop | grep genid | cut -d: -f2) + # Assert gmirror is referencing this component for now: + atf_check [ $(consumerrefs nop ${md3}.nop) = "r1w1e1" ] + + # Adding newer genid should kick out old component + atf_check gnop create $md2 + md2gen=$(gmirror dump /dev/${md2}.nop | grep genid | cut -d: -f2) + atf_check [ $md2gen -gt $md3gen ] + + disconnectwait nop "${md3}.nop" + + # Can't test this because 'status' doesn't exist until RUNNING: + #atf_check [ $(gmirror status -s $name | wc -l) -eq 1 ] + # But as a substitute, assert gmirror has dropped reference to staler + # component in favor of newer component: + atf_check [ $(consumerrefs nop ${md2}.nop) = "r1w1e1" ] + + # ditto + atf_check gnop create $md1 + md1gen=$(gmirror dump /dev/${md1}.nop | grep genid | cut -d: -f2) + atf_check [ $md1gen -gt $md2gen ] + + disconnectwait nop "${md2}.nop" + + # Assert gmirror has dropped reference to stale component in favor of + # newer component: + atf_check [ $(consumerrefs nop ${md1}.nop) = "r1w1e1" ] + + # gmirror won't start the mirror automatically with only one component + # ($md0) of configured three, so this waits out the + # kern.geom.mirror.timeout: + devwait + + atf_check [ $(gmirror status -s $name | wc -l) -eq 1 ] + atf_check -s exit:0 -o match:"DEGRADED ${md1}.nop \(ACTIVE\)" \ + gmirror status -s $name +} +run_latest_genid_cleanup() +{ + . $(atf_get_srcdir)/conf.sh + + if [ -f "$TEST_MDS_FILE" ]; then + while read test_md; do + echo "# Removing test gnop: ${test_md}.nop" + gnop destroy -f "${test_md}.nop" 2>/dev/null || : + done < "$TEST_MDS_FILE" + fi + gmirror_test_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case run_latest_genid +} Modified: head/tests/sys/geom/class/mirror/conf.sh ============================================================================== --- head/tests/sys/geom/class/mirror/conf.sh Fri Dec 7 00:50:02 2018 (r341673) +++ head/tests/sys/geom/class/mirror/conf.sh Fri Dec 7 02:44:04 2018 (r341674) @@ -19,4 +19,35 @@ syncwait() done } +consumerrefs() +{ + gclass=$1 + geom=$2 + + if [ $# -ne 2 ]; then + echo "Bad usage consumerrefs" >&2 + exit 1 + fi + + geom "${gclass}" list "${geom}" | \ + grep -A5 ^Consumers | \ + grep Mode | \ + cut -d: -f2 +} + +disconnectwait() +{ + gclass=$1 + geom=$2 + + if [ $# -ne 2 ]; then + echo "Bad usage disconnectwait" >&2 + exit 1 + fi + + while [ $(consumerrefs "$gclass" "$geom") != r0w0e0 ]; do + sleep 0.05 + done +} + . `dirname $0`/../geom_subr.sh From owner-svn-src-head@freebsd.org Fri Dec 7 03:13:37 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4576A1326ECD; Fri, 7 Dec 2018 03:13:37 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DAB7E73D84; Fri, 7 Dec 2018 03:13:36 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BA64055C7; Fri, 7 Dec 2018 03:13:36 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB73Da6J060782; Fri, 7 Dec 2018 03:13:36 GMT (envelope-from pjd@FreeBSD.org) Received: (from pjd@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB73Da47060781; Fri, 7 Dec 2018 03:13:36 GMT (envelope-from pjd@FreeBSD.org) Message-Id: <201812070313.wB73Da47060781@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pjd set sender to pjd@FreeBSD.org using -f From: Pawel Jakub Dawidek Date: Fri, 7 Dec 2018 03:13:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341675 - head/contrib/openbsm/bin/auditdistd X-SVN-Group: head X-SVN-Commit-Author: pjd X-SVN-Commit-Paths: head/contrib/openbsm/bin/auditdistd X-SVN-Commit-Revision: 341675 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: DAB7E73D84 X-Spamd-Result: default: False [-2.04 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.988,0]; NEURAL_HAM_LONG(-0.08)[-0.083,0]; NEURAL_HAM_SHORT(-0.97)[-0.971,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 07 Dec 2018 03:13:37 -0000 Author: pjd Date: Fri Dec 7 03:13:36 2018 New Revision: 341675 URL: https://svnweb.freebsd.org/changeset/base/341675 Log: Consider the following situation: The sender has .not_terminated file. It gets disconnected. The last trail file is then terminated without adding new data (this can happen for example when auditd is being stopped on the sender). After reconnect the .not_terminated was not renamed on the receiver as it should. We were already handling similar situation where the sender crashed and the .not_terminated trail file was renamed to .crash_recovery. Extend this case to handle the situation above. Modified: head/contrib/openbsm/bin/auditdistd/trail.c Modified: head/contrib/openbsm/bin/auditdistd/trail.c ============================================================================== --- head/contrib/openbsm/bin/auditdistd/trail.c Fri Dec 7 02:44:04 2018 (r341674) +++ head/contrib/openbsm/bin/auditdistd/trail.c Fri Dec 7 03:13:36 2018 (r341675) @@ -264,6 +264,12 @@ again: * 2. It is fully sent, but is not terminated, so new data can be * appended still, or * 3. It is fully sent but file name has changed. + * There are two cases here: + * 3a. Sender has crashed and the name has changed from + * .not_terminated to .crash_recovery. + * 3b. Sender was disconnected, no new data was added to the file, + * but its name has changed from .not_terminated to terminated + * name. * * Note that we are fine if our .not_terminated or .crash_recovery file * is smaller than the one on the receiver side, as it is possible that @@ -275,7 +281,7 @@ again: (offset >= sb.st_size && trail_is_not_terminated(trail->tr_filename)) || (offset >= sb.st_size && trail_is_not_terminated(filename) && - trail_is_crash_recovery(trail->tr_filename))) { + !trail_is_not_terminated(trail->tr_filename))) { /* File was not fully send. Let's finish it. */ if (lseek(fd, offset, SEEK_SET) == -1) { pjdlog_errno(LOG_ERR, From owner-svn-src-head@freebsd.org Fri Dec 7 11:10:28 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7FE491334B4D; Fri, 7 Dec 2018 11:10:28 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 24C9F859BA; Fri, 7 Dec 2018 11:10:28 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E53D0123CB; Fri, 7 Dec 2018 11:10:27 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB7BAR3G007452; Fri, 7 Dec 2018 11:10:27 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB7BARkO007451; Fri, 7 Dec 2018 11:10:27 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201812071110.wB7BARkO007451@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Fri, 7 Dec 2018 11:10:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341679 - head/sys/arm/include X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: head/sys/arm/include X-SVN-Commit-Revision: 341679 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 24C9F859BA X-Spamd-Result: default: False [-2.03 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.988,0]; NEURAL_HAM_LONG(-0.08)[-0.083,0]; NEURAL_HAM_SHORT(-0.96)[-0.964,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 07 Dec 2018 11:10:28 -0000 Author: mmel Date: Fri Dec 7 11:10:27 2018 New Revision: 341679 URL: https://svnweb.freebsd.org/changeset/base/341679 Log: Fix cut&paste typo in atomic_fetchadd_64(). Reported by: Jia-Shiun Li MFC after: 1 week Modified: head/sys/arm/include/atomic-v6.h Modified: head/sys/arm/include/atomic-v6.h ============================================================================== --- head/sys/arm/include/atomic-v6.h Fri Dec 7 09:39:37 2018 (r341678) +++ head/sys/arm/include/atomic-v6.h Fri Dec 7 11:10:27 2018 (r341679) @@ -435,7 +435,7 @@ atomic_fetchadd_64(volatile uint64_t *p, uint64_t val) __asm __volatile( "1: \n" - " ldrexd %Q[tmp], %R[tmp], [%[ptr]] \n" + " ldrexd %Q[ret], %R[ret], [%[ptr]] \n" " adds %Q[tmp], %Q[ret], %Q[val] \n" " adc %R[tmp], %R[ret], %R[val] \n" " strexd %[exf], %Q[tmp], %R[tmp], [%[ptr]] \n" From owner-svn-src-head@freebsd.org Fri Dec 7 11:47:43 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 61BCE130A963; Fri, 7 Dec 2018 11:47:43 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 08BF586E5B; Fri, 7 Dec 2018 11:47:43 +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 DDF0712A3E; Fri, 7 Dec 2018 11:47:42 +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 wB7Blgm2027824; Fri, 7 Dec 2018 11:47:42 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB7Blgbf027823; Fri, 7 Dec 2018 11:47:42 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201812071147.wB7Blgbf027823@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Fri, 7 Dec 2018 11:47:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341680 - 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: 341680 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 08BF586E5B X-Spamd-Result: default: False [-2.00 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.988,0]; NEURAL_HAM_LONG(-0.08)[-0.083,0]; NEURAL_HAM_SHORT(-0.93)[-0.930,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 07 Dec 2018 11:47:43 -0000 Author: vmaffione Date: Fri Dec 7 11:47:42 2018 New Revision: 341680 URL: https://svnweb.freebsd.org/changeset/base/341680 Log: netmap: remove dead code obsoleted by iflib The iflib subsystem implements netmap support in a driver-independent way (sys/net/iflib.c). We can therefore remove the headers that used to implement netmap support for all the drivers now supported by iflib (em, igb, ixl, ixgbe, lem). MFC after: 1 week Deleted: head/sys/dev/netmap/if_em_netmap.h head/sys/dev/netmap/if_igb_netmap.h head/sys/dev/netmap/if_ixl_netmap.h head/sys/dev/netmap/if_lem_netmap.h head/sys/dev/netmap/ixgbe_netmap.h From owner-svn-src-head@freebsd.org Fri Dec 7 12:02:32 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D8030130B6D6; Fri, 7 Dec 2018 12:02:32 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7D4B9883AF; Fri, 7 Dec 2018 12:02:32 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 56BC712D67; Fri, 7 Dec 2018 12:02:32 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB7C2WxW038197; Fri, 7 Dec 2018 12:02:32 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB7C2WT8038196; Fri, 7 Dec 2018 12:02:32 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201812071202.wB7C2WT8038196@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 7 Dec 2018 12:02:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341681 - head/sys/cam/scsi X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/cam/scsi X-SVN-Commit-Revision: 341681 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7D4B9883AF X-Spamd-Result: default: False [-2.04 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.988,0]; NEURAL_HAM_SHORT(-0.97)[-0.966,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.08)[-0.083,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 07 Dec 2018 12:02:33 -0000 Author: avg Date: Fri Dec 7 12:02:31 2018 New Revision: 341681 URL: https://svnweb.freebsd.org/changeset/base/341681 Log: daprobedone: announce if a disk is write-protected MFC after: 2 weeks Modified: head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Fri Dec 7 11:47:42 2018 (r341680) +++ head/sys/cam/scsi/scsi_da.c Fri Dec 7 12:02:31 2018 (r341681) @@ -2472,6 +2472,11 @@ daprobedone(struct cam_periph *periph, union ccb *ccb) printf("%s%d: %s\n", periph->periph_name, periph->unit_number, buf); } + if ((softc->disk->d_flags & DISKFLAG_WRITE_PROTECT) != 0 && + (softc->flags & DA_FLAG_ANNOUNCED) == 0) { + printf("%s%d: Write Protected\n", periph->periph_name, + periph->unit_number); + } /* * Since our peripheral may be invalidated by an error From owner-svn-src-head@freebsd.org Fri Dec 7 12:05:12 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 01475130BA18; Fri, 7 Dec 2018 12:05:12 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 986FE886A0; Fri, 7 Dec 2018 12:05:11 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 719A412D6D; Fri, 7 Dec 2018 12:05:11 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB7C5BPh038351; Fri, 7 Dec 2018 12:05:11 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB7C5BvA038350; Fri, 7 Dec 2018 12:05:11 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201812071205.wB7C5BvA038350@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 7 Dec 2018 12:05:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341682 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 341682 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 986FE886A0 X-Spamd-Result: default: False [-2.04 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.988,0]; NEURAL_HAM_LONG(-0.08)[-0.083,0]; NEURAL_HAM_SHORT(-0.97)[-0.966,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 07 Dec 2018 12:05:12 -0000 Author: mjg Date: Fri Dec 7 12:05:11 2018 New Revision: 341682 URL: https://svnweb.freebsd.org/changeset/base/341682 Log: unr64: use locked variant if not __LP64__ The current ifdefs are not sufficient to distinguish 32- and 64- bit variants, which results e.g. in powerpc64 not using atomics. While some 32-bit archs provide 64-bit atomics, there is no huge advantage of using them on these platforms. Reported by: many Suggested by: jhb Sponsored by: The FreeBSD Foundation Modified: head/sys/sys/systm.h Modified: head/sys/sys/systm.h ============================================================================== --- head/sys/sys/systm.h Fri Dec 7 12:02:31 2018 (r341681) +++ head/sys/sys/systm.h Fri Dec 7 12:05:11 2018 (r341682) @@ -523,7 +523,7 @@ int alloc_unr_specific(struct unrhdr *uh, u_int item); int alloc_unrl(struct unrhdr *uh); void free_unr(struct unrhdr *uh, u_int item); -#if defined(__mips__) || defined(__powerpc__) +#ifndef __LP64__ #define UNR64_LOCKED #endif From owner-svn-src-head@freebsd.org Fri Dec 7 12:06:04 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3CC9F130BA70; Fri, 7 Dec 2018 12:06:04 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C9ED4887E8; Fri, 7 Dec 2018 12:06:03 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AAE5812D6E; Fri, 7 Dec 2018 12:06:03 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB7C63Is038428; Fri, 7 Dec 2018 12:06:03 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB7C63V0038426; Fri, 7 Dec 2018 12:06:03 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201812071206.wB7C63V0038426@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 7 Dec 2018 12:06:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341683 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 341683 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C9ED4887E8 X-Spamd-Result: default: False [-2.04 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.988,0]; NEURAL_HAM_SHORT(-0.97)[-0.966,0]; NEURAL_HAM_LONG(-0.08)[-0.083,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 07 Dec 2018 12:06:04 -0000 Author: mjg Date: Fri Dec 7 12:06:03 2018 New Revision: 341683 URL: https://svnweb.freebsd.org/changeset/base/341683 Log: Annotate Giant drop/pickup macros with __predict_false They are used in important places of the kernel with the lock not being held majority of the time. Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/kern_lock.c head/sys/sys/mutex.h Modified: head/sys/kern/kern_lock.c ============================================================================== --- head/sys/kern/kern_lock.c Fri Dec 7 12:05:11 2018 (r341682) +++ head/sys/kern/kern_lock.c Fri Dec 7 12:06:03 2018 (r341683) @@ -96,14 +96,14 @@ CTASSERT(LK_UNLOCKED == (LK_UNLOCKED & int _i = 0; \ WITNESS_SAVE_DECL(Giant) #define GIANT_RESTORE() do { \ - if (_i > 0) { \ + if (__predict_false(_i > 0)) { \ while (_i--) \ mtx_lock(&Giant); \ WITNESS_RESTORE(&Giant.lock_object, Giant); \ } \ } while (0) #define GIANT_SAVE() do { \ - if (mtx_owned(&Giant)) { \ + if (__predict_false(mtx_owned(&Giant))) { \ WITNESS_SAVE(&Giant.lock_object, Giant); \ while (mtx_owned(&Giant)) { \ _i++; \ Modified: head/sys/sys/mutex.h ============================================================================== --- head/sys/sys/mutex.h Fri Dec 7 12:05:11 2018 (r341682) +++ head/sys/sys/mutex.h Fri Dec 7 12:06:03 2018 (r341683) @@ -496,7 +496,7 @@ do { \ int _giantcnt = 0; \ WITNESS_SAVE_DECL(Giant); \ \ - if (mtx_owned(&Giant)) { \ + if (__predict_false(mtx_owned(&Giant))) { \ WITNESS_SAVE(&Giant.lock_object, Giant); \ for (_giantcnt = 0; mtx_owned(&Giant) && \ !SCHEDULER_STOPPED(); _giantcnt++) \ @@ -509,7 +509,7 @@ do { \ #define PARTIAL_PICKUP_GIANT() \ mtx_assert(&Giant, MA_NOTOWNED); \ - if (_giantcnt > 0) { \ + if (__predict_false(_giantcnt > 0)) { \ while (_giantcnt--) \ mtx_lock(&Giant); \ WITNESS_RESTORE(&Giant.lock_object, Giant); \ From owner-svn-src-head@freebsd.org Fri Dec 7 12:22:33 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B290C130C297; Fri, 7 Dec 2018 12:22:33 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 555B98910C; Fri, 7 Dec 2018 12:22:33 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 365C0130CF; Fri, 7 Dec 2018 12:22:33 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB7CMXWg048203; Fri, 7 Dec 2018 12:22:33 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB7CMWh3048198; Fri, 7 Dec 2018 12:22:32 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201812071222.wB7CMWh3048198@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 7 Dec 2018 12:22:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341684 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 341684 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 555B98910C X-Spamd-Result: default: False [-1.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.989,0]; NEURAL_HAM_SHORT(-0.97)[-0.968,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.02)[-0.024,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 07 Dec 2018 12:22:34 -0000 Author: mjg Date: Fri Dec 7 12:22:32 2018 New Revision: 341684 URL: https://svnweb.freebsd.org/changeset/base/341684 Log: Manage process-related IDs with bitmaps Currently unique pid allocation on fork often requires a full walk of process, group, session lists to make sure it is not used by anything. This has a side effect of requiring proctree to be held along with allproc, which adds more contention in poudriere -j 128. The patch below implements trivial bitmaps which gets rid of the problem. Dedicated lock is introduced to manage IDs. While here a bug was discovered: all processes would inherit reap id from the first process spawned by init. This had a side effect of keeping the ID used and when allocation rolls over to the beginning it keeps being skipped. The patch is loosely based on initial work by mjoras@. Reviewed by: kib Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/kern_exit.c head/sys/kern/kern_fork.c head/sys/kern/kern_proc.c head/sys/sys/proc.h Modified: head/sys/kern/kern_exit.c ============================================================================== --- head/sys/kern/kern_exit.c Fri Dec 7 12:06:03 2018 (r341683) +++ head/sys/kern/kern_exit.c Fri Dec 7 12:22:32 2018 (r341684) @@ -148,6 +148,27 @@ reaper_abandon_children(struct proc *p, bool exiting) } static void +reaper_clear(struct proc *p) +{ + struct proc *p1; + bool clear; + + sx_assert(&proctree_lock, SX_LOCKED); + LIST_REMOVE(p, p_reapsibling); + if (p->p_reapsubtree == 1) + return; + clear = true; + LIST_FOREACH(p1, &p->p_reaper->p_reaplist, p_reapsibling) { + if (p1->p_reapsubtree == p->p_reapsubtree) { + clear = false; + break; + } + } + if (clear) + proc_id_clear(PROC_ID_REAP, p->p_reapsubtree); +} + +static void clear_orphan(struct proc *p) { struct proc *p1; @@ -881,7 +902,8 @@ proc_reap(struct thread *td, struct proc *p, int *stat sx_xunlock(PIDHASHLOCK(p->p_pid)); LIST_REMOVE(p, p_sibling); reaper_abandon_children(p, true); - LIST_REMOVE(p, p_reapsibling); + reaper_clear(p); + proc_id_clear(PROC_ID_PID, p->p_pid); PROC_LOCK(p); clear_orphan(p); PROC_UNLOCK(p); Modified: head/sys/kern/kern_fork.c ============================================================================== --- head/sys/kern/kern_fork.c Fri Dec 7 12:06:03 2018 (r341683) +++ head/sys/kern/kern_fork.c Fri Dec 7 12:22:32 2018 (r341684) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -232,22 +233,18 @@ sysctl_kern_randompid(SYSCTL_HANDLER_ARGS) SYSCTL_PROC(_kern, OID_AUTO, randompid, CTLTYPE_INT|CTLFLAG_RW, 0, 0, sysctl_kern_randompid, "I", "Random PID modulus. Special values: 0: disable, 1: choose random value"); +extern bitstr_t proc_id_pidmap; +extern bitstr_t proc_id_grpidmap; +extern bitstr_t proc_id_sessidmap; +extern bitstr_t proc_id_reapmap; + static int fork_findpid(int flags) { - struct proc *p; + pid_t result; int trypid; - static int pidchecked = 0; - bool locked_zomb = false; /* - * Requires allproc_lock in order to iterate over the list - * of processes, and proctree_lock to access p_pgrp. - */ - sx_assert(&allproc_lock, SX_LOCKED); - sx_assert(&proctree_lock, SX_LOCKED); - - /* * Find an unused process ID. We remember a range of unused IDs * ready to use (from lastpid+1 through pidchecked-1). * @@ -262,6 +259,7 @@ fork_findpid(int flags) if (randompid) trypid += arc4random() % randompid; } + mtx_lock(&procid_lock); retry: /* * If the process ID prototype has wrapped around, @@ -272,74 +270,28 @@ retry: trypid = trypid % pid_max; if (trypid < 100) trypid += 100; - pidchecked = 0; } - if (trypid >= pidchecked) { - int doingzomb = 0; - pidchecked = PID_MAX; - /* - * Scan the active and zombie procs to check whether this pid - * is in use. Remember the lowest pid that's greater - * than trypid, so we can avoid checking for a while. - * - * Avoid reuse of the process group id, session id or - * the reaper subtree id. Note that for process group - * and sessions, the amount of reserved pids is - * limited by process limit. For the subtree ids, the - * id is kept reserved only while there is a - * non-reaped process in the subtree, so amount of - * reserved pids is limited by process limit times - * two. - */ - p = LIST_FIRST(&allproc); -again: - for (; p != NULL; p = LIST_NEXT(p, p_list)) { - while (p->p_pid == trypid || - p->p_reapsubtree == trypid || - (p->p_pgrp != NULL && - (p->p_pgrp->pg_id == trypid || - (p->p_session != NULL && - p->p_session->s_sid == trypid)))) { - trypid++; - if (trypid >= pidchecked) - goto retry; - } - if (p->p_pid > trypid && pidchecked > p->p_pid) - pidchecked = p->p_pid; - if (p->p_pgrp != NULL) { - if (p->p_pgrp->pg_id > trypid && - pidchecked > p->p_pgrp->pg_id) - pidchecked = p->p_pgrp->pg_id; - if (p->p_session != NULL && - p->p_session->s_sid > trypid && - pidchecked > p->p_session->s_sid) - pidchecked = p->p_session->s_sid; - } - } - if (!doingzomb) { - doingzomb = 1; - if (!locked_zomb) { - sx_slock(&zombproc_lock); - locked_zomb = true; - } - p = LIST_FIRST(&zombproc); - goto again; - } + bit_ffc_at(&proc_id_pidmap, trypid, pid_max, &result); + if (result == -1) + goto retry; + if (bit_test(&proc_id_grpidmap, result) || + bit_test(&proc_id_sessidmap, result) || + bit_test(&proc_id_reapmap, result)) { + trypid++; + goto retry; } /* * RFHIGHPID does not mess with the lastpid counter during boot. */ - if (flags & RFHIGHPID) - pidchecked = 0; - else - lastpid = trypid; + if ((flags & RFHIGHPID) == 0) + lastpid = result; - if (locked_zomb) - sx_sunlock(&zombproc_lock); + bit_set(&proc_id_pidmap, result); + mtx_unlock(&procid_lock); - return (trypid); + return (result); } static int @@ -402,13 +354,11 @@ do_fork(struct thread *td, struct fork_req *fr, struct struct filedesc_to_leader *fdtol; struct sigacts *newsigacts; - sx_assert(&proctree_lock, SX_LOCKED); sx_assert(&allproc_lock, SX_XLOCKED); p1 = td->td_proc; trypid = fork_findpid(fr->fr_flags); - p2->p_state = PRS_NEW; /* protect against others */ p2->p_pid = trypid; AUDIT_ARG_PID(p2->p_pid); @@ -421,7 +371,6 @@ do_fork(struct thread *td, struct fork_req *fr, struct PROC_LOCK(p1); sx_xunlock(&allproc_lock); - sx_xunlock(&proctree_lock); bcopy(&p1->p_startcopy, &p2->p_startcopy, __rangeof(struct proc, p_startcopy, p_endcopy)); @@ -657,8 +606,10 @@ do_fork(struct thread *td, struct fork_req *fr, struct LIST_INSERT_HEAD(&pptr->p_children, p2, p_sibling); LIST_INIT(&p2->p_reaplist); LIST_INSERT_HEAD(&p2->p_reaper->p_reaplist, p2, p_reapsibling); - if (p2->p_reaper == p1) + if (p2->p_reaper == p1 && p1 != initproc) { p2->p_reapsubtree = p2->p_pid; + proc_id_set_cond(PROC_ID_REAP, p2->p_pid); + } sx_xunlock(&proctree_lock); /* Inform accounting that we have forked. */ @@ -975,8 +926,6 @@ fork1(struct thread *td, struct fork_req *fr) newproc->p_klist = knlist_alloc(&newproc->p_mtx); STAILQ_INIT(&newproc->p_ktr); - /* We have to lock the process tree while we look for a pid. */ - sx_xlock(&proctree_lock); sx_xlock(&allproc_lock); /* @@ -999,7 +948,6 @@ fork1(struct thread *td, struct fork_req *fr) error = EAGAIN; sx_xunlock(&allproc_lock); - sx_xunlock(&proctree_lock); #ifdef MAC mac_proc_destroy(newproc); #endif Modified: head/sys/kern/kern_proc.c ============================================================================== --- head/sys/kern/kern_proc.c Fri Dec 7 12:06:03 2018 (r341683) +++ head/sys/kern/kern_proc.c Fri Dec 7 12:22:32 2018 (r341684) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -128,6 +129,7 @@ struct sx __exclusive_cache_line allproc_lock; struct sx __exclusive_cache_line zombproc_lock; struct sx __exclusive_cache_line proctree_lock; struct mtx __exclusive_cache_line ppeers_lock; +struct mtx __exclusive_cache_line procid_lock; uma_zone_t proc_zone; /* @@ -181,6 +183,7 @@ procinit(void) sx_init(&zombproc_lock, "zombproc"); sx_init(&proctree_lock, "proctree"); mtx_init(&ppeers_lock, "p_peers", NULL, MTX_DEF); + mtx_init(&procid_lock, "procid", NULL, MTX_DEF); LIST_INIT(&allproc); LIST_INIT(&zombproc); pidhashtbl = hashinit(maxproc / 4, M_PROC, &pidhash); @@ -293,6 +296,62 @@ proc_fini(void *mem, int size) } /* + * PID space management. + * + * These bitmaps are used by fork_findpid. + */ +bitstr_t bit_decl(proc_id_pidmap, PID_MAX); +bitstr_t bit_decl(proc_id_grpidmap, PID_MAX); +bitstr_t bit_decl(proc_id_sessidmap, PID_MAX); +bitstr_t bit_decl(proc_id_reapmap, PID_MAX); + +static bitstr_t *proc_id_array[] = { + proc_id_pidmap, + proc_id_grpidmap, + proc_id_sessidmap, + proc_id_reapmap, +}; + +void +proc_id_set(int type, pid_t id) +{ + + KASSERT(type >= 0 && type < nitems(proc_id_array), + ("invalid type %d\n", type)); + mtx_lock(&procid_lock); + KASSERT(bit_test(proc_id_array[type], id) == 0, + ("bit %d already set in %d\n", id, type)); + bit_set(proc_id_array[type], id); + mtx_unlock(&procid_lock); +} + +void +proc_id_set_cond(int type, pid_t id) +{ + + KASSERT(type >= 0 && type < nitems(proc_id_array), + ("invalid type %d\n", type)); + if (bit_test(proc_id_array[type], id)) + return; + mtx_lock(&procid_lock); + bit_set(proc_id_array[type], id); + mtx_unlock(&procid_lock); +} + +void +proc_id_clear(int type, pid_t id) +{ + + KASSERT(type >= 0 && type < nitems(proc_id_array), + ("invalid type %d\n", type)); + mtx_lock(&procid_lock); + KASSERT(bit_test(proc_id_array[type], id) != 0, + ("bit %d not set in %d\n", id, type)); + bit_clear(proc_id_array[type], id); + mtx_unlock(&procid_lock); +} + +/* * Is p an inferior of the current process? */ int @@ -495,6 +554,7 @@ enterpgrp(struct proc *p, pid_t pgid, struct pgrp *pgr PGRP_LOCK(pgrp); sess->s_leader = p; sess->s_sid = p->p_pid; + proc_id_set(PROC_ID_SESSION, p->p_pid); refcount_init(&sess->s_count, 1); sess->s_ttyvp = NULL; sess->s_ttydp = NULL; @@ -510,6 +570,7 @@ enterpgrp(struct proc *p, pid_t pgid, struct pgrp *pgr PGRP_LOCK(pgrp); } pgrp->pg_id = pgid; + proc_id_set(PROC_ID_GROUP, p->p_pid); LIST_INIT(&pgrp->pg_members); /* @@ -640,6 +701,7 @@ pgdelete(struct pgrp *pgrp) tty_rel_pgrp(tp, pgrp); } + proc_id_clear(PROC_ID_GROUP, pgrp->pg_id); mtx_destroy(&pgrp->pg_mtx); free(pgrp, M_PGRP); sess_release(savesess); @@ -824,6 +886,7 @@ sess_release(struct session *s) tty_lock(s->s_ttyp); tty_rel_sess(s->s_ttyp, s); } + proc_id_clear(PROC_ID_SESSION, s->s_sid); mtx_destroy(&s->s_mtx); free(s, M_SESSION); } Modified: head/sys/sys/proc.h ============================================================================== --- head/sys/sys/proc.h Fri Dec 7 12:06:03 2018 (r341683) +++ head/sys/sys/proc.h Fri Dec 7 12:22:32 2018 (r341684) @@ -962,6 +962,7 @@ extern int allproc_gen; extern struct sx zombproc_lock; extern struct sx proctree_lock; extern struct mtx ppeers_lock; +extern struct mtx procid_lock; extern struct proc proc0; /* Process slot for swapper. */ extern struct thread0_storage thread0_st; /* Primary thread in proc0. */ #define thread0 (thread0_st.t0st_thread) @@ -1164,6 +1165,15 @@ td_softdep_cleanup(struct thread *td) if (td->td_su != NULL && softdep_ast_cleanup != NULL) softdep_ast_cleanup(td); } + +#define PROC_ID_PID 0 +#define PROC_ID_GROUP 1 +#define PROC_ID_SESSION 2 +#define PROC_ID_REAP 3 + +void proc_id_set(int type, pid_t id); +void proc_id_set_cond(int type, pid_t id); +void proc_id_clear(int type, pid_t id); #endif /* _KERNEL */ From owner-svn-src-head@freebsd.org Fri Dec 7 12:32:26 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DA487130C7C1; Fri, 7 Dec 2018 12:32:26 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 803E789725; Fri, 7 Dec 2018 12:32:26 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6232213269; Fri, 7 Dec 2018 12:32:26 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB7CWQax053386; Fri, 7 Dec 2018 12:32:26 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB7CWQOT053385; Fri, 7 Dec 2018 12:32:26 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201812071232.wB7CWQOT053385@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 7 Dec 2018 12:32:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341685 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 341685 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 803E789725 X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.988,0]; NEURAL_HAM_SHORT(-0.97)[-0.966,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.99)[-0.990,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 07 Dec 2018 12:32:27 -0000 Author: mjg Date: Fri Dec 7 12:32:25 2018 New Revision: 341685 URL: https://svnweb.freebsd.org/changeset/base/341685 Log: proc: when exiting move to zombproc before taking proctree The kernel was already doing this prior to r329615. It was changed to reduce contention on allproc. However, introduction of pidhash locks and removal of proctree -> allproc ordering from fork thanks to bitmaps fixed things enough to make this change pessimal. waitpid takes proctree on each call and this change (now) causes avoidable stalls if allproc is held. Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/kern_exit.c Modified: head/sys/kern/kern_exit.c ============================================================================== --- head/sys/kern/kern_exit.c Fri Dec 7 12:22:32 2018 (r341684) +++ head/sys/kern/kern_exit.c Fri Dec 7 12:32:25 2018 (r341685) @@ -448,7 +448,6 @@ exit1(struct thread *td, int rval, int signo) WITNESS_WARN(WARN_PANIC, NULL, "process (pid %d) exiting", p->p_pid); - sx_xlock(&proctree_lock); /* * Move proc from allproc queue to zombproc. */ @@ -458,6 +457,8 @@ exit1(struct thread *td, int rval, int signo) LIST_INSERT_HEAD(&zombproc, p, p_list); sx_xunlock(&zombproc_lock); sx_xunlock(&allproc_lock); + + sx_xlock(&proctree_lock); /* * Reparent all children processes: From owner-svn-src-head@freebsd.org Fri Dec 7 15:17:31 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A1D791310643; Fri, 7 Dec 2018 15:17:31 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 516FC8EE61; Fri, 7 Dec 2018 15:17:31 +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 2DDDE14C91; Fri, 7 Dec 2018 15:17:31 +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 wB7FHVC8035919; Fri, 7 Dec 2018 15:17:31 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB7FHTiI035911; Fri, 7 Dec 2018 15:17:29 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201812071517.wB7FHTiI035911@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 7 Dec 2018 15:17:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341689 - in head: lib/libc/sys sys/compat/freebsd32 sys/kern sys/sys X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head: lib/libc/sys sys/compat/freebsd32 sys/kern sys/sys X-SVN-Commit-Revision: 341689 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 516FC8EE61 X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.990,0]; NEURAL_HAM_LONG(-0.99)[-0.992,0]; NEURAL_HAM_SHORT(-0.97)[-0.966,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 07 Dec 2018 15:17:32 -0000 Author: kib Date: Fri Dec 7 15:17:29 2018 New Revision: 341689 URL: https://svnweb.freebsd.org/changeset/base/341689 Log: Add new file handle system calls. Namely, getfhat(2), fhlink(2), fhlinkat(2), fhreadlink(2). The syscalls are provided for a NFS userspace server (nfs-ganesha). Submitted by: Jack Halford Sponsored by: Gandi.net Tested by: pho Feedback from: brooks, markj MFC after: 1 week Differential revision: https://reviews.freebsd.org/D18359 Added: head/lib/libc/sys/fhlink.2 (contents, props changed) head/lib/libc/sys/fhreadlink.2 (contents, props changed) Modified: head/lib/libc/sys/Makefile.inc head/lib/libc/sys/Symbol.map head/lib/libc/sys/getfh.2 head/sys/compat/freebsd32/syscalls.master head/sys/kern/syscalls.master head/sys/kern/vfs_syscalls.c head/sys/sys/mount.h Modified: head/lib/libc/sys/Makefile.inc ============================================================================== --- head/lib/libc/sys/Makefile.inc Fri Dec 7 14:45:28 2018 (r341688) +++ head/lib/libc/sys/Makefile.inc Fri Dec 7 15:17:29 2018 (r341689) @@ -184,7 +184,9 @@ MAN+= abort2.2 \ extattr_get_file.2 \ fcntl.2 \ ffclock.2 \ + fhlink.2 \ fhopen.2 \ + fhreadlink.2 \ flock.2 \ fork.2 \ fsync.2 \ @@ -395,7 +397,8 @@ MLINKS+=ffclock.2 ffclock_getcounter.2 \ MLINKS+=fhopen.2 fhstat.2 fhopen.2 fhstatfs.2 MLINKS+=fsync.2 fdatasync.2 MLINKS+=getdirentries.2 getdents.2 -MLINKS+=getfh.2 lgetfh.2 +MLINKS+=getfh.2 lgetfh.2 \ + getfh.2 getfhat.2 MLINKS+=getgid.2 getegid.2 MLINKS+=getitimer.2 setitimer.2 MLINKS+=getlogin.2 getlogin_r.3 Modified: head/lib/libc/sys/Symbol.map ============================================================================== --- head/lib/libc/sys/Symbol.map Fri Dec 7 14:45:28 2018 (r341688) +++ head/lib/libc/sys/Symbol.map Fri Dec 7 15:17:29 2018 (r341689) @@ -401,6 +401,13 @@ FBSD_1.5 { cpuset_setdomain; }; +FBSD_1.6 { + fhlink; + fhlinkat; + fhreadlink; + getfhat; +}; + FBSDprivate_1.0 { ___acl_aclcheck_fd; __sys___acl_aclcheck_fd; Added: head/lib/libc/sys/fhlink.2 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/sys/fhlink.2 Fri Dec 7 15:17:29 2018 (r341689) @@ -0,0 +1,268 @@ +.\" SPDX-License-Identifier: BSD-2-Clause +.\" +.\" Copyright (c) 2018 Gandi +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd November 29, 2018 +.Dt FHLINK 2 +.Os +.Sh NAME +.Nm fhlink , +.Nm fhlinkat +.Nd make a hard file link +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In unistd.h +.Ft int +.Fn fhlink "fhandle_t *fhp" "const char *to" +.Ft int +.Fn fhlinkat "fhandle_t *fhp" "int tofd" "const char *to" +.Fc +.Sh DESCRIPTION +The +.Fn fhlink +system call +atomically creates the specified directory entry (hard link) +.Fa to +with the attributes of the underlying object pointed at by +.Fa fhp . +If the link is successful: the link count of the underlying object +is incremented; +.Fa fhp +and +.Fa to +share equal access and rights +to the +underlying object. +.Pp +If +.Fa fhp +is removed, the file +.Fa to +is not deleted and the link count of the +underlying object is +decremented. +.Pp +The object pointed at by the +.Fa fhp +argument +must exist for the hard link to +succeed and +both +.Fa fhp +and +.Fa to +must be in the same file system. +The +.Fa fhp +argument +may not be a directory. +.Pp +The +.Fn fhlinkat +system call is equivalent to +.Fa fhlink +except in the case where +.Fa to +is a relative paths. +In this case a relative path +.Fa to +is interpreted relative to +the directory associated with the file descriptor +.Fa tofd +instead of the current working directory. +.Pp +Values for +.Fa flag +are constructed by a bitwise-inclusive OR of flags from the following +list, defined in +.In fcntl.h : +.Bl -tag -width indent +.It Dv AT_SYMLINK_FOLLOW +If +.Fa fhp +names a symbolic link, a new link for the target of the symbolic link is +created. +.It Dv AT_BENEATH +Only allow to link to a file which is beneath of the topping directory. +See the description of the +.Dv O_BENEATH +flag in the +.Xr open 2 +manual page. +.El +.Pp +If +.Fn fhlinkat +is passed the special value +.Dv AT_FDCWD +in the +.Fa tofd +parameter, the current working directory is used for the +.Fa to +argument. +If +.Fa tofd +has value +.Dv AT_FDCWD , +the behavior is identical to a call to +.Fn link . +Unless +.Fa flag +contains the +.Dv AT_SYMLINK_FOLLOW +flag, if +.Fa fhp +names a symbolic link, a new link is created for the symbolic link +.Fa fhp +and not its target. +.Sh RETURN VALUES +.Rv -std link +.Sh ERRORS +The +.Fn fhlink +system call +will fail and no link will be created if: +.Bl -tag -width Er +.It Bq Er ENOTDIR +A component of +.Fa to +prefix is not a directory. +.It Bq Er ENAMETOOLONG +A component of +.Fa to +exceeded 255 characters, +or entire length of +.Fa to +name exceeded 1023 characters. +.It Bq Er ENOENT +A component of +.Fa to +prefix does not exist. +.It Bq Er EOPNOTSUPP +The file system containing the file pointed at by +.Fa fhp +does not support links. +.It Bq Er EMLINK +The link count of the file pointed at by +.Fa fhp +would exceed 32767. +.It Bq Er EACCES +A component of +.Fa to +prefix denies search permission. +.It Bq Er EACCES +The requested link requires writing in a directory with a mode +that denies write permission. +.It Bq Er ELOOP +Too many symbolic links were encountered in translating one of the pathnames. +.It Bq Er ENOENT +The file pointed at by +.Fa fhp +does not exist. +.It Bq Er EEXIST +The link named by +.Fa to +does exist. +.It Bq Er EPERM +The file pointed at by +.Fa fhp +is a directory. +.It Bq Er EPERM +The file pointed at by +.Fa fhp +has its immutable or append-only flag set, see the +.Xr chflags 2 +manual page for more information. +.It Bq Er EPERM +The parent directory of the file named by +.Fa to +has its immutable flag set. +.It Bq Er EXDEV +The link named by +.Fa to +and the file pointed at by +.Fa fhp +are on different file systems. +.It Bq Er ENOSPC +The directory in which the entry for the new link is being placed +cannot be extended because there is no space left on the file +system containing the directory. +.It Bq Er EDQUOT +The directory in which the entry for the new link +is being placed cannot be extended because the +user's quota of disk blocks on the file system +containing the directory has been exhausted. +.It Bq Er EIO +An I/O error occurred while reading from or writing to +the file system to make the directory entry. +.It Bq Er EROFS +The requested link requires writing in a directory on a read-only file +system. +.It Bq Er EFAULT +One of the pathnames specified +is outside the process's allocated address space. +.It Bq Er ESTALE +The file handle +.Fa fhp +is no longer valid +.El +.Pp +In addition to the errors returned by the +.Fn fhlink , +the +.Fn fhlinkat +system call may fail if: +.Bl -tag -width Er +.It Bq Er EBADF +The +.Fa fhp +or +.Fa to +argument does not specify an absolute path and the +.Fa tofd +argument, is not +.Dv AT_FDCWD +nor a valid file descriptor open for searching. +.It Bq Er EINVAL +The value of the +.Fa flag +argument is not valid. +.It Bq Er ENOTDIR +The +.Fa fhp +or +.Fa to +argument is not an absolute path and +.Fa tofd +is not +.Dv AT_FDCWD +nor a file descriptor associated with a directory. +.El +.Sh SEE ALSO +.Xr fhstat 2 , +.Xr fhreadlink 2 , +.Xr fhopen 2 , Added: head/lib/libc/sys/fhreadlink.2 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/sys/fhreadlink.2 Fri Dec 7 15:17:29 2018 (r341689) @@ -0,0 +1,92 @@ +.\" SPDX-License-Identifier: BSD-2-Clause +.\" +.\" Copyright (c) 2018 Gandi +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd November 29, 2018 +.Dt FHREADLINK 2 +.Os +.Sh NAME +.Nm fhreadlink +.Nd read value of a symbolic link +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In sys/param.h +.In sys/mount.h +.Ft int +.Fn fhreadlink "fhandle_t *fhp" "char *buf" "size_t bufsize" +.Fc +.Sh DESCRIPTION +The +.Fn fhreadlink +system call +places the contents of the symbolic link +.Fa fhp +in the buffer +.Fa buf , +which has size +.Fa bufsiz . +The +.Fn fhreadlink +system call does not append a +.Dv NUL +character to +.Fa buf . +.Pp +.Sh RETURN VALUES +The call returns the count of characters placed in the buffer +if it succeeds, or a \-1 if an error occurs, placing the error +code in the global variable +.Va errno . +.Sh ERRORS +The +.Fn readlink +system call +will fail if: +.Bl -tag -width Er +.It Bq Er ENOENT +The named file does not exist. +.It Bq Er ELOOP +Too many symbolic links were encountered in translating the file handle +.Fa fhp . +.It Bq Er EINVAL +The named file is not a symbolic link. +.It Bq Er EIO +An I/O error occurred while reading from the file system. +.It Bq Er EFAULT +The +.Fa buf +argument +extends outside the process's allocated address space. +.It Bq Er ESTALE +The file handle +.Fa fhp +is no longer valid +.El +.El +.Sh SEE ALSO +.Xr fhstat 2 , +.Xr fhlink 2 , Modified: head/lib/libc/sys/getfh.2 ============================================================================== --- head/lib/libc/sys/getfh.2 Fri Dec 7 14:45:28 2018 (r341688) +++ head/lib/libc/sys/getfh.2 Fri Dec 7 15:17:29 2018 (r341689) @@ -1,5 +1,6 @@ .\" Copyright (c) 1989, 1991, 1993 .\" The Regents of the University of California. All rights reserved. +.\" Copyright (c) 2018 Gandi .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -28,12 +29,13 @@ .\" @(#)getfh.2 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd April 14, 2011 +.Dd December 7, 2018 .Dt GETFH 2 .Os .Sh NAME .Nm getfh , -.Nm lgetfh +.Nm lgetfh , +.Nm getfhat .Nd get file handle .Sh LIBRARY .Lb libc @@ -44,6 +46,8 @@ .Fn getfh "const char *path" "fhandle_t *fhp" .Ft int .Fn lgetfh "const char *path" "fhandle_t *fhp" +.Ft int +.Fn getfhat "int fd" "const char *path" "fhandle_t *fhp" "int flag" .Sh DESCRIPTION The .Fn getfh @@ -51,6 +55,7 @@ system call returns a file handle for the specified file or directory in the file handle pointed to by .Fa fhp . +.Pp The .Fn lgetfh system call is like @@ -62,6 +67,85 @@ returns information about the link, while .Fn getfh returns information about the file the link references. +.Pp +The +.Fn getfhat +system call is equivalent to +.Fn getfh +and +.Fn lgetfh +except when the +.Fa path +specifies a relative or NULL path, or the +.Dv AT_BENEATH +flag is provided. +For +.Fn getfhat +and relative or NULL +.Fa path , +the status is retrieved from a file relative to +the directory associated with the file descriptor +.Fa fd +instead of the current working directory. +For +.Dv AT_BENEATH +and absolute +.Fa path , +the status is retrieved from a file specified by the +.Fa path , +but additional permission checks are performed, see below. +.Pp +The values for the +.Fa flag +are constructed by a bitwise-inclusive OR of flags from this list, +defined in +.In fcntl.h : +.Bl -tag -width indent +.It Dv AT_SYMLINK_NOFOLLOW +If +.Fa path +names a symbolic link, the status of the symbolic link is returned. +.It Dv AT_BENEATH +Only stat files and directories below the topping directory. +See the description of the +.Dv O_BENEATH +flag in the +.Xr open 2 +manual page. +.El +.Pp +If +.Fn getfhat +is passed the special value +.Dv AT_FDCWD +in the +.Fa fd +parameter, the current working directory is used and the behavior is +identical to a call to +.Fn getfth +or +.Fn lgetfh +respectively, depending on whether or not the +.Dv AT_SYMLINK_NOFOLLOW +bit is set in +.Fa flag . +.Pp +When +.Fn getfhat +is called with an absolute +.Fa path +without the +.Dv AT_BENEATH +flag, it ignores the +.Fa fd +argument. +When +.Dv AT_BENEATH +is specified with an absolute +.Fa path , +a directory passed by the +.Fa fd +argument is used as the topping point for the resolution. These system calls are restricted to the superuser. .Sh RETURN VALUES .Rv -std @@ -99,11 +183,49 @@ The .Fa fhp argument points to an invalid address. +.It Bq Er EFAULT +The +.Fa path +argument +points to an invalid address. .It Bq Er EIO An .Tn I/O error occurred while reading from or writing to the file system. +.It Bq Er ESTALE +The file handle +.Fa fhp +is no longer valid. .El +.Pp +In addition to the errors returned by +.Fn getfh , +and +.Fn lgetfh , +the +.Fn getfhat +system call may fail if: +.Bl -tag -width Er +.It Bq Er EBADF +The +.Fa path +argument does not specify an absolute path and the +.Fa fd +argument, is neither +.Dv AT_FDCWD +nor a valid file descriptor open for searching. +.It Bq Er EINVAL +The value of the +.Fa flag +argument is not valid. +.It Bq Er ENOTDIR +The +.Fa path +argument is not an absolute path and +.Fa fd +is neither +.Dv AT_FDCWD +nor a file descriptor associated with a directory. .Sh SEE ALSO .Xr fhopen 2 , .Xr open 2 , Modified: head/sys/compat/freebsd32/syscalls.master ============================================================================== --- head/sys/compat/freebsd32/syscalls.master Fri Dec 7 14:45:28 2018 (r341688) +++ head/sys/compat/freebsd32/syscalls.master Fri Dec 7 15:17:29 2018 (r341689) @@ -1138,5 +1138,12 @@ int policy); } 563 AUE_NULL NOPROTO { int getrandom(void *buf, size_t buflen, \ unsigned int flags); } +564 AUE_NULL NOPROTO { int getfhat( int fd, char *path, \ + struct fhandle *fhp, int flags); } +565 AUE_NULL NOPROTO { int fhlink( struct fhandle *fhp, const char *to ); } +566 AUE_NULL NOPROTO { int fhlinkat( struct fhandle *fhp, int tofd, \ + const char *to); } +567 AUE_NULL NOPROTO { int fhreadlink( struct fhandle *fhp, char *buf, \ + size_t bufsize); } ; vim: syntax=off Modified: head/sys/kern/syscalls.master ============================================================================== --- head/sys/kern/syscalls.master Fri Dec 7 14:45:28 2018 (r341688) +++ head/sys/kern/syscalls.master Fri Dec 7 15:17:29 2018 (r341689) @@ -3139,6 +3139,34 @@ unsigned int flags ); } +564 AUE_NULL STD { + int getfhat( + int fd, + _In_z_ char *path, + _Out_ struct fhandle *fhp, + int flags + ); + } +565 AUE_NULL STD { + int fhlink( + _In_ struct fhandle *fhp, + _In_z_ const char *to + ); + } +566 AUE_NULL STD { + int fhlinkat( + _In_ struct fhandle *fhp, + int tofd, + _In_z_ const char *to, + ); + } +567 AUE_NULL STD { + int fhreadlink( + _In_ struct fhandle *fhp, + _Out_writes_(bufsize) char *buf, + size_t bufsize + ); + } ; Please copy any additions and changes to the following compatability tables: ; sys/compat/freebsd32/syscalls.master Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Fri Dec 7 14:45:28 2018 (r341688) +++ head/sys/kern/vfs_syscalls.c Fri Dec 7 15:17:29 2018 (r341689) @@ -105,6 +105,14 @@ static int setutimes(struct thread *td, struct vnode * const struct timespec *, int, int); static int vn_access(struct vnode *vp, int user_flags, struct ucred *cred, struct thread *td); +static int kern_fhlinkat(struct thread *td, int fd, const char *path, + enum uio_seg pathseg, fhandle_t *fhp); +static int kern_getfhat(struct thread *td, int flags, int fd, + const char *path, enum uio_seg pathseg, fhandle_t *fhp); +static int kern_readlink_vp(struct vnode *vp, char *buf, enum uio_seg bufseg, + size_t count, struct thread *td); +static int kern_linkat_vp(struct thread *td, struct vnode *vp, int fd, + const char *path, enum uio_seg segflag); /* * Sync each mounted filesystem. @@ -1492,28 +1500,38 @@ can_hardlink(struct vnode *vp, struct ucred *cred) int kern_linkat(struct thread *td, int fd1, int fd2, const char *path1, - const char *path2, enum uio_seg segflg, int follow) + const char *path2, enum uio_seg segflag, int follow) { struct vnode *vp; - struct mount *mp; struct nameidata nd; int error; -again: - bwillwrite(); - NDINIT_ATRIGHTS(&nd, LOOKUP, follow | AUDITVNODE1, segflg, path1, fd1, - &cap_linkat_source_rights, td); + do { + bwillwrite(); + NDINIT_ATRIGHTS(&nd, LOOKUP, follow | AUDITVNODE1, segflag, path1, fd1, + &cap_linkat_source_rights, td); + if ((error = namei(&nd)) != 0) + return (error); + NDFREE(&nd, NDF_ONLY_PNBUF); + vp = nd.ni_vp; + } while ((error = kern_linkat_vp(td, vp, fd2, path2, segflag) == EAGAIN)); + return (error); +} - if ((error = namei(&nd)) != 0) - return (error); - NDFREE(&nd, NDF_ONLY_PNBUF); - vp = nd.ni_vp; +static int +kern_linkat_vp(struct thread *td, struct vnode *vp, int fd, const char *path, + enum uio_seg segflag) +{ + struct nameidata nd; + struct mount *mp; + int error; + if (vp->v_type == VDIR) { vrele(vp); return (EPERM); /* POSIX */ } NDINIT_ATRIGHTS(&nd, CREATE, - LOCKPARENT | SAVENAME | AUDITVNODE2 | NOCACHE, segflg, path2, fd2, + LOCKPARENT | SAVENAME | AUDITVNODE2 | NOCACHE, segflag, path, fd, &cap_linkat_target_rights, td); if ((error = namei(&nd)) == 0) { if (nd.ni_vp != NULL) { @@ -1557,7 +1575,7 @@ again: V_XSLEEP | PCATCH); if (error != 0) return (error); - goto again; + return (EAGAIN); } error = VOP_LINK(nd.ni_dvp, vp, &nd.ni_cnd); VOP_UNLOCK(vp, 0); @@ -1568,7 +1586,7 @@ again: vput(nd.ni_dvp); NDFREE(&nd, NDF_ONLY_PNBUF); vrele(vp); - goto again; + return (EAGAIN); } } vrele(vp); @@ -2484,8 +2502,6 @@ kern_readlinkat(struct thread *td, int fd, const char enum uio_seg pathseg, char *buf, enum uio_seg bufseg, size_t count) { struct vnode *vp; - struct iovec aiov; - struct uio auio; struct nameidata nd; int error; @@ -2499,12 +2515,29 @@ kern_readlinkat(struct thread *td, int fd, const char return (error); NDFREE(&nd, NDF_ONLY_PNBUF); vp = nd.ni_vp; + + error = kern_readlink_vp(vp, buf, bufseg, count, td); + vput(vp); + + return (error); +} + +/* + * Helper function to readlink from a vnode + */ +static int +kern_readlink_vp(struct vnode *vp, char *buf, enum uio_seg bufseg, size_t count, + struct thread *td) +{ + struct iovec aiov; + struct uio auio; + int error; + + ASSERT_VOP_LOCKED(vp, "kern_readlink_vp(): vp not locked"); #ifdef MAC error = mac_vnode_check_readlink(td->td_ucred, vp); - if (error != 0) { - vput(vp); + if (error != 0) return (error); - } #endif if (vp->v_type != VLNK && (vp->v_vflag & VV_READLINK) == 0) error = EINVAL; @@ -2521,7 +2554,6 @@ kern_readlinkat(struct thread *td, int fd, const char error = VOP_READLINK(vp, &auio, td->td_ucred); td->td_retval[0] = count - auio.uio_resid; } - vput(vp); return (error); } @@ -4119,13 +4151,61 @@ getvnode(struct thread *td, int fd, cap_rights_t *righ */ #ifndef _SYS_SYSPROTO_H_ struct lgetfh_args { - char *fname; + char *fname; fhandle_t *fhp; }; #endif int sys_lgetfh(struct thread *td, struct lgetfh_args *uap) { + + return (kern_getfhat(td, AT_SYMLINK_NOFOLLOW, AT_FDCWD, uap->fname, + UIO_USERSPACE, uap->fhp)); +} + +#ifndef _SYS_SYSPROTO_H_ +struct getfh_args { + char *fname; + fhandle_t *fhp; +}; +#endif +int +sys_getfh(struct thread *td, struct getfh_args *uap) +{ + + return (kern_getfhat(td, 0, AT_FDCWD, uap->fname, UIO_USERSPACE, + uap->fhp)); +} + +/* + * syscall for the rpc.lockd to use to translate an open descriptor into + * a NFS file handle. + * + * warning: do not remove the priv_check() call or this becomes one giant + * security hole. + */ +#ifndef _SYS_SYSPROTO_H_ +struct getfhat_args { + int fd; + char *path; + fhandle_t *fhp; + int flags; +}; +#endif +int +sys_getfhat(struct thread *td, struct getfhat_args *uap) +{ + + if ((uap->flags & ~(AT_SYMLINK_NOFOLLOW | AT_BENEATH)) != 0) + return (EINVAL); + return (kern_getfhat(td, uap->flags, uap->fd, uap->path ? uap->path : ".", + UIO_USERSPACE, uap->fhp)); +} + +static int +kern_getfhat(struct thread *td, int flags, int fd, const char *path, + enum uio_seg pathseg, fhandle_t *fhp) +{ struct nameidata nd; fhandle_t fh; struct vnode *vp; @@ -4134,8 +4214,9 @@ sys_lgetfh(struct thread *td, struct lgetfh_args *uap) error = priv_check(td, PRIV_VFS_GETFH); if (error != 0) return (error); - NDINIT(&nd, LOOKUP, NOFOLLOW | LOCKLEAF | AUDITVNODE1, UIO_USERSPACE, - uap->fname, td); + NDINIT_AT(&nd, LOOKUP, ((flags & AT_SYMLINK_NOFOLLOW) != 0 ? NOFOLLOW : + FOLLOW) | ((flags & AT_BENEATH) != 0 ? BENEATH : 0) | LOCKLEAF | + AUDITVNODE1, pathseg, path, fd, td); error = namei(&nd); if (error != 0) return (error); @@ -4146,40 +4227,96 @@ sys_lgetfh(struct thread *td, struct lgetfh_args *uap) error = VOP_VPTOFH(vp, &fh.fh_fid); vput(vp); if (error == 0) - error = copyout(&fh, uap->fhp, sizeof (fh)); + error = copyout(&fh, fhp, sizeof (fh)); return (error); } #ifndef _SYS_SYSPROTO_H_ -struct getfh_args { - char *fname; +struct fhlink_args { fhandle_t *fhp; + const char *to; }; #endif int -sys_getfh(struct thread *td, struct getfh_args *uap) +sys_fhlink(struct thread *td, struct fhlink_args *uap) { - struct nameidata nd; + + return (kern_fhlinkat(td, AT_FDCWD, uap->to, UIO_USERSPACE, uap->fhp)); +} + +#ifndef _SYS_SYSPROTO_H_ +struct fhlinkat_args { + fhandle_t *fhp; + int tofd; + const char *to; +}; +#endif +int +sys_fhlinkat(struct thread *td, struct fhlinkat_args *uap) +{ + + return (kern_fhlinkat(td, uap->tofd, uap->to, UIO_USERSPACE, uap->fhp)); +} + +static int +kern_fhlinkat(struct thread *td, int fd, const char *path, + enum uio_seg pathseg, fhandle_t *fhp) +{ fhandle_t fh; + struct mount *mp; struct vnode *vp; int error; error = priv_check(td, PRIV_VFS_GETFH); if (error != 0) return (error); - NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | AUDITVNODE1, UIO_USERSPACE, - uap->fname, td); - error = namei(&nd); + error = copyin(fhp, &fh, sizeof(fh)); if (error != 0) return (error); - NDFREE(&nd, NDF_ONLY_PNBUF); - vp = nd.ni_vp; - bzero(&fh, sizeof(fh)); - fh.fh_fsid = vp->v_mount->mnt_stat.f_fsid; - error = VOP_VPTOFH(vp, &fh.fh_fid); + do { + bwillwrite(); + if ((mp = vfs_busyfs(&fh.fh_fsid)) == NULL) + return (ESTALE); + error = VFS_FHTOVP(mp, &fh.fh_fid, LK_SHARED, &vp); + vfs_unbusy(mp); + if (error != 0) + return (error); + VOP_UNLOCK(vp, 0); + } while ((error = kern_linkat_vp(td, vp, fd, path, pathseg)) == EAGAIN); + return (error); +} + +#ifndef _SYS_SYSPROTO_H_ +struct fhreadlink_args { + fhandle_t *fhp; + char *buf; + size_t bufsize; +}; +#endif +int +sys_fhreadlink(struct thread *td, struct fhreadlink_args *uap) +{ + fhandle_t fh; + struct mount *mp; + struct vnode *vp; + int error; + + error = priv_check(td, PRIV_VFS_GETFH); + if (error != 0) + return (error); + if (uap->bufsize > IOSIZE_MAX) + return (EINVAL); + error = copyin(uap->fhp, &fh, sizeof(fh)); + if (error != 0) + return (error); + if ((mp = vfs_busyfs(&fh.fh_fsid)) == NULL) + return (ESTALE); + error = VFS_FHTOVP(mp, &fh.fh_fid, LK_SHARED, &vp); + vfs_unbusy(mp); + if (error != 0) + return (error); + error = kern_readlink_vp(vp, uap->buf, UIO_USERSPACE, uap->bufsize, td); vput(vp); - if (error == 0) - error = copyout(&fh, uap->fhp, sizeof (fh)); return (error); } Modified: head/sys/sys/mount.h ============================================================================== --- head/sys/sys/mount.h Fri Dec 7 14:45:28 2018 (r341688) +++ head/sys/sys/mount.h Fri Dec 7 15:17:29 2018 (r341689) @@ -932,11 +932,15 @@ void syncer_resume(void); struct stat; __BEGIN_DECLS +int fhlink(struct fhandle *, const char *); +int fhlinkat(struct fhandle *, int, const char *); int fhopen(const struct fhandle *, int); +int fhreadlink(struct fhandle *, char *, size_t); int fhstat(const struct fhandle *, struct stat *); int fhstatfs(const struct fhandle *, struct statfs *); int fstatfs(int, struct statfs *); int getfh(const char *, fhandle_t *); +int getfhat(int, char *, struct fhandle *, int); int getfsstat(struct statfs *, long, int); int getmntinfo(struct statfs **, int); int lgetfh(const char *, fhandle_t *); From owner-svn-src-head@freebsd.org Fri Dec 7 15:19:03 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 316911310703; Fri, 7 Dec 2018 15:19:03 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D4F8A8F039; Fri, 7 Dec 2018 15:19:02 +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 9CD8414CAB; Fri, 7 Dec 2018 15:19:02 +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 wB7FJ2PW036036; Fri, 7 Dec 2018 15:19:02 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB7FJ0qT036026; Fri, 7 Dec 2018 15:19:00 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201812071519.wB7FJ0qT036026@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 7 Dec 2018 15:19:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341690 - in head/sys: compat/freebsd32 kern sys X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: compat/freebsd32 kern sys X-SVN-Commit-Revision: 341690 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D4F8A8F039 X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.989,0]; NEURAL_HAM_LONG(-0.99)[-0.992,0]; NEURAL_HAM_SHORT(-0.97)[-0.965,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 07 Dec 2018 15:19:03 -0000 Author: kib Date: Fri Dec 7 15:19:00 2018 New Revision: 341690 URL: https://svnweb.freebsd.org/changeset/base/341690 Log: Regen. Modified: head/sys/compat/freebsd32/freebsd32_syscall.h head/sys/compat/freebsd32/freebsd32_syscalls.c head/sys/compat/freebsd32/freebsd32_sysent.c head/sys/compat/freebsd32/freebsd32_systrace_args.c head/sys/kern/init_sysent.c head/sys/kern/syscalls.c head/sys/kern/systrace_args.c head/sys/sys/syscall.h head/sys/sys/syscall.mk head/sys/sys/sysproto.h Modified: head/sys/compat/freebsd32/freebsd32_syscall.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscall.h Fri Dec 7 15:17:29 2018 (r341689) +++ head/sys/compat/freebsd32/freebsd32_syscall.h Fri Dec 7 15:19:00 2018 (r341690) @@ -490,4 +490,8 @@ #define FREEBSD32_SYS_freebsd32_cpuset_getdomain 561 #define FREEBSD32_SYS_freebsd32_cpuset_setdomain 562 #define FREEBSD32_SYS_getrandom 563 -#define FREEBSD32_SYS_MAXSYSCALL 564 +#define FREEBSD32_SYS_getfhat 564 +#define FREEBSD32_SYS_fhlink 565 +#define FREEBSD32_SYS_fhlinkat 566 +#define FREEBSD32_SYS_fhreadlink 567 +#define FREEBSD32_SYS_MAXSYSCALL 568 Modified: head/sys/compat/freebsd32/freebsd32_syscalls.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscalls.c Fri Dec 7 15:17:29 2018 (r341689) +++ head/sys/compat/freebsd32/freebsd32_syscalls.c Fri Dec 7 15:19:00 2018 (r341690) @@ -600,4 +600,8 @@ const char *freebsd32_syscallnames[] = { "freebsd32_cpuset_getdomain", /* 561 = freebsd32_cpuset_getdomain */ "freebsd32_cpuset_setdomain", /* 562 = freebsd32_cpuset_setdomain */ "getrandom", /* 563 = getrandom */ + "getfhat", /* 564 = getfhat */ + "fhlink", /* 565 = fhlink */ + "fhlinkat", /* 566 = fhlinkat */ + "fhreadlink", /* 567 = fhreadlink */ }; Modified: head/sys/compat/freebsd32/freebsd32_sysent.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_sysent.c Fri Dec 7 15:17:29 2018 (r341689) +++ head/sys/compat/freebsd32/freebsd32_sysent.c Fri Dec 7 15:19:00 2018 (r341690) @@ -647,4 +647,8 @@ struct sysent freebsd32_sysent[] = { { AS(freebsd32_cpuset_getdomain_args), (sy_call_t *)freebsd32_cpuset_getdomain, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 561 = freebsd32_cpuset_getdomain */ { AS(freebsd32_cpuset_setdomain_args), (sy_call_t *)freebsd32_cpuset_setdomain, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 562 = freebsd32_cpuset_setdomain */ { AS(getrandom_args), (sy_call_t *)sys_getrandom, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 563 = getrandom */ + { AS(getfhat_args), (sy_call_t *)sys_getfhat, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 564 = getfhat */ + { AS(fhlink_args), (sy_call_t *)sys_fhlink, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 565 = fhlink */ + { AS(fhlinkat_args), (sy_call_t *)sys_fhlinkat, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 566 = fhlinkat */ + { AS(fhreadlink_args), (sy_call_t *)sys_fhreadlink, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 567 = fhreadlink */ }; Modified: head/sys/compat/freebsd32/freebsd32_systrace_args.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_systrace_args.c Fri Dec 7 15:17:29 2018 (r341689) +++ head/sys/compat/freebsd32/freebsd32_systrace_args.c Fri Dec 7 15:19:00 2018 (r341690) @@ -3274,6 +3274,42 @@ systrace_args(int sysnum, void *params, uint64_t *uarg *n_args = 3; break; } + /* getfhat */ + case 564: { + struct getfhat_args *p = params; + iarg[0] = p->fd; /* int */ + uarg[1] = (intptr_t) p->path; /* char * */ + uarg[2] = (intptr_t) p->fhp; /* struct fhandle * */ + iarg[3] = p->flags; /* int */ + *n_args = 4; + break; + } + /* fhlink */ + case 565: { + struct fhlink_args *p = params; + uarg[0] = (intptr_t) p->fhp; /* struct fhandle * */ + uarg[1] = (intptr_t) p->to; /* const char * */ + *n_args = 2; + break; + } + /* fhlinkat */ + case 566: { + struct fhlinkat_args *p = params; + uarg[0] = (intptr_t) p->fhp; /* struct fhandle * */ + iarg[1] = p->tofd; /* int */ + uarg[2] = (intptr_t) p->to; /* const char * */ + *n_args = 3; + break; + } + /* fhreadlink */ + case 567: { + struct fhreadlink_args *p = params; + uarg[0] = (intptr_t) p->fhp; /* struct fhandle * */ + uarg[1] = (intptr_t) p->buf; /* char * */ + uarg[2] = p->bufsize; /* size_t */ + *n_args = 3; + break; + } default: *n_args = 0; break; @@ -8805,6 +8841,70 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d break; }; break; + /* getfhat */ + case 564: + switch(ndx) { + case 0: + p = "int"; + break; + case 1: + p = "userland char *"; + break; + case 2: + p = "userland struct fhandle *"; + break; + case 3: + p = "int"; + break; + default: + break; + }; + break; + /* fhlink */ + case 565: + switch(ndx) { + case 0: + p = "userland struct fhandle *"; + break; + case 1: + p = "userland const char *"; + break; + default: + break; + }; + break; + /* fhlinkat */ + case 566: + switch(ndx) { + case 0: + p = "userland struct fhandle *"; + break; + case 1: + p = "int"; + break; + case 2: + p = "userland const char *"; + break; + default: + break; + }; + break; + /* fhreadlink */ + case 567: + switch(ndx) { + case 0: + p = "userland struct fhandle *"; + break; + case 1: + p = "userland char *"; + break; + case 2: + p = "size_t"; + break; + default: + break; + }; + break; default: break; }; @@ -10651,6 +10751,26 @@ systrace_return_setargdesc(int sysnum, int ndx, char * break; /* getrandom */ case 563: + if (ndx == 0 || ndx == 1) + p = "int"; + break; + /* getfhat */ + case 564: + if (ndx == 0 || ndx == 1) + p = "int"; + break; + /* fhlink */ + case 565: + if (ndx == 0 || ndx == 1) + p = "int"; + break; + /* fhlinkat */ + case 566: + if (ndx == 0 || ndx == 1) + p = "int"; + break; + /* fhreadlink */ + case 567: if (ndx == 0 || ndx == 1) p = "int"; break; Modified: head/sys/kern/init_sysent.c ============================================================================== --- head/sys/kern/init_sysent.c Fri Dec 7 15:17:29 2018 (r341689) +++ head/sys/kern/init_sysent.c Fri Dec 7 15:19:00 2018 (r341690) @@ -613,4 +613,8 @@ struct sysent sysent[] = { { AS(cpuset_getdomain_args), (sy_call_t *)sys_cpuset_getdomain, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 561 = cpuset_getdomain */ { AS(cpuset_setdomain_args), (sy_call_t *)sys_cpuset_setdomain, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 562 = cpuset_setdomain */ { AS(getrandom_args), (sy_call_t *)sys_getrandom, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 563 = getrandom */ + { AS(getfhat_args), (sy_call_t *)sys_getfhat, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 564 = getfhat */ + { AS(fhlink_args), (sy_call_t *)sys_fhlink, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 565 = fhlink */ + { AS(fhlinkat_args), (sy_call_t *)sys_fhlinkat, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 566 = fhlinkat */ + { AS(fhreadlink_args), (sy_call_t *)sys_fhreadlink, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 567 = fhreadlink */ }; Modified: head/sys/kern/syscalls.c ============================================================================== --- head/sys/kern/syscalls.c Fri Dec 7 15:17:29 2018 (r341689) +++ head/sys/kern/syscalls.c Fri Dec 7 15:19:00 2018 (r341690) @@ -570,4 +570,8 @@ const char *syscallnames[] = { "cpuset_getdomain", /* 561 = cpuset_getdomain */ "cpuset_setdomain", /* 562 = cpuset_setdomain */ "getrandom", /* 563 = getrandom */ + "getfhat", /* 564 = getfhat */ + "fhlink", /* 565 = fhlink */ + "fhlinkat", /* 566 = fhlinkat */ + "fhreadlink", /* 567 = fhreadlink */ }; Modified: head/sys/kern/systrace_args.c ============================================================================== --- head/sys/kern/systrace_args.c Fri Dec 7 15:17:29 2018 (r341689) +++ head/sys/kern/systrace_args.c Fri Dec 7 15:19:00 2018 (r341690) @@ -3266,6 +3266,42 @@ systrace_args(int sysnum, void *params, uint64_t *uarg *n_args = 3; break; } + /* getfhat */ + case 564: { + struct getfhat_args *p = params; + iarg[0] = p->fd; /* int */ + uarg[1] = (intptr_t) p->path; /* char * */ + uarg[2] = (intptr_t) p->fhp; /* struct fhandle * */ + iarg[3] = p->flags; /* int */ + *n_args = 4; + break; + } + /* fhlink */ + case 565: { + struct fhlink_args *p = params; + uarg[0] = (intptr_t) p->fhp; /* struct fhandle * */ + uarg[1] = (intptr_t) p->to; /* const char * */ + *n_args = 2; + break; + } + /* fhlinkat */ + case 566: { + struct fhlinkat_args *p = params; + uarg[0] = (intptr_t) p->fhp; /* struct fhandle * */ + iarg[1] = p->tofd; /* int */ + uarg[2] = (intptr_t) p->to; /* const char * */ + *n_args = 3; + break; + } + /* fhreadlink */ + case 567: { + struct fhreadlink_args *p = params; + uarg[0] = (intptr_t) p->fhp; /* struct fhandle * */ + uarg[1] = (intptr_t) p->buf; /* char * */ + uarg[2] = p->bufsize; /* size_t */ + *n_args = 3; + break; + } default: *n_args = 0; break; @@ -8710,6 +8746,70 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d break; }; break; + /* getfhat */ + case 564: + switch(ndx) { + case 0: + p = "int"; + break; + case 1: + p = "userland char *"; + break; + case 2: + p = "userland struct fhandle *"; + break; + case 3: + p = "int"; + break; + default: + break; + }; + break; + /* fhlink */ + case 565: + switch(ndx) { + case 0: + p = "userland struct fhandle *"; + break; + case 1: + p = "userland const char *"; + break; + default: + break; + }; + break; + /* fhlinkat */ + case 566: + switch(ndx) { + case 0: + p = "userland struct fhandle *"; + break; + case 1: + p = "int"; + break; + case 2: + p = "userland const char *"; + break; + default: + break; + }; + break; + /* fhreadlink */ + case 567: + switch(ndx) { + case 0: + p = "userland struct fhandle *"; + break; + case 1: + p = "userland char *"; + break; + case 2: + p = "size_t"; + break; + default: + break; + }; + break; default: break; }; @@ -10583,6 +10683,26 @@ systrace_return_setargdesc(int sysnum, int ndx, char * break; /* getrandom */ case 563: + if (ndx == 0 || ndx == 1) + p = "int"; + break; + /* getfhat */ + case 564: + if (ndx == 0 || ndx == 1) + p = "int"; + break; + /* fhlink */ + case 565: + if (ndx == 0 || ndx == 1) + p = "int"; + break; + /* fhlinkat */ + case 566: + if (ndx == 0 || ndx == 1) + p = "int"; + break; + /* fhreadlink */ + case 567: if (ndx == 0 || ndx == 1) p = "int"; break; Modified: head/sys/sys/syscall.h ============================================================================== --- head/sys/sys/syscall.h Fri Dec 7 15:17:29 2018 (r341689) +++ head/sys/sys/syscall.h Fri Dec 7 15:19:00 2018 (r341690) @@ -499,4 +499,8 @@ #define SYS_cpuset_getdomain 561 #define SYS_cpuset_setdomain 562 #define SYS_getrandom 563 -#define SYS_MAXSYSCALL 564 +#define SYS_getfhat 564 +#define SYS_fhlink 565 +#define SYS_fhlinkat 566 +#define SYS_fhreadlink 567 +#define SYS_MAXSYSCALL 568 Modified: head/sys/sys/syscall.mk ============================================================================== --- head/sys/sys/syscall.mk Fri Dec 7 15:17:29 2018 (r341689) +++ head/sys/sys/syscall.mk Fri Dec 7 15:19:00 2018 (r341690) @@ -404,4 +404,8 @@ MIASM = \ kevent.o \ cpuset_getdomain.o \ cpuset_setdomain.o \ - getrandom.o + getrandom.o \ + getfhat.o \ + fhlink.o \ + fhlinkat.o \ + fhreadlink.o Modified: head/sys/sys/sysproto.h ============================================================================== --- head/sys/sys/sysproto.h Fri Dec 7 15:17:29 2018 (r341689) +++ head/sys/sys/sysproto.h Fri Dec 7 15:19:00 2018 (r341690) @@ -1770,6 +1770,26 @@ struct getrandom_args { char buflen_l_[PADL_(size_t)]; size_t buflen; char buflen_r_[PADR_(size_t)]; char flags_l_[PADL_(unsigned int)]; unsigned int flags; char flags_r_[PADR_(unsigned int)]; }; +struct getfhat_args { + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; + char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; + char fhp_l_[PADL_(struct fhandle *)]; struct fhandle * fhp; char fhp_r_[PADR_(struct fhandle *)]; + char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; +}; +struct fhlink_args { + char fhp_l_[PADL_(struct fhandle *)]; struct fhandle * fhp; char fhp_r_[PADR_(struct fhandle *)]; + char to_l_[PADL_(const char *)]; const char * to; char to_r_[PADR_(const char *)]; +}; +struct fhlinkat_args { + char fhp_l_[PADL_(struct fhandle *)]; struct fhandle * fhp; char fhp_r_[PADR_(struct fhandle *)]; + char tofd_l_[PADL_(int)]; int tofd; char tofd_r_[PADR_(int)]; + char to_l_[PADL_(const char *)]; const char * to; char to_r_[PADR_(const char *)]; +}; +struct fhreadlink_args { + char fhp_l_[PADL_(struct fhandle *)]; struct fhandle * fhp; char fhp_r_[PADR_(struct fhandle *)]; + char buf_l_[PADL_(char *)]; char * buf; char buf_r_[PADR_(char *)]; + char bufsize_l_[PADL_(size_t)]; size_t bufsize; char bufsize_r_[PADR_(size_t)]; +}; int nosys(struct thread *, struct nosys_args *); void sys_sys_exit(struct thread *, struct sys_exit_args *); int sys_fork(struct thread *, struct fork_args *); @@ -2150,6 +2170,10 @@ int sys_kevent(struct thread *, struct kevent_args *); int sys_cpuset_getdomain(struct thread *, struct cpuset_getdomain_args *); int sys_cpuset_setdomain(struct thread *, struct cpuset_setdomain_args *); int sys_getrandom(struct thread *, struct getrandom_args *); +int sys_getfhat(struct thread *, struct getfhat_args *); +int sys_fhlink(struct thread *, struct fhlink_args *); +int sys_fhlinkat(struct thread *, struct fhlinkat_args *); +int sys_fhreadlink(struct thread *, struct fhreadlink_args *); #ifdef COMPAT_43 @@ -3052,6 +3076,10 @@ int freebsd11_mknodat(struct thread *, struct freebsd1 #define SYS_AUE_cpuset_getdomain AUE_NULL #define SYS_AUE_cpuset_setdomain AUE_NULL #define SYS_AUE_getrandom AUE_NULL +#define SYS_AUE_getfhat AUE_NULL +#define SYS_AUE_fhlink AUE_NULL +#define SYS_AUE_fhlinkat AUE_NULL +#define SYS_AUE_fhreadlink AUE_NULL #undef PAD_ #undef PADL_ From owner-svn-src-head@freebsd.org Fri Dec 7 15:52:51 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 474011311B64; Fri, 7 Dec 2018 15:52: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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D7F866A531; Fri, 7 Dec 2018 15:52:50 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B50B415351; Fri, 7 Dec 2018 15:52:50 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB7FqorP056348; Fri, 7 Dec 2018 15:52:50 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB7Fqoau056347; Fri, 7 Dec 2018 15:52:50 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201812071552.wB7Fqoau056347@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 7 Dec 2018 15:52:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341692 - head/lib/libcasper/services/cap_syslog X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/lib/libcasper/services/cap_syslog X-SVN-Commit-Revision: 341692 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D7F866A531 X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.988,0]; NEURAL_HAM_LONG(-0.99)[-0.990,0]; NEURAL_HAM_SHORT(-0.96)[-0.963,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 07 Dec 2018 15:52:51 -0000 Author: markj Date: Fri Dec 7 15:52:50 2018 New Revision: 341692 URL: https://svnweb.freebsd.org/changeset/base/341692 Log: Let the cap_syslog capability inherit stdio descriptors. Otherwise cap_openlog(LOG_PERROR) doesn't work. Reviewed by: oshogbo MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D18457 Modified: head/lib/libcasper/services/cap_syslog/cap_syslog.c Modified: head/lib/libcasper/services/cap_syslog/cap_syslog.c ============================================================================== --- head/lib/libcasper/services/cap_syslog/cap_syslog.c Fri Dec 7 15:48:42 2018 (r341691) +++ head/lib/libcasper/services/cap_syslog/cap_syslog.c Fri Dec 7 15:52:50 2018 (r341692) @@ -198,4 +198,4 @@ syslog_command(const char *cmd, const nvlist_t *limits return (0); } -CREATE_SERVICE("system.syslog", NULL, syslog_command, 0); +CREATE_SERVICE("system.syslog", NULL, syslog_command, CASPER_SERVICE_STDIO); From owner-svn-src-head@freebsd.org Fri Dec 7 15:55:25 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 015551311C94; Fri, 7 Dec 2018 15:55:25 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 99F8F6A730; Fri, 7 Dec 2018 15:55:24 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6150715366; Fri, 7 Dec 2018 15:55:24 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB7FtO2l056536; Fri, 7 Dec 2018 15:55:24 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB7FtNlw056531; Fri, 7 Dec 2018 15:55:23 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201812071555.wB7FtNlw056531@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 7 Dec 2018 15:55:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341693 - in head/sys/riscv: include riscv X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys/riscv: include riscv X-SVN-Commit-Revision: 341693 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 99F8F6A730 X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.989,0]; NEURAL_HAM_LONG(-0.99)[-0.991,0]; NEURAL_HAM_SHORT(-0.98)[-0.980,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 07 Dec 2018 15:55:25 -0000 Author: markj Date: Fri Dec 7 15:55:23 2018 New Revision: 341693 URL: https://svnweb.freebsd.org/changeset/base/341693 Log: Rename sptbr to satp per v1.10 of the privileged architecture spec. Add a subroutine for updating satp, for use when updating the active pmap. No functional change intended. Reviewed by: jhb MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D18462 Modified: head/sys/riscv/include/cpufunc.h head/sys/riscv/riscv/locore.S head/sys/riscv/riscv/pmap.c head/sys/riscv/riscv/swtch.S Modified: head/sys/riscv/include/cpufunc.h ============================================================================== --- head/sys/riscv/include/cpufunc.h Fri Dec 7 15:52:50 2018 (r341692) +++ head/sys/riscv/include/cpufunc.h Fri Dec 7 15:55:23 2018 (r341693) @@ -109,6 +109,13 @@ sfence_vma_page(uintptr_t addr) #define rdinstret() csr_read64(instret) #define rdhpmcounter(n) csr_read64(hpmcounter##n) +static __inline void +load_satp(uint64_t val) +{ + + __asm __volatile("csrw satp, %0" :: "r"(val)); +} + #define cpufunc_nullop() riscv_nullop() void riscv_nullop(void); Modified: head/sys/riscv/riscv/locore.S ============================================================================== --- head/sys/riscv/riscv/locore.S Fri Dec 7 15:52:50 2018 (r341692) +++ head/sys/riscv/riscv/locore.S Fri Dec 7 15:55:23 2018 (r341693) @@ -152,7 +152,7 @@ _start: li t0, SATP_MODE_SV39 or s2, s2, t0 sfence.vma - csrw sptbr, s2 + csrw satp, s2 .align 2 va: @@ -297,7 +297,7 @@ ENTRY(mpentry) li t0, SATP_MODE_SV39 or s2, s2, t0 sfence.vma - csrw sptbr, s2 + csrw satp, s2 .align 2 mpva: Modified: head/sys/riscv/riscv/pmap.c ============================================================================== --- head/sys/riscv/riscv/pmap.c Fri Dec 7 15:52:50 2018 (r341692) +++ head/sys/riscv/riscv/pmap.c Fri Dec 7 15:55:23 2018 (r341693) @@ -3302,7 +3302,7 @@ pmap_activate(struct thread *td) reg = SATP_MODE_SV39; reg |= (td->td_pcb->pcb_l1addr >> PAGE_SHIFT); - __asm __volatile("csrw sptbr, %0" :: "r"(reg)); + load_satp(reg); pmap_invalidate_all(pmap); critical_exit(); Modified: head/sys/riscv/riscv/swtch.S ============================================================================== --- head/sys/riscv/riscv/swtch.S Fri Dec 7 15:52:50 2018 (r341692) +++ head/sys/riscv/riscv/swtch.S Fri Dec 7 15:55:23 2018 (r341693) @@ -223,7 +223,7 @@ ENTRY(cpu_throw) srli t0, t0, PAGE_SHIFT li t1, SATP_MODE_SV39 or t0, t0, t1 - csrw sptbr, t0 + csrw satp, t0 /* TODO: Invalidate the TLB */ @@ -341,7 +341,7 @@ ENTRY(cpu_switch) srli t0, t0, PAGE_SHIFT li t1, SATP_MODE_SV39 or t0, t0, t1 - csrw sptbr, t0 + csrw satp, t0 /* TODO: Invalidate the TLB */ From owner-svn-src-head@freebsd.org Fri Dec 7 15:56:41 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 53CB91311D5C; Fri, 7 Dec 2018 15:56:41 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EB88F6A8DD; Fri, 7 Dec 2018 15:56:40 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B25E815367; Fri, 7 Dec 2018 15:56:40 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB7FueWO056632; Fri, 7 Dec 2018 15:56:40 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB7Fuei5056631; Fri, 7 Dec 2018 15:56:40 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201812071556.wB7Fuei5056631@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 7 Dec 2018 15:56:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341694 - head/sys/riscv/include X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/riscv/include X-SVN-Commit-Revision: 341694 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: EB88F6A8DD X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.989,0]; NEURAL_HAM_LONG(-0.99)[-0.991,0]; NEURAL_HAM_SHORT(-0.98)[-0.980,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 07 Dec 2018 15:56:41 -0000 Author: markj Date: Fri Dec 7 15:56:40 2018 New Revision: 341694 URL: https://svnweb.freebsd.org/changeset/base/341694 Log: Update the description of the address space layout on RISC-V. This adds more detail and fixes some inaccuracies. Reviewed by: jhb MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D18463 Modified: head/sys/riscv/include/vmparam.h Modified: head/sys/riscv/include/vmparam.h ============================================================================== --- head/sys/riscv/include/vmparam.h Fri Dec 7 15:55:23 2018 (r341693) +++ head/sys/riscv/include/vmparam.h Fri Dec 7 15:56:40 2018 (r341694) @@ -115,23 +115,24 @@ /** * Address space layout. * - * RISC-V implements up to a 48 bit virtual address space. The address space is - * split into 2 regions at each end of the 64 bit address space, with an - * out of range "hole" in the middle. + * RISC-V implements multiple paging modes with different virtual address space + * sizes: SV32, SV39 and SV48. SV39 permits a virtual address space size of + * 512GB and uses a three-level page table. Since this is large enough for most + * purposes, we currently use SV39 for both userland and the kernel, avoiding + * the extra translation step required by SV48. * - * We limit the size of the two spaces to 39 bits each. + * The address space is split into two regions at each end of the 64-bit address + * space: * - * Upper region: 0xffffffffffffffff - * 0xffffff8000000000 + * 0x0000000000000000 - 0x0000003fffffffff 256GB user map + * 0x0000004000000000 - 0xffffffbfffffffff unmappable + * 0xffffffc000000000 - 0xffffffc7ffffffff 32GB kernel map + * 0xffffffc800000000 - 0xffffffcfffffffff 32GB unused + * 0xffffffd000000000 - 0xffffffefffffffff 128GB direct map + * 0xfffffff000000000 - 0xffffffffffffffff 64GB unused * - * Hole: 0xffffff7fffffffff - * 0x0000008000000000 + * The kernel is loaded at the beginning of the kernel map. * - * Lower region: 0x0000007fffffffff - * 0x0000000000000000 - * - * We use the upper region for the kernel, and the lower region for userland. - * * We define some interesting address constants: * * VM_MIN_ADDRESS and VM_MAX_ADDRESS define the start and end of the entire @@ -146,11 +147,9 @@ #define VM_MIN_ADDRESS (0x0000000000000000UL) #define VM_MAX_ADDRESS (0xffffffffffffffffUL) -/* 32 GiB of kernel addresses */ #define VM_MIN_KERNEL_ADDRESS (0xffffffc000000000UL) #define VM_MAX_KERNEL_ADDRESS (0xffffffc800000000UL) -/* 128 GiB maximum for the direct map region */ #define DMAP_MIN_ADDRESS (0xffffffd000000000UL) #define DMAP_MAX_ADDRESS (0xfffffff000000000UL) From owner-svn-src-head@freebsd.org Fri Dec 7 16:01:52 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BAB121312093; Fri, 7 Dec 2018 16:01:52 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5BD476AD4A; Fri, 7 Dec 2018 16:01:52 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3CBD7153DB; Fri, 7 Dec 2018 16:01:52 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB7G1qWx058452; Fri, 7 Dec 2018 16:01:52 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB7G1qwZ058451; Fri, 7 Dec 2018 16:01:52 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201812071601.wB7G1qwZ058451@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 7 Dec 2018 16:01:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341695 - head/sys/dev/acpi_support X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/dev/acpi_support X-SVN-Commit-Revision: 341695 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5BD476AD4A X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.988,0]; NEURAL_HAM_SHORT(-0.98)[-0.979,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.99)[-0.990,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 07 Dec 2018 16:01:52 -0000 Author: avg Date: Fri Dec 7 16:01:51 2018 New Revision: 341695 URL: https://svnweb.freebsd.org/changeset/base/341695 Log: aibs: fix a typo in the probe method that was introduced in r339754 Because of that typo the driver would try to attach to every device on acpi bus. That disrupted acpi attachment of uart driver, at least. MFC after: 4 days X-MFC with: r339754 Modified: head/sys/dev/acpi_support/atk0110.c Modified: head/sys/dev/acpi_support/atk0110.c ============================================================================== --- head/sys/dev/acpi_support/atk0110.c Fri Dec 7 15:56:40 2018 (r341694) +++ head/sys/dev/acpi_support/atk0110.c Fri Dec 7 16:01:51 2018 (r341695) @@ -129,7 +129,7 @@ aibs_probe(device_t dev) rv = ACPI_ID_PROBE(device_get_parent(dev), dev, aibs_hids, NULL); if (rv <= 0 ) device_set_desc(dev, "ASUSTeK AI Booster (ACPI ASOC ATK0110)"); - return (0); + return (rv); } static int From owner-svn-src-head@freebsd.org Fri Dec 7 16:05:40 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0FBAD1312235; Fri, 7 Dec 2018 16:05:40 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AC40E6B13C; Fri, 7 Dec 2018 16:05:39 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 87BE01551D; Fri, 7 Dec 2018 16:05:39 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB7G5dEj061878; Fri, 7 Dec 2018 16:05:39 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB7G5dFx061877; Fri, 7 Dec 2018 16:05:39 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201812071605.wB7G5dFx061877@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 7 Dec 2018 16:05:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341696 - head/sys/dev/acpica X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/dev/acpica X-SVN-Commit-Revision: 341696 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: AC40E6B13C X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.988,0]; NEURAL_HAM_SHORT(-0.98)[-0.979,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.99)[-0.990,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 07 Dec 2018 16:05:40 -0000 Author: avg Date: Fri Dec 7 16:05:39 2018 New Revision: 341696 URL: https://svnweb.freebsd.org/changeset/base/341696 Log: acpi_MatchHid: use ACPI_MATCHHID_NOMATCH instead of FALSE Binary representation of both is the same (zero), but ACPI_MATCHHID_NOMATCH is better for consistency. MFC after: 4 days X-MFC with: r339754 Modified: head/sys/dev/acpica/acpi.c Modified: head/sys/dev/acpica/acpi.c ============================================================================== --- head/sys/dev/acpica/acpi.c Fri Dec 7 16:01:51 2018 (r341695) +++ head/sys/dev/acpica/acpi.c Fri Dec 7 16:05:39 2018 (r341696) @@ -2290,7 +2290,7 @@ acpi_MatchHid(ACPI_HANDLE h, const char *hid) ACPI_FAILURE(AcpiGetObjectInfo(h, &devinfo))) return (ACPI_MATCHHID_NOMATCH); - ret = FALSE; + ret = ACPI_MATCHHID_NOMATCH; if ((devinfo->Valid & ACPI_VALID_HID) != 0 && strcmp(hid, devinfo->HardwareId.String) == 0) ret = ACPI_MATCHHID_HID; From owner-svn-src-head@freebsd.org Fri Dec 7 16:10:14 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A965D1312405; Fri, 7 Dec 2018 16:10:14 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4C4606B5DC; Fri, 7 Dec 2018 16:10:14 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2946415527; Fri, 7 Dec 2018 16:10:14 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB7GAEfY062246; Fri, 7 Dec 2018 16:10:14 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB7GAEfe062245; Fri, 7 Dec 2018 16:10:14 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201812071610.wB7GAEfe062245@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 7 Dec 2018 16:10:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341697 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 341697 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4C4606B5DC X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.988,0]; NEURAL_HAM_LONG(-0.99)[-0.990,0]; NEURAL_HAM_SHORT(-0.98)[-0.979,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 07 Dec 2018 16:10:14 -0000 Author: mjg Date: Fri Dec 7 16:10:13 2018 New Revision: 341697 URL: https://svnweb.freebsd.org/changeset/base/341697 Log: refcount: remove a stale comment about conditional ref/unref routines It was there for vfs-specific variants and was copied over when it should not. Sponsored by: The FreeBSD Foundation Modified: head/sys/sys/refcount.h Modified: head/sys/sys/refcount.h ============================================================================== --- head/sys/sys/refcount.h Fri Dec 7 16:05:39 2018 (r341696) +++ head/sys/sys/refcount.h Fri Dec 7 16:10:13 2018 (r341697) @@ -79,8 +79,6 @@ refcount_release(volatile u_int *count) /* * This functions returns non-zero if the refcount was * incremented. Else zero is returned. - * - * A temporary hack until refcount_* APIs are sorted out. */ static __inline __result_use_check int refcount_acquire_if_not_zero(volatile u_int *count) From owner-svn-src-head@freebsd.org Fri Dec 7 16:11:46 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B83F1131249D; Fri, 7 Dec 2018 16:11:46 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5BE456B82B; Fri, 7 Dec 2018 16:11:46 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3D0C215675; Fri, 7 Dec 2018 16:11:46 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB7GBkjn063775; Fri, 7 Dec 2018 16:11:46 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB7GBjjs063772; Fri, 7 Dec 2018 16:11:45 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201812071611.wB7GBjjs063772@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 7 Dec 2018 16:11:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341698 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 341698 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5BE456B82B X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.988,0]; NEURAL_HAM_SHORT(-0.98)[-0.979,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.99)[-0.990,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 07 Dec 2018 16:11:47 -0000 Author: mjg Date: Fri Dec 7 16:11:45 2018 New Revision: 341698 URL: https://svnweb.freebsd.org/changeset/base/341698 Log: Replace hand-rolled unrefs if > 1 with refcount_release_if_not_last Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/kern_jail.c head/sys/kern/kern_loginclass.c head/sys/kern/kern_resource.c Modified: head/sys/kern/kern_jail.c ============================================================================== --- head/sys/kern/kern_jail.c Fri Dec 7 16:10:13 2018 (r341697) +++ head/sys/kern/kern_jail.c Fri Dec 7 16:11:45 2018 (r341698) @@ -4023,13 +4023,11 @@ prison_racct_free_locked(struct prison_racct *prr) void prison_racct_free(struct prison_racct *prr) { - int old; ASSERT_RACCT_ENABLED(); sx_assert(&allprison_lock, SA_UNLOCKED); - old = prr->prr_refcount; - if (old > 1 && atomic_cmpset_int(&prr->prr_refcount, old, old - 1)) + if (refcount_release_if_not_last(&prr->prr_refcount)) return; sx_xlock(&allprison_lock); Modified: head/sys/kern/kern_loginclass.c ============================================================================== --- head/sys/kern/kern_loginclass.c Fri Dec 7 16:10:13 2018 (r341697) +++ head/sys/kern/kern_loginclass.c Fri Dec 7 16:11:45 2018 (r341698) @@ -84,10 +84,8 @@ loginclass_hold(struct loginclass *lc) void loginclass_free(struct loginclass *lc) { - int old; - old = lc->lc_refcount; - if (old > 1 && atomic_cmpset_int(&lc->lc_refcount, old, old - 1)) + if (refcount_release_if_not_last(&lc->lc_refcount)) return; rw_wlock(&loginclasses_lock); Modified: head/sys/kern/kern_resource.c ============================================================================== --- head/sys/kern/kern_resource.c Fri Dec 7 16:10:13 2018 (r341697) +++ head/sys/kern/kern_resource.c Fri Dec 7 16:11:45 2018 (r341698) @@ -1323,14 +1323,10 @@ uihold(struct uidinfo *uip) void uifree(struct uidinfo *uip) { - int old; - /* Prepare for optimal case. */ - old = uip->ui_ref; - if (old > 1 && atomic_cmpset_int(&uip->ui_ref, old, old - 1)) + if (refcount_release_if_not_last(&uip->ui_ref)) return; - /* Prepare for suboptimal case. */ rw_wlock(&uihashtbl_lock); if (refcount_release(&uip->ui_ref) == 0) { rw_wunlock(&uihashtbl_lock); From owner-svn-src-head@freebsd.org Fri Dec 7 16:22:55 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9AFF01312A64; Fri, 7 Dec 2018 16:22:55 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3C54D6C186; Fri, 7 Dec 2018 16:22:55 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 17FF01586C; Fri, 7 Dec 2018 16:22:55 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB7GMsvJ072169; Fri, 7 Dec 2018 16:22:54 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB7GMsUo072168; Fri, 7 Dec 2018 16:22:54 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201812071622.wB7GMsUo072168@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 7 Dec 2018 16:22:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341699 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 341699 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3C54D6C186 X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.988,0]; NEURAL_HAM_SHORT(-0.96)[-0.964,0]; NEURAL_HAM_LONG(-0.99)[-0.990,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 07 Dec 2018 16:22:55 -0000 Author: mjg Date: Fri Dec 7 16:22:54 2018 New Revision: 341699 URL: https://svnweb.freebsd.org/changeset/base/341699 Log: vm: use fcmpset for vmspace reference counting Sponsored by: The FreeBSD Foundation Modified: head/sys/vm/vm_map.c Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Fri Dec 7 16:11:45 2018 (r341698) +++ head/sys/vm/vm_map.c Fri Dec 7 16:22:54 2018 (r341699) @@ -391,8 +391,8 @@ vmspace_exit(struct thread *td) p = td->td_proc; vm = p->p_vmspace; atomic_add_int(&vmspace0.vm_refcnt, 1); + refcnt = vm->vm_refcnt; do { - refcnt = vm->vm_refcnt; if (refcnt > 1 && p->p_vmspace != &vmspace0) { /* Switch now since other proc might free vmspace */ PROC_VMSPACE_LOCK(p); @@ -400,7 +400,7 @@ vmspace_exit(struct thread *td) PROC_VMSPACE_UNLOCK(p); pmap_activate(td); } - } while (!atomic_cmpset_int(&vm->vm_refcnt, refcnt, refcnt - 1)); + } while (!atomic_fcmpset_int(&vm->vm_refcnt, &refcnt, refcnt - 1)); if (refcnt == 1) { if (p->p_vmspace != vm) { /* vmspace not yet freed, switch back */ @@ -437,13 +437,13 @@ vmspace_acquire_ref(struct proc *p) PROC_VMSPACE_UNLOCK(p); return (NULL); } + refcnt = vm->vm_refcnt; do { - refcnt = vm->vm_refcnt; if (refcnt <= 0) { /* Avoid 0->1 transition */ PROC_VMSPACE_UNLOCK(p); return (NULL); } - } while (!atomic_cmpset_int(&vm->vm_refcnt, refcnt, refcnt + 1)); + } while (!atomic_fcmpset_int(&vm->vm_refcnt, &refcnt, refcnt + 1)); if (vm != p->p_vmspace) { PROC_VMSPACE_UNLOCK(p); vmspace_free(vm); From owner-svn-src-head@freebsd.org Fri Dec 7 16:33:42 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0C4EA1312F01 for ; Fri, 7 Dec 2018 16:33:42 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x82d.google.com (mail-qt1-x82d.google.com [IPv6:2607:f8b0:4864:20::82d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 436736CA6E for ; Fri, 7 Dec 2018 16:33:41 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x82d.google.com with SMTP id t13so5129112qtn.3 for ; Fri, 07 Dec 2018 08:33:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=2hGJMlLBQODYjcxViExIo1narCBIwcm51BD43sGgPvI=; b=AsakdCcd2jJB6GitaTiCPfiAnHcu69fOKucviiiSboAMYRAtSspqHFU4qtPgb9aNhN yV0aH3NcxL3cPNm7nWpNl49DTMgOTKDkh7SykvrJuRR5uCuTWVNjpQQHKC3uVKMWmcd4 rsMIrLXyS1bayCbT+Nk5wzTY2mJKTk8AuAZNGAp7dW37y6b018xaGOmXY9V46gwRF3e2 bvHO3A+RkKqkX/gL7XitTCm/GOqDpOu56oGWCAgfr3fKgc6vW23gwzHjScEi9TkkCZTx dyajKwnDUzucufZ2pqTAGbTB1j/GV1qknDG0we64Yg++Y2L2xOmkUrQkXtBHBFy7uq04 a1dA== 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=2hGJMlLBQODYjcxViExIo1narCBIwcm51BD43sGgPvI=; b=gwGOIT3Xz1jmSBY3+SgRatf0p363ckf1/P9Qb+wBs2axrRptdiBhUf42SlnOLJvXzE W0VJ0NMSk+92oQGKFYBrTW3Oul6Nzho6+bcY8HuIPV6o1IBGGCyQDKwm5qrVFx0a44Kq Br7OHAZaUgGO4/S9pgpol6IRAVGV0hKPT0mpZXDP1DMkBcajMt20pgs+I2sFpVf8yIyi 5ORmap2rhsfos+2ppTUbmrgLfz4MR+z0er+73xyzA7OjIv2tSyyitz4RJI3oNe36wWi+ PFEsteXZbahsrHbeRDF/zl+AUJSM42Wlvl2vLGFx3SFcWn3qkuZKX3g0coEoWLpcuHPF QDXQ== X-Gm-Message-State: AA+aEWaf3qUXek95EAP16vjmWRiA71mqt77Fmc4DBkVlq13CrnrK2MvB UKrJKiEHVzmTQ7TzLBhYD8BxaiL61Lw5ixJscOahdQ== X-Google-Smtp-Source: AFSGD/VtoeY8TgpeTVHrunYdnllm6vvgv4wTlKGcjGZpwXie88WyWgJ4Z3hbr1TjWSyotA0fF+ETl04lX5os5rtUgcE= X-Received: by 2002:a05:6214:1087:: with SMTP id o7mr2693191qvr.115.1544200420375; Fri, 07 Dec 2018 08:33:40 -0800 (PST) MIME-Version: 1.0 References: <201812071202.wB7C2WT8038196@repo.freebsd.org> In-Reply-To: <201812071202.wB7C2WT8038196@repo.freebsd.org> From: Warner Losh Date: Fri, 7 Dec 2018 09:33:28 -0700 Message-ID: Subject: Re: svn commit: r341681 - head/sys/cam/scsi To: Andriy Gapon Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org X-Rspamd-Queue-Id: 436736CA6E X-Spamd-Result: default: False [-4.95 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; 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)[bsdimp.com]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MX_GOOD(-0.01)[cached: ALT1.aspmx.l.google.com]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; RCVD_IN_DNSWL_NONE(0.00)[d.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]; NEURAL_HAM_SHORT(-0.97)[-0.974,0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_LAST(0.00)[]; IP_SCORE(-1.97)[ip: (-6.97), ipnet: 2607:f8b0::/32(-1.51), asn: 15169(-1.30), country: US(-0.09)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_COUNT_TWO(0.00)[2] X-Rspamd-Server: mx1.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, 07 Dec 2018 16:33:42 -0000 On Fri, Dec 7, 2018 at 5:02 AM Andriy Gapon wrote: > Author: avg > Date: Fri Dec 7 12:02:31 2018 > New Revision: 341681 > URL: https://svnweb.freebsd.org/changeset/base/341681 > > Log: > daprobedone: announce if a disk is write-protected > > MFC after: 2 weeks > > Modified: > head/sys/cam/scsi/scsi_da.c > > Modified: head/sys/cam/scsi/scsi_da.c > > ============================================================================== > --- head/sys/cam/scsi/scsi_da.c Fri Dec 7 11:47:42 2018 (r341680) > +++ head/sys/cam/scsi/scsi_da.c Fri Dec 7 12:02:31 2018 (r341681) > @@ -2472,6 +2472,11 @@ daprobedone(struct cam_periph *periph, union ccb > *ccb) > printf("%s%d: %s\n", periph->periph_name, > periph->unit_number, buf); > } > + if ((softc->disk->d_flags & DISKFLAG_WRITE_PROTECT) != 0 && > + (softc->flags & DA_FLAG_ANNOUNCED) == 0) { > + printf("%s%d: Write Protected\n", periph->periph_name, > + periph->unit_number); > + } > This is incorrect. It needs to be added to buf so that it gets printed atomically with the rest of things. Warner > /* > * Since our peripheral may be invalidated by an error > > From owner-svn-src-head@freebsd.org Fri Dec 7 16:44:53 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7A7E01313254; Fri, 7 Dec 2018 16:44:53 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 19CA36D1E6; Fri, 7 Dec 2018 16:44:53 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EA58E15BDF; Fri, 7 Dec 2018 16:44:52 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB7GiqlF082636; Fri, 7 Dec 2018 16:44:52 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB7GiqpR082635; Fri, 7 Dec 2018 16:44:52 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201812071644.wB7GiqpR082635@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 7 Dec 2018 16:44:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341700 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 341700 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 19CA36D1E6 X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.988,0]; NEURAL_HAM_LONG(-0.99)[-0.990,0]; NEURAL_HAM_SHORT(-0.96)[-0.964,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 07 Dec 2018 16:44:53 -0000 Author: mjg Date: Fri Dec 7 16:44:52 2018 New Revision: 341700 URL: https://svnweb.freebsd.org/changeset/base/341700 Log: fd: try do less work with the lock in dup Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Fri Dec 7 16:22:54 2018 (r341699) +++ head/sys/kern/kern_descrip.c Fri Dec 7 16:44:52 2018 (r341700) @@ -818,6 +818,7 @@ kern_dup(struct thread *td, u_int mode, int flags, int p = td->td_proc; fdp = p->p_fd; + oioctls = NULL; MPASS((flags & ~(FDDUP_FLAG_CLOEXEC)) == 0); MPASS(mode < FDDUP_LASTMODE); @@ -922,7 +923,6 @@ kern_dup(struct thread *td, u_int mode, int flags, int #ifdef CAPABILITIES seq_write_end(&newfde->fde_seq); #endif - filecaps_free_finish(oioctls); td->td_retval[0] = new; error = 0; @@ -935,6 +935,7 @@ unlock: FILEDESC_XUNLOCK(fdp); } + filecaps_free_finish(oioctls); return (error); } @@ -1511,7 +1512,7 @@ filecaps_copy_prep(const struct filecaps *src) u_long *ioctls; size_t size; - if (src->fc_ioctls == NULL) + if (__predict_true(src->fc_ioctls == NULL)) return (NULL); KASSERT(src->fc_nioctls > 0, @@ -1529,7 +1530,7 @@ filecaps_copy_finish(const struct filecaps *src, struc size_t size; *dst = *src; - if (src->fc_ioctls == NULL) { + if (__predict_true(src->fc_ioctls == NULL)) { MPASS(ioctls == NULL); return; } From owner-svn-src-head@freebsd.org Fri Dec 7 16:47:36 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 238AF1313315; Fri, 7 Dec 2018 16:47:36 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A472E6D3A4; Fri, 7 Dec 2018 16:47:35 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 852D715BE1; Fri, 7 Dec 2018 16:47:35 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB7GlZms082798; Fri, 7 Dec 2018 16:47:35 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB7GlZwm082797; Fri, 7 Dec 2018 16:47:35 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201812071647.wB7GlZwm082797@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 7 Dec 2018 16:47:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341701 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 341701 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A472E6D3A4 X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.988,0]; NEURAL_HAM_SHORT(-0.96)[-0.965,0]; NEURAL_HAM_LONG(-0.99)[-0.990,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 07 Dec 2018 16:47:36 -0000 Author: mjg Date: Fri Dec 7 16:47:34 2018 New Revision: 341701 URL: https://svnweb.freebsd.org/changeset/base/341701 Log: racct: add RACCT_ENABLED macro and racct_set_unlocked This allows to remove PROC_LOCK/UNLOCK pairs spread thorought the kernel only used to appease racct_set. Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/kern_racct.c head/sys/sys/racct.h Modified: head/sys/kern/kern_racct.c ============================================================================== --- head/sys/kern/kern_racct.c Fri Dec 7 16:44:52 2018 (r341700) +++ head/sys/kern/kern_racct.c Fri Dec 7 16:47:34 2018 (r341701) @@ -726,6 +726,18 @@ racct_set_locked(struct proc *p, int resource, uint64_ * even if it's above the limit. */ int +racct_set_unlocked(struct proc *p, int resource, uint64_t amount) +{ + int error; + + ASSERT_RACCT_ENABLED(); + PROC_LOCK(p); + error = racct_set(p, resource, amount); + PROC_UNLOCK(p); + return (error); +} + +int racct_set(struct proc *p, int resource, uint64_t amount) { int error; Modified: head/sys/sys/racct.h ============================================================================== --- head/sys/sys/racct.h Fri Dec 7 16:44:52 2018 (r341700) +++ head/sys/sys/racct.h Fri Dec 7 16:47:34 2018 (r341701) @@ -164,12 +164,14 @@ extern struct mtx racct_lock; #define RACCT_UNLOCK() mtx_unlock(&racct_lock) #define RACCT_LOCK_ASSERT() mtx_assert(&racct_lock, MA_OWNED) +#define RACCT_ENABLED() __predict_false(racct_enable) + #define RACCT_PROC_LOCK(p) do { \ - if (__predict_false(racct_enable)) \ + if (RACCT_ENABLED()) \ PROC_LOCK(p); \ } while (0) #define RACCT_PROC_UNLOCK(p) do { \ - if (__predict_false(racct_enable)) \ + if (RACCT_ENABLED()) \ PROC_UNLOCK(p); \ } while (0) @@ -178,6 +180,7 @@ void racct_add_cred(struct ucred *cred, int resource, void racct_add_force(struct proc *p, int resource, uint64_t amount); void racct_add_buf(struct proc *p, const struct buf *bufp, int is_write); int racct_set(struct proc *p, int resource, uint64_t amount); +int racct_set_unlocked(struct proc *p, int resource, uint64_t amount); void racct_set_force(struct proc *p, int resource, uint64_t amount); void racct_sub(struct proc *p, int resource, uint64_t amount); void racct_sub_cred(struct ucred *cred, int resource, uint64_t amount); From owner-svn-src-head@freebsd.org Fri Dec 7 16:51:39 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D8CBD131347C; Fri, 7 Dec 2018 16:51:39 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7DE056D752; Fri, 7 Dec 2018 16:51:39 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5EE0215C3E; Fri, 7 Dec 2018 16:51:39 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB7Gpd7I084765; Fri, 7 Dec 2018 16:51:39 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB7Gpda9084764; Fri, 7 Dec 2018 16:51:39 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201812071651.wB7Gpda9084764@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 7 Dec 2018 16:51:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341702 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 341702 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7DE056D752 X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.988,0]; NEURAL_HAM_SHORT(-0.96)[-0.965,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.99)[-0.990,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 07 Dec 2018 16:51:40 -0000 Author: mjg Date: Fri Dec 7 16:51:38 2018 New Revision: 341702 URL: https://svnweb.freebsd.org/changeset/base/341702 Log: fd: use racct_set_unlocked Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Fri Dec 7 16:47:34 2018 (r341701) +++ head/sys/kern/kern_descrip.c Fri Dec 7 16:51:38 2018 (r341702) @@ -878,10 +878,8 @@ kern_dup(struct thread *td, u_int mode, int flags, int * the limit on the size of the file descriptor table. */ #ifdef RACCT - if (racct_enable) { - PROC_LOCK(p); - error = racct_set(p, RACCT_NOFILE, new + 1); - PROC_UNLOCK(p); + if (RACCT_ENABLED()) { + error = racct_set_unlocked(p, RACCT_NOFILE, new + 1); if (error != 0) { error = EMFILE; goto unlock; @@ -1751,10 +1749,8 @@ fdalloc(struct thread *td, int minfd, int *result) if (fd >= fdp->fd_nfiles) { allocfd = min(fd * 2, maxfd); #ifdef RACCT - if (racct_enable) { - PROC_LOCK(p); - error = racct_set(p, RACCT_NOFILE, allocfd); - PROC_UNLOCK(p); + if (RACCT_ENABLED()) { + error = racct_set_unlocked(p, RACCT_NOFILE, allocfd); if (error != 0) return (EMFILE); } @@ -2266,11 +2262,8 @@ fdescfree(struct thread *td) MPASS(fdp != NULL); #ifdef RACCT - if (racct_enable) { - PROC_LOCK(p); - racct_set(p, RACCT_NOFILE, 0); - PROC_UNLOCK(p); - } + if (RACCT_ENABLED()) + racct_set_unlocked(p, RACCT_NOFILE, 0); #endif if (p->p_fdtol != NULL) From owner-svn-src-head@freebsd.org Fri Dec 7 16:52:53 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6E2641313609; Fri, 7 Dec 2018 16:52:53 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 122B66DA80; Fri, 7 Dec 2018 16:52:53 +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 E742015D78; Fri, 7 Dec 2018 16:52:52 +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 wB7Gqq5n087778; Fri, 7 Dec 2018 16:52:52 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB7GqqFN087777; Fri, 7 Dec 2018 16:52:52 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201812071652.wB7GqqFN087777@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 7 Dec 2018 16:52:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341703 - head/etc/mtree X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/etc/mtree X-SVN-Commit-Revision: 341703 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 122B66DA80 X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.987,0]; NEURAL_HAM_LONG(-0.99)[-0.990,0]; NEURAL_HAM_SHORT(-0.96)[-0.963,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 07 Dec 2018 16:52:53 -0000 Author: emaste Date: Fri Dec 7 16:52:52 2018 New Revision: 341703 URL: https://svnweb.freebsd.org/changeset/base/341703 Log: BSD.debug.dist: add newly added nvmecontrol directory Modified: head/etc/mtree/BSD.debug.dist Modified: head/etc/mtree/BSD.debug.dist ============================================================================== --- head/etc/mtree/BSD.debug.dist Fri Dec 7 16:51:38 2018 (r341702) +++ head/etc/mtree/BSD.debug.dist Fri Dec 7 16:52:52 2018 (r341703) @@ -19,6 +19,8 @@ .. geom .. + nvmecontrol + .. .. libexec .. From owner-svn-src-head@freebsd.org Fri Dec 7 17:21:13 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5CA101314141; Fri, 7 Dec 2018 17:21:13 +0000 (UTC) (envelope-from agapon@gmail.com) Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 430476ED3A; Fri, 7 Dec 2018 17:21:12 +0000 (UTC) (envelope-from agapon@gmail.com) Received: by mail-lf1-f45.google.com with SMTP id f23so3532573lfc.13; Fri, 07 Dec 2018 09:21:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=NXekZ4mDKtE+bVHdVTiNua/JT8ebW0hmrRxdTSUSG2M=; b=nEDWYoiyvZoB9TiHEIHLknlqvca3sZCB8waHpDMW5A9WKJ3B1hibuDb3uPQnYuJT2r MC8QkRJUldwLBPH+lkE94oGwC0UpvbxtUbqahC9w+depeHQHvRrQx476TGz3vri+d8gR TSJQkZB0PZoq6riMfGFFXUGByqgBLzcS7h5uzbVbmVItqlFuCOJ96lUMte4POEWkIgZU /aIQWFYrd78ZFzaBNuYIL7e4DiZCfOyA/N31+6O5GHKHZ4uRTzlZevHqGUtQ95Am+KBY AcJRy+BpnUVo/Bn86/P4C181Owf8aAR8WEGkHa5tCR/lklKOiUKX/TxGC7fgJ5UGRm1L 0WRA== X-Gm-Message-State: AA+aEWYA4oiHhYE1D+SNw3d2zdkSGTdDjHRgVwhJwK6s8Es+zM4A2N34 +aMjw1IKoiWZjUpvjw4mnGfLLVFW X-Google-Smtp-Source: AFSGD/VXdfY3U6DJ5EsMUTrzmOs/7G2A6bG7MXQqaUl4WBpGqm+k9gz7aOZWg0L0kgx3PdpVuqefSw== X-Received: by 2002:a19:26ce:: with SMTP id m197mr1772361lfm.23.1544203264556; Fri, 07 Dec 2018 09:21:04 -0800 (PST) Received: from [192.168.0.88] (east.meadow.volia.net. [93.72.151.96]) by smtp.googlemail.com with ESMTPSA id u26-v6sm670910lji.22.2018.12.07.09.21.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Dec 2018 09:21:03 -0800 (PST) Subject: Re: svn commit: r341681 - head/sys/cam/scsi To: Warner Losh Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201812071202.wB7C2WT8038196@repo.freebsd.org> From: Andriy Gapon Openpgp: preference=signencrypt Autocrypt: addr=avg@FreeBSD.org; prefer-encrypt=mutual; keydata= xsFNBFm4LIgBEADNB/3lT7f15UKeQ52xCFQx/GqHkSxEdVyLFZTmY3KyNPQGBtyvVyBfprJ7 mAeXZWfhat6cKNRAGZcL5EmewdQuUfQfBdYmKjbw3a9GFDsDNuhDA2QwFt8BmkiVMRYyvI7l N0eVzszWCUgdc3qqM6qqcgBaqsVmJluwpvwp4ZBXmch5BgDDDb1MPO8AZ2QZfIQmplkj8Y6Z AiNMknkmgaekIINSJX8IzRzKD5WwMsin70psE8dpL/iBsA2cpJGzWMObVTtCxeDKlBCNqM1i gTXta1ukdUT7JgLEFZk9ceYQQMJJtUwzWu1UHfZn0Fs29HTqawfWPSZVbulbrnu5q55R4PlQ /xURkWQUTyDpqUvb4JK371zhepXiXDwrrpnyyZABm3SFLkk2bHlheeKU6Yql4pcmSVym1AS4 dV8y0oHAfdlSCF6tpOPf2+K9nW1CFA8b/tw4oJBTtfZ1kxXOMdyZU5fiG7xb1qDgpQKgHUX8 7Rd2T1UVLVeuhYlXNw2F+a2ucY+cMoqz3LtpksUiBppJhw099gEXehcN2JbUZ2TueJdt1FdS ztnZmsHUXLxrRBtGwqnFL7GSd6snpGIKuuL305iaOGODbb9c7ne1JqBbkw1wh8ci6vvwGlzx rexzimRaBzJxlkjNfMx8WpCvYebGMydNoeEtkWldtjTNVsUAtQARAQABzR5BbmRyaXkgR2Fw b24gPGF2Z0BGcmVlQlNELm9yZz7CwZQEEwEIAD4WIQS+LEO7ngQnXA4Bjr538m7TUc1yjwUC WbgsiAIbIwUJBaOagAULCQgHAgYVCAkKCwIEFgIDAQIeAQIXgAAKCRB38m7TUc1yj+JAEACV l9AK/nOWAt/9cufV2fRj0hdOqB1aCshtSrwHk/exXsDa4/FkmegxXQGY+3GWX3deIyesbVRL rYdtdK0dqJyT1SBqXK1h3/at9rxr9GQA6KWOxTjUFURsU7ok/6SIlm8uLRPNKO+yq0GDjgaO LzN+xykuBA0FlhQAXJnpZLcVfPJdWv7sSHGedL5ln8P8rxR+XnmsA5TUaaPcbhTB+mG+iKFj GghASDSfGqLWFPBlX/fpXikBDZ1gvOr8nyMY9nXhgfXpq3B6QCRYKPy58ChrZ5weeJZ29b7/ QdEO8NFNWHjSD9meiLdWQaqo9Y7uUxN3wySc/YUZxtS0bhAd8zJdNPsJYG8sXgKjeBQMVGuT eCAJFEYJqbwWvIXMfVWop4+O4xB+z2YE3jAbG/9tB/GSnQdVSj3G8MS80iLS58frnt+RSEw/ psahrfh0dh6SFHttE049xYiC+cM8J27Aaf0i9RflyITq57NuJm+AHJoU9SQUkIF0nc6lfA+o JRiyRlHZHKoRQkIg4aiKaZSWjQYRl5Txl0IZUP1dSWMX4s3XTMurC/pnja45dge/4ESOtJ9R 8XuIWg45Oq6MeIWdjKddGhRj3OohsltKgkEU3eLKYtB6qRTQypHHUawCXz88uYt5e3w4V16H lCpSTZV/EVHnNe45FVBlvK7k7HFfDDkryM7BTQRZuCyIARAAlq0slcsVboY/+IUJdcbEiJRW be9HKVz4SUchq0z9MZPX/0dcnvz/gkyYA+OuM78dNS7Mbby5dTvOqfpLJfCuhaNYOhlE0wY+ 1T6Tf1f4c/uA3U/YiadukQ3+6TJuYGAdRZD5EqYFIkreARTVWg87N9g0fT9BEqLw9lJtEGDY EWUE7L++B8o4uu3LQFEYxcrb4K/WKmgtmFcm77s0IKDrfcX4doV92QTIpLiRxcOmCC/OCYuO jB1oaaqXQzZrCutXRK0L5XN1Y1PYjIrEzHMIXmCDlLYnpFkK+itlXwlE2ZQxkfMruCWdQXye syl2fynAe8hvp7Mms9qU2r2K9EcJiR5N1t1C2/kTKNUhcRv7Yd/vwusK7BqJbhlng5ZgRx0m WxdntU/JLEntz3QBsBsWM9Y9wf2V4tLv6/DuDBta781RsCB/UrU2zNuOEkSixlUiHxw1dccI 6CVlaWkkJBxmHX22GdDFrcjvwMNIbbyfQLuBq6IOh8nvu9vuItup7qemDG3Ms6TVwA7BD3j+ 3fGprtyW8Fd/RR2bW2+LWkMrqHffAr6Y6V3h5kd2G9Q8ZWpEJk+LG6Mk3fhZhmCnHhDu6CwN MeUvxXDVO+fqc3JjFm5OxhmfVeJKrbCEUJyM8ESWLoNHLqjywdZga4Q7P12g8DUQ1mRxYg/L HgZY3zfKOqcAEQEAAcLBfAQYAQgAJhYhBL4sQ7ueBCdcDgGOvnfybtNRzXKPBQJZuCyIAhsM BQkFo5qAAAoJEHfybtNRzXKPBVwQAKfFy9P7N3OsLDMB56A4Kf+ZT+d5cIx0Yiaf4n6w7m3i ImHHHk9FIetI4Xe54a2IXh4Bq5UkAGY0667eIs+Z1Ea6I2i27Sdo7DxGwq09Qnm/Y65ADvXs 3aBvokCcm7FsM1wky395m8xUos1681oV5oxgqeRI8/76qy0hD9WR65UW+HQgZRIcIjSel9vR XDaD2HLGPTTGr7u4v00UeTMs6qvPsa2PJagogrKY8RXdFtXvweQFz78NbXhluwix2Tb9ETPk LIpDrtzV73CaE2aqBG/KrboXT2C67BgFtnk7T7Y7iKq4/XvEdDWscz2wws91BOXuMMd4c/c4 OmGW9m3RBLufFrOag1q5yUS9QbFfyqL6dftJP3Zq/xe+mr7sbWbhPVCQFrH3r26mpmy841ym dwQnNcsbIGiBASBSKksOvIDYKa2Wy8htPmWFTEOPRpFXdGQ27awcjjnB42nngyCK5ukZDHi6 w0qK5DNQQCkiweevCIC6wc3p67jl1EMFY5+z+zdTPb3h7LeVnGqW0qBQl99vVFgzLxchKcl0 R/paSFgwqXCZhAKMuUHncJuynDOP7z5LirUeFI8qsBAJi1rXpQoLJTVcW72swZ42IdPiboqx NbTMiNOiE36GqMcTPfKylCbF45JNX4nF9ElM0E+Y8gi4cizJYBRr2FBJgay0b9Cp Message-ID: <1f62c734-80fe-ca88-cf58-20c340463c8c@FreeBSD.org> Date: Fri, 7 Dec 2018 19:21:01 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 430476ED3A X-Spamd-Result: default: False [-3.81 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[FreeBSD.org]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; NEURAL_HAM_SHORT(-0.83)[-0.830,0]; RCVD_IN_DNSWL_NONE(0.00)[45.167.85.209.list.dnswl.org : 127.0.5.0]; IP_SCORE(-0.97)[ipnet: 209.85.128.0/17(-3.45), asn: 15169(-1.30), country: US(-0.09)]; FORGED_SENDER(0.30)[avg@FreeBSD.org,agapon@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[45.167.85.209.rep.mailspike.net : 127.0.0.17]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[avg@FreeBSD.org,agapon@gmail.com]; MID_RHS_MATCH_FROM(0.00)[] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 07 Dec 2018 17:21:13 -0000 On 07/12/2018 18:33, Warner Losh wrote: > > > On Fri, Dec 7, 2018 at 5:02 AM Andriy Gapon > wrote: > > Author: avg > Date: Fri Dec  7 12:02:31 2018 > New Revision: 341681 > URL: https://svnweb.freebsd.org/changeset/base/341681 > > Log: >   daprobedone: announce if a disk is write-protected > >   MFC after:    2 weeks > > Modified: >   head/sys/cam/scsi/scsi_da.c > > Modified: head/sys/cam/scsi/scsi_da.c > ============================================================================== > --- head/sys/cam/scsi/scsi_da.c Fri Dec  7 11:47:42 2018        (r341680) > +++ head/sys/cam/scsi/scsi_da.c Fri Dec  7 12:02:31 2018        (r341681) > @@ -2472,6 +2472,11 @@ daprobedone(struct cam_periph *periph, union ccb *ccb) >                 printf("%s%d: %s\n", periph->periph_name, >                     periph->unit_number, buf); >         } > +       if ((softc->disk->d_flags & DISKFLAG_WRITE_PROTECT) != 0 && > +           (softc->flags & DA_FLAG_ANNOUNCED) == 0) { > +               printf("%s%d: Write Protected\n", periph->periph_name, > +                   periph->unit_number); > +       } > > > This is incorrect. It needs to be added to buf so that it gets printed > atomically with the rest of things. My impression is that "the rest of the things" is not printed atomically, unfortunately. It would be great if it was. For example, the printf that we see in the diff context above prints only "Delete methods:" line. -- Andriy Gapon From owner-svn-src-head@freebsd.org Fri Dec 7 17:21:38 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BA6A2131417B; Fri, 7 Dec 2018 17:21:38 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 461AC6EEA9; Fri, 7 Dec 2018 17:21:38 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-2.local (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id 9631810B709; Fri, 7 Dec 2018 12:21:36 -0500 (EST) Subject: Re: svn commit: r341689 - in head: lib/libc/sys sys/compat/freebsd32 sys/kern sys/sys To: Konstantin Belousov , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201812071517.wB7FHTiI035911@repo.freebsd.org> From: John Baldwin Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= xsDiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg80eSm9obiBCYWxk d2luIDxqb2huQGJhbGR3aW4uY3g+wmMEExECACMCGwMGCwkIBwMCBBUCCAMEFgIDAQIeAQIX gAUCRND5wwIZAQAKCRBy3lIGd+N/BNLXAJ9KIb6teuDL1W+FkCgvv+y8PxKTkACeIUfbn3sl cueBzqTcf09idwa8YTbOwU0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Ds gnr31AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh +GojXlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cM SOrHYUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOF QVHOEVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq 1tqzhltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZ TwtXsNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m 7Z164yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioI AjjHaIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbU KWwxQ4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjH uW/CSQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZN wwCfafMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: Date: Fri, 7 Dec 2018 09:21:34 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <201812071517.wB7FHTiI035911@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Fri, 07 Dec 2018 12:21:37 -0500 (EST) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-Rspamd-Queue-Id: 461AC6EEA9 X-Spamd-Result: default: False [-2.93 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.994,0]; NEURAL_HAM_SHORT(-0.94)[-0.936,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 07 Dec 2018 17:21:39 -0000 On 12/7/18 7:17 AM, Konstantin Belousov wrote: > Author: kib > Date: Fri Dec 7 15:17:29 2018 > New Revision: 341689 > URL: https://svnweb.freebsd.org/changeset/base/341689 > > Log: > Add new file handle system calls. > > Namely, getfhat(2), fhlink(2), fhlinkat(2), fhreadlink(2). The > syscalls are provided for a NFS userspace server (nfs-ganesha). > > Submitted by: Jack Halford > Sponsored by: Gandi.net > Tested by: pho > Feedback from: brooks, markj > MFC after: 1 week > Differential revision: https://reviews.freebsd.org/D18359 Can this be used to implement 'flink' (create a link to an open file descriptor)? Hmm, it appears so. It is limited to PRIV_VFS_GETFH at least. The getfh(2) manpage notes this explicitly, but the new manpages don't appear to. Even with the PRIV check, I'm still somewhat nervous about what flink means for processes running as root that are using Capsicum. Maybe it's ok, but I didn't see any discussion of this in the review. -- John Baldwin                                                                              From owner-svn-src-head@freebsd.org Fri Dec 7 17:48:09 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7E3901314EE5; Fri, 7 Dec 2018 17:48:09 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 85B9A6FF87; Fri, 7 Dec 2018 17:48:08 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id wB7Hlvhf092391 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 7 Dec 2018 19:48:00 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua wB7Hlvhf092391 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id wB7HlvGA092390; Fri, 7 Dec 2018 19:47:57 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 7 Dec 2018 19:47:57 +0200 From: Konstantin Belousov To: John Baldwin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r341689 - in head: lib/libc/sys sys/compat/freebsd32 sys/kern sys/sys Message-ID: <20181207174757.GI52540@kib.kiev.ua> References: <201812071517.wB7FHTiI035911@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.0 (2018-11-25) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-Rspamd-Queue-Id: 85B9A6FF87 X-Spamd-Result: default: False [-5.05 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; FREEMAIL_FROM(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; R_SPF_SOFTFAIL(0.00)[~all]; RCVD_COUNT_THREE(0.00)[3]; TO_DN_SOME(0.00)[]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; NEURAL_HAM_SHORT(-0.92)[-0.917,0]; IP_SCORE(-2.12)[ip: (-2.55), ipnet: 2001:470::/32(-4.48), asn: 6939(-3.47), country: US(-0.09)]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; RCVD_TLS_LAST(0.00)[]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : No valid SPF, No valid DKIM,none] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 07 Dec 2018 17:48:09 -0000 On Fri, Dec 07, 2018 at 09:21:34AM -0800, John Baldwin wrote: > On 12/7/18 7:17 AM, Konstantin Belousov wrote: > > Author: kib > > Date: Fri Dec 7 15:17:29 2018 > > New Revision: 341689 > > URL: https://svnweb.freebsd.org/changeset/base/341689 > > > > Log: > > Add new file handle system calls. > > > > Namely, getfhat(2), fhlink(2), fhlinkat(2), fhreadlink(2). The > > syscalls are provided for a NFS userspace server (nfs-ganesha). > > > > Submitted by: Jack Halford > > Sponsored by: Gandi.net > > Tested by: pho > > Feedback from: brooks, markj > > MFC after: 1 week > > Differential revision: https://reviews.freebsd.org/D18359 > > Can this be used to implement 'flink' (create a link to an open file > descriptor)? Hmm, it appears so. It is limited to PRIV_VFS_GETFH at least. > The getfh(2) manpage notes this explicitly, but the new manpages don't > appear to. Even with the PRIV check, I'm still somewhat nervous about what > flink means for processes running as root that are using Capsicum. Maybe > it's ok, but I didn't see any discussion of this in the review. If the process can execute getfh(2) and fhlink(2), then its privileges are not much different from the privileges of the in-kernel NFS server. During the review, I verified that PRIV_VFS_GETFH is checked, and considered suggesting fine-grainer individual privs for other operations, but decided that this is not too useful. That said, how can you translate from file descriptor to file handle ? E.g. to know (and not guess) the file handle on UFS, the process must posses PRIV_VFS_GENERATION. If you have PRIV_VFS_GETFH/PRIV_VFS_GENERATION privs, then you can implement flink(2) for UFS, but might be that it is even not undesirable. From owner-svn-src-head@freebsd.org Fri Dec 7 18:04:55 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3C51313154A0; Fri, 7 Dec 2018 18:04:55 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A9E9170921; Fri, 7 Dec 2018 18:04:54 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-2.local (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id DBBEE10B68A; Fri, 7 Dec 2018 13:04:52 -0500 (EST) Subject: Re: svn commit: r341689 - in head: lib/libc/sys sys/compat/freebsd32 sys/kern sys/sys To: Konstantin Belousov References: <201812071517.wB7FHTiI035911@repo.freebsd.org> <20181207174757.GI52540@kib.kiev.ua> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: John Baldwin Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= xsDiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg80eSm9obiBCYWxk d2luIDxqb2huQGJhbGR3aW4uY3g+wmMEExECACMCGwMGCwkIBwMCBBUCCAMEFgIDAQIeAQIX gAUCRND5wwIZAQAKCRBy3lIGd+N/BNLXAJ9KIb6teuDL1W+FkCgvv+y8PxKTkACeIUfbn3sl cueBzqTcf09idwa8YTbOwU0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Ds gnr31AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh +GojXlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cM SOrHYUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOF QVHOEVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq 1tqzhltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZ TwtXsNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m 7Z164yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioI AjjHaIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbU KWwxQ4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjH uW/CSQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZN wwCfafMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: Date: Fri, 7 Dec 2018 10:04:51 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20181207174757.GI52540@kib.kiev.ua> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Fri, 07 Dec 2018 13:04:53 -0500 (EST) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-Rspamd-Queue-Id: A9E9170921 X-Spamd-Result: default: False [-2.93 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.995,0]; NEURAL_HAM_SHORT(-0.93)[-0.932,0]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 07 Dec 2018 18:04:55 -0000 On 12/7/18 9:47 AM, Konstantin Belousov wrote: > On Fri, Dec 07, 2018 at 09:21:34AM -0800, John Baldwin wrote: >> On 12/7/18 7:17 AM, Konstantin Belousov wrote: >>> Author: kib >>> Date: Fri Dec 7 15:17:29 2018 >>> New Revision: 341689 >>> URL: https://svnweb.freebsd.org/changeset/base/341689 >>> >>> Log: >>> Add new file handle system calls. >>> >>> Namely, getfhat(2), fhlink(2), fhlinkat(2), fhreadlink(2). The >>> syscalls are provided for a NFS userspace server (nfs-ganesha). >>> >>> Submitted by: Jack Halford >>> Sponsored by: Gandi.net >>> Tested by: pho >>> Feedback from: brooks, markj >>> MFC after: 1 week >>> Differential revision: https://reviews.freebsd.org/D18359 >> >> Can this be used to implement 'flink' (create a link to an open file >> descriptor)? Hmm, it appears so. It is limited to PRIV_VFS_GETFH at least. >> The getfh(2) manpage notes this explicitly, but the new manpages don't >> appear to. Even with the PRIV check, I'm still somewhat nervous about what >> flink means for processes running as root that are using Capsicum. Maybe >> it's ok, but I didn't see any discussion of this in the review. > > If the process can execute getfh(2) and fhlink(2), then its privileges > are not much different from the privileges of the in-kernel NFS server. > During the review, I verified that PRIV_VFS_GETFH is checked, and considered > suggesting fine-grainer individual privs for other operations, but decided > that this is not too useful. > > That said, how can you translate from file descriptor to file > handle ? E.g. to know (and not guess) the file handle on UFS, > the process must posses PRIV_VFS_GENERATION. If you have > PRIV_VFS_GETFH/PRIV_VFS_GENERATION privs, then you can implement > flink(2) for UFS, but might be that it is even not undesirable. My understanding of the normal reason against flink is that you can make unlinked files readable by other processes (though something like /proc//fd/ already permits this), and in particular if a more privileged process passes an fd to a less privileged process. The requirement for root mostly mitigates this when root vs not-root is your only privilege. However, a capsicum vs non-capsicum process is a more recent privilege that is orthogonal to root vs non-root. It might be that allowing a capsicumized root to create links to files that were intentionally unlinked by a non-capsicumized root would be the same problem. In practice on the majority of FreeBSD systems, root has all of the PRIV_foo things. You have to write custom MAC modules to actually limit root. Thus it would seem that we should now be happy to add flink() so long as it requires root. -- John Baldwin                                                                              From owner-svn-src-head@freebsd.org Fri Dec 7 18:10:15 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DEB571315630 for ; Fri, 7 Dec 2018 18:10:14 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1.eu.mailhop.org (outbound1.eu.mailhop.org [52.28.251.132]) (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 5403F70C2C for ; Fri, 7 Dec 2018 18:10:14 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1544206205; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=KkBhs7QDOMUN+K9k+hQiKbOlGj4EftqiySmg7GuZHj37LYkxbtuFdFO5VWycaOuQsmFrjpmw96NPu 0RzXK7WR9njymtJ+BJct3KIOqWLDNzfj5Ti5oxy80yffFoLCwxLtgp2KKlEBFCOih3CQ4jSylNcdPv XsJtsEE+7jnENtqK9TKdAEkDDPHuyNdJiwpg9TSZBPNimp7BrpmN9YRXL0wqUzOtL2P0TrymJupmi7 +/Mgm/+/O+AoFW6mYAmWcQ2D9RBt1n+sJMz/m9FWlZWhgOzouXZDw0U0NqAx5/rthRy+Oz3eOcvuYM bg+3YpqE6zrtNnZMx0UMbdrIcoCZIwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:dkim-signature:from; bh=jwBDMfAL3XSSyZ0SPAaMxHmScoeVh37IKwJbB7lZB50=; b=ER/jIj7mMl2ENQxeCT9RErKzWJHQCOPgV/1jCsRbAUrN3uD8coL0EfU4G55TKToRBPsqCBjtdjPMT LYiPyDCNW5D6dKPbAgHNyiq4eeflxen1dcl+4zsYqsbbCu9TMzh3X6y3vqRn0BoVtsmGY+c2OIuFqw wk9Pyw1j3gU4g/U6enMB8bs1KmGXgxOLXEwCXaxbmZ7l7++004dCJgcEKUtMlPY36MJ4RBlSC+agv6 RflAwJNZBL3JlNSQyNjAMmY9PI2MkIKRtdyG8RJ4KMdFaMwQ9ttyLKFZBmjns3NlAy2ds9pq5rpvwG PgQBMjvsQsXf3s2FkqC0QQ6HgDEGuCg== ARC-Authentication-Results: i=1; outbound3.eu.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:from; bh=jwBDMfAL3XSSyZ0SPAaMxHmScoeVh37IKwJbB7lZB50=; b=sFgEXGZ/06qlH2ijNlJ5ADIB7FkSryk0b3QtZC5IgeGUNvEEnQVRvZ0S3RqRhaCHAc0VFlnkh2KF9 G0YUcwgl1qsX0MggHJZKLBc+jzyd2F9wZxfbJysGx+4jRdOteMFSMNLoLphDh/D7Zh/TtpeJF8C7eH CZvJADnjdpV/GlwSriyJzSVb7xIHM4IFvl5BH/vGTjPDnHdnHiK89uVCkzPJAj5h7E8CigPPNG0UhK n/R+GvK4r6CCk1VhheiJTSSWRNxxkl2qb4TZXMtVFnAFwXDh3M8KT1V35soFvaNwflQUGFo4ryGASA jbZldAmyzDin/R6wyK1upHZzqhfskZQ== X-MHO-RoutePath: aGlwcGll X-MHO-User: 50ff3bdb-fa4b-11e8-8a28-a1efd8da9a94 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound3.eu.mailhop.org (Halon) with ESMTPSA id 50ff3bdb-fa4b-11e8-8a28-a1efd8da9a94; Fri, 07 Dec 2018 18:10:03 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id wB7IA1Ym064531; Fri, 7 Dec 2018 11:10:01 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <1544206201.1860.288.camel@freebsd.org> Subject: Re: svn commit: r341682 - head/sys/sys From: Ian Lepore To: Mateusz Guzik , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Fri, 07 Dec 2018 11:10:01 -0700 In-Reply-To: <201812071205.wB7C5BvA038350@repo.freebsd.org> References: <201812071205.wB7C5BvA038350@repo.freebsd.org> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5403F70C2C X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.993,0]; NEURAL_HAM_SHORT(-0.98)[-0.982,0]; ASN(0.00)[asn:16509, ipnet:52.28.0.0/16, country:US]; NEURAL_HAM_LONG(-0.99)[-0.994,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 07 Dec 2018 18:10:15 -0000 On Fri, 2018-12-07 at 12:05 +0000, Mateusz Guzik wrote: > Author: mjg > Date: Fri Dec  7 12:05:11 2018 > New Revision: 341682 > URL: https://svnweb.freebsd.org/changeset/base/341682 > > Log: >   unr64: use locked variant if not __LP64__ >    >   The current ifdefs are not sufficient to distinguish 32- and 64- > bit >   variants, which results e.g. in powerpc64 not using atomics. >    >   While some 32-bit archs provide 64-bit atomics, there is no huge > advantage >   of using them on these platforms. >    >   Reported by: many >   Suggested by: jhb >   Sponsored by: The FreeBSD Foundation > > Modified: >   head/sys/sys/systm.h > > Modified: head/sys/sys/systm.h > ===================================================================== > ========= > --- head/sys/sys/systm.h Fri Dec  7 12:02:31 2018 (r341 > 681) > +++ head/sys/sys/systm.h Fri Dec  7 12:05:11 2018 (r341 > 682) > @@ -523,7 +523,7 @@ int alloc_unr_specific(struct unrhdr *uh, u_int > item); >  int alloc_unrl(struct unrhdr *uh); >  void free_unr(struct unrhdr *uh, u_int item); >   > -#if defined(__mips__) || defined(__powerpc__) > +#ifndef __LP64__ >  #define UNR64_LOCKED >  #endif >   > This seems like a wholly unsatisfying solution compared to how trivial it would be to do something like have each arch's atomic.h set a symbol to indicate whether 64-bit atomics are available. Dismissing 32-bit arches because you don't perceive performance to be important there doesn't seem like a valid argument. -- Ian From owner-svn-src-head@freebsd.org Fri Dec 7 18:28:57 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9521C1316190; Fri, 7 Dec 2018 18:28:57 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 358BC719DC; Fri, 7 Dec 2018 18:28:57 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-2.local (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id 2054610A87D; Fri, 7 Dec 2018 13:28:55 -0500 (EST) Subject: Re: svn commit: r341682 - head/sys/sys To: Ian Lepore , Mateusz Guzik , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201812071205.wB7C5BvA038350@repo.freebsd.org> <1544206201.1860.288.camel@freebsd.org> From: John Baldwin Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= xsDiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg80eSm9obiBCYWxk d2luIDxqb2huQGJhbGR3aW4uY3g+wmMEExECACMCGwMGCwkIBwMCBBUCCAMEFgIDAQIeAQIX gAUCRND5wwIZAQAKCRBy3lIGd+N/BNLXAJ9KIb6teuDL1W+FkCgvv+y8PxKTkACeIUfbn3sl cueBzqTcf09idwa8YTbOwU0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Ds gnr31AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh +GojXlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cM SOrHYUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOF QVHOEVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq 1tqzhltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZ TwtXsNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m 7Z164yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioI AjjHaIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbU KWwxQ4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjH uW/CSQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZN wwCfafMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: <07a9fd27-3c8f-9ba4-2f3d-17f65c51b2c4@FreeBSD.org> Date: Fri, 7 Dec 2018 10:28:53 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <1544206201.1860.288.camel@freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Fri, 07 Dec 2018 13:28:55 -0500 (EST) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-Rspamd-Queue-Id: 358BC719DC X-Spamd-Result: default: False [-2.92 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.995,0]; NEURAL_HAM_SHORT(-0.92)[-0.924,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 07 Dec 2018 18:28:57 -0000 On 12/7/18 10:10 AM, Ian Lepore wrote: > On Fri, 2018-12-07 at 12:05 +0000, Mateusz Guzik wrote: >> Author: mjg >> Date: Fri Dec  7 12:05:11 2018 >> New Revision: 341682 >> URL: https://svnweb.freebsd.org/changeset/base/341682 >> >> Log: >>   unr64: use locked variant if not __LP64__ >>    >>   The current ifdefs are not sufficient to distinguish 32- and 64- >> bit >>   variants, which results e.g. in powerpc64 not using atomics. >>    >>   While some 32-bit archs provide 64-bit atomics, there is no huge >> advantage >>   of using them on these platforms. >>    >>   Reported by: many >>   Suggested by: jhb >>   Sponsored by: The FreeBSD Foundation >> >> Modified: >>   head/sys/sys/systm.h >> >> Modified: head/sys/sys/systm.h >> ===================================================================== >> ========= >> --- head/sys/sys/systm.h Fri Dec  7 12:02:31 2018 (r341 >> 681) >> +++ head/sys/sys/systm.h Fri Dec  7 12:05:11 2018 (r341 >> 682) >> @@ -523,7 +523,7 @@ int alloc_unr_specific(struct unrhdr *uh, u_int >> item); >>  int alloc_unrl(struct unrhdr *uh); >>  void free_unr(struct unrhdr *uh, u_int item); >>   >> -#if defined(__mips__) || defined(__powerpc__) >> +#ifndef __LP64__ >>  #define UNR64_LOCKED >>  #endif >>   >> > > This seems like a wholly unsatisfying solution compared to how trivial > it would be to do something like have each arch's atomic.h set a symbol > to indicate whether 64-bit atomics are available. Dismissing 32-bit > arches because you don't perceive performance to be important there > doesn't seem like a valid argument. I think you are free to adjust the #ifdef if you find that it actually makes a difference. unr lists have been using a mutex on 32-bit architectures the entire time the API has existed, and I'm not sure you are running -j128 poudriere package builds on a raspberry pi to get the kind of workload where this lock contention matters. -- John Baldwin                                                                              From owner-svn-src-head@freebsd.org Fri Dec 7 19:00:18 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0C02C1316B0F; Fri, 7 Dec 2018 19:00:18 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io1-f43.google.com (mail-io1-f43.google.com [209.85.166.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6DE9872A57; Fri, 7 Dec 2018 19:00:17 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io1-f43.google.com with SMTP id n9so4073118ioh.7; Fri, 07 Dec 2018 11:00:17 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=mbZ2fS8Tp817z9hGyLUqslByDr9tHKAvRXDiuYLRevY=; b=sly8ISo3HeS9PRz6dy9Hmqu2gDK1lniVpCv77FrXh0wsYoGYZspTSTCa53UdIx1Bf0 TUOTe33NsU5HMVcXKHJFnHFxBqk65Q+x1a1h97lqM3pYff/LHfYHd6axrqdRwlaVMuXo bvpw2mO817lyvUCQNZw1TZqFWiQTc4/UhGigR1vu8joSqrmJHwJL2li71EVkeJmVNX1V SVzUVkuKJ5MIPWaMHQflRSg/8r7suMc3lLMcLwn4/ZJhgc8gjmnSJKatx8XtRJcmsaoA Pz5aeohA9UnvLNlFo9o3SqOPXlxqF0jSQJxkHoEM1eyxAZeXLRu8EvOMnu6yESdk3GTl A5Pw== X-Gm-Message-State: AA+aEWY01y7Sz4D7U1x+oM2kZ6wFkWCgMY38eX99Ozscv1Z2DoqNB/4B TZoM8P0ja/BbEdqC6dmTBDTqyrcf X-Google-Smtp-Source: AFSGD/UMsSE/LOP/+eYXoyIFBGIsblERr89PdFTYF+Kht6RwS4sURt6ZZnQ5wM22uukrj95L3okQMg== X-Received: by 2002:a5e:9905:: with SMTP id t5mr2643376ioj.153.1544209210596; Fri, 07 Dec 2018 11:00:10 -0800 (PST) Received: from mail-it1-f176.google.com (mail-it1-f176.google.com. [209.85.166.176]) by smtp.gmail.com with ESMTPSA id m20sm2330047itm.29.2018.12.07.11.00.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Dec 2018 11:00:10 -0800 (PST) Received: by mail-it1-f176.google.com with SMTP id b5so8654646iti.2; Fri, 07 Dec 2018 11:00:10 -0800 (PST) X-Received: by 2002:a24:5411:: with SMTP id t17mr2969915ita.32.1544209210093; Fri, 07 Dec 2018 11:00:10 -0800 (PST) MIME-Version: 1.0 References: <201812071517.wB7FHTiI035911@repo.freebsd.org> <20181207174757.GI52540@kib.kiev.ua> In-Reply-To: Reply-To: cem@freebsd.org From: Conrad Meyer Date: Fri, 7 Dec 2018 10:59:59 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r341689 - in head: lib/libc/sys sys/compat/freebsd32 sys/kern sys/sys To: John Baldwin Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 6DE9872A57 X-Spamd-Result: default: False [-3.73 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; HAS_REPLYTO(0.00)[cem@freebsd.org]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; REPLYTO_ADDR_EQ_FROM(0.00)[]; RCVD_COUNT_THREE(0.00)[4]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; NEURAL_HAM_SHORT(-0.75)[-0.755,0]; FORGED_SENDER(0.30)[cem@freebsd.org,csecem@gmail.com]; RCVD_TLS_LAST(0.00)[]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; TAGGED_FROM(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; FROM_NEQ_ENVFROM(0.00)[cem@freebsd.org,csecem@gmail.com]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.org]; IP_SCORE(-0.97)[ipnet: 209.85.128.0/17(-3.45), asn: 15169(-1.30), country: US(-0.09)]; RCVD_IN_DNSWL_NONE(0.00)[43.166.85.209.list.dnswl.org : 127.0.5.0]; RWL_MAILSPIKE_POSSIBLE(0.00)[43.166.85.209.rep.mailspike.net : 127.0.0.17] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 07 Dec 2018 19:00:18 -0000 On Fri, Dec 7, 2018 at 10:05 AM John Baldwin wrote: > The > requirement for root mostly mitigates this when root vs not-root is your > only privilege. However, a capsicum vs non-capsicum process is a more > recent privilege that is orthogonal to root vs non-root. It might be that > allowing a capsicumized root to create links to files that were intentionally > unlinked by a non-capsicumized root would be the same problem. None of these syscalls were added to sys/kern/capabilities.conf, so I think a capsicum-contained root cannot use them anyway. Maybe I misunderstand how capabilities.conf works, though. Best, Conrad From owner-svn-src-head@freebsd.org Fri Dec 7 19:10:52 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BAA751316D75; Fri, 7 Dec 2018 19:10:52 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 591697302A; Fri, 7 Dec 2018 19:10:52 +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 3BCA8173E9; Fri, 7 Dec 2018 19:10:52 +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 wB7JAqP4055209; Fri, 7 Dec 2018 19:10:52 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB7JAqCd055208; Fri, 7 Dec 2018 19:10:52 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201812071910.wB7JAqCd055208@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 7 Dec 2018 19:10:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341704 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 341704 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 591697302A X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.988,0]; NEURAL_HAM_SHORT(-0.97)[-0.969,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.99)[-0.990,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 07 Dec 2018 19:10:52 -0000 Author: mav Date: Fri Dec 7 19:10:51 2018 New Revision: 341704 URL: https://svnweb.freebsd.org/changeset/base/341704 Log: Fill initid explicitly on requests. Unfortunately ctl_scsi_zero_io() wipes that field, so it was always zero. While there, targ_port is set by kernel, so user-space should not fill it. MFC after: 1 week Modified: head/usr.sbin/bhyve/pci_virtio_scsi.c Modified: head/usr.sbin/bhyve/pci_virtio_scsi.c ============================================================================== --- head/usr.sbin/bhyve/pci_virtio_scsi.c Fri Dec 7 16:52:52 2018 (r341703) +++ head/usr.sbin/bhyve/pci_virtio_scsi.c Fri Dec 7 19:10:51 2018 (r341704) @@ -389,7 +389,7 @@ pci_vtscsi_tmf_handle(struct pci_vtscsi_softc *sc, ctl_scsi_zero_io(io); io->io_hdr.io_type = CTL_IO_TASK; - io->io_hdr.nexus.targ_port = tmf->lun[1]; + io->io_hdr.nexus.initid = sc->vss_iid; io->io_hdr.nexus.targ_lun = pci_vtscsi_get_lun(tmf->lun); io->taskio.tag_type = CTL_TAG_SIMPLE; io->taskio.tag_num = (uint32_t)tmf->id; @@ -480,7 +480,7 @@ pci_vtscsi_request_handle(struct pci_vtscsi_queue *q, io = ctl_scsi_alloc_io(sc->vss_iid); ctl_scsi_zero_io(io); - io->io_hdr.nexus.targ_port = cmd_rd->lun[1]; + io->io_hdr.nexus.initid = sc->vss_iid; io->io_hdr.nexus.targ_lun = pci_vtscsi_get_lun(cmd_rd->lun); io->io_hdr.io_type = CTL_IO_SCSI; From owner-svn-src-head@freebsd.org Fri Dec 7 19:34:58 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AF8631317F92; Fri, 7 Dec 2018 19:34:58 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3EBEE743A8; Fri, 7 Dec 2018 19:34:57 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-2.local (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id 667E910AFD2; Fri, 7 Dec 2018 14:34:54 -0500 (EST) Subject: Re: svn commit: r341689 - in head: lib/libc/sys sys/compat/freebsd32 sys/kern sys/sys To: cem@freebsd.org References: <201812071517.wB7FHTiI035911@repo.freebsd.org> <20181207174757.GI52540@kib.kiev.ua> Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org From: John Baldwin Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= xsDiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg80eSm9obiBCYWxk d2luIDxqb2huQGJhbGR3aW4uY3g+wmMEExECACMCGwMGCwkIBwMCBBUCCAMEFgIDAQIeAQIX gAUCRND5wwIZAQAKCRBy3lIGd+N/BNLXAJ9KIb6teuDL1W+FkCgvv+y8PxKTkACeIUfbn3sl cueBzqTcf09idwa8YTbOwU0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Ds gnr31AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh +GojXlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cM SOrHYUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOF QVHOEVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq 1tqzhltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZ TwtXsNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m 7Z164yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioI AjjHaIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbU KWwxQ4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjH uW/CSQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZN wwCfafMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: <4bcd78df-fb28-1c69-c51e-a50b55c50b1b@FreeBSD.org> Date: Fri, 7 Dec 2018 11:34:50 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Fri, 07 Dec 2018 14:34:57 -0500 (EST) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-Rspamd-Queue-Id: 3EBEE743A8 X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.994,0]; NEURAL_HAM_SHORT(-0.94)[-0.944,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; ASN(0.00)[asn:11403, ipnet:96.47.64.0/20, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 07 Dec 2018 19:34:58 -0000 On 12/7/18 10:59 AM, Conrad Meyer wrote: > On Fri, Dec 7, 2018 at 10:05 AM John Baldwin wrote: >> The >> requirement for root mostly mitigates this when root vs not-root is your >> only privilege. However, a capsicum vs non-capsicum process is a more >> recent privilege that is orthogonal to root vs non-root. It might be that >> allowing a capsicumized root to create links to files that were intentionally >> unlinked by a non-capsicumized root would be the same problem. > > None of these syscalls were added to sys/kern/capabilities.conf, so I > think a capsicum-contained root cannot use them anyway. Maybe I > misunderstand how capabilities.conf works, though. Ok. -- John Baldwin                                                                              From owner-svn-src-head@freebsd.org Fri Dec 7 20:30:02 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D849C131A40A; Fri, 7 Dec 2018 20:30:01 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8000675EF1; Fri, 7 Dec 2018 20:30:01 +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 5D5251802D; Fri, 7 Dec 2018 20:30:01 +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 wB7KU1a5096600; Fri, 7 Dec 2018 20:30:01 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB7KU0Xa096597; Fri, 7 Dec 2018 20:30:00 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201812072030.wB7KU0Xa096597@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 7 Dec 2018 20:30:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341705 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 341705 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8000675EF1 X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.989,0]; NEURAL_HAM_SHORT(-0.96)[-0.960,0]; NEURAL_HAM_LONG(-0.99)[-0.991,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 07 Dec 2018 20:30:02 -0000 Author: mav Date: Fri Dec 7 20:30:00 2018 New Revision: 341705 URL: https://svnweb.freebsd.org/changeset/base/341705 Log: Fix several iov handling bugs in bhyve virtio-scsi backend. - buf_to_iov() does not use buflen parameter, allowing out of bound read. - buf_to_iov() leaks memory if seek argument > 0. - iov_to_buf() doesn't need to reallocate buffer for every segment. - there is no point to use size_t for iov counts, int is more then enough. - some iov function arguments can be constified. - pci_vtscsi_request_handle() used truncate_iov() incorrectly, allowing getting out of buffer and possibly corrupting data. - pci_vtscsi_controlq_notify() written returned status at wrong offset. - pci_vtscsi_controlq_notify() leaked one buffer per event. Reported by: wg Reviewed by: araujo MFC after: 1 week Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D18465 Modified: head/usr.sbin/bhyve/iov.c head/usr.sbin/bhyve/iov.h head/usr.sbin/bhyve/pci_virtio_scsi.c Modified: head/usr.sbin/bhyve/iov.c ============================================================================== --- head/usr.sbin/bhyve/iov.c Fri Dec 7 19:10:51 2018 (r341704) +++ head/usr.sbin/bhyve/iov.c Fri Dec 7 20:30:00 2018 (r341705) @@ -2,6 +2,7 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2016 Jakub Klama . + * Copyright (c) 2018 Alexander Motin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -39,12 +40,12 @@ __FBSDID("$FreeBSD$"); #include "iov.h" void -seek_iov(struct iovec *iov1, size_t niov1, struct iovec *iov2, size_t *niov2, +seek_iov(const struct iovec *iov1, int niov1, struct iovec *iov2, int *niov2, size_t seek) { size_t remainder = 0; size_t left = seek; - size_t i, j; + int i, j; for (i = 0; i < niov1; i++) { size_t toseek = MIN(left, iov1[i].iov_len); @@ -69,9 +70,10 @@ seek_iov(struct iovec *iov1, size_t niov1, struct iove } size_t -count_iov(struct iovec *iov, size_t niov) +count_iov(const struct iovec *iov, int niov) { - size_t i, total = 0; + size_t total = 0; + int i; for (i = 0; i < niov; i++) total += iov[i].iov_len; @@ -79,35 +81,36 @@ count_iov(struct iovec *iov, size_t niov) return (total); } -size_t -truncate_iov(struct iovec *iov, size_t niov, size_t length) +void +truncate_iov(struct iovec *iov, int *niov, size_t length) { - size_t i, done = 0; + size_t done = 0; + int i; - for (i = 0; i < niov; i++) { + for (i = 0; i < *niov; i++) { size_t toseek = MIN(length - done, iov[i].iov_len); done += toseek; - if (toseek < iov[i].iov_len) { + if (toseek <= iov[i].iov_len) { iov[i].iov_len = toseek; - return (i + 1); + *niov = i + 1; + return; } } - - return (niov); } ssize_t -iov_to_buf(struct iovec *iov, size_t niov, void **buf) +iov_to_buf(const struct iovec *iov, int niov, void **buf) { - size_t i, ptr = 0, total = 0; + size_t ptr, total; + int i; - for (i = 0; i < niov; i++) { - total += iov[i].iov_len; - *buf = realloc(*buf, total); - if (*buf == NULL) - return (-1); + total = count_iov(iov, niov); + *buf = realloc(*buf, total); + if (*buf == NULL) + return (-1); + for (i = 0, ptr = 0; i < niov; i++) { memcpy(*buf + ptr, iov[i].iov_base, iov[i].iov_len); ptr += iov[i].iov_len; } @@ -116,12 +119,12 @@ iov_to_buf(struct iovec *iov, size_t niov, void **buf) } ssize_t -buf_to_iov(void *buf, size_t buflen, struct iovec *iov, size_t niov, +buf_to_iov(const void *buf, size_t buflen, struct iovec *iov, int niov, size_t seek) { struct iovec *diov; - size_t ndiov, i; - uintptr_t off = 0; + int ndiov, i; + size_t off = 0, len; if (seek > 0) { diov = malloc(sizeof(struct iovec) * niov); @@ -131,10 +134,14 @@ buf_to_iov(void *buf, size_t buflen, struct iovec *iov ndiov = niov; } - for (i = 0; i < ndiov; i++) { - memcpy(diov[i].iov_base, buf + off, diov[i].iov_len); - off += diov[i].iov_len; + for (i = 0; i < ndiov && off < buflen; i++) { + len = MIN(diov[i].iov_len, buflen - off); + memcpy(diov[i].iov_base, buf + off, len); + off += len; } + + if (seek > 0) + free(diov); return ((ssize_t)off); } Modified: head/usr.sbin/bhyve/iov.h ============================================================================== --- head/usr.sbin/bhyve/iov.h Fri Dec 7 19:10:51 2018 (r341704) +++ head/usr.sbin/bhyve/iov.h Fri Dec 7 20:30:00 2018 (r341705) @@ -2,6 +2,7 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2016 Jakub Klama . + * Copyright (c) 2018 Alexander Motin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,12 +33,12 @@ #ifndef _IOV_H_ #define _IOV_H_ -void seek_iov(struct iovec *iov1, size_t niov1, struct iovec *iov2, - size_t *niov2, size_t seek); -size_t truncate_iov(struct iovec *iov, size_t niov, size_t length); -size_t count_iov(struct iovec *iov, size_t niov); -ssize_t iov_to_buf(struct iovec *iov, size_t niov, void **buf); -ssize_t buf_to_iov(void *buf, size_t buflen, struct iovec *iov, size_t niov, +void seek_iov(const struct iovec *iov1, int niov1, struct iovec *iov2, + int *niov2, size_t seek); +void truncate_iov(struct iovec *iov, int *niov, size_t length); +size_t count_iov(const struct iovec *iov, int niov); +ssize_t iov_to_buf(const struct iovec *iov, int niov, void **buf); +ssize_t buf_to_iov(const void *buf, size_t buflen, struct iovec *iov, int niov, size_t seek); #endif /* _IOV_H_ */ Modified: head/usr.sbin/bhyve/pci_virtio_scsi.c ============================================================================== --- head/usr.sbin/bhyve/pci_virtio_scsi.c Fri Dec 7 19:10:51 2018 (r341704) +++ head/usr.sbin/bhyve/pci_virtio_scsi.c Fri Dec 7 20:30:00 2018 (r341705) @@ -462,7 +462,7 @@ pci_vtscsi_request_handle(struct pci_vtscsi_queue *q, struct pci_vtscsi_req_cmd_wr *cmd_wr; struct iovec data_iov_in[VTSCSI_MAXSEG], data_iov_out[VTSCSI_MAXSEG]; union ctl_io *io; - size_t data_niov_in, data_niov_out; + int data_niov_in, data_niov_out; void *ext_data_ptr = NULL; uint32_t ext_data_len = 0, ext_sg_entries = 0; int err; @@ -472,8 +472,8 @@ pci_vtscsi_request_handle(struct pci_vtscsi_queue *q, seek_iov(iov_out, niov_out, data_iov_out, &data_niov_out, VTSCSI_OUT_HEADER_LEN(sc)); - truncate_iov(iov_in, niov_in, VTSCSI_IN_HEADER_LEN(sc)); - truncate_iov(iov_out, niov_out, VTSCSI_OUT_HEADER_LEN(sc)); + truncate_iov(iov_in, &niov_in, VTSCSI_IN_HEADER_LEN(sc)); + truncate_iov(iov_out, &niov_out, VTSCSI_OUT_HEADER_LEN(sc)); iov_to_buf(iov_in, niov_in, (void **)&cmd_rd); cmd_wr = malloc(VTSCSI_OUT_HEADER_LEN(sc)); @@ -552,7 +552,8 @@ pci_vtscsi_controlq_notify(void *vsc, struct vqueue_in n = vq_getchain(vq, &idx, iov, VTSCSI_MAXSEG, NULL); bufsize = iov_to_buf(iov, n, &buf); iolen = pci_vtscsi_control_handle(sc, buf, bufsize); - buf_to_iov(buf + bufsize - iolen, iolen, iov, n, iolen); + buf_to_iov(buf + bufsize - iolen, iolen, iov, n, + bufsize - iolen); /* * Release this chain and handle more @@ -560,6 +561,7 @@ pci_vtscsi_controlq_notify(void *vsc, struct vqueue_in vq_relchain(vq, idx, iolen); } vq_endchains(vq, 1); /* Generate interrupt if appropriate. */ + free(buf); } static void From owner-svn-src-head@freebsd.org Fri Dec 7 20:55:31 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 07EB7131AF20; Fri, 7 Dec 2018 20:55:31 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 99A5C77066; Fri, 7 Dec 2018 20:55:30 +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 5C251184F5; Fri, 7 Dec 2018 20:55:30 +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 wB7KtUSp011919; Fri, 7 Dec 2018 20:55:30 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB7KtUEQ011918; Fri, 7 Dec 2018 20:55:30 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201812072055.wB7KtUEQ011918@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 7 Dec 2018 20:55:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341706 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 341706 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 99A5C77066 X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.988,0]; NEURAL_HAM_SHORT(-0.96)[-0.959,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.99)[-0.990,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 07 Dec 2018 20:55:31 -0000 Author: mav Date: Fri Dec 7 20:55:29 2018 New Revision: 341706 URL: https://svnweb.freebsd.org/changeset/base/341706 Log: Make virtio-scsi pass SCSI Task Attributes to CTL. MFC after: 1 week Sponsored by: iXsystems, Inc. Modified: head/usr.sbin/bhyve/pci_virtio_scsi.c Modified: head/usr.sbin/bhyve/pci_virtio_scsi.c ============================================================================== --- head/usr.sbin/bhyve/pci_virtio_scsi.c Fri Dec 7 20:30:00 2018 (r341705) +++ head/usr.sbin/bhyve/pci_virtio_scsi.c Fri Dec 7 20:55:29 2018 (r341706) @@ -499,7 +499,21 @@ pci_vtscsi_request_handle(struct pci_vtscsi_queue *q, io->scsiio.sense_len = sc->vss_config.sense_size; io->scsiio.tag_num = (uint32_t)cmd_rd->id; - io->scsiio.tag_type = CTL_TAG_SIMPLE; + switch (cmd_rd->task_attr) { + case VIRTIO_SCSI_S_ORDERED: + io->scsiio.tag_type = CTL_TAG_ORDERED; + break; + case VIRTIO_SCSI_S_HEAD: + io->scsiio.tag_type = CTL_TAG_HEAD_OF_QUEUE; + break; + case VIRTIO_SCSI_S_ACA: + io->scsiio.tag_type = CTL_TAG_ACA; + break; + case VIRTIO_SCSI_S_SIMPLE: + default: + io->scsiio.tag_type = CTL_TAG_SIMPLE; + break; + } io->scsiio.ext_sg_entries = ext_sg_entries; io->scsiio.ext_data_ptr = ext_data_ptr; io->scsiio.ext_data_len = ext_data_len; From owner-svn-src-head@freebsd.org Fri Dec 7 21:57:40 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C2EBC1321A42; Fri, 7 Dec 2018 21:57:40 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6658C79A58; Fri, 7 Dec 2018 21:57:40 +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 4778318EE2; Fri, 7 Dec 2018 21:57:40 +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 wB7Lveic043369; Fri, 7 Dec 2018 21:57:40 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB7LveLU043368; Fri, 7 Dec 2018 21:57:40 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201812072157.wB7LveLU043368@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 7 Dec 2018 21:57:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341709 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 341709 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6658C79A58 X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.988,0]; NEURAL_HAM_LONG(-0.99)[-0.990,0]; NEURAL_HAM_SHORT(-0.98)[-0.977,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 07 Dec 2018 21:57:40 -0000 Author: imp Date: Fri Dec 7 21:57:39 2018 New Revision: 341709 URL: https://svnweb.freebsd.org/changeset/base/341709 Log: Add nda(4) cross reference to nvme(4) Modified: head/share/man/man4/nvme.4 Modified: head/share/man/man4/nvme.4 ============================================================================== --- head/share/man/man4/nvme.4 Fri Dec 7 21:42:41 2018 (r341708) +++ head/share/man/man4/nvme.4 Fri Dec 7 21:57:39 2018 (r341709) @@ -33,7 +33,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 7, 2016 +.Dd December 7, 2018 .Dt NVME 4 .Os .Sh NAME @@ -70,6 +70,8 @@ Per-CPU IO queue pairs .It API for registering NVMe namespace consumers such as .Xr nvd 4 +or +.Xr nda 4 .It API for submitting NVM commands to namespaces .It @@ -163,6 +165,7 @@ with a completion entry that was posted by the control and completion queues to the console. .El .Sh SEE ALSO +.Xr nda 4 , .Xr nvd 4 , .Xr pci 4 , .Xr nvmecontrol 8 , From owner-svn-src-head@freebsd.org Fri Dec 7 21:58:09 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3C0241321A8C; Fri, 7 Dec 2018 21:58:09 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D668279B91; Fri, 7 Dec 2018 21:58:08 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B79B318EE3; Fri, 7 Dec 2018 21:58:08 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB7Lw8nh043440; Fri, 7 Dec 2018 21:58:08 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB7Lw8Ut043439; Fri, 7 Dec 2018 21:58:08 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201812072158.wB7Lw8Ut043439@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 7 Dec 2018 21:58:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341710 - head/sys/dev/nvme X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/nvme X-SVN-Commit-Revision: 341710 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D668279B91 X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.988,0]; NEURAL_HAM_SHORT(-0.98)[-0.977,0]; NEURAL_HAM_LONG(-0.99)[-0.990,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 07 Dec 2018 21:58:09 -0000 Author: imp Date: Fri Dec 7 21:58:08 2018 New Revision: 341710 URL: https://svnweb.freebsd.org/changeset/base/341710 Log: Even though they are reserved, cdw2 and cdw3 can be set via nvme-cli (and soon nvmecontrol). Go ahead and copy them into rsvd2 and rsvd3. Sponsored by: Netflix Modified: head/sys/dev/nvme/nvme_ctrlr.c Modified: head/sys/dev/nvme/nvme_ctrlr.c ============================================================================== --- head/sys/dev/nvme/nvme_ctrlr.c Fri Dec 7 21:57:39 2018 (r341709) +++ head/sys/dev/nvme/nvme_ctrlr.c Fri Dec 7 21:58:08 2018 (r341710) @@ -1075,6 +1075,8 @@ nvme_ctrlr_passthrough_cmd(struct nvme_controller *ctr /* Assume userspace already converted to little-endian */ req->cmd.opc = pt->cmd.opc; req->cmd.fuse = pt->cmd.fuse; + req->cmd.rsvd2 = pt->cmd.rsvd2; + req->cmd.rsvd3 = pt->cmd.rsvd3; req->cmd.cdw10 = pt->cmd.cdw10; req->cmd.cdw11 = pt->cmd.cdw11; req->cmd.cdw12 = pt->cmd.cdw12; From owner-svn-src-head@freebsd.org Fri Dec 7 23:05:13 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CDFA31322F98; Fri, 7 Dec 2018 23:05:13 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5EB167B9A0; Fri, 7 Dec 2018 23:05:13 +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 34C4819A6D; Fri, 7 Dec 2018 23:05:13 +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 wB7N5Ds7079340; Fri, 7 Dec 2018 23:05:13 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB7N5DbX079339; Fri, 7 Dec 2018 23:05:13 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201812072305.wB7N5DbX079339@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 7 Dec 2018 23:05:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341711 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 341711 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5EB167B9A0 X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_SHORT(-0.98)[-0.976,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.99)[-0.990,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 07 Dec 2018 23:05:14 -0000 Author: kib Date: Fri Dec 7 23:05:12 2018 New Revision: 341711 URL: https://svnweb.freebsd.org/changeset/base/341711 Log: Fix expression evaluation. Braces were put in the wrong place, causing failing EAGAIN check to return zero result. Remove the problematic assignment from the conditional expression at all. While there, remove used once variable vp, and wrap too long line. Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/kern/vfs_syscalls.c Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Fri Dec 7 21:58:08 2018 (r341710) +++ head/sys/kern/vfs_syscalls.c Fri Dec 7 23:05:12 2018 (r341711) @@ -1502,19 +1502,18 @@ int kern_linkat(struct thread *td, int fd1, int fd2, const char *path1, const char *path2, enum uio_seg segflag, int follow) { - struct vnode *vp; struct nameidata nd; int error; do { bwillwrite(); - NDINIT_ATRIGHTS(&nd, LOOKUP, follow | AUDITVNODE1, segflag, path1, fd1, - &cap_linkat_source_rights, td); + NDINIT_ATRIGHTS(&nd, LOOKUP, follow | AUDITVNODE1, segflag, + path1, fd1, &cap_linkat_source_rights, td); if ((error = namei(&nd)) != 0) return (error); NDFREE(&nd, NDF_ONLY_PNBUF); - vp = nd.ni_vp; - } while ((error = kern_linkat_vp(td, vp, fd2, path2, segflag) == EAGAIN)); + error = kern_linkat_vp(td, nd.ni_vp, fd2, path2, segflag); + } while (error == EAGAIN); return (error); } From owner-svn-src-head@freebsd.org Fri Dec 7 23:07:53 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0245C1323057; Fri, 7 Dec 2018 23:07:53 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 998717BB60; Fri, 7 Dec 2018 23:07:52 +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 7A86B19A95; Fri, 7 Dec 2018 23:07:52 +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 wB7N7qIZ079489; Fri, 7 Dec 2018 23:07:52 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB7N7quB079488; Fri, 7 Dec 2018 23:07:52 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201812072307.wB7N7quB079488@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 7 Dec 2018 23:07:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341712 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 341712 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 998717BB60 X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_SHORT(-0.98)[-0.976,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.99)[-0.990,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 07 Dec 2018 23:07:53 -0000 Author: kib Date: Fri Dec 7 23:07:51 2018 New Revision: 341712 URL: https://svnweb.freebsd.org/changeset/base/341712 Log: Simplify kern_readlink_vp(). When we detected that the vnode is not symlink, return immediately. This moves the readlink code out of else branch and unindents it. Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/kern/vfs_syscalls.c Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Fri Dec 7 23:05:12 2018 (r341711) +++ head/sys/kern/vfs_syscalls.c Fri Dec 7 23:07:51 2018 (r341712) @@ -2539,20 +2539,19 @@ kern_readlink_vp(struct vnode *vp, char *buf, enum uio return (error); #endif if (vp->v_type != VLNK && (vp->v_vflag & VV_READLINK) == 0) - error = EINVAL; - else { - aiov.iov_base = buf; - aiov.iov_len = count; - auio.uio_iov = &aiov; - auio.uio_iovcnt = 1; - auio.uio_offset = 0; - auio.uio_rw = UIO_READ; - auio.uio_segflg = bufseg; - auio.uio_td = td; - auio.uio_resid = count; - error = VOP_READLINK(vp, &auio, td->td_ucred); - td->td_retval[0] = count - auio.uio_resid; - } + return (EINVAL); + + aiov.iov_base = buf; + aiov.iov_len = count; + auio.uio_iov = &aiov; + auio.uio_iovcnt = 1; + auio.uio_offset = 0; + auio.uio_rw = UIO_READ; + auio.uio_segflg = bufseg; + auio.uio_td = td; + auio.uio_resid = count; + error = VOP_READLINK(vp, &auio, td->td_ucred); + td->td_retval[0] = count - auio.uio_resid; return (error); } From owner-svn-src-head@freebsd.org Fri Dec 7 23:11:23 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 166D0132312B; Fri, 7 Dec 2018 23:11:23 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DCF0E7BD7E; Fri, 7 Dec 2018 23:11:21 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id wB7NBAVO066340 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 8 Dec 2018 01:11:14 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua wB7NBAVO066340 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id wB7NBAoM066339; Sat, 8 Dec 2018 01:11:10 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 8 Dec 2018 01:11:10 +0200 From: Konstantin Belousov To: John Baldwin Cc: cem@freebsd.org, src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r341689 - in head: lib/libc/sys sys/compat/freebsd32 sys/kern sys/sys Message-ID: <20181207231110.GJ52540@kib.kiev.ua> References: <201812071517.wB7FHTiI035911@repo.freebsd.org> <20181207174757.GI52540@kib.kiev.ua> <4bcd78df-fb28-1c69-c51e-a50b55c50b1b@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4bcd78df-fb28-1c69-c51e-a50b55c50b1b@FreeBSD.org> User-Agent: Mutt/1.11.0 (2018-11-25) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-Rspamd-Queue-Id: DCF0E7BD7E X-Spamd-Result: default: False [-5.06 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; R_SPF_SOFTFAIL(0.00)[~all]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[3]; IP_SCORE(-2.12)[ip: (-2.53), ipnet: 2001:470::/32(-4.49), asn: 6939(-3.47), country: US(-0.09)]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; NEURAL_HAM_SHORT(-0.94)[-0.935,0]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; RCVD_TLS_LAST(0.00)[]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : No valid SPF, No valid DKIM,none] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 07 Dec 2018 23:11:23 -0000 On Fri, Dec 07, 2018 at 11:34:50AM -0800, John Baldwin wrote: > On 12/7/18 10:59 AM, Conrad Meyer wrote: > > On Fri, Dec 7, 2018 at 10:05 AM John Baldwin wrote: > >> The > >> requirement for root mostly mitigates this when root vs not-root is your > >> only privilege. However, a capsicum vs non-capsicum process is a more > >> recent privilege that is orthogonal to root vs non-root. It might be that > >> allowing a capsicumized root to create links to files that were intentionally > >> unlinked by a non-capsicumized root would be the same problem. > > > > None of these syscalls were added to sys/kern/capabilities.conf, so I > > think a capsicum-contained root cannot use them anyway. Maybe I > > misunderstand how capabilities.conf works, though. > > Ok. FWIW fhopenat(2) was added to capabilities.conf in the original submission. From owner-svn-src-head@freebsd.org Fri Dec 7 23:13:38 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2C27E13232FB; Fri, 7 Dec 2018 23:13:38 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 866877C0DA; Fri, 7 Dec 2018 23:13:37 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id wB7NDQrS066388 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 8 Dec 2018 01:13:29 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua wB7NDQrS066388 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id wB7NDQ5V066386; Sat, 8 Dec 2018 01:13:26 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 8 Dec 2018 01:13:26 +0200 From: Konstantin Belousov To: John Baldwin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r341689 - in head: lib/libc/sys sys/compat/freebsd32 sys/kern sys/sys Message-ID: <20181207231326.GK52540@kib.kiev.ua> References: <201812071517.wB7FHTiI035911@repo.freebsd.org> <20181207174757.GI52540@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.0 (2018-11-25) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-Rspamd-Queue-Id: 866877C0DA X-Spamd-Result: default: False [-5.06 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; FREEMAIL_FROM(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; R_SPF_SOFTFAIL(0.00)[~all]; RCVD_COUNT_THREE(0.00)[3]; TO_DN_SOME(0.00)[]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; NEURAL_HAM_SHORT(-0.94)[-0.942,0]; IP_SCORE(-2.11)[ip: (-2.52), ipnet: 2001:470::/32(-4.48), asn: 6939(-3.47), country: US(-0.09)]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; RCVD_TLS_LAST(0.00)[]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : No valid SPF, No valid DKIM,none] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 07 Dec 2018 23:13:38 -0000 On Fri, Dec 07, 2018 at 10:04:51AM -0800, John Baldwin wrote: > On 12/7/18 9:47 AM, Konstantin Belousov wrote: > > On Fri, Dec 07, 2018 at 09:21:34AM -0800, John Baldwin wrote: > >> On 12/7/18 7:17 AM, Konstantin Belousov wrote: > >>> Author: kib > >>> Date: Fri Dec 7 15:17:29 2018 > >>> New Revision: 341689 > >>> URL: https://svnweb.freebsd.org/changeset/base/341689 > >>> > >>> Log: > >>> Add new file handle system calls. > >>> > >>> Namely, getfhat(2), fhlink(2), fhlinkat(2), fhreadlink(2). The > >>> syscalls are provided for a NFS userspace server (nfs-ganesha). > >>> > >>> Submitted by: Jack Halford > >>> Sponsored by: Gandi.net > >>> Tested by: pho > >>> Feedback from: brooks, markj > >>> MFC after: 1 week > >>> Differential revision: https://reviews.freebsd.org/D18359 > >> > >> Can this be used to implement 'flink' (create a link to an open file > >> descriptor)? Hmm, it appears so. It is limited to PRIV_VFS_GETFH at least. > >> The getfh(2) manpage notes this explicitly, but the new manpages don't > >> appear to. Even with the PRIV check, I'm still somewhat nervous about what > >> flink means for processes running as root that are using Capsicum. Maybe > >> it's ok, but I didn't see any discussion of this in the review. > > > > If the process can execute getfh(2) and fhlink(2), then its privileges > > are not much different from the privileges of the in-kernel NFS server. > > During the review, I verified that PRIV_VFS_GETFH is checked, and considered > > suggesting fine-grainer individual privs for other operations, but decided > > that this is not too useful. > > > > That said, how can you translate from file descriptor to file > > handle ? E.g. to know (and not guess) the file handle on UFS, > > the process must posses PRIV_VFS_GENERATION. If you have > > PRIV_VFS_GETFH/PRIV_VFS_GENERATION privs, then you can implement > > flink(2) for UFS, but might be that it is even not undesirable. > > My understanding of the normal reason against flink is that you can make > unlinked files readable by other processes (though something like > /proc//fd/ already permits this), and in particular if a more > privileged process passes an fd to a less privileged process. The > requirement for root mostly mitigates this when root vs not-root is your > only privilege. However, a capsicum vs non-capsicum process is a more > recent privilege that is orthogonal to root vs non-root. It might be that > allowing a capsicumized root to create links to files that were intentionally > unlinked by a non-capsicumized root would be the same problem. > > In practice on the majority of FreeBSD systems, root has all of the PRIV_foo > things. You have to write custom MAC modules to actually limit root. Thus > it would seem that we should now be happy to add flink() so long as it > requires root. Do you think that flink(2) itself is useful ? As I understand the typical use case, it is the last chance way to recover of the unlinked but still opened file, by making a hard link from /dev/fd/N. From owner-svn-src-head@freebsd.org Fri Dec 7 23:31:11 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1BF6D1323BB1; Fri, 7 Dec 2018 23:31:11 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 883157CE9E; Fri, 7 Dec 2018 23:31:10 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-2.local (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id 675D510B68A; Fri, 7 Dec 2018 18:31:08 -0500 (EST) Subject: Re: svn commit: r341689 - in head: lib/libc/sys sys/compat/freebsd32 sys/kern sys/sys To: Konstantin Belousov References: <201812071517.wB7FHTiI035911@repo.freebsd.org> <20181207174757.GI52540@kib.kiev.ua> <20181207231326.GK52540@kib.kiev.ua> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: John Baldwin Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= xsDiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg80eSm9obiBCYWxk d2luIDxqb2huQGJhbGR3aW4uY3g+wmMEExECACMCGwMGCwkIBwMCBBUCCAMEFgIDAQIeAQIX gAUCRND5wwIZAQAKCRBy3lIGd+N/BNLXAJ9KIb6teuDL1W+FkCgvv+y8PxKTkACeIUfbn3sl cueBzqTcf09idwa8YTbOwU0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Ds gnr31AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh +GojXlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cM SOrHYUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOF QVHOEVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq 1tqzhltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZ TwtXsNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m 7Z164yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioI AjjHaIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbU KWwxQ4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjH uW/CSQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZN wwCfafMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: <791d6d0c-671f-d4cd-272c-2d7e89f9f849@FreeBSD.org> Date: Fri, 7 Dec 2018 15:31:07 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20181207231326.GK52540@kib.kiev.ua> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Fri, 07 Dec 2018 18:31:09 -0500 (EST) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-Rspamd-Queue-Id: 883157CE9E X-Spamd-Result: default: False [-2.99 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.99)[-0.994,0]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 07 Dec 2018 23:31:11 -0000 On 12/7/18 3:13 PM, Konstantin Belousov wrote: > On Fri, Dec 07, 2018 at 10:04:51AM -0800, John Baldwin wrote: >> On 12/7/18 9:47 AM, Konstantin Belousov wrote: >>> On Fri, Dec 07, 2018 at 09:21:34AM -0800, John Baldwin wrote: >>>> On 12/7/18 7:17 AM, Konstantin Belousov wrote: >>>>> Author: kib >>>>> Date: Fri Dec 7 15:17:29 2018 >>>>> New Revision: 341689 >>>>> URL: https://svnweb.freebsd.org/changeset/base/341689 >>>>> >>>>> Log: >>>>> Add new file handle system calls. >>>>> >>>>> Namely, getfhat(2), fhlink(2), fhlinkat(2), fhreadlink(2). The >>>>> syscalls are provided for a NFS userspace server (nfs-ganesha). >>>>> >>>>> Submitted by: Jack Halford >>>>> Sponsored by: Gandi.net >>>>> Tested by: pho >>>>> Feedback from: brooks, markj >>>>> MFC after: 1 week >>>>> Differential revision: https://reviews.freebsd.org/D18359 >>>> >>>> Can this be used to implement 'flink' (create a link to an open file >>>> descriptor)? Hmm, it appears so. It is limited to PRIV_VFS_GETFH at least. >>>> The getfh(2) manpage notes this explicitly, but the new manpages don't >>>> appear to. Even with the PRIV check, I'm still somewhat nervous about what >>>> flink means for processes running as root that are using Capsicum. Maybe >>>> it's ok, but I didn't see any discussion of this in the review. >>> >>> If the process can execute getfh(2) and fhlink(2), then its privileges >>> are not much different from the privileges of the in-kernel NFS server. >>> During the review, I verified that PRIV_VFS_GETFH is checked, and considered >>> suggesting fine-grainer individual privs for other operations, but decided >>> that this is not too useful. >>> >>> That said, how can you translate from file descriptor to file >>> handle ? E.g. to know (and not guess) the file handle on UFS, >>> the process must posses PRIV_VFS_GENERATION. If you have >>> PRIV_VFS_GETFH/PRIV_VFS_GENERATION privs, then you can implement >>> flink(2) for UFS, but might be that it is even not undesirable. >> >> My understanding of the normal reason against flink is that you can make >> unlinked files readable by other processes (though something like >> /proc//fd/ already permits this), and in particular if a more >> privileged process passes an fd to a less privileged process. The >> requirement for root mostly mitigates this when root vs not-root is your >> only privilege. However, a capsicum vs non-capsicum process is a more >> recent privilege that is orthogonal to root vs non-root. It might be that >> allowing a capsicumized root to create links to files that were intentionally >> unlinked by a non-capsicumized root would be the same problem. >> >> In practice on the majority of FreeBSD systems, root has all of the PRIV_foo >> things. You have to write custom MAC modules to actually limit root. Thus >> it would seem that we should now be happy to add flink() so long as it >> requires root. > > Do you think that flink(2) itself is useful ? I'm not sure. The motivating use case in some of the stuff I found online today was to permit one to construct a file with an initial set of contents such that other processes couldn't open the file until it was fully ready, so you created an unlinked file (Linux has an O_TMPFILE for this I think) and only later hooked it up in the filesystem. (You can use linkat with either /dev/fd/ or the /proc equivalent I think as the source to do this on Linux apparently.) I'm not sure it is otherwise useful. This particular use case also seems like a kludge to workaround the advisory file locking in POSIX, and you could also accomplish this by just doing a rename() from a temporary name to the final name instead. A use case I had in the past was a helper application that wanted to avoid races with trying to execute binaries over NFS, so it would copy the binary to local disk and fork a child to call exec. Once the child exec'd it would unlink the binary so they didn't leak on the local filesystem. However, it would also watch the child process and if the child process crashed instead of exiting cleanly it would make a new copy of the binary (by reading from the original and writing it out to a new file) so that there was a matching binary for the core that could be used with a debugger. In theory flink() would have been more efficient than making a copy of the file. OTOH, that was also running as an unprivileged user and flink() for non-root user, so if the previous security concerns are still valid I think you probably don't want non-root using flink(). -- John Baldwin                                                                              From owner-svn-src-head@freebsd.org Sat Dec 8 04:53:10 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F0F681330EB8; Sat, 8 Dec 2018 04:53:09 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 947556D4D6; Sat, 8 Dec 2018 04:53:09 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 700C61D8F2; Sat, 8 Dec 2018 04:53:09 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB84r9jZ060254; Sat, 8 Dec 2018 04:53:09 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB84r9tO060253; Sat, 8 Dec 2018 04:53:09 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201812080453.wB84r9tO060253@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 8 Dec 2018 04:53:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341719 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 341719 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 947556D4D6 X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_SHORT(-0.96)[-0.960,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.99)[-0.990,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 08 Dec 2018 04:53:10 -0000 Author: mjg Date: Sat Dec 8 04:53:08 2018 New Revision: 341719 URL: https://svnweb.freebsd.org/changeset/base/341719 Log: amd64: stop re-reading curpc on subyte/suword Originally read value is still safely kept. Re-reading code was there for previous iterations which were partially shared with i386. Sponsored by: The FreeBSD Foundation Modified: head/sys/amd64/amd64/support.S Modified: head/sys/amd64/amd64/support.S ============================================================================== --- head/sys/amd64/amd64/support.S Sat Dec 8 00:48:10 2018 (r341718) +++ head/sys/amd64/amd64/support.S Sat Dec 8 04:53:08 2018 (r341719) @@ -1155,7 +1155,6 @@ ENTRY(suword16_nosmap) movw %si,(%rdi) xorl %eax,%eax - movq PCPU(CURPCB),%rcx /* restore trashed register */ movq %rax,PCB_ONFAULT(%rcx) POP_FRAME_POINTER ret @@ -1174,7 +1173,6 @@ ENTRY(suword16_smap) movw %si,(%rdi) clac xorl %eax,%eax - movq PCPU(CURPCB),%rcx /* restore trashed register */ movq %rax,PCB_ONFAULT(%rcx) POP_FRAME_POINTER ret @@ -1192,7 +1190,6 @@ ENTRY(subyte_nosmap) movl %esi,%eax movb %al,(%rdi) xorl %eax,%eax - movq PCPU(CURPCB),%rcx /* restore trashed register */ movq %rax,PCB_ONFAULT(%rcx) POP_FRAME_POINTER ret @@ -1212,7 +1209,6 @@ ENTRY(subyte_smap) movb %al,(%rdi) clac xorl %eax,%eax - movq PCPU(CURPCB),%rcx /* restore trashed register */ movq %rax,PCB_ONFAULT(%rcx) POP_FRAME_POINTER ret From owner-svn-src-head@freebsd.org Sat Dec 8 03:49:49 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 60074132EE0B; Sat, 8 Dec 2018 03:49:49 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-qt1-x832.google.com (mail-qt1-x832.google.com [IPv6:2607:f8b0:4864:20::832]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9E9816B1DC; Sat, 8 Dec 2018 03:49:48 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-qt1-x832.google.com with SMTP id z16so6815393qtq.4; Fri, 07 Dec 2018 19:49:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Q9f2Qw0tLvGo9botAjw5W/kxZfM8QuT05KDr/MNEyXg=; b=VanJwnkZJWECfjiCui9ppJrk1Fmn2heBHpRuW6k4j4gL17xQNTl9CIqFelDCcdAIw4 4Xill7vzOx/GwSiaUYykt9CuANc7eTzS1tabJ4EaxH1XS2oPeURO0bwO9w+qnFIDP1MI 7C1nOjkvtAkYcq4A6M/9uvjEvKCIoHPzHJ+WJ33nsZbsLmI1hsNHEI2Cupv9s9u+1WOe hSq+JwcFhuTTt7+pxbRDER4n52+/NiHNDdksP5R259VBt9Ea+qydiyb5+eGh8GnsY95a VfirLtlN04d5/H93eASmbzvJMcP/2hQmIzBKivE2uBtIcWiGGlHrs8tWMfMCNLFbOuCG X0lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Q9f2Qw0tLvGo9botAjw5W/kxZfM8QuT05KDr/MNEyXg=; b=Fj3eUXMFS/nURG1z5aoFWpE+ePZYYpGXMouKDD0bf3EFDWQTNr21UN9TrqeJtuYPiz uqVjrPQgElZbFwT9b9mrCz87KsjFWRFa5HltkKzVRMUrrbz4EipkqM2lmVD1xMVSaUG+ 7tykG/PBNyUz65/VjvrRByEwlbdjQw8RG+6j/LepJGrVxiUkh7bFpVy1xG6fwUZ0CVGb DWm2x3aTCCdKLfUxzG0TKgw71Ixu4OpVJnbcS0s7HQT9kl7LGB+y7ILXyW/Mjs49Z4Rt NCeSLKu/4OK7guvwrFFKhdtg4QjH0KiPR0rhQxQHdwrusPPDdS9TQgXfRMkkgZ8Vtbsu dBgg== X-Gm-Message-State: AA+aEWZj2KO21MNplMExtE5UCEpYruV7iQ2/lwzXnDOwgPyja/lwidLS MUC7Fp4Q3NXxdy5NABdjg6XeMWYL9dVXxN+2OC/kZw== X-Google-Smtp-Source: AFSGD/VSN+EP+B3GBbtQeKNJtHPGp/aqPW2W3yoiHxV1CCUIo+7Kr4EDFbvoeGq0oUni9A6zp+TPuIYDBF43whI05Sg= X-Received: by 2002:ac8:46c6:: with SMTP id h6mr4503133qto.315.1544240987985; Fri, 07 Dec 2018 19:49:47 -0800 (PST) MIME-Version: 1.0 Received: by 2002:ac8:784:0:0:0:0:0 with HTTP; Fri, 7 Dec 2018 19:49:47 -0800 (PST) In-Reply-To: <1544206201.1860.288.camel@freebsd.org> References: <201812071205.wB7C5BvA038350@repo.freebsd.org> <1544206201.1860.288.camel@freebsd.org> From: Mateusz Guzik Date: Sat, 8 Dec 2018 04:49:47 +0100 Message-ID: Subject: Re: svn commit: r341682 - head/sys/sys To: Ian Lepore Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 9E9816B1DC X-Spamd-Result: default: False [-5.58 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; R_DKIM_ALLOW(-0.20)[gmail.com]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; FREEMAIL_FROM(0.00)[gmail.com]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[2.3.8.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_SHORT(-0.52)[-0.516,0]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; IP_SCORE(-2.05)[ip: (-7.36), ipnet: 2607:f8b0::/32(-1.50), asn: 15169(-1.30), country: US(-0.09)] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 08 Dec 2018 03:49:49 -0000 On 12/7/18, Ian Lepore wrote: > On Fri, 2018-12-07 at 12:05 +0000, Mateusz Guzik wrote: >> Author: mjg >> Date: Fri Dec 7 12:05:11 2018 >> New Revision: 341682 >> URL: https://svnweb.freebsd.org/changeset/base/341682 >> >> Log: >> unr64: use locked variant if not __LP64__ >> >> The current ifdefs are not sufficient to distinguish 32- and 64- >> bit >> variants, which results e.g. in powerpc64 not using atomics. >> >> While some 32-bit archs provide 64-bit atomics, there is no huge >> advantage >> of using them on these platforms. >> [..] > This seems like a wholly unsatisfying solution compared to how trivial > it would be to do something like have each arch's atomic.h set a symbol > to indicate whether 64-bit atomics are available. Dismissing 32-bit > arches because you don't perceive performance to be important there > doesn't seem like a valid argument. > But performance *is* improved on 32-bit architectures as well. Bitmap handling would try to very hard to reduce memory usage, which had a lot of single-threaded overhead (e.g. it allocates memory just in case and then frees it). Since 64-bit inode numbers can simply grow there is no need for any of it and memory use is 64 bit to store the variable. And that's what unr64 is doing. The main difference here is in scalability - taking a lock, bumping a variable and releasing the lock scales much worse than an atomic (which still scales poorly if heavily used). 32-bit arches don't really have enough concurrency to see a difference with this code. single-threaded this is indeed a little bit slower, but this is not running in any hot path. Fully satisfying solution would be that all architectures get 64-bit ops, even if in the worst case they end up taking a lock. Then subsystems would not have to ifdef on anything. However, there was some opposition to this proposal and I don't think this is important enough to push. -- Mateusz Guzik From owner-svn-src-head@freebsd.org Sat Dec 8 06:34:14 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 107211333AF3; Sat, 8 Dec 2018 06:34:14 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A99F6702B1; Sat, 8 Dec 2018 06:34:13 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 890031E908; Sat, 8 Dec 2018 06:34:13 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB86YDVc011824; Sat, 8 Dec 2018 06:34:13 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB86YDfq011822; Sat, 8 Dec 2018 06:34:13 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201812080634.wB86YDfq011822@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 8 Dec 2018 06:34:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341722 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 341722 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A99F6702B1 X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_LONG(-0.99)[-0.990,0]; NEURAL_HAM_SHORT(-0.96)[-0.960,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 08 Dec 2018 06:34:14 -0000 Author: mjg Date: Sat Dec 8 06:34:12 2018 New Revision: 341722 URL: https://svnweb.freebsd.org/changeset/base/341722 Log: proc: postpone proc unlock until after reporting with kqueue kqueue would always relock immediately afterwards. While here drop the NULL check for list itself. The list is always allocated. Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/kern_event.c head/sys/kern/kern_fork.c Modified: head/sys/kern/kern_event.c ============================================================================== --- head/sys/kern/kern_event.c Sat Dec 8 06:31:43 2018 (r341721) +++ head/sys/kern/kern_event.c Sat Dec 8 06:34:12 2018 (r341722) @@ -533,11 +533,12 @@ knote_fork(struct knlist *list, int pid) struct kevent kev; int error; - if (list == NULL) + MPASS(list != NULL); + KNL_ASSERT_LOCKED(list); + if (SLIST_EMPTY(&list->kl_list)) return; memset(&kev, 0, sizeof(kev)); - list->kl_lock(list->kl_lockarg); SLIST_FOREACH(kn, &list->kl_list, kn_selnext) { kq = kn->kn_kq; KQ_LOCK(kq); @@ -606,7 +607,6 @@ knote_fork(struct knlist *list, int pid) kn_leave_flux(kn); KQ_UNLOCK_FLUX(kq); } - list->kl_unlock(list->kl_lockarg); } /* Modified: head/sys/kern/kern_fork.c ============================================================================== --- head/sys/kern/kern_fork.c Sat Dec 8 06:31:43 2018 (r341721) +++ head/sys/kern/kern_fork.c Sat Dec 8 06:34:12 2018 (r341722) @@ -686,15 +686,15 @@ do_fork(struct thread *td, struct fork_req *fr, struct PROC_UNLOCK(p2); /* - * Now can be swapped. + * Tell any interested parties about the new process. */ - _PRELE(p1); - PROC_UNLOCK(p1); + knote_fork(p1->p_klist, p2->p_pid); /* - * Tell any interested parties about the new process. + * Now can be swapped. */ - knote_fork(p1->p_klist, p2->p_pid); + _PRELE(p1); + PROC_UNLOCK(p1); SDT_PROBE3(proc, , , create, p2, p1, fr->fr_flags); if (fr->fr_flags & RFPROCDESC) { From owner-svn-src-head@freebsd.org Sat Dec 8 06:30:42 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B2FB81333989; Sat, 8 Dec 2018 06:30:42 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5B0A86FE08; Sat, 8 Dec 2018 06:30:42 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3D47D1E788; Sat, 8 Dec 2018 06:30:42 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB86UghJ007757; Sat, 8 Dec 2018 06:30:42 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB86UfO2007755; Sat, 8 Dec 2018 06:30:41 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201812080630.wB86UfO2007755@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 8 Dec 2018 06:30:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341720 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 341720 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5B0A86FE08 X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_SHORT(-0.96)[-0.960,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.99)[-0.990,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 08 Dec 2018 06:30:42 -0000 Author: mjg Date: Sat Dec 8 06:30:41 2018 New Revision: 341720 URL: https://svnweb.freebsd.org/changeset/base/341720 Log: Provide SDT_PROBES_ENABLED macro. Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/kern_synch.c head/sys/sys/sdt.h Modified: head/sys/kern/kern_synch.c ============================================================================== --- head/sys/kern/kern_synch.c Sat Dec 8 04:53:08 2018 (r341719) +++ head/sys/kern/kern_synch.c Sat Dec 8 06:30:41 2018 (r341720) @@ -431,7 +431,7 @@ mi_switch(int flags, struct thread *newtd) CTR4(KTR_PROC, "mi_switch: old thread %ld (td_sched %p, pid %ld, %s)", td->td_tid, td_get_sched(td), td->td_proc->p_pid, td->td_name); #ifdef KDTRACE_HOOKS - if (__predict_false(sdt_probes_enabled) && + if (SDT_PROBES_ENABLED() && ((flags & SW_PREEMPT) != 0 || ((flags & SW_INVOL) != 0 && (flags & SW_TYPE_MASK) == SWT_NEEDRESCHED))) SDT_PROBE0(sched, , , preempt); Modified: head/sys/sys/sdt.h ============================================================================== --- head/sys/sys/sdt.h Sat Dec 8 04:53:08 2018 (r341719) +++ head/sys/sys/sdt.h Sat Dec 8 06:30:41 2018 (r341720) @@ -164,8 +164,10 @@ SET_DECLARE(sdt_argtypes_set, struct sdt_argtype); #define SDT_PROBE_DECLARE(prov, mod, func, name) \ extern struct sdt_probe sdt_##prov##_##mod##_##func##_##name[1] +#define SDT_PROBES_ENABLED() __predict_false(sdt_probes_enabled) + #define SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4) do { \ - if (__predict_false(sdt_probes_enabled)) { \ + if (SDT_PROBES_ENABLED()) { \ if (__predict_false(sdt_##prov##_##mod##_##func##_##name->id)) \ (*sdt_probe_func)(sdt_##prov##_##mod##_##func##_##name->id, \ (uintptr_t) arg0, (uintptr_t) arg1, (uintptr_t) arg2, \ From owner-svn-src-head@freebsd.org Sat Dec 8 06:31:44 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 992071333A86; Sat, 8 Dec 2018 06:31:44 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3CCB870135; Sat, 8 Dec 2018 06:31:44 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1DCF71E8C8; Sat, 8 Dec 2018 06:31:44 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB86Vh7i009242; Sat, 8 Dec 2018 06:31:43 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB86Vhmg009241; Sat, 8 Dec 2018 06:31:43 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201812080631.wB86Vhmg009241@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 8 Dec 2018 06:31:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341721 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 341721 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3CCB870135 X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_SHORT(-0.96)[-0.960,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.99)[-0.990,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 08 Dec 2018 06:31:44 -0000 Author: mjg Date: Sat Dec 8 06:31:43 2018 New Revision: 341721 URL: https://svnweb.freebsd.org/changeset/base/341721 Log: proc: handle sdt exit probe before taking the proc lock Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/kern_exit.c Modified: head/sys/kern/kern_exit.c ============================================================================== --- head/sys/kern/kern_exit.c Sat Dec 8 06:30:41 2018 (r341720) +++ head/sys/kern/kern_exit.c Sat Dec 8 06:31:43 2018 (r341721) @@ -556,6 +556,17 @@ exit1(struct thread *td, int rval, int signo) PROC_UNLOCK(q); } +#ifdef KDTRACE_HOOKS + if (SDT_PROBES_ENABLED()) { + int reason = CLD_EXITED; + if (WCOREDUMP(signo)) + reason = CLD_DUMPED; + else if (WIFSIGNALED(signo)) + reason = CLD_KILLED; + SDT_PROBE1(proc, , , exit, reason); + } +#endif + /* Save exit status. */ PROC_LOCK(p); p->p_xthread = td; @@ -573,15 +584,6 @@ exit1(struct thread *td, int rval, int signo) * Notify interested parties of our demise. */ KNOTE_LOCKED(p->p_klist, NOTE_EXIT); - -#ifdef KDTRACE_HOOKS - int reason = CLD_EXITED; - if (WCOREDUMP(signo)) - reason = CLD_DUMPED; - else if (WIFSIGNALED(signo)) - reason = CLD_KILLED; - SDT_PROBE1(proc, , , exit, reason); -#endif /* * If this is a process with a descriptor, we may not need to deliver From owner-svn-src-head@freebsd.org Sat Dec 8 10:22:13 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C88CB130E98D; Sat, 8 Dec 2018 10:22:13 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7033F76797; Sat, 8 Dec 2018 10:22:13 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 52BF020DC1; Sat, 8 Dec 2018 10:22:13 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB8AMDRE030349; Sat, 8 Dec 2018 10:22:13 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB8AMD8J030348; Sat, 8 Dec 2018 10:22:13 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201812081022.wB8AMD8J030348@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 8 Dec 2018 10:22:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341723 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 341723 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7033F76797 X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_SHORT(-0.98)[-0.977,0]; NEURAL_HAM_LONG(-0.99)[-0.990,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 08 Dec 2018 10:22:14 -0000 Author: mjg Date: Sat Dec 8 10:22:12 2018 New Revision: 341723 URL: https://svnweb.freebsd.org/changeset/base/341723 Log: Fix a corner case in ID bitmap management. If all IDs from trypid to pid_max were used as pids, the code would enter a loop which would be infinite if none of the IDs could become free (e.g. they all belong to processes which did not transitioned to zombie). Fixes: r341684 ("Manage process-related IDs with bitmaps") Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/kern_fork.c Modified: head/sys/kern/kern_fork.c ============================================================================== --- head/sys/kern/kern_fork.c Sat Dec 8 06:34:12 2018 (r341722) +++ head/sys/kern/kern_fork.c Sat Dec 8 10:22:12 2018 (r341723) @@ -273,8 +273,10 @@ retry: } bit_ffc_at(&proc_id_pidmap, trypid, pid_max, &result); - if (result == -1) + if (result == -1) { + trypid = 100; goto retry; + } if (bit_test(&proc_id_grpidmap, result) || bit_test(&proc_id_sessidmap, result) || bit_test(&proc_id_reapmap, result)) { From owner-svn-src-head@freebsd.org Sat Dec 8 11:38:40 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 684E113116D9; Sat, 8 Dec 2018 11:38:40 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 06EE879245; Sat, 8 Dec 2018 11:38:40 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DC3A421953; Sat, 8 Dec 2018 11:38:39 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB8BcdAq066638; Sat, 8 Dec 2018 11:38:39 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB8Bcdw8066637; Sat, 8 Dec 2018 11:38:39 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201812081138.wB8Bcdw8066637@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 8 Dec 2018 11:38:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341724 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 341724 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 06EE879245 X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_LONG(-0.99)[-0.990,0]; NEURAL_HAM_SHORT(-0.96)[-0.962,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 08 Dec 2018 11:38:40 -0000 Author: mjg Date: Sat Dec 8 11:38:39 2018 New Revision: 341724 URL: https://svnweb.freebsd.org/changeset/base/341724 Log: Remove proctree acquire from note_procstat_proc It is not needed since r340482 ("proc: always store parent pid in p_oppid") 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 Sat Dec 8 10:22:12 2018 (r341723) +++ head/sys/kern/imgact_elf.c Sat Dec 8 11:38:39 2018 (r341724) @@ -2118,10 +2118,8 @@ __elfN(note_procstat_proc)(void *arg, struct sbuf *sb, KASSERT(*sizep == size, ("invalid size")); structsize = sizeof(elf_kinfo_proc_t); sbuf_bcat(sb, &structsize, sizeof(structsize)); - sx_slock(&proctree_lock); PROC_LOCK(p); kern_proc_out(p, sb, ELF_KERN_PROC_MASK); - sx_sunlock(&proctree_lock); } *sizep = size; } From owner-svn-src-head@freebsd.org Sat Dec 8 12:49:21 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 03A0B1314340; Sat, 8 Dec 2018 12:49:21 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9AA817BAF6; Sat, 8 Dec 2018 12:49:20 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7651D2249A; Sat, 8 Dec 2018 12:49:20 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB8CnKvN003180; Sat, 8 Dec 2018 12:49:20 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB8CnKnQ003179; Sat, 8 Dec 2018 12:49:20 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201812081249.wB8CnKnQ003179@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sat, 8 Dec 2018 12:49:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341725 - head/bin/sh X-SVN-Group: head X-SVN-Commit-Author: jilles X-SVN-Commit-Paths: head/bin/sh X-SVN-Commit-Revision: 341725 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9AA817BAF6 X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_SHORT(-0.98)[-0.982,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.99)[-0.990,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 08 Dec 2018 12:49:21 -0000 Author: jilles Date: Sat Dec 8 12:49:19 2018 New Revision: 341725 URL: https://svnweb.freebsd.org/changeset/base/341725 Log: sh(1): Remove -c string from set builtin documentation Altering the -c string at run time does not make sense and is not possible. MFC after: 1 week Modified: head/bin/sh/sh.1 Modified: head/bin/sh/sh.1 ============================================================================== --- head/bin/sh/sh.1 Sat Dec 8 11:38:39 2018 (r341724) +++ head/bin/sh/sh.1 Sat Dec 8 12:49:19 2018 (r341725) @@ -32,7 +32,7 @@ .\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95 .\" $FreeBSD$ .\" -.Dd November 27, 2018 +.Dd December 8, 2018 .Dt SH 1 .Os .Sh NAME @@ -2485,8 +2485,8 @@ lines, suitable for re-input to the shell. See the .Sx Functions subsection. -.It Ic set Oo Fl /+abCEefIimnpTuVvx Oc Oo Fl /+o Ar longname Oc Oo -.Fl c Ar string Oc Op Fl - Ar arg ... +.It Ic set Oo Fl /+abCEefIimnpTuVvx Oc Oo Fl /+o Ar longname +.Oc Op Fl - Ar arg ... The .Ic set command performs three different functions: From owner-svn-src-head@freebsd.org Sat Dec 8 12:52:10 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 90D4A131462A; Sat, 8 Dec 2018 12:52:10 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 36DD77BE26; Sat, 8 Dec 2018 12:52:10 +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 194F722514; Sat, 8 Dec 2018 12:52:10 +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 wB8Cq9Pb007266; Sat, 8 Dec 2018 12:52:09 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB8Cq9mq007265; Sat, 8 Dec 2018 12:52:09 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201812081252.wB8Cq9mq007265@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Sat, 8 Dec 2018 12:52:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341726 - head/tools/tools/netmap X-SVN-Group: head X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: head/tools/tools/netmap X-SVN-Commit-Revision: 341726 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 36DD77BE26 X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_SHORT(-0.98)[-0.983,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.99)[-0.991,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 08 Dec 2018 12:52:10 -0000 Author: vmaffione Date: Sat Dec 8 12:52:09 2018 New Revision: 341726 URL: https://svnweb.freebsd.org/changeset/base/341726 Log: tools: netmap: pkt-gen: check packet length against interface MTU Validate the value of the -l argument (packet length) against the MTU of the netmap port. In case the netmap port does not refer to a physical interface (e.g. VALE port or pipe), then the netmap buffer size is used as MTU. This change also sets a better default value for the -M option, so that pkt-gen uses the largest possible fragments in case of multi-slot packets. Differential Revision: https://reviews.freebsd.org/D18436 Modified: head/tools/tools/netmap/pkt-gen.c Modified: head/tools/tools/netmap/pkt-gen.c ============================================================================== --- head/tools/tools/netmap/pkt-gen.c Sat Dec 8 12:49:19 2018 (r341725) +++ head/tools/tools/netmap/pkt-gen.c Sat Dec 8 12:52:09 2018 (r341726) @@ -195,7 +195,7 @@ struct virt_header { uint8_t fields[VIRT_HDR_MAX]; }; -#define MAX_BODYSIZE 16384 +#define MAX_BODYSIZE 65536 struct pkt { struct virt_header vh; @@ -238,7 +238,6 @@ struct mac_range { /* ifname can be netmap:foo-xxxx */ #define MAX_IFNAMELEN 64 /* our buffer for ifname */ -//#define MAX_PKTSIZE 1536 #define MAX_PKTSIZE MAX_BODYSIZE /* XXX: + IP_HDR + ETH_HDR */ /* compact timestamp to fit into 60 byte packet. (enough to obtain RTT) */ @@ -263,7 +262,7 @@ struct glob_arg { int forever; uint64_t npackets; /* total packets to send */ int frags; /* fragments per packet */ - u_int mtu; /* size of each fragment */ + u_int frag_size; /* size of each fragment */ int nthreads; int cpus; /* cpus used for running */ int system_cpus; /* cpus on the system */ @@ -308,6 +307,11 @@ struct glob_arg { }; enum dev_type { DEV_NONE, DEV_NETMAP, DEV_PCAP, DEV_TAP }; +enum { + TD_TYPE_SENDER = 1, + TD_TYPE_RECEIVER, + TD_TYPE_OTHER, +}; /* * Arguments for a new thread. The same structure is used by @@ -509,6 +513,42 @@ extract_mac_range(struct mac_range *r) return 0; } +static int +get_if_mtu(const struct glob_arg *g) +{ + char ifname[IFNAMSIZ]; + struct ifreq ifreq; + int s, ret; + + if (!strncmp(g->ifname, "netmap:", 7) && !strchr(g->ifname, '{') + && !strchr(g->ifname, '}')) { + /* Parse the interface name and ask the kernel for the + * MTU value. */ + strncpy(ifname, g->ifname+7, IFNAMSIZ-1); + ifname[strcspn(ifname, "-*^{}/@")] = '\0'; + + s = socket(AF_INET, SOCK_DGRAM, 0); + if (s < 0) { + D("socket() failed: %s", strerror(errno)); + return s; + } + + memset(&ifreq, 0, sizeof(ifreq)); + strncpy(ifreq.ifr_name, ifname, IFNAMSIZ); + + ret = ioctl(s, SIOCGIFMTU, &ifreq); + if (ret) { + D("ioctl(SIOCGIFMTU) failed: %s", strerror(errno)); + } + + return ifreq.ifr_mtu; + } + + /* This is a pipe or a VALE port, where the MTU is very large, + * so we use some practical limit. */ + return 65536; +} + static struct targ *targs; static int global_nthreads; @@ -1581,18 +1621,18 @@ sender_body(void *data) #endif /* NO_PCAP */ } else { int tosend = 0; - u_int bufsz, mtu = targ->g->mtu; + u_int bufsz, frag_size = targ->g->frag_size; nifp = targ->nmd->nifp; txring = NETMAP_TXRING(nifp, targ->nmd->first_tx_ring); bufsz = txring->nr_buf_size; - if (bufsz < mtu) - mtu = bufsz; + if (bufsz < frag_size) + frag_size = bufsz; targ->frag_size = targ->g->pkt_size / targ->frags; - if (targ->frag_size > mtu) { - targ->frags = targ->g->pkt_size / mtu; - targ->frag_size = mtu; - if (targ->g->pkt_size % mtu != 0) + if (targ->frag_size > frag_size) { + targ->frags = targ->g->pkt_size / frag_size; + targ->frag_size = frag_size; + if (targ->g->pkt_size % frag_size != 0) targ->frags++; } D("frags %u frag_size %u", targ->frags, targ->frag_size); @@ -2441,12 +2481,6 @@ usage(int errcode) exit(errcode); } -enum { - TD_TYPE_SENDER = 1, - TD_TYPE_RECEIVER, - TD_TYPE_OTHER, -}; - static void start_threads(struct glob_arg *g) { int i; @@ -2779,8 +2813,8 @@ main(int arc, char **argv) g.cpus = 1; /* default */ g.forever = 1; g.tx_rate = 0; - g.frags =1; - g.mtu = 1500; + g.frags = 1; + g.frag_size = (u_int)-1; /* use the netmap buffer size by default */ g.nmr_config = ""; g.virt_header = 0; g.wait_link = 2; /* wait 2 seconds for physical ports */ @@ -2824,7 +2858,7 @@ main(int arc, char **argv) break; case 'M': - g.mtu = atoi(optarg); + g.frag_size = atoi(optarg); break; case 'f': @@ -3102,6 +3136,16 @@ main(int arc, char **argv) if (g.nthreads < 1 || g.nthreads > devqueues) { D("bad nthreads %d, have %d queues", g.nthreads, devqueues); // continue, fail later + } + + if (g.td_type == TD_TYPE_SENDER) { + int mtu = get_if_mtu(&g); + + if (mtu > 0 && g.pkt_size > mtu) { + D("pkt_size (%d) must be <= mtu (%d)", + g.pkt_size, mtu); + return -1; + } } if (verbose) { From owner-svn-src-head@freebsd.org Sat Dec 8 14:04:58 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D8C7513174B0; Sat, 8 Dec 2018 14:04:58 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6182F7F11D; Sat, 8 Dec 2018 14:04:58 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 38D322319A; Sat, 8 Dec 2018 14:04:58 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB8E4wHf045001; Sat, 8 Dec 2018 14:04:58 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB8E4wV2045000; Sat, 8 Dec 2018 14:04:58 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201812081404.wB8E4wV2045000@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 8 Dec 2018 14:04:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341727 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 341727 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6182F7F11D X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_LONG(-0.99)[-0.990,0]; NEURAL_HAM_SHORT(-0.96)[-0.963,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 08 Dec 2018 14:04:59 -0000 Author: mjg Date: Sat Dec 8 14:04:57 2018 New Revision: 341727 URL: https://svnweb.freebsd.org/changeset/base/341727 Log: umtx: avoid umtxshm locking on object termination if possible Sample build world result on tmpfs: kern.ipc.umtx_terminate_notempty: 0 kern.ipc.umtx_terminate_empty: 2891815 Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/kern_umtx.c Modified: head/sys/kern/kern_umtx.c ============================================================================== --- head/sys/kern/kern_umtx.c Sat Dec 8 12:52:09 2018 (r341726) +++ head/sys/kern/kern_umtx.c Sat Dec 8 14:04:57 2018 (r341727) @@ -3796,6 +3796,9 @@ umtx_shm_object_terminated(vm_object_t object) struct umtx_shm_reg *reg, *reg1; bool dofree; + if (LIST_EMPTY(USHM_OBJ_UMTX(object))) + return; + dofree = false; mtx_lock(&umtx_shm_lock); LIST_FOREACH_SAFE(reg, USHM_OBJ_UMTX(object), ushm_obj_link, reg1) { From owner-svn-src-head@freebsd.org Sat Dec 8 14:58:18 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 304A6131A827; Sat, 8 Dec 2018 14:58:18 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C64B38258D; Sat, 8 Dec 2018 14:58:17 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A74E8239E9; Sat, 8 Dec 2018 14:58:17 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB8EwHkZ071571; Sat, 8 Dec 2018 14:58:17 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB8EwHVM071570; Sat, 8 Dec 2018 14:58:17 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201812081458.wB8EwHVM071570@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Sat, 8 Dec 2018 14:58:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341738 - head/libexec/rtld-elf/aarch64 X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: head/libexec/rtld-elf/aarch64 X-SVN-Commit-Revision: 341738 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C64B38258D X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_SHORT(-0.96)[-0.963,0]; NEURAL_HAM_LONG(-0.99)[-0.990,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 08 Dec 2018 14:58:18 -0000 Author: mmel Date: Sat Dec 8 14:58:17 2018 New Revision: 341738 URL: https://svnweb.freebsd.org/changeset/base/341738 Log: Implement R_AARCH64_TLS_DTPMOD64 and A_AARCH64_TLS_DTPREL64 relocations. Although these are slightly obsolete in favor of R_AARCH64_TLSDESC, gcc -mtls-dialect=trad still use them. Please note that definition of TLS_DTPMOD64 and TLS_DTPREL64 are incorrectly exchanged in GNU binutils. TLS_DTPREL64 should be encoded to 1028 (as is defined in ARM ELF ABI) but binutils encode it to 1029. And vice versa, TLS_DTPMOD64 should be encoded to 1029 but binutils encode it to 1028. While I'm in, add also R_AARCH64_NONE. It can be produced as result of linker relaxation. MFC after: 1 week Modified: head/libexec/rtld-elf/aarch64/reloc.c Modified: head/libexec/rtld-elf/aarch64/reloc.c ============================================================================== --- head/libexec/rtld-elf/aarch64/reloc.c Sat Dec 8 14:54:33 2018 (r341737) +++ head/libexec/rtld-elf/aarch64/reloc.c Sat Dec 8 14:58:17 2018 (r341738) @@ -223,6 +223,8 @@ reloc_plt(Obj_Entry *obj) case R_AARCH64_IRELATIVE: obj->irelative = true; break; + case R_AARCH64_NONE: + break; default: _rtld_error("Unknown relocation type %u in PLT", (unsigned int)ELF_R_TYPE(rela->r_info)); @@ -391,6 +393,8 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int case R_AARCH64_ABS64: case R_AARCH64_GLOB_DAT: case R_AARCH64_TLS_TPREL64: + case R_AARCH64_TLS_DTPREL64: + case R_AARCH64_TLS_DTPMOD64: def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj, flags, cache, lockstate); if (def == NULL) @@ -478,8 +482,23 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int *where = def->st_value + rela->r_addend + defobj->tlsoffset; break; + + /* + * !!! BEWARE !!! + * ARM ELF ABI defines TLS_DTPMOD64 as 1029, and TLS_DTPREL64 + * as 1028. But actual bfd linker and the glibc RTLD linker + * treats TLS_DTPMOD64 as 1028 and TLS_DTPREL64 1029. + */ + case R_AARCH64_TLS_DTPREL64: /* efectively is TLS_DTPMOD64 */ + *where += (Elf_Addr)defobj->tlsindex; + break; + case R_AARCH64_TLS_DTPMOD64: /* efectively is TLS_DTPREL64 */ + *where += (Elf_Addr)(def->st_value + rela->r_addend); + break; case R_AARCH64_RELATIVE: *where = (Elf_Addr)(obj->relocbase + rela->r_addend); + break; + case R_AARCH64_NONE: break; default: rtld_printf("%s: Unhandled relocation %lu\n", From owner-svn-src-head@freebsd.org Sat Dec 8 18:34:06 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 267091325524; Sat, 8 Dec 2018 18:34:06 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A9C348A3BD; Sat, 8 Dec 2018 18:34:05 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8B48725E35; Sat, 8 Dec 2018 18:34:05 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB8IY5s3086199; Sat, 8 Dec 2018 18:34:05 GMT (envelope-from jchandra@FreeBSD.org) Received: (from jchandra@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB8IY5eG086198; Sat, 8 Dec 2018 18:34:05 GMT (envelope-from jchandra@FreeBSD.org) Message-Id: <201812081834.wB8IY5eG086198@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jchandra set sender to jchandra@FreeBSD.org using -f From: "Jayachandran C." Date: Sat, 8 Dec 2018 18:34:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341741 - head/sys/x86/acpica X-SVN-Group: head X-SVN-Commit-Author: jchandra X-SVN-Commit-Paths: head/sys/x86/acpica X-SVN-Commit-Revision: 341741 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A9C348A3BD X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_LONG(-0.99)[-0.992,0]; NEURAL_HAM_SHORT(-0.97)[-0.968,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 08 Dec 2018 18:34:06 -0000 Author: jchandra Date: Sat Dec 8 18:34:05 2018 New Revision: 341741 URL: https://svnweb.freebsd.org/changeset/base/341741 Log: x86/acpica/srat.c: Add API for parsing proximity tables The SLIT and SRAT ACPI tables needs to be parsed on arm64 as well, on systems that use UEFI/ACPI firmware and support NUMA. To do this, we need to move most of the logic of x86/acpica/srat.c to dev/acpica and provide an API that architectures can use to parse and configure ACPI NUMA information. This commit adds the API in srat.c as a first step, without making any functional changes. We will move the common code to sys/dev/acpica as the next step. The functions added are: * int acpi_pxm_init(int ncpus, vm_paddr_t maxphys) - to allocate and initialize data structures used * void acpi_pxm_parse_tables(void) - parse SRAT/SLIT, save the cpu and memory proximity information * void acpi_pxm_set_mem_locality(void) - use the saved data to set memory locality * void acpi_pxm_set_cpu_locality(void) - use the saved data to set cpu locality * void acpi_pxm_free(void) - free data structures allocated by init On arm64, we do not have an cpu APIC id that can be used as index to store CPU data, we need to use the Processor Uid. To help with this, define internal functions cpu_add, cpu_find, cpu_get_info to store and get CPU proximity information. Reviewed by: markj, jhb (previous version) Differential Revision: https://reviews.freebsd.org/D17940 Modified: head/sys/x86/acpica/srat.c Modified: head/sys/x86/acpica/srat.c ============================================================================== --- head/sys/x86/acpica/srat.c Sat Dec 8 17:50:00 2018 (r341740) +++ head/sys/x86/acpica/srat.c Sat Dec 8 18:34:05 2018 (r341741) @@ -56,6 +56,15 @@ __FBSDID("$FreeBSD$"); #include +/* + * Parse and use proximity information in SRAT and SLIT. + */ +int acpi_pxm_init(int ncpus, vm_paddr_t maxphys); +void acpi_pxm_parse_tables(void); +void acpi_pxm_set_mem_locality(void); +void acpi_pxm_set_cpu_locality(void); +void acpi_pxm_free(void); + #if MAXMEMDOM > 1 static struct cpu_info { int enabled:1; @@ -63,6 +72,9 @@ static struct cpu_info { int domain; } *cpus; +static int max_cpus; +static int last_cpu; + struct mem_affinity mem_info[VM_PHYSSEG_MAX + 1]; int num_mem; @@ -71,6 +83,7 @@ static vm_paddr_t srat_physaddr; static int domain_pxm[MAXMEMDOM]; static int ndomain; +static vm_paddr_t maxphyaddr; static ACPI_TABLE_SLIT *slit; static vm_paddr_t slit_physaddr; @@ -177,15 +190,60 @@ overlaps_phys_avail(vm_paddr_t start, vm_paddr_t end) break; } return (0); - } +/* + * Find CPU by processor ID (APIC ID on x86). + */ +static struct cpu_info * +cpu_find(int cpuid) +{ + + if (cpuid <= last_cpu && cpus[cpuid].enabled) + return (&cpus[cpuid]); + return (NULL); +} + +/* + * Find CPU by pcpu pointer. + */ +static struct cpu_info * +cpu_get_info(struct pcpu *pc) +{ + struct cpu_info *cpup; + int id; + + id = pc->pc_apic_id; + cpup = cpu_find(id); + if (cpup == NULL) + panic("SRAT: CPU with APIC ID %u is not known", id); + return (cpup); +} + +/* + * Add proximity information for a new CPU. + */ +static struct cpu_info * +cpu_add(int cpuid, int domain) +{ + struct cpu_info *cpup; + + if (cpuid >= max_cpus) + return (NULL); + last_cpu = imax(last_cpu, cpuid); + cpup = &cpus[cpuid]; + cpup->domain = domain; + cpup->enabled = 1; + return (cpup); +} + static void srat_parse_entry(ACPI_SUBTABLE_HEADER *entry, void *arg) { ACPI_SRAT_CPU_AFFINITY *cpu; ACPI_SRAT_X2APIC_CPU_AFFINITY *x2apic; ACPI_SRAT_MEM_AFFINITY *mem; + static struct cpu_info *cpup; int domain, i, slot; switch (entry->Type) { @@ -202,20 +260,17 @@ srat_parse_entry(ACPI_SUBTABLE_HEADER *entry, void *ar "enabled" : "disabled"); if (!(cpu->Flags & ACPI_SRAT_CPU_ENABLED)) break; - if (cpu->ApicId > max_apic_id) { - printf("SRAT: Ignoring local APIC ID %u (too high)\n", - cpu->ApicId); - break; - } - - if (cpus[cpu->ApicId].enabled) { + cpup = cpu_find(cpu->ApicId); + if (cpup != NULL) { printf("SRAT: Duplicate local APIC ID %u\n", cpu->ApicId); *(int *)arg = ENXIO; break; } - cpus[cpu->ApicId].domain = domain; - cpus[cpu->ApicId].enabled = 1; + cpup = cpu_add(cpu->ApicId, domain); + if (cpup == NULL) + printf("SRAT: Ignoring local APIC ID %u (too high)\n", + cpu->ApicId); break; case ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY: x2apic = (ACPI_SRAT_X2APIC_CPU_AFFINITY *)entry; @@ -226,16 +281,12 @@ srat_parse_entry(ACPI_SUBTABLE_HEADER *entry, void *ar "enabled" : "disabled"); if (!(x2apic->Flags & ACPI_SRAT_CPU_ENABLED)) break; - if (x2apic->ApicId > max_apic_id) { + KASSERT(cpu_find(x2apic->ApicId) == NULL, + ("Duplicate local APIC ID %u", x2apic->ApicId)); + cpup = cpu_add(x2apic->ApicId, x2apic->ProximityDomain); + if (cpup == NULL) printf("SRAT: Ignoring local APIC ID %u (too high)\n", x2apic->ApicId); - break; - } - - KASSERT(!cpus[x2apic->ApicId].enabled, - ("Duplicate local APIC ID %u", x2apic->ApicId)); - cpus[x2apic->ApicId].domain = x2apic->ProximityDomain; - cpus[x2apic->ApicId].enabled = 1; break; case ACPI_SRAT_TYPE_MEMORY_AFFINITY: mem = (ACPI_SRAT_MEM_AFFINITY *)entry; @@ -248,7 +299,7 @@ srat_parse_entry(ACPI_SUBTABLE_HEADER *entry, void *ar "enabled" : "disabled"); if (!(mem->Flags & ACPI_SRAT_MEM_ENABLED)) break; - if (mem->BaseAddress >= cpu_getmaxphyaddr() || + if (mem->BaseAddress >= maxphyaddr || !overlaps_phys_avail(mem->BaseAddress, mem->BaseAddress + mem->Length)) { printf("SRAT: Ignoring memory at addr 0x%jx\n", @@ -293,7 +344,7 @@ check_domains(void) for (i = 0; i < num_mem; i++) { found = 0; - for (j = 0; j <= max_apic_id; j++) + for (j = 0; j <= last_cpu; j++) if (cpus[j].enabled && cpus[j].domain == mem_info[i].domain) { cpus[j].has_memory = 1; @@ -305,7 +356,7 @@ check_domains(void) return (ENXIO); } } - for (i = 0; i <= max_apic_id; i++) + for (i = 0; i <= last_cpu; i++) if (cpus[i].enabled && !cpus[i].has_memory) { found = 0; for (j = 0; j < num_mem && !found; j++) { @@ -412,7 +463,7 @@ renumber_domains(void) for (j = 0; j < num_mem; j++) if (mem_info[j].domain == domain_pxm[i]) mem_info[j].domain = i; - for (j = 0; j <= max_apic_id; j++) + for (j = 0; j <= last_cpu; j++) if (cpus[j].enabled && cpus[j].domain == domain_pxm[i]) cpus[j].domain = i; } @@ -421,18 +472,21 @@ renumber_domains(void) } /* - * Look for an ACPI System Resource Affinity Table ("SRAT") + * Look for an ACPI System Resource Affinity Table ("SRAT"), + * allocate space for cpu information, and initialize globals. */ -static int -parse_srat(void) +int +acpi_pxm_init(int ncpus, vm_paddr_t maxphys) { unsigned int idx, size; vm_paddr_t addr; - int error; if (resource_disabled("srat", 0)) return (-1); + max_cpus = ncpus; + last_cpu = -1; + maxphyaddr = maxphys; srat_physaddr = acpi_find_table(ACPI_SIG_SRAT); if (srat_physaddr == 0) return (-1); @@ -448,7 +502,7 @@ parse_srat(void) KASSERT(idx != 0, ("phys_avail is empty!")); idx -= 2; - size = sizeof(*cpus) * (max_apic_id + 1); + size = sizeof(*cpus) * max_cpus; addr = trunc_page(phys_avail[idx + 1] - size); KASSERT(addr >= phys_avail[idx], ("Not enough memory for SRAT table items")); @@ -461,7 +515,14 @@ parse_srat(void) */ cpus = (struct cpu_info *)pmap_mapbios(addr, size); bzero(cpus, size); + return (0); +} +static int +parse_srat(void) +{ + int error; + /* * Make a pass over the table to populate the cpus[] and * mem_info[] tables. @@ -493,16 +554,42 @@ init_mem_locality(void) vm_locality_table[i] = -1; } -static void -parse_acpi_tables(void *dummy) +/* + * Parse SRAT and SLIT to save proximity info. Don't do + * anything if SRAT is not available. + */ +void +acpi_pxm_parse_tables(void) { + if (srat_physaddr == 0) + return; if (parse_srat() < 0) return; init_mem_locality(); (void)parse_slit(); +} + +/* + * Use saved data from SRAT/SLIT to update memory locality. + */ +void +acpi_pxm_set_mem_locality(void) +{ + + if (srat_physaddr == 0) + return; vm_phys_register_domains(ndomain, mem_info, vm_locality_table); } + +static void +parse_acpi_tables(void *dummy) +{ + + acpi_pxm_init(max_apic_id + 1, cpu_getmaxphyaddr()); + acpi_pxm_parse_tables(); + acpi_pxm_set_mem_locality(); +} SYSINIT(parse_acpi_tables, SI_SUB_VM - 1, SI_ORDER_FIRST, parse_acpi_tables, NULL); @@ -515,10 +602,10 @@ srat_walk_table(acpi_subtable_handler *handler, void * } /* - * Setup per-CPU domain IDs. + * Setup per-CPU domain IDs from information saved in 'cpus'. */ -static void -srat_set_cpus(void *dummy) +void +acpi_pxm_set_cpu_locality(void) { struct cpu_info *cpu; struct pcpu *pc; @@ -531,20 +618,35 @@ srat_set_cpus(void *dummy) continue; pc = pcpu_find(i); KASSERT(pc != NULL, ("no pcpu data for CPU %u", i)); - cpu = &cpus[pc->pc_apic_id]; - if (!cpu->enabled) - panic("SRAT: CPU with APIC ID %u is not known", - pc->pc_apic_id); + cpu = cpu_get_info(pc); pc->pc_domain = vm_ndomains > 1 ? cpu->domain : 0; CPU_SET(i, &cpuset_domain[pc->pc_domain]); if (bootverbose) printf("SRAT: CPU %u has memory domain %d\n", i, pc->pc_domain); } +} - /* Last usage of the cpus array, unmap it. */ - pmap_unmapbios((vm_offset_t)cpus, sizeof(*cpus) * (max_apic_id + 1)); +/* + * Free data structures allocated during acpi_pxm_init. + */ +void +acpi_pxm_free(void) +{ + + if (srat_physaddr == 0) + return; + pmap_unmapbios((vm_offset_t)cpus, sizeof(*cpus) * max_cpus); + srat_physaddr = 0; cpus = NULL; +} + +static void +srat_set_cpus(void *dummy) +{ + + acpi_pxm_set_cpu_locality(); + acpi_pxm_free(); } SYSINIT(srat_set_cpus, SI_SUB_CPU, SI_ORDER_ANY, srat_set_cpus, NULL); From owner-svn-src-head@freebsd.org Sat Dec 8 19:11:00 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BA6EC13267CA; Sat, 8 Dec 2018 19:10:59 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6F1D78BF5C; Sat, 8 Dec 2018 19:10:59 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4FE012636F; Sat, 8 Dec 2018 19:10:59 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB8JAxDS003726; Sat, 8 Dec 2018 19:10:59 GMT (envelope-from jchandra@FreeBSD.org) Received: (from jchandra@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB8JAwN1003722; Sat, 8 Dec 2018 19:10:58 GMT (envelope-from jchandra@FreeBSD.org) Message-Id: <201812081910.wB8JAwN1003722@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jchandra set sender to jchandra@FreeBSD.org using -f From: "Jayachandran C." Date: Sat, 8 Dec 2018 19:10:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341742 - in head/sys: conf dev/acpica x86/acpica X-SVN-Group: head X-SVN-Commit-Author: jchandra X-SVN-Commit-Paths: in head/sys: conf dev/acpica x86/acpica X-SVN-Commit-Revision: 341742 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6F1D78BF5C X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_SHORT(-0.98)[-0.975,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.99)[-0.992,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 08 Dec 2018 19:11:00 -0000 Author: jchandra Date: Sat Dec 8 19:10:58 2018 New Revision: 341742 URL: https://svnweb.freebsd.org/changeset/base/341742 Log: acpica : move SRAT/SLIT parsing to sys/dev/acpica This moves the architecture independent parts of sys/x86/acpica/srat.c to sys/dev/acpica/acpi_pxm.c, to be used later on arm64. The function declarations are moved to sys/dev/acpica/acpivar.h We also need to update sys/conf/files.{i386,amd64} to use the new file. No functional changes. Reviewed by: markj, imp Differential Revision: https://reviews.freebsd.org/D17941 Added: head/sys/dev/acpica/acpi_pxm.c (contents, props changed) Modified: head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/dev/acpica/acpivar.h head/sys/x86/acpica/srat.c Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Sat Dec 8 18:34:05 2018 (r341741) +++ head/sys/conf/files.amd64 Sat Dec 8 19:10:58 2018 (r341742) @@ -203,6 +203,7 @@ dev/acpica/acpi_pci_link.c optional acpi pci dev/acpica/acpi_pcib.c optional acpi pci 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/acpi_support/acpi_wmi_if.m standard dev/agp/agp_amd64.c optional agp Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Sat Dec 8 18:34:05 2018 (r341741) +++ head/sys/conf/files.i386 Sat Dec 8 19:10:58 2018 (r341742) @@ -332,6 +332,7 @@ dev/vmware/vmci/vmci_resource.c optional vmci dev/acpica/acpi_if.m standard dev/acpica/acpi_hpet.c optional acpi dev/acpica/acpi_timer.c optional acpi +dev/acpica/acpi_pxm.c optional acpi dev/acpi_support/acpi_wmi_if.m standard dev/wbwd/wbwd.c optional wbwd dev/isci/isci.c optional isci Added: head/sys/dev/acpica/acpi_pxm.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/acpica/acpi_pxm.c Sat Dec 8 19:10:58 2018 (r341742) @@ -0,0 +1,649 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2010 Hudson River Trading LLC + * Written by: John H. Baldwin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_vm.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include + +#if MAXMEMDOM > 1 +static struct cpu_info { + int enabled:1; + int has_memory:1; + int domain; +} *cpus; + +static int max_cpus; +static int last_cpu; + +struct mem_affinity mem_info[VM_PHYSSEG_MAX + 1]; +int num_mem; + +static ACPI_TABLE_SRAT *srat; +static vm_paddr_t srat_physaddr; + +static int domain_pxm[MAXMEMDOM]; +static int ndomain; +static vm_paddr_t maxphyaddr; + +static ACPI_TABLE_SLIT *slit; +static vm_paddr_t slit_physaddr; +static int vm_locality_table[MAXMEMDOM * MAXMEMDOM]; + +static void srat_walk_table(acpi_subtable_handler *handler, void *arg); + +/* + * SLIT parsing. + */ + +static void +slit_parse_table(ACPI_TABLE_SLIT *s) +{ + int i, j; + int i_domain, j_domain; + int offset = 0; + uint8_t e; + + /* + * This maps the SLIT data into the VM-domain centric view. + * There may be sparse entries in the PXM namespace, so + * remap them to a VM-domain ID and if it doesn't exist, + * skip it. + * + * It should result in a packed 2d array of VM-domain + * locality information entries. + */ + + if (bootverbose) + printf("SLIT.Localities: %d\n", (int) s->LocalityCount); + for (i = 0; i < s->LocalityCount; i++) { + i_domain = acpi_map_pxm_to_vm_domainid(i); + if (i_domain < 0) + continue; + + if (bootverbose) + printf("%d: ", i); + for (j = 0; j < s->LocalityCount; j++) { + j_domain = acpi_map_pxm_to_vm_domainid(j); + if (j_domain < 0) + continue; + e = s->Entry[i * s->LocalityCount + j]; + if (bootverbose) + printf("%d ", (int) e); + /* 255 == "no locality information" */ + if (e == 255) + vm_locality_table[offset] = -1; + else + vm_locality_table[offset] = e; + offset++; + } + if (bootverbose) + printf("\n"); + } +} + +/* + * Look for an ACPI System Locality Distance Information Table ("SLIT") + */ +static int +parse_slit(void) +{ + + if (resource_disabled("slit", 0)) { + return (-1); + } + + slit_physaddr = acpi_find_table(ACPI_SIG_SLIT); + if (slit_physaddr == 0) { + return (-1); + } + + /* + * Make a pass over the table to populate the cpus[] and + * mem_info[] tables. + */ + slit = acpi_map_table(slit_physaddr, ACPI_SIG_SLIT); + slit_parse_table(slit); + acpi_unmap_table(slit); + slit = NULL; + + return (0); +} + +/* + * SRAT parsing. + */ + +/* + * Returns true if a memory range overlaps with at least one range in + * phys_avail[]. + */ +static int +overlaps_phys_avail(vm_paddr_t start, vm_paddr_t end) +{ + int i; + + for (i = 0; phys_avail[i] != 0 && phys_avail[i + 1] != 0; i += 2) { + if (phys_avail[i + 1] <= start) + continue; + if (phys_avail[i] < end) + return (1); + break; + } + return (0); +} + +/* + * Find CPU by processor ID (APIC ID on x86). + */ +static struct cpu_info * +cpu_find(int cpuid) +{ + + if (cpuid <= last_cpu && cpus[cpuid].enabled) + return (&cpus[cpuid]); + return (NULL); +} + +/* + * Find CPU by pcpu pointer. + */ +static struct cpu_info * +cpu_get_info(struct pcpu *pc) +{ + struct cpu_info *cpup; + int id; + + id = pc->pc_apic_id; + cpup = cpu_find(id); + if (cpup == NULL) + panic("SRAT: CPU with APIC ID %u is not known", id); + return (cpup); +} + +/* + * Add proximity information for a new CPU. + */ +static struct cpu_info * +cpu_add(int cpuid, int domain) +{ + struct cpu_info *cpup; + + if (cpuid >= max_cpus) + return (NULL); + last_cpu = imax(last_cpu, cpuid); + cpup = &cpus[cpuid]; + cpup->domain = domain; + cpup->enabled = 1; + return (cpup); +} + +static void +srat_parse_entry(ACPI_SUBTABLE_HEADER *entry, void *arg) +{ + ACPI_SRAT_CPU_AFFINITY *cpu; + ACPI_SRAT_X2APIC_CPU_AFFINITY *x2apic; + ACPI_SRAT_MEM_AFFINITY *mem; + static struct cpu_info *cpup; + int domain, i, slot; + + switch (entry->Type) { + case ACPI_SRAT_TYPE_CPU_AFFINITY: + cpu = (ACPI_SRAT_CPU_AFFINITY *)entry; + domain = cpu->ProximityDomainLo | + cpu->ProximityDomainHi[0] << 8 | + cpu->ProximityDomainHi[1] << 16 | + cpu->ProximityDomainHi[2] << 24; + if (bootverbose) + printf("SRAT: Found CPU APIC ID %u domain %d: %s\n", + cpu->ApicId, domain, + (cpu->Flags & ACPI_SRAT_CPU_ENABLED) ? + "enabled" : "disabled"); + if (!(cpu->Flags & ACPI_SRAT_CPU_ENABLED)) + break; + cpup = cpu_find(cpu->ApicId); + if (cpup != NULL) { + printf("SRAT: Duplicate local APIC ID %u\n", + cpu->ApicId); + *(int *)arg = ENXIO; + break; + } + cpup = cpu_add(cpu->ApicId, domain); + if (cpup == NULL) + printf("SRAT: Ignoring local APIC ID %u (too high)\n", + cpu->ApicId); + break; + case ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY: + x2apic = (ACPI_SRAT_X2APIC_CPU_AFFINITY *)entry; + if (bootverbose) + printf("SRAT: Found CPU APIC ID %u domain %d: %s\n", + x2apic->ApicId, x2apic->ProximityDomain, + (x2apic->Flags & ACPI_SRAT_CPU_ENABLED) ? + "enabled" : "disabled"); + if (!(x2apic->Flags & ACPI_SRAT_CPU_ENABLED)) + break; + KASSERT(cpu_find(x2apic->ApicId) == NULL, + ("Duplicate local APIC ID %u", x2apic->ApicId)); + cpup = cpu_add(x2apic->ApicId, x2apic->ProximityDomain); + if (cpup == NULL) + printf("SRAT: Ignoring local APIC ID %u (too high)\n", + x2apic->ApicId); + break; + case ACPI_SRAT_TYPE_MEMORY_AFFINITY: + mem = (ACPI_SRAT_MEM_AFFINITY *)entry; + if (bootverbose) + printf( + "SRAT: Found memory domain %d addr 0x%jx len 0x%jx: %s\n", + mem->ProximityDomain, (uintmax_t)mem->BaseAddress, + (uintmax_t)mem->Length, + (mem->Flags & ACPI_SRAT_MEM_ENABLED) ? + "enabled" : "disabled"); + if (!(mem->Flags & ACPI_SRAT_MEM_ENABLED)) + break; + if (mem->BaseAddress >= maxphyaddr || + !overlaps_phys_avail(mem->BaseAddress, + mem->BaseAddress + mem->Length)) { + printf("SRAT: Ignoring memory at addr 0x%jx\n", + (uintmax_t)mem->BaseAddress); + break; + } + if (num_mem == VM_PHYSSEG_MAX) { + printf("SRAT: Too many memory regions\n"); + *(int *)arg = ENXIO; + break; + } + slot = num_mem; + for (i = 0; i < num_mem; i++) { + if (mem_info[i].end <= mem->BaseAddress) + continue; + if (mem_info[i].start < + (mem->BaseAddress + mem->Length)) { + printf("SRAT: Overlapping memory entries\n"); + *(int *)arg = ENXIO; + return; + } + slot = i; + } + for (i = num_mem; i > slot; i--) + mem_info[i] = mem_info[i - 1]; + mem_info[slot].start = mem->BaseAddress; + mem_info[slot].end = mem->BaseAddress + mem->Length; + mem_info[slot].domain = mem->ProximityDomain; + num_mem++; + break; + } +} + +/* + * Ensure each memory domain has at least one CPU and that each CPU + * has at least one memory domain. + */ +static int +check_domains(void) +{ + int found, i, j; + + for (i = 0; i < num_mem; i++) { + found = 0; + for (j = 0; j <= last_cpu; j++) + if (cpus[j].enabled && + cpus[j].domain == mem_info[i].domain) { + cpus[j].has_memory = 1; + found++; + } + if (!found) { + printf("SRAT: No CPU found for memory domain %d\n", + mem_info[i].domain); + return (ENXIO); + } + } + for (i = 0; i <= last_cpu; i++) + if (cpus[i].enabled && !cpus[i].has_memory) { + found = 0; + for (j = 0; j < num_mem && !found; j++) { + if (mem_info[j].domain == cpus[i].domain) + found = 1; + } + if (!found) { + if (bootverbose) + printf("SRAT: mem dom %d is empty\n", + cpus[i].domain); + mem_info[num_mem].start = 0; + mem_info[num_mem].end = 0; + mem_info[num_mem].domain = cpus[i].domain; + num_mem++; + } + } + return (0); +} + +/* + * Check that the SRAT memory regions cover all of the regions in + * phys_avail[]. + */ +static int +check_phys_avail(void) +{ + vm_paddr_t address; + int i, j; + + /* j is the current offset into phys_avail[]. */ + address = phys_avail[0]; + j = 0; + for (i = 0; i < num_mem; i++) { + /* + * Consume as many phys_avail[] entries as fit in this + * region. + */ + while (address >= mem_info[i].start && + address <= mem_info[i].end) { + /* + * If we cover the rest of this phys_avail[] entry, + * advance to the next entry. + */ + if (phys_avail[j + 1] <= mem_info[i].end) { + j += 2; + if (phys_avail[j] == 0 && + phys_avail[j + 1] == 0) { + return (0); + } + address = phys_avail[j]; + } else + address = mem_info[i].end + 1; + } + } + printf("SRAT: No memory region found for 0x%jx - 0x%jx\n", + (uintmax_t)phys_avail[j], (uintmax_t)phys_avail[j + 1]); + return (ENXIO); +} + +/* + * Renumber the memory domains to be compact and zero-based if not + * already. Returns an error if there are too many domains. + */ +static int +renumber_domains(void) +{ + int i, j, slot; + + /* Enumerate all the domains. */ + ndomain = 0; + for (i = 0; i < num_mem; i++) { + /* See if this domain is already known. */ + for (j = 0; j < ndomain; j++) { + if (domain_pxm[j] >= mem_info[i].domain) + break; + } + if (j < ndomain && domain_pxm[j] == mem_info[i].domain) + continue; + + if (ndomain >= MAXMEMDOM) { + ndomain = 1; + printf("SRAT: Too many memory domains\n"); + return (EFBIG); + } + + /* Insert the new domain at slot 'j'. */ + slot = j; + for (j = ndomain; j > slot; j--) + domain_pxm[j] = domain_pxm[j - 1]; + domain_pxm[slot] = mem_info[i].domain; + ndomain++; + } + + /* Renumber each domain to its index in the sorted 'domain_pxm' list. */ + for (i = 0; i < ndomain; i++) { + /* + * If the domain is already the right value, no need + * to renumber. + */ + if (domain_pxm[i] == i) + continue; + + /* Walk the cpu[] and mem_info[] arrays to renumber. */ + for (j = 0; j < num_mem; j++) + if (mem_info[j].domain == domain_pxm[i]) + mem_info[j].domain = i; + for (j = 0; j <= last_cpu; j++) + if (cpus[j].enabled && cpus[j].domain == domain_pxm[i]) + cpus[j].domain = i; + } + + return (0); +} + +/* + * Look for an ACPI System Resource Affinity Table ("SRAT"), + * allocate space for cpu information, and initialize globals. + */ +int +acpi_pxm_init(int ncpus, vm_paddr_t maxphys) +{ + unsigned int idx, size; + vm_paddr_t addr; + + if (resource_disabled("srat", 0)) + return (-1); + + max_cpus = ncpus; + last_cpu = -1; + maxphyaddr = maxphys; + srat_physaddr = acpi_find_table(ACPI_SIG_SRAT); + if (srat_physaddr == 0) + return (-1); + + /* + * Allocate data structure: + * + * Find the last physical memory region and steal some memory from + * it. This is done because at this point in the boot process + * malloc is still not usable. + */ + for (idx = 0; phys_avail[idx + 1] != 0; idx += 2); + KASSERT(idx != 0, ("phys_avail is empty!")); + idx -= 2; + + size = sizeof(*cpus) * max_cpus; + addr = trunc_page(phys_avail[idx + 1] - size); + KASSERT(addr >= phys_avail[idx], + ("Not enough memory for SRAT table items")); + phys_avail[idx + 1] = addr - 1; + + /* + * We cannot rely on PHYS_TO_DMAP because this code is also used in + * i386, so use pmap_mapbios to map the memory, this will end up using + * the default memory attribute (WB), and the DMAP when available. + */ + cpus = (struct cpu_info *)pmap_mapbios(addr, size); + bzero(cpus, size); + return (0); +} + +static int +parse_srat(void) +{ + int error; + + /* + * Make a pass over the table to populate the cpus[] and + * mem_info[] tables. + */ + srat = acpi_map_table(srat_physaddr, ACPI_SIG_SRAT); + error = 0; + srat_walk_table(srat_parse_entry, &error); + acpi_unmap_table(srat); + srat = NULL; + if (error || check_domains() != 0 || check_phys_avail() != 0 || + renumber_domains() != 0) { + srat_physaddr = 0; + return (-1); + } + + return (0); +} + +static void +init_mem_locality(void) +{ + int i; + + /* + * For now, assume -1 == "no locality information for + * this pairing. + */ + for (i = 0; i < MAXMEMDOM * MAXMEMDOM; i++) + vm_locality_table[i] = -1; +} + +/* + * Parse SRAT and SLIT to save proximity info. Don't do + * anything if SRAT is not available. + */ +void +acpi_pxm_parse_tables(void) +{ + + if (srat_physaddr == 0) + return; + if (parse_srat() < 0) + return; + init_mem_locality(); + (void)parse_slit(); +} + +/* + * Use saved data from SRAT/SLIT to update memory locality. + */ +void +acpi_pxm_set_mem_locality(void) +{ + + if (srat_physaddr == 0) + return; + vm_phys_register_domains(ndomain, mem_info, vm_locality_table); +} + +static void +srat_walk_table(acpi_subtable_handler *handler, void *arg) +{ + + acpi_walk_subtables(srat + 1, (char *)srat + srat->Header.Length, + handler, arg); +} + +/* + * Setup per-CPU domain IDs from information saved in 'cpus'. + */ +void +acpi_pxm_set_cpu_locality(void) +{ + struct cpu_info *cpu; + struct pcpu *pc; + u_int i; + + if (srat_physaddr == 0) + return; + for (i = 0; i < MAXCPU; i++) { + if (CPU_ABSENT(i)) + continue; + pc = pcpu_find(i); + KASSERT(pc != NULL, ("no pcpu data for CPU %u", i)); + cpu = cpu_get_info(pc); + pc->pc_domain = vm_ndomains > 1 ? cpu->domain : 0; + CPU_SET(i, &cpuset_domain[pc->pc_domain]); + if (bootverbose) + printf("SRAT: CPU %u has memory domain %d\n", i, + pc->pc_domain); + } +} + +/* + * Free data structures allocated during acpi_pxm_init. + */ +void +acpi_pxm_free(void) +{ + + if (srat_physaddr == 0) + return; + pmap_unmapbios((vm_offset_t)cpus, sizeof(*cpus) * max_cpus); + srat_physaddr = 0; + cpus = NULL; +} + +/* + * Map a _PXM value to a VM domain ID. + * + * Returns the domain ID, or -1 if no domain ID was found. + */ +int +acpi_map_pxm_to_vm_domainid(int pxm) +{ + int i; + + for (i = 0; i < ndomain; i++) { + if (domain_pxm[i] == pxm) + return (vm_ndomains > 1 ? i : 0); + } + + return (-1); +} + +#else /* MAXMEMDOM == 1 */ + +int +acpi_map_pxm_to_vm_domainid(int pxm) +{ + + return (-1); +} + +#endif /* MAXMEMDOM > 1 */ Modified: head/sys/dev/acpica/acpivar.h ============================================================================== --- head/sys/dev/acpica/acpivar.h Sat Dec 8 18:34:05 2018 (r341741) +++ head/sys/dev/acpica/acpivar.h Sat Dec 8 19:10:58 2018 (r341742) @@ -526,6 +526,15 @@ ACPI_HANDLE acpi_GetReference(ACPI_HANDLE scope, ACPI_ SYSCTL_DECL(_debug_acpi); /* + * Parse and use proximity information in SRAT and SLIT. + */ +int acpi_pxm_init(int ncpus, vm_paddr_t maxphys); +void acpi_pxm_parse_tables(void); +void acpi_pxm_set_mem_locality(void); +void acpi_pxm_set_cpu_locality(void); +void acpi_pxm_free(void); + +/* * Map a PXM to a VM domain. * * Returns the VM domain ID if found, or -1 if not found / invalid. Modified: head/sys/x86/acpica/srat.c ============================================================================== --- head/sys/x86/acpica/srat.c Sat Dec 8 18:34:05 2018 (r341741) +++ head/sys/x86/acpica/srat.c Sat Dec 8 19:10:58 2018 (r341742) @@ -36,553 +36,16 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include -#include -#include -#include #include -#include #include -/* - * Parse and use proximity information in SRAT and SLIT. - */ -int acpi_pxm_init(int ncpus, vm_paddr_t maxphys); -void acpi_pxm_parse_tables(void); -void acpi_pxm_set_mem_locality(void); -void acpi_pxm_set_cpu_locality(void); -void acpi_pxm_free(void); - #if MAXMEMDOM > 1 -static struct cpu_info { - int enabled:1; - int has_memory:1; - int domain; -} *cpus; -static int max_cpus; -static int last_cpu; - -struct mem_affinity mem_info[VM_PHYSSEG_MAX + 1]; -int num_mem; - -static ACPI_TABLE_SRAT *srat; -static vm_paddr_t srat_physaddr; - -static int domain_pxm[MAXMEMDOM]; -static int ndomain; -static vm_paddr_t maxphyaddr; - -static ACPI_TABLE_SLIT *slit; -static vm_paddr_t slit_physaddr; -static int vm_locality_table[MAXMEMDOM * MAXMEMDOM]; - -static void srat_walk_table(acpi_subtable_handler *handler, void *arg); - -/* - * SLIT parsing. - */ - static void -slit_parse_table(ACPI_TABLE_SLIT *s) -{ - int i, j; - int i_domain, j_domain; - int offset = 0; - uint8_t e; - - /* - * This maps the SLIT data into the VM-domain centric view. - * There may be sparse entries in the PXM namespace, so - * remap them to a VM-domain ID and if it doesn't exist, - * skip it. - * - * It should result in a packed 2d array of VM-domain - * locality information entries. - */ - - if (bootverbose) - printf("SLIT.Localities: %d\n", (int) s->LocalityCount); - for (i = 0; i < s->LocalityCount; i++) { - i_domain = acpi_map_pxm_to_vm_domainid(i); - if (i_domain < 0) - continue; - - if (bootverbose) - printf("%d: ", i); - for (j = 0; j < s->LocalityCount; j++) { - j_domain = acpi_map_pxm_to_vm_domainid(j); - if (j_domain < 0) - continue; - e = s->Entry[i * s->LocalityCount + j]; - if (bootverbose) - printf("%d ", (int) e); - /* 255 == "no locality information" */ - if (e == 255) - vm_locality_table[offset] = -1; - else - vm_locality_table[offset] = e; - offset++; - } - if (bootverbose) - printf("\n"); - } -} - -/* - * Look for an ACPI System Locality Distance Information Table ("SLIT") - */ -static int -parse_slit(void) -{ - - if (resource_disabled("slit", 0)) { - return (-1); - } - - slit_physaddr = acpi_find_table(ACPI_SIG_SLIT); - if (slit_physaddr == 0) { - return (-1); - } - - /* - * Make a pass over the table to populate the cpus[] and - * mem_info[] tables. - */ - slit = acpi_map_table(slit_physaddr, ACPI_SIG_SLIT); - slit_parse_table(slit); - acpi_unmap_table(slit); - slit = NULL; - - return (0); -} - -/* - * SRAT parsing. - */ - -/* - * Returns true if a memory range overlaps with at least one range in - * phys_avail[]. - */ -static int -overlaps_phys_avail(vm_paddr_t start, vm_paddr_t end) -{ - int i; - - for (i = 0; phys_avail[i] != 0 && phys_avail[i + 1] != 0; i += 2) { - if (phys_avail[i + 1] <= start) - continue; - if (phys_avail[i] < end) - return (1); - break; - } - return (0); -} - -/* - * Find CPU by processor ID (APIC ID on x86). - */ -static struct cpu_info * -cpu_find(int cpuid) -{ - - if (cpuid <= last_cpu && cpus[cpuid].enabled) - return (&cpus[cpuid]); - return (NULL); -} - -/* - * Find CPU by pcpu pointer. - */ -static struct cpu_info * -cpu_get_info(struct pcpu *pc) -{ - struct cpu_info *cpup; - int id; - - id = pc->pc_apic_id; - cpup = cpu_find(id); - if (cpup == NULL) - panic("SRAT: CPU with APIC ID %u is not known", id); - return (cpup); -} - -/* - * Add proximity information for a new CPU. - */ -static struct cpu_info * -cpu_add(int cpuid, int domain) -{ - struct cpu_info *cpup; - - if (cpuid >= max_cpus) - return (NULL); - last_cpu = imax(last_cpu, cpuid); - cpup = &cpus[cpuid]; - cpup->domain = domain; - cpup->enabled = 1; - return (cpup); -} - -static void -srat_parse_entry(ACPI_SUBTABLE_HEADER *entry, void *arg) -{ - ACPI_SRAT_CPU_AFFINITY *cpu; - ACPI_SRAT_X2APIC_CPU_AFFINITY *x2apic; - ACPI_SRAT_MEM_AFFINITY *mem; - static struct cpu_info *cpup; - int domain, i, slot; - - switch (entry->Type) { - case ACPI_SRAT_TYPE_CPU_AFFINITY: - cpu = (ACPI_SRAT_CPU_AFFINITY *)entry; - domain = cpu->ProximityDomainLo | - cpu->ProximityDomainHi[0] << 8 | - cpu->ProximityDomainHi[1] << 16 | - cpu->ProximityDomainHi[2] << 24; - if (bootverbose) - printf("SRAT: Found CPU APIC ID %u domain %d: %s\n", - cpu->ApicId, domain, - (cpu->Flags & ACPI_SRAT_CPU_ENABLED) ? - "enabled" : "disabled"); - if (!(cpu->Flags & ACPI_SRAT_CPU_ENABLED)) - break; - cpup = cpu_find(cpu->ApicId); - if (cpup != NULL) { - printf("SRAT: Duplicate local APIC ID %u\n", - cpu->ApicId); - *(int *)arg = ENXIO; - break; - } - cpup = cpu_add(cpu->ApicId, domain); - if (cpup == NULL) - printf("SRAT: Ignoring local APIC ID %u (too high)\n", - cpu->ApicId); - break; - case ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY: - x2apic = (ACPI_SRAT_X2APIC_CPU_AFFINITY *)entry; - if (bootverbose) - printf("SRAT: Found CPU APIC ID %u domain %d: %s\n", - x2apic->ApicId, x2apic->ProximityDomain, - (x2apic->Flags & ACPI_SRAT_CPU_ENABLED) ? - "enabled" : "disabled"); - if (!(x2apic->Flags & ACPI_SRAT_CPU_ENABLED)) - break; - KASSERT(cpu_find(x2apic->ApicId) == NULL, - ("Duplicate local APIC ID %u", x2apic->ApicId)); - cpup = cpu_add(x2apic->ApicId, x2apic->ProximityDomain); - if (cpup == NULL) - printf("SRAT: Ignoring local APIC ID %u (too high)\n", - x2apic->ApicId); - break; - case ACPI_SRAT_TYPE_MEMORY_AFFINITY: - mem = (ACPI_SRAT_MEM_AFFINITY *)entry; - if (bootverbose) - printf( - "SRAT: Found memory domain %d addr 0x%jx len 0x%jx: %s\n", - mem->ProximityDomain, (uintmax_t)mem->BaseAddress, - (uintmax_t)mem->Length, - (mem->Flags & ACPI_SRAT_MEM_ENABLED) ? - "enabled" : "disabled"); - if (!(mem->Flags & ACPI_SRAT_MEM_ENABLED)) - break; - if (mem->BaseAddress >= maxphyaddr || - !overlaps_phys_avail(mem->BaseAddress, - mem->BaseAddress + mem->Length)) { - printf("SRAT: Ignoring memory at addr 0x%jx\n", - (uintmax_t)mem->BaseAddress); - break; - } - if (num_mem == VM_PHYSSEG_MAX) { - printf("SRAT: Too many memory regions\n"); - *(int *)arg = ENXIO; - break; - } - slot = num_mem; - for (i = 0; i < num_mem; i++) { - if (mem_info[i].end <= mem->BaseAddress) - continue; - if (mem_info[i].start < - (mem->BaseAddress + mem->Length)) { - printf("SRAT: Overlapping memory entries\n"); - *(int *)arg = ENXIO; - return; - } - slot = i; - } - for (i = num_mem; i > slot; i--) - mem_info[i] = mem_info[i - 1]; - mem_info[slot].start = mem->BaseAddress; - mem_info[slot].end = mem->BaseAddress + mem->Length; - mem_info[slot].domain = mem->ProximityDomain; - num_mem++; - break; - } -} - -/* - * Ensure each memory domain has at least one CPU and that each CPU - * has at least one memory domain. - */ -static int -check_domains(void) -{ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Sat Dec 8 19:32:24 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 68C9213274F1; Sat, 8 Dec 2018 19:32:24 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0FC4F8CD27; Sat, 8 Dec 2018 19:32:24 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E4E6026807; Sat, 8 Dec 2018 19:32:23 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB8JWN9Q017297; Sat, 8 Dec 2018 19:32:23 GMT (envelope-from jchandra@FreeBSD.org) Received: (from jchandra@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB8JWNZf016911; Sat, 8 Dec 2018 19:32:23 GMT (envelope-from jchandra@FreeBSD.org) Message-Id: <201812081932.wB8JWNZf016911@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jchandra set sender to jchandra@FreeBSD.org using -f From: "Jayachandran C." Date: Sat, 8 Dec 2018 19:32:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341743 - in head/sys: conf dev/acpica X-SVN-Group: head X-SVN-Commit-Author: jchandra X-SVN-Commit-Paths: in head/sys: conf dev/acpica X-SVN-Commit-Revision: 341743 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0FC4F8CD27 X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_SHORT(-0.97)[-0.974,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.99)[-0.991,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 08 Dec 2018 19:32:24 -0000 Author: jchandra Date: Sat Dec 8 19:32:23 2018 New Revision: 341743 URL: https://svnweb.freebsd.org/changeset/base/341743 Log: acpica: support parsing of arm64 affinity in acpi_pxm.c ACPI SRAT table on arm64 uses GICC entries to provide CPU locality information. These entries use an AcpiProcessorUid to identify the CPU (unlike on x86 where the entries have an APIC ID). Update acpi_pxm.c to extend the cpu_add/cpu_find/cpu_get_info functions to handle AcpiProcessorUid. Use the updated functions while parsing ACPI_SRAT_GICC_AFFINITY entry for arm64. Also update sys/conf/files.arm64 to build acpi_pxm.c when ACPI is enabled. Reviewed by: markj (previous version) Differential Revision: https://reviews.freebsd.org/D17942 Modified: head/sys/conf/files.arm64 head/sys/dev/acpica/acpi_pxm.c Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Sat Dec 8 19:10:58 2018 (r341742) +++ head/sys/conf/files.arm64 Sat Dec 8 19:32:23 2018 (r341743) @@ -188,6 +188,7 @@ dev/acpica/acpi_bus_if.m optional acpi dev/acpica/acpi_if.m optional acpi dev/acpica/acpi_pci_link.c optional acpi pci dev/acpica/acpi_pcib.c optional acpi pci +dev/acpica/acpi_pxm.c optional acpi dev/ahci/ahci_generic.c optional ahci dev/axgbe/if_axgbe.c optional axgbe dev/axgbe/xgbe-desc.c optional axgbe Modified: head/sys/dev/acpica/acpi_pxm.c ============================================================================== --- head/sys/dev/acpica/acpi_pxm.c Sat Dec 8 19:10:58 2018 (r341742) +++ head/sys/dev/acpica/acpi_pxm.c Sat Dec 8 19:32:23 2018 (r341743) @@ -59,6 +59,7 @@ static struct cpu_info { int enabled:1; int has_memory:1; int domain; + int id; } *cpus; static int max_cpus; @@ -182,14 +183,33 @@ overlaps_phys_avail(vm_paddr_t start, vm_paddr_t end) } /* - * Find CPU by processor ID (APIC ID on x86). + * On x86 we can use the cpuid to index the cpus array, but on arm64 + * we have an ACPI Processor UID with a larger range. + * + * Use this variable to indicate if the cpus can be stored by index. */ +#ifdef __aarch64__ +static const int cpus_use_indexing = 0; +#else +static const int cpus_use_indexing = 1; +#endif + +/* + * Find CPU by processor ID (APIC ID on x86, Processor UID on arm64) + */ static struct cpu_info * cpu_find(int cpuid) { + int i; - if (cpuid <= last_cpu && cpus[cpuid].enabled) - return (&cpus[cpuid]); + if (cpus_use_indexing) { + if (cpuid <= last_cpu && cpus[cpuid].enabled) + return (&cpus[cpuid]); + } else { + for (i = 0; i <= last_cpu; i++) + if (cpus[i].id == cpuid) + return (&cpus[i]); + } return (NULL); } @@ -202,10 +222,14 @@ cpu_get_info(struct pcpu *pc) struct cpu_info *cpup; int id; +#ifdef __aarch64__ + id = pc->pc_acpi_id; +#else id = pc->pc_apic_id; +#endif cpup = cpu_find(id); if (cpup == NULL) - panic("SRAT: CPU with APIC ID %u is not known", id); + panic("SRAT: CPU with ID %u is not known", id); return (cpup); } @@ -217,11 +241,18 @@ cpu_add(int cpuid, int domain) { struct cpu_info *cpup; - if (cpuid >= max_cpus) - return (NULL); - last_cpu = imax(last_cpu, cpuid); - cpup = &cpus[cpuid]; + if (cpus_use_indexing) { + if (cpuid >= max_cpus) + return (NULL); + last_cpu = imax(last_cpu, cpuid); + cpup = &cpus[cpuid]; + } else { + if (last_cpu >= max_cpus - 1) + return (NULL); + cpup = &cpus[++last_cpu]; + } cpup->domain = domain; + cpup->id = cpuid; cpup->enabled = 1; return (cpup); } @@ -232,6 +263,7 @@ srat_parse_entry(ACPI_SUBTABLE_HEADER *entry, void *ar ACPI_SRAT_CPU_AFFINITY *cpu; ACPI_SRAT_X2APIC_CPU_AFFINITY *x2apic; ACPI_SRAT_MEM_AFFINITY *mem; + ACPI_SRAT_GICC_AFFINITY *gicc; static struct cpu_info *cpup; int domain, i, slot; @@ -276,6 +308,22 @@ srat_parse_entry(ACPI_SUBTABLE_HEADER *entry, void *ar if (cpup == NULL) printf("SRAT: Ignoring local APIC ID %u (too high)\n", x2apic->ApicId); + break; + case ACPI_SRAT_TYPE_GICC_AFFINITY: + gicc = (ACPI_SRAT_GICC_AFFINITY *)entry; + if (bootverbose) + printf("SRAT: Found CPU UID %u domain %d: %s\n", + gicc->AcpiProcessorUid, gicc->ProximityDomain, + (gicc->Flags & ACPI_SRAT_GICC_ENABLED) ? + "enabled" : "disabled"); + if (!(gicc->Flags & ACPI_SRAT_GICC_ENABLED)) + break; + KASSERT(cpu_find(gicc->AcpiProcessorUid) == NULL, + ("Duplicate CPU UID %u", gicc->AcpiProcessorUid)); + cpup = cpu_add(gicc->AcpiProcessorUid, gicc->ProximityDomain); + if (cpup == NULL) + printf("SRAT: Ignoring CPU UID %u (too high)\n", + gicc->AcpiProcessorUid); break; case ACPI_SRAT_TYPE_MEMORY_AFFINITY: mem = (ACPI_SRAT_MEM_AFFINITY *)entry; From owner-svn-src-head@freebsd.org Sat Dec 8 19:38:57 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F3D461327606; Sat, 8 Dec 2018 19:38:56 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2B9968CF39; Sat, 8 Dec 2018 19:38:56 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id wB8JHrRX059013; Sat, 8 Dec 2018 11:17:53 -0800 (PST) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id wB8JHrJm059012; Sat, 8 Dec 2018 11:17:53 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201812081917.wB8JHrJm059012@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r341682 - head/sys/sys In-Reply-To: To: Mateusz Guzik Date: Sat, 8 Dec 2018 11:17:53 -0800 (PST) CC: Ian Lepore , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 2B9968CF39 X-Spamd-Result: default: False [2.04 / 15.00]; ARC_NA(0.00)[]; HAS_REPLYTO(0.00)[rgrimes@freebsd.org]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_SPAM_SHORT(0.34)[0.341,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[dnsmgr.net]; REPLYTO_DOM_NEQ_FROM_DOM(0.00)[]; AUTH_NA(1.00)[]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MX_GOOD(-0.01)[cached: pdx.rh.CN85.dnsmgr.net]; NEURAL_SPAM_LONG(0.06)[0.062,0]; NEURAL_SPAM_MEDIUM(0.77)[0.768,0]; R_SPF_NA(0.00)[]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:13868, ipnet:69.59.192.0/19, country:US]; MID_RHS_MATCH_FROM(0.00)[]; IP_SCORE(-0.02)[country: US(-0.09)] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 08 Dec 2018 19:38:57 -0000 > On 12/7/18, Ian Lepore wrote: > > On Fri, 2018-12-07 at 12:05 +0000, Mateusz Guzik wrote: > >> Author: mjg > >> Date: Fri Dec 7 12:05:11 2018 > >> New Revision: 341682 > >> URL: https://svnweb.freebsd.org/changeset/base/341682 > >> > >> Log: > >> unr64: use locked variant if not __LP64__ > >> > >> The current ifdefs are not sufficient to distinguish 32- and 64- > >> bit > >> variants, which results e.g. in powerpc64 not using atomics. > >> > >> While some 32-bit archs provide 64-bit atomics, there is no huge > >> advantage > >> of using them on these platforms. > >> > [..] > > This seems like a wholly unsatisfying solution compared to how trivial > > it would be to do something like have each arch's atomic.h set a symbol > > to indicate whether 64-bit atomics are available. Dismissing 32-bit > > arches because you don't perceive performance to be important there > > doesn't seem like a valid argument. > > > > But performance *is* improved on 32-bit architectures as well. > > Bitmap handling would try to very hard to reduce memory usage, which > had a lot of single-threaded overhead (e.g. it allocates memory just in > case and then frees it). Since 64-bit inode numbers can simply grow > there is no need for any of it and memory use is 64 bit to store the > variable. And that's what unr64 is doing. > > The main difference here is in scalability - taking a lock, bumping a > variable and releasing the lock scales much worse than an atomic > (which still scales poorly if heavily used). 32-bit arches don't really > have enough concurrency to see a difference with this code. All your high thread Intel and Amd CPU's can still run in 32bit with all those threads active, so you can get high concurrency on 32-bit arches. > > single-threaded this is indeed a little bit slower, but this is not > running in any hot path. > > Fully satisfying solution would be that all architectures get 64-bit > ops, even if in the worst case they end up taking a lock. Then > subsystems would not have to ifdef on anything. However, there > was some opposition to this proposal and I don't think this is > important enough to push. -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Sat Dec 8 19:42:02 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A049B1327883; Sat, 8 Dec 2018 19:42:02 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3D0CF8D1F2; Sat, 8 Dec 2018 19:42:02 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ED85E269B5; Sat, 8 Dec 2018 19:42:01 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB8Jg1eT021363; Sat, 8 Dec 2018 19:42:01 GMT (envelope-from jchandra@FreeBSD.org) Received: (from jchandra@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB8Jg10K021362; Sat, 8 Dec 2018 19:42:01 GMT (envelope-from jchandra@FreeBSD.org) Message-Id: <201812081942.wB8Jg10K021362@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jchandra set sender to jchandra@FreeBSD.org using -f From: "Jayachandran C." Date: Sat, 8 Dec 2018 19:42:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341744 - in head/sys/arm64: acpica arm64 X-SVN-Group: head X-SVN-Commit-Author: jchandra X-SVN-Commit-Paths: in head/sys/arm64: acpica arm64 X-SVN-Commit-Revision: 341744 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3D0CF8D1F2 X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_SHORT(-0.97)[-0.974,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.99)[-0.990,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 08 Dec 2018 19:42:02 -0000 Author: jchandra Date: Sat Dec 8 19:42:01 2018 New Revision: 341744 URL: https://svnweb.freebsd.org/changeset/base/341744 Log: arm64: add ACPI based NUMA support Use the newly defined SRAT/SLIT parsing APIs in arm64 to support ACPI based NUMA. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D17943 Modified: head/sys/arm64/acpica/acpi_machdep.c head/sys/arm64/arm64/mp_machdep.c Modified: head/sys/arm64/acpica/acpi_machdep.c ============================================================================== --- head/sys/arm64/acpica/acpi_machdep.c Sat Dec 8 19:32:23 2018 (r341743) +++ head/sys/arm64/acpica/acpi_machdep.c Sat Dec 8 19:42:01 2018 (r341744) @@ -233,3 +233,16 @@ acpi_map_addr(struct acpi_generic_address *addr, bus_s return (bus_space_map(*tag, phys, size, 0, handle)); } + +#if MAXMEMDOM > 1 +static void +parse_pxm_tables(void *dummy) +{ + + acpi_pxm_init(MAXCPU, (vm_paddr_t)1 << 40); + acpi_pxm_parse_tables(); + acpi_pxm_set_mem_locality(); +} +SYSINIT(parse_pxm_tables, SI_SUB_VM - 1, SI_ORDER_FIRST, parse_pxm_tables, + NULL); +#endif Modified: head/sys/arm64/arm64/mp_machdep.c ============================================================================== --- head/sys/arm64/arm64/mp_machdep.c Sat Dec 8 19:32:23 2018 (r341743) +++ head/sys/arm64/arm64/mp_machdep.c Sat Dec 8 19:42:01 2018 (r341744) @@ -442,13 +442,15 @@ madt_handler(ACPI_SUBTABLE_HEADER *entry, void *arg) { ACPI_MADT_GENERIC_INTERRUPT *intr; u_int *cpuid; + u_int id; switch(entry->Type) { case ACPI_MADT_TYPE_GENERIC_INTERRUPT: intr = (ACPI_MADT_GENERIC_INTERRUPT *)entry; cpuid = arg; - - start_cpu((*cpuid), intr->ArmMpidr); + id = *cpuid; + start_cpu(id, intr->ArmMpidr); + __pcpu[id].pc_acpi_id = intr->Uid; (*cpuid)++; break; default: @@ -478,6 +480,12 @@ cpu_init_acpi(void) madt_handler, &cpuid); acpi_unmap_table(madt); + +#if MAXMEMDOM > 1 + /* set proximity info */ + acpi_pxm_set_cpu_locality(); + acpi_pxm_free(); +#endif } #endif From owner-svn-src-head@freebsd.org Sat Dec 8 22:12:58 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D2643132ACF6; Sat, 8 Dec 2018 22:12:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 74ABE6B08E; Sat, 8 Dec 2018 22:12:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 55E7729B; Sat, 8 Dec 2018 22:12:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB8MCwFX000554; Sat, 8 Dec 2018 22:12:58 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB8MCwmC000553; Sat, 8 Dec 2018 22:12:58 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201812082212.wB8MCwmC000553@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 8 Dec 2018 22:12:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341746 - head/sys/i386/i386 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/i386/i386 X-SVN-Commit-Revision: 341746 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 74ABE6B08E X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_SHORT(-0.98)[-0.975,0]; NEURAL_HAM_LONG(-0.99)[-0.990,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 08 Dec 2018 22:12:59 -0000 Author: kib Date: Sat Dec 8 22:12:57 2018 New Revision: 341746 URL: https://svnweb.freebsd.org/changeset/base/341746 Log: Fix PAE boot. With the introduction of M_EXEC support for kmem_malloc(), some kernel mappings start having NX bit set in the paging structures early, for PAE kernels on machines with NX support, i.e. practically on all machines. In particular, AP trampoline and initialization needs to access pages which translations has NX bit set, before initializecpu() is called. Check for CPUID NX feature and enable EFER.NXE before we enable paging in mp boot trampoline. This allows the CPU to use the kernel page table instead of generating page fault due to reserved bit set. PR: 233819 Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/i386/i386/mpboot.s Modified: head/sys/i386/i386/mpboot.s ============================================================================== --- head/sys/i386/i386/mpboot.s Sat Dec 8 19:45:05 2018 (r341745) +++ head/sys/i386/i386/mpboot.s Sat Dec 8 22:12:57 2018 (r341746) @@ -99,6 +99,20 @@ NON_GPROF_ENTRY(MPentry) movl %cr4, %eax orl $CR4_PAE, %eax movl %eax, %cr4 + movl $0x80000000, %eax + cpuid + movl $0x80000001, %ebx + cmpl %ebx, %eax + jb 1f + movl %ebx, %eax + cpuid + testl $AMDID_NX, %edx + je 1f + movl $MSR_EFER, %ecx + rdmsr + orl $EFER_NXE,%eax + wrmsr +1: #else movl IdlePTD, %eax movl %eax,%cr3