From owner-svn-src-all@freebsd.org Sun Dec 2 00:41:44 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-all@freebsd.org Sun Dec 2 02:20:36 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-all@freebsd.org Sun Dec 2 03:03:58 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-all@freebsd.org Sun Dec 2 04:46:44 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C4963131036D for ; Sun, 2 Dec 2018 04:46:43 +0000 (UTC) (envelope-from henry@myownphrase.com) Received: from a2nlsmtp01-03.prod.iad2.secureserver.net (a2nlsmtp01-03.prod.iad2.secureserver.net [198.71.225.37]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "relay-hosting.secureserver.net", Issuer "Starfield Secure Certificate Authority - G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2358983DAF for ; Sun, 2 Dec 2018 04:46:43 +0000 (UTC) (envelope-from henry@myownphrase.com) Received: from a2plcpnl0712.prod.iad2.secureserver.net ([198.71.240.25]) by : HOSTING RELAY : with ESMTP id TIgHggy0JvsMITIgHgRHD5; Sat, 01 Dec 2018 20:44:29 -0700 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=myownphrase.com; s=default; h=Content-Transfer-Encoding:Content-Type: MIME-Version:Message-ID:Subject:Reply-To:From:To:Date:Sender:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=luqhWaXcEj3sWQK2g/DDow3UR4cwsAAYOw1ueW8zsck=; b=NXMuVY8LhlnaUaHAGHVKvzPA0+ ndw2LaeT2BKbyTHHHssxkA7gy67vUw6cPzYsAm7URrGUeiMaHjm8Ix43oOOhn1mMDuNSmgTsHGaCv 9hmulkUoxvSITmwxX1X0K8TzN/+qCLIkG/5OYyDj1ey8LhzpkesONTWMFsl5R8Ytz3js2ep1L8Z70 8XWgqpp/vrBUrRLYcsq3NfId3jahwbXAlridzeNQvryF4v8Gkyg80OiJIrRHL2TX+l/+KD7eZCHn2 wL3wM0OspQy/uh/SH+qygdYwA0/OsI60LAEA2TbCFtSKwlb1AYQRjPphzBe4K9Z7gOXD18OYWPTdu I0f+Nv4w==; Received: from [127.0.0.1] (port=59342 helo=myownphrase.com) by a2plcpnl0712.prod.iad2.secureserver.net with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.91) (envelope-from ) id 1gTIgH-005UxD-AP for svn-src-all@freebsd.org; Sat, 01 Dec 2018 20:44:29 -0700 Date: Sun, 2 Dec 2018 03:44:24 +0000 To: "svn-src-all@freebsd.org" From: "henry@myownphrase.com" Reply-To: "henry@myownphrase.com" Subject: Svn-src-all, The most user-friendly method to rank a website Message-ID: X-Mailer: PHPMailer 5.2.22 (https://github.com/PHPMailer/PHPMailer) MIME-Version: 1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - a2plcpnl0712.prod.iad2.secureserver.net X-AntiAbuse: Original Domain - freebsd.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - myownphrase.com X-Get-Message-Sender-Via: a2plcpnl0712.prod.iad2.secureserver.net: authenticated_id: henry@myownphrase.com X-Authenticated-Sender: a2plcpnl0712.prod.iad2.secureserver.net: henry@myownphrase.com X-Source: X-Source-Args: X-Source-Dir: X-CMAE-Envelope: MS4wfAt/TsYZFDl2pYkOky551a1wQL/jpyeMxyAMq+MRuyAfx4mioJ/gxaypB6hzRnLDXjxOojunoc++w/nAJlKzUEcJyY2tykUJEKmXNnOcC04Nk4qaqv5I FxfGY5X23/Vxy+NM5ouS4PQhFJ5nHw7yzAFh1eL+tawavQU3DGqnETNcWgEC6lpJJRTiIsE9cjCbat/G2CUoiPdkxbKAvPLJcpk= X-Rspamd-Queue-Id: 2358983DAF X-Spamd-Result: default: False [3.46 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; HAS_REPLYTO(0.00)[henry@myownphrase.com]; MX_INVALID(0.50)[cached]; HAS_X_SOURCE(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[myownphrase.com:~]; HAS_X_ANTIABUSE(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; IP_SCORE(0.34)[ip: (1.04), ipnet: 198.71.224.0/21(0.63), asn: 26496(0.13), country: US(-0.09)]; ASN(0.00)[asn:26496, ipnet:198.71.224.0/21, country:US]; MID_RHS_MATCH_FROM(0.00)[]; HAS_X_AS(0.00)[henry@myownphrase.com]; ARC_NA(0.00)[]; REPLYTO_EQ_FROM(0.00)[]; FROM_DN_EQ_ADDR(1.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_SPAM_SHORT(0.43)[0.433,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; HAS_PHPMAILER_SIG(0.00)[]; DMARC_NA(0.00)[myownphrase.com]; NEURAL_SPAM_MEDIUM(0.73)[0.730,0]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_SPAM_LONG(0.56)[0.559,0]; R_DKIM_PERMFAIL(0.00)[myownphrase.com]; R_SPF_NA(0.00)[]; TO_DN_EQ_ADDR_ALL(0.00)[]; HAS_X_GMSV(0.00)[henry@myownphrase.com]; RCVD_TLS_ALL(0.00)[] X-Rspamd-Server: mx1.freebsd.org Content-Type: text/plain; charset=us-ascii X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Dec 2018 04:46:44 -0000 Hi Svn-src-all, If the phrase you're trying to rank well for aren't competitive then getting good placement is pretty easy. Just follow our new technology and you will get the best of it. This technology can place your web page on top of search engines and keep it above your competitors during the whole year so that you can renew it every year just like domains. You can get more information about the technology from after visiting the website. You can fill online quote form or call. In meantime, you can see how it works in 3 easy steps: - Go to our website and click on DEMO button. - Type your website freebsd org and keyword in demo form. - Click on VIEW ONLINE DEMO and see results. Enjoy, Henry From owner-svn-src-all@freebsd.org Sun Dec 2 05:06:41 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-all@freebsd.org Sun Dec 2 07:39:18 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-all@freebsd.org Sun Dec 2 07:45:23 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B557E1313EEF; Sun, 2 Dec 2018 07:45:23 +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 582B588C32; Sun, 2 Dec 2018 07:45:23 +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 35E2323B60; Sun, 2 Dec 2018 07:45:23 +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 wB27jNc7029647; Sun, 2 Dec 2018 07:45:23 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB27jNUS029646; Sun, 2 Dec 2018 07:45:23 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201812020745.wB27jNUS029646@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:45:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r341394 - stable/11/libexec/rtld-elf/arm X-SVN-Group: stable-11 X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: stable/11/libexec/rtld-elf/arm X-SVN-Commit-Revision: 341394 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 582B588C32 X-Spamd-Result: default: False [0.36 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.12)[-0.124,0]; NEURAL_SPAM_LONG(0.01)[0.011,0]; NEURAL_SPAM_SHORT(0.47)[0.468,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Dec 2018 07:45:23 -0000 Author: mmel Date: Sun Dec 2 07:45:22 2018 New Revision: 341394 URL: https://svnweb.freebsd.org/changeset/base/341394 Log: MFC r338317: Fix wrong offset calculation for R_ARM_TLS_TPOFF32 relocations. TLS_TCB_SIZE is already accounted in defobj-> tlsoffset so all these symbols were incorrectly relocated by +8. Modified: stable/11/libexec/rtld-elf/arm/reloc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/libexec/rtld-elf/arm/reloc.c ============================================================================== --- stable/11/libexec/rtld-elf/arm/reloc.c Sun Dec 2 07:39:16 2018 (r341393) +++ stable/11/libexec/rtld-elf/arm/reloc.c Sun Dec 2 07:45:22 2018 (r341394) @@ -327,9 +327,7 @@ reloc_nonplt_object(Obj_Entry *obj, const Elf_Rel *rel if (!defobj->tls_done && allocate_tls_offset(obj)) return -1; - /* XXX: FIXME */ - tmp = (Elf_Addr)def->st_value + defobj->tlsoffset + - TLS_TCB_SIZE; + tmp = (Elf_Addr)def->st_value + defobj->tlsoffset; if (__predict_true(RELOC_ALIGNED_P(where))) *where = tmp; else From owner-svn-src-all@freebsd.org Sun Dec 2 12:35:50 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E3818131BB9E; Sun, 2 Dec 2018 12:35:49 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8A34A6ABA9; Sun, 2 Dec 2018 12:35:49 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 64B0626B51; Sun, 2 Dec 2018 12:35:49 +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 wB2CZnge084679; Sun, 2 Dec 2018 12:35:49 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB2CZnAT084678; Sun, 2 Dec 2018 12:35:49 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201812021235.wB2CZnAT084678@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:35:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341395 - stable/12/sys/vm X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/vm X-SVN-Commit-Revision: 341395 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8A34A6ABA9 X-Spamd-Result: default: False [0.15 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.12)[-0.124,0]; NEURAL_SPAM_SHORT(0.26)[0.261,0]; NEURAL_SPAM_LONG(0.01)[0.011,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Dec 2018 12:35:50 -0000 Author: kib Date: Sun Dec 2 12:35:48 2018 New Revision: 341395 URL: https://svnweb.freebsd.org/changeset/base/341395 Log: MFC r340922: Avoid unneeded check in vmspace_alloc(). Modified: stable/12/sys/vm/vm_map.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/vm/vm_map.c ============================================================================== --- stable/12/sys/vm/vm_map.c Sun Dec 2 07:45:22 2018 (r341394) +++ stable/12/sys/vm/vm_map.c Sun Dec 2 12:35:48 2018 (r341395) @@ -283,12 +283,7 @@ vmspace_alloc(vm_offset_t min, vm_offset_t max, pmap_p struct vmspace *vm; vm = uma_zalloc(vmspace_zone, M_WAITOK); - KASSERT(vm->vm_map.pmap == NULL, ("vm_map.pmap must be NULL")); - - if (pinit == NULL) - pinit = &pmap_pinit; - if (!pinit(vmspace_pmap(vm))) { uma_zfree(vmspace_zone, vm); return (NULL); @@ -3424,7 +3419,8 @@ vmspace_fork(struct vmspace *vm1, vm_ooffset_t *fork_c old_map = &vm1->vm_map; /* Copy immutable fields of vm1 to vm2. */ - vm2 = vmspace_alloc(vm_map_min(old_map), vm_map_max(old_map), NULL); + vm2 = vmspace_alloc(vm_map_min(old_map), vm_map_max(old_map), + pmap_pinit); if (vm2 == NULL) return (NULL); vm2->vm_taddr = vm1->vm_taddr; @@ -3975,7 +3971,7 @@ vmspace_exec(struct proc *p, vm_offset_t minuser, vm_o KASSERT((curthread->td_pflags & TDP_EXECVMSPC) == 0, ("vmspace_exec recursed")); - newvmspace = vmspace_alloc(minuser, maxuser, NULL); + newvmspace = vmspace_alloc(minuser, maxuser, pmap_pinit); if (newvmspace == NULL) return (ENOMEM); newvmspace->vm_swrss = oldvmspace->vm_swrss; From owner-svn-src-all@freebsd.org Sun Dec 2 12:51:50 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 635EA1321896; Sun, 2 Dec 2018 12:51:50 +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 F41506B809; Sun, 2 Dec 2018 12:51:49 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D680A26E86; Sun, 2 Dec 2018 12:51:49 +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 wB2CpnWr092822; Sun, 2 Dec 2018 12:51:49 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB2CpnBV092821; Sun, 2 Dec 2018 12:51:49 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201812021251.wB2CpnBV092821@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:51:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r341396 - stable/11/sys/vm X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/vm X-SVN-Commit-Revision: 341396 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: F41506B809 X-Spamd-Result: default: False [-0.23 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.12)[-0.124,0]; NEURAL_SPAM_LONG(0.01)[0.011,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_SHORT(-0.12)[-0.116,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Dec 2018 12:51:50 -0000 Author: kib Date: Sun Dec 2 12:51:49 2018 New Revision: 341396 URL: https://svnweb.freebsd.org/changeset/base/341396 Log: MFC r340922: Avoid unneeded check in vmspace_alloc(). Modified: stable/11/sys/vm/vm_map.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/vm_map.c ============================================================================== --- stable/11/sys/vm/vm_map.c Sun Dec 2 12:35:48 2018 (r341395) +++ stable/11/sys/vm/vm_map.c Sun Dec 2 12:51:49 2018 (r341396) @@ -278,12 +278,7 @@ vmspace_alloc(vm_offset_t min, vm_offset_t max, pmap_p struct vmspace *vm; vm = uma_zalloc(vmspace_zone, M_WAITOK); - KASSERT(vm->vm_map.pmap == NULL, ("vm_map.pmap must be NULL")); - - if (pinit == NULL) - pinit = &pmap_pinit; - if (!pinit(vmspace_pmap(vm))) { uma_zfree(vmspace_zone, vm); return (NULL); @@ -3367,7 +3362,8 @@ vmspace_fork(struct vmspace *vm1, vm_ooffset_t *fork_c old_map = &vm1->vm_map; /* Copy immutable fields of vm1 to vm2. */ - vm2 = vmspace_alloc(vm_map_min(old_map), vm_map_max(old_map), NULL); + vm2 = vmspace_alloc(vm_map_min(old_map), vm_map_max(old_map), + pmap_pinit); if (vm2 == NULL) return (NULL); vm2->vm_taddr = vm1->vm_taddr; @@ -3918,7 +3914,7 @@ vmspace_exec(struct proc *p, vm_offset_t minuser, vm_o KASSERT((curthread->td_pflags & TDP_EXECVMSPC) == 0, ("vmspace_exec recursed")); - newvmspace = vmspace_alloc(minuser, maxuser, NULL); + newvmspace = vmspace_alloc(minuser, maxuser, pmap_pinit); if (newvmspace == NULL) return (ENOMEM); newvmspace->vm_swrss = oldvmspace->vm_swrss; From owner-svn-src-all@freebsd.org Sun Dec 2 12:53:40 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-all@freebsd.org Sun Dec 2 13:16:48 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-all@freebsd.org Sun Dec 2 13:27:37 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-all@freebsd.org Sun Dec 2 13:29:14 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-all@freebsd.org Sun Dec 2 18:08:28 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 489EF1329867; Sun, 2 Dec 2018 18:08:28 +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 E4D7B77420; Sun, 2 Dec 2018 18:08:27 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C4EC022A4; Sun, 2 Dec 2018 18:08:27 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB2I8R77077375; Sun, 2 Dec 2018 18:08:27 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB2I8RGv077374; Sun, 2 Dec 2018 18:08:27 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201812021808.wB2I8RGv077374@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 2 Dec 2018 18:08:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r341401 - stable/11/sys/vm X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/sys/vm X-SVN-Commit-Revision: 341401 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E4D7B77420 X-Spamd-Result: default: False [0.16 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.12)[-0.124,0]; NEURAL_SPAM_LONG(0.01)[0.011,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_SPAM_SHORT(0.28)[0.276,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Dec 2018 18:08:28 -0000 Author: markj Date: Sun Dec 2 18:08:27 2018 New Revision: 341401 URL: https://svnweb.freebsd.org/changeset/base/341401 Log: MFC r341247: Update the free page count when blacklisting pages. PR: 231296 Modified: stable/11/sys/vm/vm_page.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/vm_page.c ============================================================================== --- stable/11/sys/vm/vm_page.c Sun Dec 2 13:29:13 2018 (r341400) +++ stable/11/sys/vm/vm_page.c Sun Dec 2 18:08:27 2018 (r341401) @@ -304,8 +304,10 @@ vm_page_blacklist_add(vm_paddr_t pa, bool verbose) mtx_lock(&vm_page_queue_free_mtx); ret = vm_phys_unfree_page(m); + if (ret != 0) + vm_phys_freecnt_adj(m, -1); mtx_unlock(&vm_page_queue_free_mtx); - if (ret) { + if (ret != 0) { TAILQ_INSERT_TAIL(&blacklist_head, m, listq); if (verbose) printf("Skipping page with pa 0x%jx\n", (uintmax_t)pa); From owner-svn-src-all@freebsd.org Sun Dec 2 18:31:00 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-all@freebsd.org Sun Dec 2 19:08:52 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A4FAF132AF74; Sun, 2 Dec 2018 19:08:52 +0000 (UTC) (envelope-from ygy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BA02794FB; Sun, 2 Dec 2018 19:08:52 +0000 (UTC) (envelope-from ygy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2B1FC2C99; Sun, 2 Dec 2018 19:08:52 +0000 (UTC) (envelope-from ygy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB2J8qJM008335; Sun, 2 Dec 2018 19:08:52 GMT (envelope-from ygy@FreeBSD.org) Received: (from ygy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB2J8qOZ008334; Sun, 2 Dec 2018 19:08:52 GMT (envelope-from ygy@FreeBSD.org) Message-Id: <201812021908.wB2J8qOZ008334@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ygy set sender to ygy@FreeBSD.org using -f From: Guangyuan Yang Date: Sun, 2 Dec 2018 19:08:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341403 - stable/12/stand/i386/pxeldr X-SVN-Group: stable-12 X-SVN-Commit-Author: ygy X-SVN-Commit-Paths: stable/12/stand/i386/pxeldr X-SVN-Commit-Revision: 341403 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4BA02794FB X-Spamd-Result: default: False [0.24 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.12)[-0.124,0]; NEURAL_SPAM_LONG(0.01)[0.011,0]; NEURAL_SPAM_SHORT(0.35)[0.348,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Dec 2018 19:08:52 -0000 Author: ygy (doc committer) Date: Sun Dec 2 19:08:51 2018 New Revision: 341403 URL: https://svnweb.freebsd.org/changeset/base/341403 Log: MFC r340917, r341007 r340917: Update pxeboot(8) manual page to reflect the next-server change in the ISC DHCP v3 server. r341007: Bump the date of pxeboot(8) manual page for r340917. PR: 123484 Submitted by: edwin@mavetju.org Reviewed by: AllanJude Modified: stable/12/stand/i386/pxeldr/pxeboot.8 Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/i386/pxeldr/pxeboot.8 ============================================================================== --- stable/12/stand/i386/pxeldr/pxeboot.8 Sun Dec 2 18:30:58 2018 (r341402) +++ stable/12/stand/i386/pxeldr/pxeboot.8 Sun Dec 2 19:08:51 2018 (r341403) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 27, 2017 +.Dd November 25, 2018 .Dt PXEBOOT 8 .Os .Sh NAME @@ -58,7 +58,7 @@ The .Nm binary is loaded just like any other boot file, by specifying it in the DHCP server's configuration file. -Below is a sample configuration for the ISC DHCP v2 server: +Below is a sample configuration for the ISC DHCP v3 server: .Bd -literal -offset indent option domain-name "example.com"; option routers 10.0.0.1; @@ -67,6 +67,7 @@ option broadcast-address 10.0.0.255; option domain-name-servers 10.0.0.1; server-name "DHCPserver"; server-identifier 10.0.0.1; +next-server 10.0.0.1; default-lease-time 120; max-lease-time 120; @@ -80,10 +81,11 @@ subnet 10.0.0.0 netmask 255.255.255.0 { } .Ed +.Va next-server +is the IP address of the next server in the bootstrap process, i.e. +your TFTP server or NFS server. .Nm recognizes -.Va next-server -and .Va option root-path directives as the server and path to NFS mount for file requests, respectively, or the server to make TFTP requests to. From owner-svn-src-all@freebsd.org Sun Dec 2 19:35:23 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-all@freebsd.org Sun Dec 2 19:36:21 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-all@freebsd.org Sun Dec 2 21:58:37 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-all@freebsd.org Sun Dec 2 23:10:59 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-all@freebsd.org Sun Dec 2 23:12:17 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-all@freebsd.org Sun Dec 2 23:12:30 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-all@freebsd.org Sun Dec 2 23:12:40 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-all@freebsd.org Sun Dec 2 23:13:20 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-all@freebsd.org Sun Dec 2 23:12:51 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-all@freebsd.org Sun Dec 2 23:13:02 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-all@freebsd.org Sun Dec 2 23:13:29 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-all@freebsd.org Sun Dec 2 23:13:42 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-all@freebsd.org Sun Dec 2 23:13:52 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-all@freebsd.org Mon Dec 3 02:32:40 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D47F313124F1; Mon, 3 Dec 2018 02:32:40 +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 7A8676C565; Mon, 3 Dec 2018 02:32:40 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5BE397B84; Mon, 3 Dec 2018 02:32:40 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB32Wefe040023; Mon, 3 Dec 2018 02:32:40 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB32WeGA040022; Mon, 3 Dec 2018 02:32:40 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201812030232.wB32WeGA040022@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 02:32:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341417 - stable/12/tools/test/sort/bigtest X-SVN-Group: stable-12 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/12/tools/test/sort/bigtest X-SVN-Commit-Revision: 341417 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7A8676C565 X-Spamd-Result: default: False [0.40 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.12)[-0.124,0]; NEURAL_SPAM_LONG(0.01)[0.011,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_SPAM_SHORT(0.51)[0.508,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Dec 2018 02:32:41 -0000 Author: emaste Date: Mon Dec 3 02:32:39 2018 New Revision: 341417 URL: https://svnweb.freebsd.org/changeset/base/341417 Log: MFC r340095: Remove apparently unused 0-byte files that cause grief on Windows r235274 added a sort regression test (it operates by comparing output against GNU sort). The commit included a number of 0-byte files, one of which ends in a trailing . which reportedly breaks svn/git checkouts on Windows. It appears these were added accidentally, so just remove them. PR: 232479 Deleted: stable/12/tools/test/sort/bigtest/q-1.022.tgz stable/12/tools/test/sort/bigtest/q-1.024.003. stable/12/tools/test/sort/bigtest/q-1.024.003.tgz stable/12/tools/test/sort/bigtest/q-1.024.009.tgz stable/12/tools/test/sort/bigtest/q-1.024.07.tgz stable/12/tools/test/sort/bigtest/q-1.024.tgz stable/12/tools/test/sort/bigtest/q-1.23.1.tgz stable/12/tools/test/sort/bigtest/q-1.23.tgz Modified: Directory Properties: stable/12/ (props changed) From owner-svn-src-all@freebsd.org Mon Dec 3 02:33:54 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5497C13125BF; Mon, 3 Dec 2018 02:33:54 +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 E8E466C6F2; Mon, 3 Dec 2018 02:33: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 C9E8D7B88; Mon, 3 Dec 2018 02:33:53 +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 wB32Xr3l040155; Mon, 3 Dec 2018 02:33:53 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB32XrHf040154; Mon, 3 Dec 2018 02:33:53 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201812030233.wB32XrHf040154@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 02:33:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r341418 - stable/11/tools/test/sort/bigtest X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/tools/test/sort/bigtest X-SVN-Commit-Revision: 341418 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E8E466C6F2 X-Spamd-Result: default: False [0.40 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.12)[-0.124,0]; NEURAL_SPAM_LONG(0.01)[0.011,0]; NEURAL_SPAM_SHORT(0.51)[0.508,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Dec 2018 02:33:54 -0000 Author: emaste Date: Mon Dec 3 02:33:53 2018 New Revision: 341418 URL: https://svnweb.freebsd.org/changeset/base/341418 Log: MFC r340095: Remove apparently unused 0-byte files that cause grief on Windows r235274 added a sort regression test (it operates by comparing output against GNU sort). The commit included a number of 0-byte files, one of which ends in a trailing . which reportedly breaks svn/git checkouts on Windows. It appears these were added accidentally, so just remove them. PR: 232479 Deleted: stable/11/tools/test/sort/bigtest/q-1.022.tgz stable/11/tools/test/sort/bigtest/q-1.024.003. stable/11/tools/test/sort/bigtest/q-1.024.003.tgz stable/11/tools/test/sort/bigtest/q-1.024.009.tgz stable/11/tools/test/sort/bigtest/q-1.024.07.tgz stable/11/tools/test/sort/bigtest/q-1.024.tgz stable/11/tools/test/sort/bigtest/q-1.23.1.tgz stable/11/tools/test/sort/bigtest/q-1.23.tgz Modified: Directory Properties: stable/11/ (props changed) From owner-svn-src-all@freebsd.org Mon Dec 3 02:38:16 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 575C71312776; Mon, 3 Dec 2018 02:38:16 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F23416C9E4; Mon, 3 Dec 2018 02:38: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 D333D7B90; Mon, 3 Dec 2018 02:38: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 wB32cFud040400; Mon, 3 Dec 2018 02:38:15 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB32cFoa040399; Mon, 3 Dec 2018 02:38:15 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201812030238.wB32cFoa040399@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 02:38:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r341419 - stable/10/tools/test/sort/bigtest X-SVN-Group: stable-10 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/10/tools/test/sort/bigtest X-SVN-Commit-Revision: 341419 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: F23416C9E4 X-Spamd-Result: default: False [0.40 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.12)[-0.124,0]; NEURAL_SPAM_LONG(0.01)[0.011,0]; NEURAL_SPAM_SHORT(0.51)[0.508,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Dec 2018 02:38:16 -0000 Author: emaste Date: Mon Dec 3 02:38:15 2018 New Revision: 341419 URL: https://svnweb.freebsd.org/changeset/base/341419 Log: MFC r340095: Remove apparently unused 0-byte files that cause grief on Windows r235274 added a sort regression test (it operates by comparing output against GNU sort). The commit included a number of 0-byte files, one of which ends in a trailing . which reportedly breaks svn/git checkouts on Windows. It appears these were added accidentally, so just remove them. PR: 232479 Deleted: stable/10/tools/test/sort/bigtest/q-1.022.tgz stable/10/tools/test/sort/bigtest/q-1.024.003. stable/10/tools/test/sort/bigtest/q-1.024.003.tgz stable/10/tools/test/sort/bigtest/q-1.024.009.tgz stable/10/tools/test/sort/bigtest/q-1.024.07.tgz stable/10/tools/test/sort/bigtest/q-1.024.tgz stable/10/tools/test/sort/bigtest/q-1.23.1.tgz stable/10/tools/test/sort/bigtest/q-1.23.tgz Modified: Directory Properties: stable/10/ (props changed) From owner-svn-src-all@freebsd.org Mon Dec 3 03:32:59 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Dec 3 03:58:32 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Dec 3 04:07:20 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 79FAC1314A62; Mon, 3 Dec 2018 04:07:20 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1E3DE6FAF5; Mon, 3 Dec 2018 04:07:20 +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 ECF4F10B29; Mon, 3 Dec 2018 04:07:19 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB347JIb086698; Mon, 3 Dec 2018 04:07:19 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB347J9g086694; Mon, 3 Dec 2018 04:07:19 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201812030407.wB347J9g086694@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 04:07:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341421 - in stable/12/stand/i386: common gptboot zfsboot X-SVN-Group: stable-12 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in stable/12/stand/i386: common gptboot zfsboot X-SVN-Commit-Revision: 341421 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1E3DE6FAF5 X-Spamd-Result: default: False [0.41 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.06)[-0.058,0]; NEURAL_SPAM_SHORT(0.41)[0.407,0]; NEURAL_SPAM_LONG(0.06)[0.057,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Dec 2018 04:07:20 -0000 Author: ian Date: Mon Dec 3 04:07:18 2018 New Revision: 341421 URL: https://svnweb.freebsd.org/changeset/base/341421 Log: MFC r341071, r341160 r341071: Restore the ability to override the disk unit/partition at the boot: prompt in gptboot. When arch-independent geli support was added, a new static 'gdsk' struct was added, but there was still a static 'dsk' struct, and when you typed in an alternate disk/partition, the string was parsed into that struct, which was then never used for anything. Now the string gets parsed into gdsk.dsk, the struct that's actually used. r341160: Add comments describing the bootargs handoff between loader(8) and gptboot or zfsboot, when loader(8) is the BTX loader. No functional changes. Modified: stable/12/stand/i386/common/bootargs.h stable/12/stand/i386/gptboot/gptboot.c stable/12/stand/i386/zfsboot/zfsboot.c Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/i386/common/bootargs.h ============================================================================== --- stable/12/stand/i386/common/bootargs.h Mon Dec 3 03:58:30 2018 (r341420) +++ stable/12/stand/i386/common/bootargs.h Mon Dec 3 04:07:18 2018 (r341421) @@ -43,6 +43,24 @@ #ifndef __ASSEMBLER__ +/* + * This struct describes the contents of the stack on entry to btxldr.S. This + * is the data that follows the return address, so it begins at 4(%esp). On + * the sending side, this data is passed as individual args to __exec(). On the + * receiving side, code in btxldr.S copies the data from the entry stack to a + * known fixed location in the new address space. Then, btxcsu.S sets the + * global variable __args to point to that known fixed location before calling + * main(), which casts __args to a struct bootargs pointer to access the data. + * The btxldr.S code is aware of KARGS_FLAGS_EXTARG, and if it's set, the extra + * args data is copied along with the other bootargs from the entry stack to the + * fixed location in the new address space. + * + * The bootinfo field is actually a pointer to a bootinfo struct that has been + * converted to uint32_t using VTOP(). On the receiving side it must be + * converted back to a pointer using PTOV(). Code in btxldr.S is aware of this + * field and if it's non-NULL it copies the data it points to into another known + * fixed location, and adjusts the bootinfo field to point to that new location. + */ struct bootargs { uint32_t howto; Modified: stable/12/stand/i386/gptboot/gptboot.c ============================================================================== --- stable/12/stand/i386/gptboot/gptboot.c Mon Dec 3 03:58:30 2018 (r341420) +++ stable/12/stand/i386/gptboot/gptboot.c Mon Dec 3 04:07:18 2018 (r341421) @@ -81,7 +81,6 @@ uint32_t opts; static const char *const dev_nm[NDEV] = {"ad", "da", "fd"}; static const unsigned char dev_maj[NDEV] = {30, 4, 2}; -static struct dsk dsk; static char kname[1024]; static int comspeed = SIOSPD; static struct bootinfo bootinfo; @@ -488,6 +487,12 @@ load(void) geliargs.keybuf_sentinel = KEYBUF_SENTINEL; geliargs.keybuf = gelibuf; #endif + /* + * Note that the geliargs struct is passed by value, not by pointer. + * Code in btxldr.S copies the values from the entry stack to a fixed + * location within loader(8) at startup due to the presence of the + * KARGS_FLAGS_EXTARG flag. + */ __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 @@ -569,22 +574,22 @@ parse_cmds(char *cmdstr, int *dskupdated) arg[1] != dev_nm[i][1]; i++) if (i == NDEV - 1) return (-1); - dsk.type = i; + gdsk.dsk.type = i; arg += 3; - dsk.unit = *arg - '0'; - if (arg[1] != 'p' || dsk.unit > 9) + gdsk.dsk.unit = *arg - '0'; + if (arg[1] != 'p' || gdsk.dsk.unit > 9) return (-1); arg += 2; - dsk.part = *arg - '0'; - if (dsk.part < 1 || dsk.part > 9) + gdsk.dsk.part = *arg - '0'; + if (gdsk.dsk.part < 1 || gdsk.dsk.part > 9) return (-1); arg++; if (arg[0] != ')') return (-1); arg++; if (drv == -1) - drv = dsk.unit; - dsk.drive = (dsk.type <= TYPE_MAXHARD + drv = gdsk.dsk.unit; + gdsk.dsk.drive = (gdsk.dsk.type <= TYPE_MAXHARD ? DRV_HARD : 0) + drv; *dskupdated = 1; } Modified: stable/12/stand/i386/zfsboot/zfsboot.c ============================================================================== --- stable/12/stand/i386/zfsboot/zfsboot.c Mon Dec 3 03:58:30 2018 (r341420) +++ stable/12/stand/i386/zfsboot/zfsboot.c Mon Dec 3 04:07:18 2018 (r341421) @@ -1005,6 +1005,11 @@ load(void) zfsargs.primary_vdev = primary_vdev->v_guid; else printf("failed to detect primary vdev\n"); + /* + * Note that the zfsargs struct is passed by value, not by pointer. Code in + * btxldr.S copies the values from the entry stack to a fixed location + * within loader(8) at startup due to the presence of KARGS_FLAGS_EXTARG. + */ __exec((caddr_t)addr, RB_BOOTINFO | (opts & RBX_MASK), bootdev, KARGS_FLAGS_ZFS | KARGS_FLAGS_EXTARG, From owner-svn-src-all@freebsd.org Mon Dec 3 04:47:29 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Dec 3 04:49:44 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Dec 3 04:56:07 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Dec 3 06:09:50 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Dec 3 09:40:38 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Dec 3 09:44:03 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Dec 3 12:55:54 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Dec 3 13:15:56 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Dec 3 13:17:14 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Dec 3 15:14:42 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E82BE132A072; Mon, 3 Dec 2018 15:14: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 8444A85E74; Mon, 3 Dec 2018 15:14:41 +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 66A7917AA7; Mon, 3 Dec 2018 15:14:41 +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 wB3FEf5t030583; Mon, 3 Dec 2018 15:14:41 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB3FEfmb030582; Mon, 3 Dec 2018 15:14:41 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201812031514.wB3FEfmb030582@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 15:14:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341426 - stable/12/sys/dev/cxgbe/cxgbei X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/dev/cxgbe/cxgbei X-SVN-Commit-Revision: 341426 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8444A85E74 X-Spamd-Result: default: False [-0.28 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.41)[-0.406,0]; NEURAL_SPAM_LONG(0.01)[0.011,0]; NEURAL_SPAM_SHORT(0.11)[0.113,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Dec 2018 15:14:42 -0000 Author: markj Date: Mon Dec 3 15:14:40 2018 New Revision: 341426 URL: https://svnweb.freebsd.org/changeset/base/341426 Log: MFC r341001: Check for an allocation failure before dereferencing the pointer. Modified: stable/12/sys/dev/cxgbe/cxgbei/cxgbei.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/cxgbe/cxgbei/cxgbei.c ============================================================================== --- stable/12/sys/dev/cxgbe/cxgbei/cxgbei.c Mon Dec 3 13:15:54 2018 (r341425) +++ stable/12/sys/dev/cxgbe/cxgbei/cxgbei.c Mon Dec 3 15:14:40 2018 (r341426) @@ -449,9 +449,9 @@ do_rx_iscsi_ddp(struct sge_iq *iq, const struct rss_he struct icl_pdu *ip0; ip0 = icl_cxgbei_new_pdu(M_NOWAIT); - icl_cxgbei_new_pdu_set_conn(ip0, ic); if (ip0 == NULL) CXGBE_UNIMPLEMENTED("PDU allocation failure"); + icl_cxgbei_new_pdu_set_conn(ip0, ic); icp0 = ip_to_icp(ip0); icp0->icp_seq = 0; /* XXX */ icp0->icp_flags = ICPF_RX_HDR | ICPF_RX_STATUS; From owner-svn-src-all@freebsd.org Mon Dec 3 15:18:36 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6F744132A20D; Mon, 3 Dec 2018 15:18:36 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DF55A8613A; Mon, 3 Dec 2018 15:18:35 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BC2AA17AA8; Mon, 3 Dec 2018 15:18:35 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB3FIZFi030808; Mon, 3 Dec 2018 15:18:35 GMT (envelope-from shurd@FreeBSD.org) Received: (from shurd@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB3FIZXh030806; Mon, 3 Dec 2018 15:18:35 GMT (envelope-from shurd@FreeBSD.org) Message-Id: <201812031518.wB3FIZXh030806@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: shurd set sender to shurd@FreeBSD.org using -f From: Stephen Hurd Date: Mon, 3 Dec 2018 15:18:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341427 - in stable/12/sys/dev: ixgbe ixl X-SVN-Group: stable-12 X-SVN-Commit-Author: shurd X-SVN-Commit-Paths: in stable/12/sys/dev: ixgbe ixl X-SVN-Commit-Revision: 341427 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: DF55A8613A X-Spamd-Result: default: False [-0.28 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.41)[-0.406,0]; NEURAL_SPAM_LONG(0.01)[0.011,0]; NEURAL_SPAM_SHORT(0.11)[0.113,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Dec 2018 15:18:36 -0000 Author: shurd Date: Mon Dec 3 15:18:35 2018 New Revision: 341427 URL: https://svnweb.freebsd.org/changeset/base/341427 Log: MFC r341156: Fix first-packet completion The first packet after the ring is initialized was never completed as isc_txd_credits_update() would not include it in the count of completed packets. This caused netmap to never complete a batch. See PR 233022 for more details. This is the same fix as the r340310 for e1000 PR: 233607 Reported by: lev Reviewed by: lev Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D18368 Modified: stable/12/sys/dev/ixgbe/ix_txrx.c stable/12/sys/dev/ixl/ixl_txrx.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ixgbe/ix_txrx.c ============================================================================== --- stable/12/sys/dev/ixgbe/ix_txrx.c Mon Dec 3 15:14:40 2018 (r341426) +++ stable/12/sys/dev/ixgbe/ix_txrx.c Mon Dec 3 15:18:35 2018 (r341427) @@ -297,6 +297,8 @@ ixgbe_isc_txd_credits_update(void *arg, uint16_t txqid ntxd = scctx->isc_ntxd[0]; do { delta = (int32_t)cur - (int32_t)prev; + if (prev == 0 && cur == 0) + delta += 1; if (delta < 0) delta += ntxd; Modified: stable/12/sys/dev/ixl/ixl_txrx.c ============================================================================== --- stable/12/sys/dev/ixl/ixl_txrx.c Mon Dec 3 15:14:40 2018 (r341426) +++ stable/12/sys/dev/ixl/ixl_txrx.c Mon Dec 3 15:18:35 2018 (r341427) @@ -516,7 +516,13 @@ ixl_isc_txd_credits_update_dwb(void *arg, uint16_t txq ntxd = scctx->isc_ntxd[0]; do { delta = (int32_t)cur - (int32_t)prev; + /* + * XXX This appears to be a hack for first-packet. + * A correct fix would prevent prev == cur in the first place. + */ MPASS(prev == 0 || delta != 0); + if (prev == 0 && cur == 0) + delta += 1; if (delta < 0) delta += ntxd; #if 0 From owner-svn-src-all@freebsd.org Mon Dec 3 15:25:41 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8098E132A4AA; Mon, 3 Dec 2018 15:25:41 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 235DE86639; Mon, 3 Dec 2018 15:25:41 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 038F317C4C; Mon, 3 Dec 2018 15:25:41 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB3FPetu035857; Mon, 3 Dec 2018 15:25:40 GMT (envelope-from gnn@FreeBSD.org) Received: (from gnn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB3FPecp035856; Mon, 3 Dec 2018 15:25:40 GMT (envelope-from gnn@FreeBSD.org) Message-Id: <201812031525.wB3FPecp035856@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gnn set sender to gnn@FreeBSD.org using -f From: "George V. Neville-Neil" Date: Mon, 3 Dec 2018 15:25:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org Subject: svn commit: r341428 - svnadmin/conf X-SVN-Group: svnadmin X-SVN-Commit-Author: gnn X-SVN-Commit-Paths: svnadmin/conf X-SVN-Commit-Revision: 341428 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 235DE86639 X-Spamd-Result: default: False [-0.33 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.41)[-0.413,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_SPAM_SHORT(0.12)[0.124,0]; NEURAL_HAM_LONG(-0.04)[-0.041,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Dec 2018 15:25:41 -0000 Author: gnn Date: Mon Dec 3 15:25:40 2018 New Revision: 341428 URL: https://svnweb.freebsd.org/changeset/base/341428 Log: Free Vincenzo Maffione from mentorship Modified: svnadmin/conf/mentors Modified: svnadmin/conf/mentors ============================================================================== --- svnadmin/conf/mentors Mon Dec 3 15:18:35 2018 (r341427) +++ svnadmin/conf/mentors Mon Dec 3 15:25:40 2018 (r341428) @@ -35,5 +35,4 @@ slavash kib Co-mentor: hselasky slm ken Co-mentor: scottl, ambrisko thj jtl tmunro mjg Co-mentor: allanjude -vmaffione hrs Co-mentor: gnn wosch cem From owner-svn-src-all@freebsd.org Mon Dec 3 15:59:47 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Dec 3 16:14:28 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Dec 3 16:21:48 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Dec 3 17:18:01 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Dec 3 17:40:56 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 463DA132DB7B; Mon, 3 Dec 2018 17:40:56 +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 E19E48C03C; Mon, 3 Dec 2018 17:40:55 +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 C361519292; Mon, 3 Dec 2018 17:40:55 +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 wB3HetDr003391; Mon, 3 Dec 2018 17:40:55 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB3Het71003388; Mon, 3 Dec 2018 17:40:55 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201812031740.wB3Het71003388@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:40:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r341431 - in stable/11: share/man/man4 tools/tools/netmap X-SVN-Group: stable-11 X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: in stable/11: share/man/man4 tools/tools/netmap X-SVN-Commit-Revision: 341431 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E19E48C03C X-Spamd-Result: default: False [-0.29 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.33)[-0.331,0]; NEURAL_SPAM_LONG(0.10)[0.102,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_SHORT(-0.06)[-0.060,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Dec 2018 17:40:56 -0000 Author: vmaffione Date: Mon Dec 3 17:40:54 2018 New Revision: 341431 URL: https://svnweb.freebsd.org/changeset/base/341431 Log: MFC r339659 netmap: add man page for the bridge program Added bridge(8). Also, minor fixes to the netmap "bridge" application: - indentation fixes and code cleanup - better usage description - better processing of netmap flags Reviewed by: 0mp Approved by: gnn (mentor) Differential Revision: https://reviews.freebsd.org/D17664 Added: stable/11/tools/tools/netmap/bridge.8 - copied unchanged from r339659, head/tools/tools/netmap/bridge.8 Modified: stable/11/share/man/man4/netmap.4 stable/11/tools/tools/netmap/bridge.c stable/11/tools/tools/netmap/pkt-gen.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/netmap.4 ============================================================================== --- stable/11/share/man/man4/netmap.4 Mon Dec 3 17:17:59 2018 (r341430) +++ stable/11/share/man/man4/netmap.4 Mon Dec 3 17:40:54 2018 (r341431) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 14, 2015 +.Dd October 23, 2018 .Dt NETMAP 4 .Os .Sh NAME @@ -1026,6 +1026,9 @@ Other clients attached to the same switch can now communicate with the network card or the host. .Sh SEE ALSO +.Xr pkt-gen 8 , +.Xr bridge 8 +.Pp .Pa http://info.iet.unipi.it/~luigi/netmap/ .Pp Luigi Rizzo, Revisiting network I/O APIs: the netmap framework, Copied: stable/11/tools/tools/netmap/bridge.8 (from r339659, head/tools/tools/netmap/bridge.8) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/tools/tools/netmap/bridge.8 Mon Dec 3 17:40:54 2018 (r341431, copy of r339659, head/tools/tools/netmap/bridge.8) @@ -0,0 +1,82 @@ +.\" Copyright (c) 2016 Luigi Rizzo, Universita` di Pisa +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd October 23, 2018 +.Dt BRIDGE 8 +.Os +.Sh NAME +.Nm bridge +.Nd netmap client to bridge two netmap ports +.Sh SYNOPSIS +.Bk -words +.Bl -tag -width "bridge" +.It Nm +.Op Fl i Ar port +.Op Fl b Ar batch size +.Op Fl w Ar wait-link +.Op Fl v +.Op Fl c +.El +.Ek +.Sh DESCRIPTION +.Nm +is a simple netmap application that bridges packets between two netmap ports. +If the two netmap ports use the same netmap memory region +.Nm +forwards packets without copying the packets payload (zero-copy mode), unless +explicitly prevented by the +.Fl c +flag. +.Bl -tag -width Ds +.It Fl i Ar port +Name of the netmap port. +It can be supplied up to two times to identify the ports that must be bridged. +Any netmap port type (physical interface, VALE switch, pipe, monitor port...) +can be used. +If the option is supplied only once, then it must be for a physical interface and, in that case, +.Nm +will bridge the port and the host stack. +.It Fl b Ar batch-size +Maximum number of packets to send in one operation. +.It Fl w Ar wait-link +indicates the number of seconds to wait before transmitting. +It defaults to 2, and may be useful when talking to physical +ports to let link negotiation complete before starting transmission. +.It Fl v +Enable verbose mode +.It Fl c +Disable zero-copy mode. +.El +.Sh SEE ALSO +.Xr netmap 4 , +.Xr pkt-gen 8 +.Sh AUTHORS +.An -nosplit +.Nm +has been written by +.An Luigi Rizzo +and +.An Matteo Landi +at the Universita` di Pisa, Italy. Modified: stable/11/tools/tools/netmap/bridge.c ============================================================================== --- stable/11/tools/tools/netmap/bridge.c Mon Dec 3 17:17:59 2018 (r341430) +++ stable/11/tools/tools/netmap/bridge.c Mon Dec 3 17:40:54 2018 (r341431) @@ -34,18 +34,18 @@ sigint_h(int sig) int pkt_queued(struct nm_desc *d, int tx) { - u_int i, tot = 0; + u_int i, tot = 0; - if (tx) { - for (i = d->first_tx_ring; i <= d->last_tx_ring; i++) { - tot += nm_ring_space(NETMAP_TXRING(d->nifp, i)); - } - } else { - for (i = d->first_rx_ring; i <= d->last_rx_ring; i++) { - tot += nm_ring_space(NETMAP_RXRING(d->nifp, i)); - } - } - return tot; + if (tx) { + for (i = d->first_tx_ring; i <= d->last_tx_ring; i++) { + tot += nm_ring_space(NETMAP_TXRING(d->nifp, i)); + } + } else { + for (i = d->first_rx_ring; i <= d->last_rx_ring; i++) { + tot += nm_ring_space(NETMAP_RXRING(d->nifp, i)); + } + } + return tot; } /* @@ -76,13 +76,13 @@ process_rings(struct netmap_ring *rxring, struct netma /* swap packets */ if (ts->buf_idx < 2 || rs->buf_idx < 2) { - D("wrong index rx[%d] = %d -> tx[%d] = %d", + RD(5, "wrong index rx[%d] = %d -> tx[%d] = %d", j, rs->buf_idx, k, ts->buf_idx); sleep(2); } /* copy the packet length. */ - if (rs->len > 2048) { - D("wrong len %d rx[%d] -> tx[%d]", rs->len, j, k); + if (rs->len > rxring->nr_buf_size) { + RD(5, "wrong len %d rx[%d] -> tx[%d]", rs->len, j, k); rs->len = 0; } else if (verbose > 1) { D("%s send len %d rx[%d] -> tx[%d]", msg, rs->len, j, k); @@ -95,6 +95,8 @@ process_rings(struct netmap_ring *rxring, struct netma /* report the buffer change. */ ts->flags |= NS_BUF_CHANGED; rs->flags |= NS_BUF_CHANGED; + /* copy the NS_MOREFRAG */ + rs->flags = (rs->flags & ~NS_MOREFRAG) | (ts->flags & NS_MOREFRAG); } else { char *rxbuf = NETMAP_BUF(rxring, rs->buf_idx); char *txbuf = NETMAP_BUF(txring, ts->buf_idx); @@ -117,7 +119,7 @@ move(struct nm_desc *src, struct nm_desc *dst, u_int l { struct netmap_ring *txring, *rxring; u_int m = 0, si = src->first_rx_ring, di = dst->first_tx_ring; - const char *msg = (src->req.nr_ringid & NETMAP_SW_RING) ? + const char *msg = (src->req.nr_flags == NR_REG_SW) ? "host->net" : "net->host"; while (si <= src->last_rx_ring && di <= dst->last_tx_ring) { @@ -143,7 +145,20 @@ static void usage(void) { fprintf(stderr, - "usage: bridge [-v] [-i ifa] [-i ifb] [-b burst] [-w wait_time] [iface]\n"); + "netmap bridge program: forward packets between two " + "network interfaces\n" + " usage(1): bridge [-v] [-i ifa] [-i ifb] [-b burst] " + "[-w wait_time] [-L]\n" + " usage(2): bridge [-v] [-w wait_time] [-L] " + "[ifa [ifb [burst]]]\n" + "\n" + " ifa and ifb are specified using the nm_open() syntax.\n" + " When ifb is missing (or is equal to ifa), bridge will\n" + " forward between between ifa and the host stack if -L\n" + " is not specified, otherwise loopback traffic on ifa.\n" + "\n" + " example: bridge -w 10 -i netmap:eth3 -i netmap:eth1\n" + ); exit(1); } @@ -163,14 +178,16 @@ main(int argc, char **argv) struct nm_desc *pa = NULL, *pb = NULL; char *ifa = NULL, *ifb = NULL; char ifabuf[64] = { 0 }; + int loopback = 0; - fprintf(stderr, "%s built %s %s\n", - argv[0], __DATE__, __TIME__); + fprintf(stderr, "%s built %s %s\n\n", argv[0], __DATE__, __TIME__); - while ( (ch = getopt(argc, argv, "b:ci:vw:")) != -1) { + while ((ch = getopt(argc, argv, "hb:ci:vw:L")) != -1) { switch (ch) { default: D("bad option %c %s", ch, optarg); + /* fallthrough */ + case 'h': usage(); break; case 'b': /* burst */ @@ -194,6 +211,9 @@ main(int argc, char **argv) case 'w': wait_link = atoi(optarg); break; + case 'L': + loopback = 1; + break; } } @@ -201,12 +221,12 @@ main(int argc, char **argv) argc -= optind; argv += optind; + if (argc > 0) + ifa = argv[0]; if (argc > 1) - ifa = argv[1]; + ifb = argv[1]; if (argc > 2) - ifb = argv[2]; - if (argc > 3) - burst = atoi(argv[3]); + burst = atoi(argv[2]); if (!ifb) ifb = ifa; if (!ifa) { @@ -222,9 +242,13 @@ main(int argc, char **argv) wait_link = 4; } if (!strcmp(ifa, ifb)) { - D("same interface, endpoint 0 goes to host"); - snprintf(ifabuf, sizeof(ifabuf) - 1, "%s^", ifa); - ifa = ifabuf; + if (!loopback) { + D("same interface, endpoint 0 goes to host"); + snprintf(ifabuf, sizeof(ifabuf) - 1, "%s^", ifa); + ifa = ifabuf; + } else { + D("same interface, loopbacking traffic"); + } } else { /* two different interfaces. Take all rings on if1 */ } @@ -233,7 +257,7 @@ main(int argc, char **argv) D("cannot open %s", ifa); return (1); } - // XXX use a single mmap ? + /* try to reuse the mmap() of the first interface, if possible */ pb = nm_open(ifb, NULL, NM_OPEN_NO_MMAP, pa); if (pb == NULL) { D("cannot open %s", ifb); @@ -243,7 +267,7 @@ main(int argc, char **argv) zerocopy = zerocopy && (pa->mem == pb->mem); D("------- zerocopy %ssupported", zerocopy ? "" : "NOT "); - /* setup poll(2) variables. */ + /* setup poll(2) array */ memset(pollfd, 0, sizeof(pollfd)); pollfd[0].fd = pa->fd; pollfd[1].fd = pb->fd; @@ -262,6 +286,21 @@ main(int argc, char **argv) pollfd[0].revents = pollfd[1].revents = 0; n0 = pkt_queued(pa, 0); n1 = pkt_queued(pb, 0); +#if defined(_WIN32) || defined(BUSYWAIT) + if (n0) { + ioctl(pollfd[1].fd, NIOCTXSYNC, NULL); + pollfd[1].revents = POLLOUT; + } else { + ioctl(pollfd[0].fd, NIOCRXSYNC, NULL); + } + if (n1) { + ioctl(pollfd[0].fd, NIOCTXSYNC, NULL); + pollfd[0].revents = POLLOUT; + } else { + ioctl(pollfd[1].fd, NIOCRXSYNC, NULL); + } + ret = 1; +#else if (n0) pollfd[1].events |= POLLOUT; else @@ -270,7 +309,10 @@ main(int argc, char **argv) pollfd[0].events |= POLLOUT; else pollfd[1].events |= POLLIN; + + /* poll() also cause kernel to txsync/rxsync the NICs */ ret = poll(pollfd, 2, 2500); +#endif /* defined(_WIN32) || defined(BUSYWAIT) */ if (ret <= 0 || verbose) D("poll %s [0] ev %x %x rx %d@%d tx %d," " [1] ev %x %x rx %d@%d tx %d", @@ -298,18 +340,15 @@ main(int argc, char **argv) D("error on fd1, rx [%d,%d,%d)", rx->head, rx->cur, rx->tail); } - if (pollfd[0].revents & POLLOUT) { + if (pollfd[0].revents & POLLOUT) move(pb, pa, burst); - // XXX we don't need the ioctl */ - // ioctl(me[0].fd, NIOCTXSYNC, NULL); - } - if (pollfd[1].revents & POLLOUT) { + + if (pollfd[1].revents & POLLOUT) move(pa, pb, burst); - // XXX we don't need the ioctl */ - // ioctl(me[1].fd, NIOCTXSYNC, NULL); - } + + /* We don't need ioctl(NIOCTXSYNC) on the two file descriptors here, + * kernel will txsync on next poll(). */ } - D("exiting"); nm_close(pb); nm_close(pa); Modified: stable/11/tools/tools/netmap/pkt-gen.8 ============================================================================== --- stable/11/tools/tools/netmap/pkt-gen.8 Mon Dec 3 17:17:59 2018 (r341430) +++ stable/11/tools/tools/netmap/pkt-gen.8 Mon Dec 3 17:40:54 2018 (r341431) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 1, 2016 +.Dd October 23, 2018 .Dt PKT-GEN 8 .Os .Sh NAME @@ -170,10 +170,9 @@ packets to be received by the target host. .Dl .Nm -i netmap:ncxl0 -f tx -s 172.16.0.1:53 -d 172.16.1.3:53 -D 00:07:43:29:2a:e0 -.Sh FILES -.Xr netmap 4 .Sh SEE ALSO -.Xr netmap 4 +.Xr netmap 4 , +.Xr bridge 8 .Sh AUTHORS This manual page was written by .An George V. Neville-Neil Aq gnn@FreeBSD.org . From owner-svn-src-all@freebsd.org Mon Dec 3 17:46:54 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 92A35132DD3C; Mon, 3 Dec 2018 17:46:54 +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 3A4F78C444; Mon, 3 Dec 2018 17:46:54 +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 1C68C19434; Mon, 3 Dec 2018 17:46:54 +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 wB3Hkrir008262; Mon, 3 Dec 2018 17:46:53 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB3HkrBA008261; Mon, 3 Dec 2018 17:46:53 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201812031746.wB3HkrBA008261@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:46:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r341432 - stable/11/tools/tools/netmap X-SVN-Group: stable-11 X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: stable/11/tools/tools/netmap X-SVN-Commit-Revision: 341432 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3A4F78C444 X-Spamd-Result: default: False [-0.29 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.33)[-0.331,0]; NEURAL_HAM_SHORT(-0.06)[-0.060,0]; NEURAL_SPAM_LONG(0.10)[0.102,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Dec 2018 17:46:54 -0000 Author: vmaffione Date: Mon Dec 3 17:46:53 2018 New Revision: 341432 URL: https://svnweb.freebsd.org/changeset/base/341432 Log: MFC r339685 netmap: add man page for the vale-ctl program Added man page for vale-ctl program. Small fixes to vale-ctl, including the support for -m option (to specify the netmap memory allocator id). Reviewed by: 0mp Approved by: gnn (mentor) Differential Revision: https://reviews.freebsd.org/D17683 Added: stable/11/tools/tools/netmap/vale-ctl.4 - copied unchanged from r339685, head/tools/tools/netmap/vale-ctl.4 Modified: stable/11/tools/tools/netmap/vale-ctl.c Directory Properties: stable/11/ (props changed) Copied: stable/11/tools/tools/netmap/vale-ctl.4 (from r339685, head/tools/tools/netmap/vale-ctl.4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/tools/tools/netmap/vale-ctl.4 Mon Dec 3 17:46:53 2018 (r341432, copy of r339685, head/tools/tools/netmap/vale-ctl.4) @@ -0,0 +1,163 @@ +.\" Copyright (c) 2016 Michio Honda. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd October 24, 2018 +.Dt VALE-CTL 4 +.Os +.Sh NAME +.Nm vale-ctl +.Nd manage VALE switches provided by netmap +.Sh SYNOPSIS +.Bk -words +.Bl -tag -width "vale-ctl" +.It Nm +.Op Fl g Ar valeSSS:PPP +.Op Fl a Ar valeSSS:interface +.Op Fl h Ar valeSSS:interface +.Op Fl d Ar valeSSS:interface +.Op Fl n Ar interface +.Op Fl r Ar interface +.Op Fl l Ar valeSSS:PPP +.Op Fl l +.Op Fl p Ar valeSSS:PPP +.Op Fl P Ar valeSSS:PPP +.Op Fl C Ar spec +.Op Fl m Ar memid +.El +.Ek +.Sh DESCRIPTION +.Nm +manages and inspects +.Xr vale 4 +switches, for instance attaching and detaching interfaces, creating +and deleting persistent VALE ports, or listing the existing switches +and their ports. +In the following, +.Ar valeSSS +is the name of a VALE switch, while +.Ar valeSSS:PPP +is the name of a VALE port of +.Ar valeSSS . +.Pp +When issued without options it lists all the existing switch ports together +with their internal bridge number and port number. +.Bl -tag -width Ds +.It Fl g Ar valeSSS:PPP +Print the number of receive rings of +.Ar valeSSS:PPP . +.It Fl a Ar valeSSS:interface +Attach +.Ar interface +(which must be an existing network interface) to +.Ar valeSSS +and detach it from the host stack. +.It Fl h Ar valeSSS:interface +Attach +.Ar interface +(which must be an existing network interface) to +.Ar valeSSS +while keeping it attached to the host stack. +More precisely, packets coming from +the host stack and directed to the interface will go through the switch, where +they can still reach the interface if the switch rules allow it. +Conversely, packets coming from the interface will go through the switch and, +if appropriate, will reach the host stack. +.It Fl d Ar valeSSS:interface +Detach +.Ar interface +from +.Ar valeSSS . +.It Fl n Ar interface +Create a new persistent VALE port with name +.Ar interface . +The name must be different from any other network interface +already present in the system. +.It Fl d Ar interface +Destroy the persistent VALE port with name +.Ar inteface . +.It Fl l Ar valeSSS:PPP +Show the internal bridge number and port number of the given switch port. +.It Fl p Ar valeSSS:PPP +Enable polling mode for +.Ar valeSSS:PPP . +In polling mode, a dedicated kernel thread is spawned to handle packets +received from +.Ar valeSSS:PPP +and push them into the switch. +The kernel thread busy waits on the switch port rather than relying on +interrupts or notifications. +Polling mode can only be used on physical NICs attached to a VALE switch. +.It Fl P Ar valeSSS:PPP +Disable polling mode for +.Ar valeSSS:PPP . +.It Fl C Ar x | Ar x,y | Ar x,y,z | Ar x,y,z,w +When used in conjunction with +.Fl n +it supplies the number of tx and rx rings and slots. +The full format with four numbers gives, in order, number of tx slots, number +of rx slots, number of tx rings and number of rx rings. +The form with three numbers uses +.Ar z +for both the number of tx and the number of rx rings. +The forms with less than two numbers use the default values for the number +of rings. +The form with two numbers supplies the numbers of tx and rx slots. +The form with only one number uses +.Ar x +for both the number of tx and the number of rx slots. +.Pp +When used in conjunction with +.Fl p +only the first three forms are used. +The first number may be either 0 or 1. +If 0, then all interface rings will be polled by a single thread, running +on the core id given by the second number (the third number, if present, +must be 1). +If the first number is 1, then the ring identified by the second number will +be polled by the core with the same id. +If a third number is given, then this is repeated for as many consecutive +rings and cores. +.It Fl m Ar memid +Used in conjunction with +.Fl n +supplies the netmap memory region identifier to use together with the newly +created persistent VALE port. +These ports use a private memory region by default. +Using this option you can let them share memory with other ports. +Pass 1 as +.Ar memid +to use the global memory region already shared by all +harware netmap ports. +.El +.Sh SEE ALSO +.Xr netmap 4 , +.Xr vale 4 +.Sh AUTHORS +.An -nosplit +.Nm +has been written by +.An Michio Honda +at NetApp. Modified: stable/11/tools/tools/netmap/vale-ctl.c ============================================================================== --- stable/11/tools/tools/netmap/vale-ctl.c Mon Dec 3 17:40:54 2018 (r341431) +++ stable/11/tools/tools/netmap/vale-ctl.c Mon Dec 3 17:46:53 2018 (r341432) @@ -25,6 +25,10 @@ /* $FreeBSD$ */ +#define NETMAP_WITH_LIBS +#include +#include + #include #include #include /* PRI* macros */ @@ -35,17 +39,9 @@ #include #include /* apple needs sockaddr */ #include /* ifreq */ -#include -#include #include /* basename */ #include /* atoi, free */ -/* debug support */ -#define ND(format, ...) do {} while(0) -#define D(format, ...) \ - fprintf(stderr, "%s [%d] " format "\n", \ - __FUNCTION__, __LINE__, ##__VA_ARGS__) - /* XXX cut and paste from pkt-gen.c because I'm not sure whether this * program may include nm_util.h */ @@ -86,7 +82,7 @@ void parse_nmr_config(const char* conf, struct nmreq * } static int -bdg_ctl(const char *name, int nr_cmd, int nr_arg, char *nmr_config) +bdg_ctl(const char *name, int nr_cmd, int nr_arg, char *nmr_config, int nr_arg2) { struct nmreq nmr; int error = 0; @@ -100,9 +96,10 @@ bdg_ctl(const char *name, int nr_cmd, int nr_arg, char bzero(&nmr, sizeof(nmr)); nmr.nr_version = NETMAP_API; if (name != NULL) /* might be NULL */ - strncpy(nmr.nr_name, name, sizeof(nmr.nr_name)); + strncpy(nmr.nr_name, name, sizeof(nmr.nr_name)-1); nmr.nr_cmd = nr_cmd; parse_nmr_config(nmr_config, &nmr); + nmr.nr_arg2 = nr_arg2; switch (nr_cmd) { case NETMAP_BDG_DELIF: @@ -117,8 +114,11 @@ bdg_ctl(const char *name, int nr_cmd, int nr_arg, char break; case NETMAP_BDG_ATTACH: case NETMAP_BDG_DETACH: - if (nr_arg && nr_arg != NETMAP_BDG_HOST) + nmr.nr_flags = NR_REG_ALL_NIC; + if (nr_arg && nr_arg != NETMAP_BDG_HOST) { + nmr.nr_flags = NR_REG_NIC_SW; nr_arg = 0; + } nmr.nr_arg1 = nr_arg; error = ioctl(fd, NIOCREGIF, &nmr); if (error == -1) { @@ -152,6 +152,36 @@ bdg_ctl(const char *name, int nr_cmd, int nr_arg, char break; + case NETMAP_BDG_POLLING_ON: + case NETMAP_BDG_POLLING_OFF: + /* We reuse nmreq fields as follows: + * nr_tx_slots: 0 and non-zero indicate REG_ALL_NIC + * REG_ONE_NIC, respectively. + * nr_rx_slots: CPU core index. This also indicates the + * first queue in the case of REG_ONE_NIC + * nr_tx_rings: (REG_ONE_NIC only) indicates the + * number of CPU cores or the last queue + */ + nmr.nr_flags |= nmr.nr_tx_slots ? + NR_REG_ONE_NIC : NR_REG_ALL_NIC; + nmr.nr_ringid = nmr.nr_rx_slots; + /* number of cores/rings */ + if (nmr.nr_flags == NR_REG_ALL_NIC) + nmr.nr_arg1 = 1; + else + nmr.nr_arg1 = nmr.nr_tx_rings; + + error = ioctl(fd, NIOCREGIF, &nmr); + if (!error) + D("polling on %s %s", nmr.nr_name, + nr_cmd == NETMAP_BDG_POLLING_ON ? + "started" : "stopped"); + else + D("polling on %s %s (err %d)", nmr.nr_name, + nr_cmd == NETMAP_BDG_POLLING_ON ? + "couldn't start" : "couldn't stop", error); + break; + default: /* GINFO */ nmr.nr_cmd = nmr.nr_arg1 = nmr.nr_arg2 = 0; error = ioctl(fd, NIOCGINFO, &nmr); @@ -166,36 +196,44 @@ bdg_ctl(const char *name, int nr_cmd, int nr_arg, char return error; } +static void +usage(int errcode) +{ + fprintf(stderr, + "Usage:\n" + "vale-ctl arguments\n" + "\t-g interface interface name to get info\n" + "\t-d interface interface name to be detached\n" + "\t-a interface interface name to be attached\n" + "\t-h interface interface name to be attached with the host stack\n" + "\t-n interface interface name to be created\n" + "\t-r interface interface name to be deleted\n" + "\t-l list all or specified bridge's interfaces (default)\n" + "\t-C string ring/slot setting of an interface creating by -n\n" + "\t-p interface start polling. Additional -C x,y,z configures\n" + "\t\t x: 0 (REG_ALL_NIC) or 1 (REG_ONE_NIC),\n" + "\t\t y: CPU core id for ALL_NIC and core/ring for ONE_NIC\n" + "\t\t z: (ONE_NIC only) num of total cores/rings\n" + "\t-P interface stop polling\n" + "\t-m memid to use when creating a new interface\n"); + exit(errcode); +} + int main(int argc, char *argv[]) { int ch, nr_cmd = 0, nr_arg = 0; - const char *command = basename(argv[0]); char *name = NULL, *nmr_config = NULL; + int nr_arg2 = 0; - if (argc > 3) { -usage: - fprintf(stderr, - "Usage:\n" - "%s arguments\n" - "\t-g interface interface name to get info\n" - "\t-d interface interface name to be detached\n" - "\t-a interface interface name to be attached\n" - "\t-h interface interface name to be attached with the host stack\n" - "\t-n interface interface name to be created\n" - "\t-r interface interface name to be deleted\n" - "\t-l list all or specified bridge's interfaces (default)\n" - "\t-C string ring/slot setting of an interface creating by -n\n" - "", command); - return 0; - } - - while ((ch = getopt(argc, argv, "d:a:h:g:l:n:r:C:")) != -1) { - name = optarg; /* default */ + while ((ch = getopt(argc, argv, "d:a:h:g:l:n:r:C:p:P:m:")) != -1) { + if (ch != 'C' && ch != 'm') + name = optarg; /* default */ switch (ch) { default: fprintf(stderr, "bad option %c %s", ch, optarg); - goto usage; + usage(-1); + break; case 'd': nr_cmd = NETMAP_BDG_DETACH; break; @@ -217,19 +255,28 @@ usage: break; case 'l': nr_cmd = NETMAP_BDG_LIST; - if (optind < argc && argv[optind][0] == '-') - name = NULL; break; case 'C': nmr_config = strdup(optarg); break; + case 'p': + nr_cmd = NETMAP_BDG_POLLING_ON; + break; + case 'P': + nr_cmd = NETMAP_BDG_POLLING_OFF; + break; + case 'm': + nr_arg2 = atoi(optarg); + break; } - if (optind != argc) { - // fprintf(stderr, "optind %d argc %d\n", optind, argc); - goto usage; - } } - if (argc == 1) + if (optind != argc) { + // fprintf(stderr, "optind %d argc %d\n", optind, argc); + usage(-1); + } + if (argc == 1) { nr_cmd = NETMAP_BDG_LIST; - return bdg_ctl(name, nr_cmd, nr_arg, nmr_config) ? 1 : 0; + name = NULL; + } + return bdg_ctl(name, nr_cmd, nr_arg, nmr_config, nr_arg2) ? 1 : 0; } From owner-svn-src-all@freebsd.org Mon Dec 3 17:51:11 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Dec 3 17:51:25 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4D726132DE1C; Mon, 3 Dec 2018 17:51:25 +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 D53438C771; Mon, 3 Dec 2018 17:51:24 +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 99D1719480; Mon, 3 Dec 2018 17:51:24 +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 wB3HpOOI008617; Mon, 3 Dec 2018 17:51:24 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB3HpNoo008608; Mon, 3 Dec 2018 17:51:23 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201812031751.wB3HpNoo008608@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:51:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r341434 - in stable/11: share/man/man4 tools/tools/netmap X-SVN-Group: stable-11 X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: in stable/11: share/man/man4 tools/tools/netmap X-SVN-Commit-Revision: 341434 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D53438C771 X-Spamd-Result: default: False [-0.06 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.25)[-0.248,0]; NEURAL_SPAM_LONG(0.19)[0.192,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_SHORT(-0.01)[-0.009,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Dec 2018 17:51:25 -0000 Author: vmaffione Date: Mon Dec 3 17:51:22 2018 New Revision: 341434 URL: https://svnweb.freebsd.org/changeset/base/341434 Log: MFC r340279 netmap: add load balancer program Add the lb program, which is able to load-balance input traffic received from a netmap port over M groups, with N netmap pipes in each group. Each received packet is forwarded to one of the pipes chosen from each group (using an L3/L4 connection-consistent hash function). This also adds a man page for lb and some cross-references in related man pages. Reviewed by: bcr, 0mp Approved by: gnn (mentor) Differential Revision: https://reviews.freebsd.org/D17735 Added: stable/11/tools/tools/netmap/ctrs.h (contents, props changed) stable/11/tools/tools/netmap/lb.8 - copied unchanged from r340279, head/tools/tools/netmap/lb.8 stable/11/tools/tools/netmap/lb.c - copied unchanged from r340279, head/tools/tools/netmap/lb.c stable/11/tools/tools/netmap/pkt_hash.c - copied unchanged from r340279, head/tools/tools/netmap/pkt_hash.c stable/11/tools/tools/netmap/pkt_hash.h - copied unchanged from r340279, head/tools/tools/netmap/pkt_hash.h Modified: stable/11/share/man/man4/netmap.4 stable/11/tools/tools/netmap/Makefile stable/11/tools/tools/netmap/README stable/11/tools/tools/netmap/bridge.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/netmap.4 ============================================================================== --- stable/11/share/man/man4/netmap.4 Mon Dec 3 17:51:10 2018 (r341433) +++ stable/11/share/man/man4/netmap.4 Mon Dec 3 17:51:22 2018 (r341434) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 23, 2018 +.Dd October 28, 2018 .Dt NETMAP 4 .Os .Sh NAME @@ -1026,8 +1026,11 @@ Other clients attached to the same switch can now communicate with the network card or the host. .Sh SEE ALSO -.Xr pkt-gen 8 , -.Xr bridge 8 +.Xr vale 4 , +.Xr vale-ctl 4 , +.Xr bridge 8 , +.Xr lb 8 , +.Xr pkt-gen 8 .Pp .Pa http://info.iet.unipi.it/~luigi/netmap/ .Pp Modified: stable/11/tools/tools/netmap/Makefile ============================================================================== --- stable/11/tools/tools/netmap/Makefile Mon Dec 3 17:51:10 2018 (r341433) +++ stable/11/tools/tools/netmap/Makefile Mon Dec 3 17:51:22 2018 (r341434) @@ -3,7 +3,7 @@ # # For multiple programs using a single source file each, # we can just define 'progs' and create custom targets. -PROGS = pkt-gen bridge vale-ctl +PROGS = pkt-gen bridge vale-ctl lb CLEANFILES = $(PROGS) *.o MAN= @@ -30,3 +30,6 @@ bridge: bridge.o vale-ctl: vale-ctl.o $(CC) $(CFLAGS) -o vale-ctl vale-ctl.o + +lb: lb.o pkt_hash.o + $(CC) $(CFLAGS) -o lb lb.o pkt_hash.o $(LDFLAGS) Modified: stable/11/tools/tools/netmap/README ============================================================================== --- stable/11/tools/tools/netmap/README Mon Dec 3 17:51:10 2018 (r341433) +++ stable/11/tools/tools/netmap/README Mon Dec 3 17:51:22 2018 (r341434) @@ -1,9 +1,13 @@ $FreeBSD$ -This directory contains examples that use netmap +This directory contains applications that use the netmap API - pkt-gen a packet sink/source using the netmap API + pkt-gen a multi-function packet generator and traffic sink - bridge a two-port jumper wire, also using the native API + bridge a two-port jumper wire, also using the netmap API - vale-ctl the program to control VALE bridges + vale-ctl the program to control and inspect VALE switches + + lb an L3/L4 load balancer + + nmreplay a tool to playback a pcap file to a netmap port Modified: stable/11/tools/tools/netmap/bridge.8 ============================================================================== --- stable/11/tools/tools/netmap/bridge.8 Mon Dec 3 17:51:10 2018 (r341433) +++ stable/11/tools/tools/netmap/bridge.8 Mon Dec 3 17:51:22 2018 (r341434) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 23, 2018 +.Dd October 28, 2018 .Dt BRIDGE 8 .Os .Sh NAME @@ -71,7 +71,8 @@ Disable zero-copy mode. .El .Sh SEE ALSO .Xr netmap 4 , -.Xr pkt-gen 8 +.Xr pkt-gen 8 , +.Xr lb 8 .Sh AUTHORS .An -nosplit .Nm Added: stable/11/tools/tools/netmap/ctrs.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/tools/tools/netmap/ctrs.h Mon Dec 3 17:51:22 2018 (r341434) @@ -0,0 +1,116 @@ +#ifndef CTRS_H_ +#define CTRS_H_ + +/* $FreeBSD$ */ + +#include + +/* counters to accumulate statistics */ +struct my_ctrs { + uint64_t pkts, bytes, events; + uint64_t drop, drop_bytes; + uint64_t min_space; + struct timeval t; + uint32_t oq_n; /* number of elements in overflow queue (used in lb) */ +}; + +/* very crude code to print a number in normalized form. + * Caller has to make sure that the buffer is large enough. + */ +static const char * +norm2(char *buf, double val, char *fmt, int normalize) +{ + char *units[] = { "", "K", "M", "G", "T" }; + u_int i; + if (normalize) + for (i = 0; val >=1000 && i < sizeof(units)/sizeof(char *) - 1; i++) + val /= 1000; + else + i=0; + sprintf(buf, fmt, val, units[i]); + return buf; +} + +static __inline const char * +norm(char *buf, double val, int normalize) +{ + if (normalize) + return norm2(buf, val, "%.3f %s", normalize); + else + return norm2(buf, val, "%.0f %s", normalize); +} + +static __inline int +timespec_ge(const struct timespec *a, const struct timespec *b) +{ + + if (a->tv_sec > b->tv_sec) + return (1); + if (a->tv_sec < b->tv_sec) + return (0); + if (a->tv_nsec >= b->tv_nsec) + return (1); + return (0); +} + +static __inline struct timespec +timeval2spec(const struct timeval *a) +{ + struct timespec ts = { + .tv_sec = a->tv_sec, + .tv_nsec = a->tv_usec * 1000 + }; + return ts; +} + +static __inline struct timeval +timespec2val(const struct timespec *a) +{ + struct timeval tv = { + .tv_sec = a->tv_sec, + .tv_usec = a->tv_nsec / 1000 + }; + return tv; +} + + +static __inline struct timespec +timespec_add(struct timespec a, struct timespec b) +{ + struct timespec ret = { a.tv_sec + b.tv_sec, a.tv_nsec + b.tv_nsec }; + if (ret.tv_nsec >= 1000000000) { + ret.tv_sec++; + ret.tv_nsec -= 1000000000; + } + return ret; +} + +static __inline struct timespec +timespec_sub(struct timespec a, struct timespec b) +{ + struct timespec ret = { a.tv_sec - b.tv_sec, a.tv_nsec - b.tv_nsec }; + if (ret.tv_nsec < 0) { + ret.tv_sec--; + ret.tv_nsec += 1000000000; + } + return ret; +} + +static __inline uint64_t +wait_for_next_report(struct timeval *prev, struct timeval *cur, + int report_interval) +{ + struct timeval delta; + + delta.tv_sec = report_interval/1000; + delta.tv_usec = (report_interval%1000)*1000; + if (select(0, NULL, NULL, NULL, &delta) < 0 && errno != EINTR) { + perror("select"); + abort(); + } + gettimeofday(cur, NULL); + timersub(cur, prev, &delta); + return delta.tv_sec* 1000000 + delta.tv_usec; +} +#endif /* CTRS_H_ */ + Copied: stable/11/tools/tools/netmap/lb.8 (from r340279, head/tools/tools/netmap/lb.8) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/tools/tools/netmap/lb.8 Mon Dec 3 17:51:22 2018 (r341434, copy of r340279, head/tools/tools/netmap/lb.8) @@ -0,0 +1,130 @@ +.\" Copyright (c) 2017 Corelight, Inc. and Universita` di Pisa +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd October 28, 2018 +.Dt LB 8 +.Os +.Sh NAME +.Nm lb +.Nd netmap-based load balancer +.Sh SYNOPSIS +.Bk -words +.Bl -tag -width "lb" +.It Nm +.Op Fl i Ar port +.Op Fl p Ar pipe-group +.Op Fl B Ar extra-buffers +.Op Fl b Ar batch-size +.Op Fl w Ar wait-link +.El +.Ek +.Sh DESCRIPTION +.Nm +reads packets from an input netmap port and sends them to a number of netmap pipes, +trying to balance the packets received by each pipe. +Packets belonging to the +same connection will always be sent to the same pipe. +.Pp +Command line options are listed below. +.Bl -tag -width Ds +.It Fl i Ar port +Name of a netmap port. +It must be supplied exactly once to identify +the input port. +Any netmap port type (e.g., physical interface, VALE switch, pipe, +monitor port) can be used. +.It Fl p Ar name Ns Cm \&: Ns Ar number | number +Add a new pipe group of the given number of pipes. +The pipe group will receive all the packets read from the input port, balanced +among the available pipes. +The receiving ends of the pipes +will be called +.Dq Ar name Ns Em }0 +to +.Dq Ar name No Ns Em } Ns Aq Ar number No - 1 . +The name is optional and defaults to +the name of the input port (stripped down of any netmap operator). +If the name is omitted, also the colon can be omitted. +.Pp +This option can be supplied multiple times to define a sequence of pipe groups, +each group receiving all the packets in turn. +.Pp +If no +.Fl p +option is given, a single group of two pipes with default name is assumed. +.Pp +It is allowed to use the same name for several groups. +The pipe numbering in each +group will start from were the previous identically-named group had left. +.It Fl B Ar extra-buffers +Try to reserve the given number of extra buffers. +Extra buffers are shared among +all pipes in all groups and work as an extension of the pipe rings. +If a pipe ring is full for whatever reason, +.Nm +tries to use extra buffers before dropping any packets directed to that pipe. +.Pp +If all extra buffers are busy, some are stolen from the pipe with the longest +backlog. +This gives preference to newer packets over old ones, and prevents a +stalled pipe to deplete the pool of extra buffers. +.It Fl b Ar batch-size +Maximum number of packets processed between two read operations from the input port. +Higher values of batch-size improve performance by amortizing read operations, +but increase the risk of filling up the port internal queues. +.It Fl w Ar wait-link +indicates the number of seconds to wait before transmitting. +It defaults to 2, and may be useful when talking to physical +ports to let link negotiation complete before starting transmission. +.El +.Sh LIMITATIONS +The group chaining assumes that the applications on the receiving end of the +pipes are read-only: they must not modify the buffers or the pipe ring slots +in any way. +.Pp +The group naming is currently implemented by creating a persistent VALE port +with the given name. +If +.Nm +does not exit cleanly the ports will not be removed. +Please use +.Xr vale-ctl 4 +to remove any stale persistent VALE port. +.Sh SEE ALSO +.Xr netmap 4 , +.Xr bridge 8 , +.Xr pkt-gen 8 +.Pp +.Pa http://info.iet.unipi.it/~luigi/netmap/ +.Sh AUTHORS +.An -nosplit +.Nm +has been written by +.An Seth Hall +at Corelight, USA. +The facilities related to extra buffers and pipe groups have been added by +.An Giuseppe Lettieri +at University of Pisa, Italy, under contract by Corelight, USA. Copied: stable/11/tools/tools/netmap/lb.c (from r340279, head/tools/tools/netmap/lb.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/tools/tools/netmap/lb.c Mon Dec 3 17:51:22 2018 (r341434, copy of r340279, head/tools/tools/netmap/lb.c) @@ -0,0 +1,1027 @@ +/* + * Copyright (C) 2017 Corelight, Inc. and Universita` di Pisa. 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$ */ +#include +#include +#include +#include +#include +#include + +#define NETMAP_WITH_LIBS +#include +#include + +#include /* htonl */ + +#include + +#include "pkt_hash.h" +#include "ctrs.h" + + +/* + * use our version of header structs, rather than bringing in a ton + * of platform specific ones + */ +#ifndef ETH_ALEN +#define ETH_ALEN 6 +#endif + +struct compact_eth_hdr { + unsigned char h_dest[ETH_ALEN]; + unsigned char h_source[ETH_ALEN]; + u_int16_t h_proto; +}; + +struct compact_ip_hdr { + u_int8_t ihl:4, version:4; + u_int8_t tos; + u_int16_t tot_len; + u_int16_t id; + u_int16_t frag_off; + u_int8_t ttl; + u_int8_t protocol; + u_int16_t check; + u_int32_t saddr; + u_int32_t daddr; +}; + +struct compact_ipv6_hdr { + u_int8_t priority:4, version:4; + u_int8_t flow_lbl[3]; + u_int16_t payload_len; + u_int8_t nexthdr; + u_int8_t hop_limit; + struct in6_addr saddr; + struct in6_addr daddr; +}; + +#define MAX_IFNAMELEN 64 +#define MAX_PORTNAMELEN (MAX_IFNAMELEN + 40) +#define DEF_OUT_PIPES 2 +#define DEF_EXTRA_BUFS 0 +#define DEF_BATCH 2048 +#define DEF_WAIT_LINK 2 +#define DEF_STATS_INT 600 +#define BUF_REVOKE 100 +#define STAT_MSG_MAXSIZE 1024 + +struct { + char ifname[MAX_IFNAMELEN]; + char base_name[MAX_IFNAMELEN]; + int netmap_fd; + uint16_t output_rings; + uint16_t num_groups; + uint32_t extra_bufs; + uint16_t batch; + int stdout_interval; + int syslog_interval; + int wait_link; + bool busy_wait; +} glob_arg; + +/* + * the overflow queue is a circular queue of buffers + */ +struct overflow_queue { + char name[MAX_IFNAMELEN + 16]; + struct netmap_slot *slots; + uint32_t head; + uint32_t tail; + uint32_t n; + uint32_t size; +}; + +struct overflow_queue *freeq; + +static inline int +oq_full(struct overflow_queue *q) +{ + return q->n >= q->size; +} + +static inline int +oq_empty(struct overflow_queue *q) +{ + return q->n <= 0; +} + +static inline void +oq_enq(struct overflow_queue *q, const struct netmap_slot *s) +{ + if (unlikely(oq_full(q))) { + D("%s: queue full!", q->name); + abort(); + } + q->slots[q->tail] = *s; + q->n++; + q->tail++; + if (q->tail >= q->size) + q->tail = 0; +} + +static inline struct netmap_slot +oq_deq(struct overflow_queue *q) +{ + struct netmap_slot s = q->slots[q->head]; + if (unlikely(oq_empty(q))) { + D("%s: queue empty!", q->name); + abort(); + } + q->n--; + q->head++; + if (q->head >= q->size) + q->head = 0; + return s; +} + +static volatile int do_abort = 0; + +uint64_t dropped = 0; +uint64_t forwarded = 0; +uint64_t received_bytes = 0; +uint64_t received_pkts = 0; +uint64_t non_ip = 0; +uint32_t freeq_n = 0; + +struct port_des { + char interface[MAX_PORTNAMELEN]; + struct my_ctrs ctr; + unsigned int last_sync; + uint32_t last_tail; + struct overflow_queue *oq; + struct nm_desc *nmd; + struct netmap_ring *ring; + struct group_des *group; +}; + +struct port_des *ports; + +/* each group of pipes receives all the packets */ +struct group_des { + char pipename[MAX_IFNAMELEN]; + struct port_des *ports; + int first_id; + int nports; + int last; + int custom_port; +}; + +struct group_des *groups; + +/* statistcs */ +struct counters { + struct timeval ts; + struct my_ctrs *ctrs; + uint64_t received_pkts; + uint64_t received_bytes; + uint64_t non_ip; + uint32_t freeq_n; + int status __attribute__((aligned(64))); +#define COUNTERS_EMPTY 0 +#define COUNTERS_FULL 1 +}; + +struct counters counters_buf; + +static void * +print_stats(void *arg) +{ + int npipes = glob_arg.output_rings; + int sys_int = 0; + (void)arg; + struct my_ctrs cur, prev; + struct my_ctrs *pipe_prev; + + pipe_prev = calloc(npipes, sizeof(struct my_ctrs)); + if (pipe_prev == NULL) { + D("out of memory"); + exit(1); + } + + char stat_msg[STAT_MSG_MAXSIZE] = ""; + + memset(&prev, 0, sizeof(prev)); + while (!do_abort) { + int j, dosyslog = 0, dostdout = 0, newdata; + uint64_t pps = 0, dps = 0, bps = 0, dbps = 0, usec = 0; + struct my_ctrs x; + + counters_buf.status = COUNTERS_EMPTY; + newdata = 0; + memset(&cur, 0, sizeof(cur)); + sleep(1); + if (counters_buf.status == COUNTERS_FULL) { + __sync_synchronize(); + newdata = 1; + cur.t = counters_buf.ts; + if (prev.t.tv_sec || prev.t.tv_usec) { + usec = (cur.t.tv_sec - prev.t.tv_sec) * 1000000 + + cur.t.tv_usec - prev.t.tv_usec; + } + } + + ++sys_int; + if (glob_arg.stdout_interval && sys_int % glob_arg.stdout_interval == 0) + dostdout = 1; + if (glob_arg.syslog_interval && sys_int % glob_arg.syslog_interval == 0) + dosyslog = 1; + + for (j = 0; j < npipes; ++j) { + struct my_ctrs *c = &counters_buf.ctrs[j]; + cur.pkts += c->pkts; + cur.drop += c->drop; + cur.drop_bytes += c->drop_bytes; + cur.bytes += c->bytes; + + if (usec) { + x.pkts = c->pkts - pipe_prev[j].pkts; + x.drop = c->drop - pipe_prev[j].drop; + x.bytes = c->bytes - pipe_prev[j].bytes; + x.drop_bytes = c->drop_bytes - pipe_prev[j].drop_bytes; + pps = (x.pkts*1000000 + usec/2) / usec; + dps = (x.drop*1000000 + usec/2) / usec; + bps = ((x.bytes*1000000 + usec/2) / usec) * 8; + dbps = ((x.drop_bytes*1000000 + usec/2) / usec) * 8; + } + pipe_prev[j] = *c; + + if ( (dosyslog || dostdout) && newdata ) + snprintf(stat_msg, STAT_MSG_MAXSIZE, + "{" + "\"ts\":%.6f," + "\"interface\":\"%s\"," + "\"output_ring\":%" PRIu16 "," + "\"packets_forwarded\":%" PRIu64 "," + "\"packets_dropped\":%" PRIu64 "," + "\"data_forward_rate_Mbps\":%.4f," + "\"data_drop_rate_Mbps\":%.4f," + "\"packet_forward_rate_kpps\":%.4f," + "\"packet_drop_rate_kpps\":%.4f," + "\"overflow_queue_size\":%" PRIu32 + "}", cur.t.tv_sec + (cur.t.tv_usec / 1000000.0), + ports[j].interface, + j, + c->pkts, + c->drop, + (double)bps / 1024 / 1024, + (double)dbps / 1024 / 1024, + (double)pps / 1000, + (double)dps / 1000, + c->oq_n); + + if (dosyslog && stat_msg[0]) + syslog(LOG_INFO, "%s", stat_msg); + if (dostdout && stat_msg[0]) + printf("%s\n", stat_msg); + } + if (usec) { + x.pkts = cur.pkts - prev.pkts; + x.drop = cur.drop - prev.drop; + x.bytes = cur.bytes - prev.bytes; + x.drop_bytes = cur.drop_bytes - prev.drop_bytes; + pps = (x.pkts*1000000 + usec/2) / usec; + dps = (x.drop*1000000 + usec/2) / usec; + bps = ((x.bytes*1000000 + usec/2) / usec) * 8; + dbps = ((x.drop_bytes*1000000 + usec/2) / usec) * 8; + } + + if ( (dosyslog || dostdout) && newdata ) + snprintf(stat_msg, STAT_MSG_MAXSIZE, + "{" + "\"ts\":%.6f," + "\"interface\":\"%s\"," + "\"output_ring\":null," + "\"packets_received\":%" PRIu64 "," + "\"packets_forwarded\":%" PRIu64 "," + "\"packets_dropped\":%" PRIu64 "," + "\"non_ip_packets\":%" PRIu64 "," + "\"data_forward_rate_Mbps\":%.4f," + "\"data_drop_rate_Mbps\":%.4f," + "\"packet_forward_rate_kpps\":%.4f," + "\"packet_drop_rate_kpps\":%.4f," + "\"free_buffer_slots\":%" PRIu32 + "}", cur.t.tv_sec + (cur.t.tv_usec / 1000000.0), + glob_arg.ifname, + received_pkts, + cur.pkts, + cur.drop, + counters_buf.non_ip, + (double)bps / 1024 / 1024, + (double)dbps / 1024 / 1024, + (double)pps / 1000, + (double)dps / 1000, + counters_buf.freeq_n); + + if (dosyslog && stat_msg[0]) + syslog(LOG_INFO, "%s", stat_msg); + if (dostdout && stat_msg[0]) + printf("%s\n", stat_msg); + + prev = cur; + } + + free(pipe_prev); + + return NULL; +} + +static void +free_buffers(void) +{ + int i, tot = 0; + struct port_des *rxport = &ports[glob_arg.output_rings]; + + /* build a netmap free list with the buffers in all the overflow queues */ + for (i = 0; i < glob_arg.output_rings + 1; i++) { + struct port_des *cp = &ports[i]; + struct overflow_queue *q = cp->oq; + + if (!q) + continue; + + while (q->n) { + struct netmap_slot s = oq_deq(q); + uint32_t *b = (uint32_t *)NETMAP_BUF(cp->ring, s.buf_idx); + + *b = rxport->nmd->nifp->ni_bufs_head; + rxport->nmd->nifp->ni_bufs_head = s.buf_idx; + tot++; + } + } + D("added %d buffers to netmap free list", tot); + + for (i = 0; i < glob_arg.output_rings + 1; ++i) { + nm_close(ports[i].nmd); + } +} + + +static void sigint_h(int sig) +{ + (void)sig; /* UNUSED */ + do_abort = 1; + signal(SIGINT, SIG_DFL); +} + +void usage() +{ + printf("usage: lb [options]\n"); + printf("where options are:\n"); + printf(" -h view help text\n"); + printf(" -i iface interface name (required)\n"); + printf(" -p [prefix:]npipes add a new group of output pipes\n"); + printf(" -B nbufs number of extra buffers (default: %d)\n", DEF_EXTRA_BUFS); + printf(" -b batch batch size (default: %d)\n", DEF_BATCH); + printf(" -w seconds wait for link up (default: %d)\n", DEF_WAIT_LINK); + printf(" -W enable busy waiting. this will run your CPU at 100%%\n"); + printf(" -s seconds seconds between syslog stats messages (default: 0)\n"); + printf(" -o seconds seconds between stdout stats messages (default: 0)\n"); + exit(0); +} + +static int +parse_pipes(char *spec) +{ + char *end = index(spec, ':'); + static int max_groups = 0; + struct group_des *g; + + ND("spec %s num_groups %d", spec, glob_arg.num_groups); + if (max_groups < glob_arg.num_groups + 1) { + size_t size = sizeof(*g) * (glob_arg.num_groups + 1); + groups = realloc(groups, size); + if (groups == NULL) { + D("out of memory"); + return 1; + } + } + g = &groups[glob_arg.num_groups]; + memset(g, 0, sizeof(*g)); + + if (end != NULL) { + if (end - spec > MAX_IFNAMELEN - 8) { + D("name '%s' too long", spec); + return 1; + } + if (end == spec) { + D("missing prefix before ':' in '%s'", spec); + return 1; + } + strncpy(g->pipename, spec, end - spec); + g->custom_port = 1; + end++; + } else { + /* no prefix, this group will use the + * name of the input port. + * This will be set in init_groups(), + * since here the input port may still + * be uninitialized + */ + end = spec; + } + if (*end == '\0') { + g->nports = DEF_OUT_PIPES; + } else { + g->nports = atoi(end); + if (g->nports < 1) { + D("invalid number of pipes '%s' (must be at least 1)", end); + return 1; + } + } + glob_arg.output_rings += g->nports; + glob_arg.num_groups++; + return 0; +} + +/* complete the initialization of the groups data structure */ +void init_groups(void) +{ + int i, j, t = 0; + struct group_des *g = NULL; + for (i = 0; i < glob_arg.num_groups; i++) { + g = &groups[i]; + g->ports = &ports[t]; + for (j = 0; j < g->nports; j++) + g->ports[j].group = g; + t += g->nports; + if (!g->custom_port) + strcpy(g->pipename, glob_arg.base_name); + for (j = 0; j < i; j++) { + struct group_des *h = &groups[j]; + if (!strcmp(h->pipename, g->pipename)) + g->first_id += h->nports; + } + } + g->last = 1; +} + +/* push the packet described by slot rs to the group g. + * This may cause other buffers to be pushed down the + * chain headed by g. + * Return a free buffer. + */ +uint32_t forward_packet(struct group_des *g, struct netmap_slot *rs) +{ + uint32_t hash = rs->ptr; + uint32_t output_port = hash % g->nports; + struct port_des *port = &g->ports[output_port]; + struct netmap_ring *ring = port->ring; + struct overflow_queue *q = port->oq; + + /* Move the packet to the output pipe, unless there is + * either no space left on the ring, or there is some + * packet still in the overflow queue (since those must + * take precedence over the new one) + */ + if (ring->head != ring->tail && (q == NULL || oq_empty(q))) { + struct netmap_slot *ts = &ring->slot[ring->head]; + struct netmap_slot old_slot = *ts; + + ts->buf_idx = rs->buf_idx; + ts->len = rs->len; + ts->flags |= NS_BUF_CHANGED; + ts->ptr = rs->ptr; + ring->head = nm_ring_next(ring, ring->head); + port->ctr.bytes += rs->len; + port->ctr.pkts++; + forwarded++; + return old_slot.buf_idx; + } + + /* use the overflow queue, if available */ + if (q == NULL || oq_full(q)) { + /* no space left on the ring and no overflow queue + * available: we are forced to drop the packet + */ + dropped++; + port->ctr.drop++; + port->ctr.drop_bytes += rs->len; + return rs->buf_idx; + } + + oq_enq(q, rs); + + /* + * we cannot continue down the chain and we need to + * return a free buffer now. We take it from the free queue. + */ + if (oq_empty(freeq)) { + /* the free queue is empty. Revoke some buffers + * from the longest overflow queue + */ + uint32_t j; + struct port_des *lp = &ports[0]; + uint32_t max = lp->oq->n; + + /* let lp point to the port with the longest queue */ + for (j = 1; j < glob_arg.output_rings; j++) { + struct port_des *cp = &ports[j]; + if (cp->oq->n > max) { + lp = cp; + max = cp->oq->n; + } + } + + /* move the oldest BUF_REVOKE buffers from the + * lp queue to the free queue + */ + // XXX optimize this cycle + for (j = 0; lp->oq->n && j < BUF_REVOKE; j++) { + struct netmap_slot tmp = oq_deq(lp->oq); + + dropped++; + lp->ctr.drop++; + lp->ctr.drop_bytes += tmp.len; + + oq_enq(freeq, &tmp); + } + + ND(1, "revoked %d buffers from %s", j, lq->name); + } + + return oq_deq(freeq).buf_idx; +} + +int main(int argc, char **argv) +{ + int ch; + uint32_t i; + int rv; + unsigned int iter = 0; + int poll_timeout = 10; /* default */ + + glob_arg.ifname[0] = '\0'; + glob_arg.output_rings = 0; + glob_arg.batch = DEF_BATCH; + glob_arg.wait_link = DEF_WAIT_LINK; + glob_arg.busy_wait = false; + glob_arg.syslog_interval = 0; + glob_arg.stdout_interval = 0; + + while ( (ch = getopt(argc, argv, "hi:p:b:B:s:o:w:W")) != -1) { + switch (ch) { + case 'i': + D("interface is %s", optarg); + if (strlen(optarg) > MAX_IFNAMELEN - 8) { + D("ifname too long %s", optarg); + return 1; + } + if (strncmp(optarg, "netmap:", 7) && strncmp(optarg, "vale", 4)) { + sprintf(glob_arg.ifname, "netmap:%s", optarg); + } else { + strcpy(glob_arg.ifname, optarg); + } + break; + + case 'p': + if (parse_pipes(optarg)) { + usage(); + return 1; + } + break; + + case 'B': + glob_arg.extra_bufs = atoi(optarg); + D("requested %d extra buffers", glob_arg.extra_bufs); + break; + + case 'b': + glob_arg.batch = atoi(optarg); + D("batch is %d", glob_arg.batch); + break; + + case 'w': + glob_arg.wait_link = atoi(optarg); + D("link wait for up time is %d", glob_arg.wait_link); + break; + + case 'W': + glob_arg.busy_wait = true; + break; + + case 'o': + glob_arg.stdout_interval = atoi(optarg); + break; + + case 's': + glob_arg.syslog_interval = atoi(optarg); + break; + + case 'h': + usage(); + return 0; + break; + + default: + D("bad option %c %s", ch, optarg); + usage(); + return 1; + } + } + + if (glob_arg.ifname[0] == '\0') { + D("missing interface name"); + usage(); + return 1; + } + + /* extract the base name */ + char *nscan = strncmp(glob_arg.ifname, "netmap:", 7) ? + glob_arg.ifname : glob_arg.ifname + 7; + strncpy(glob_arg.base_name, nscan, MAX_IFNAMELEN-1); + for (nscan = glob_arg.base_name; *nscan && !index("-*^{}/@", *nscan); nscan++) + ; + *nscan = '\0'; + + if (glob_arg.num_groups == 0) + parse_pipes(""); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Dec 3 18:00:47 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Dec 3 18:20:46 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Dec 3 18:56:14 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Dec 3 19:02:16 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 047D4132FA31; Mon, 3 Dec 2018 19:02:16 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7EA6D8F5E3; Mon, 3 Dec 2018 19:02:15 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 457891A11A; Mon, 3 Dec 2018 19:02:15 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB3J2FQj049142; Mon, 3 Dec 2018 19:02:15 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB3J2FMD049141; Mon, 3 Dec 2018 19:02:15 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201812031902.wB3J2FMD049141@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Mon, 3 Dec 2018 19:02:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r341436 - stable/11/release/doc/share/xml X-SVN-Group: stable-11 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: stable/11/release/doc/share/xml X-SVN-Commit-Revision: 341436 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7EA6D8F5E3 X-Spamd-Result: default: False [-0.07 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.41)[-0.406,0]; NEURAL_SPAM_LONG(0.01)[0.011,0]; NEURAL_SPAM_SHORT(0.33)[0.330,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Dec 2018 19:02:16 -0000 Author: gjb Date: Mon Dec 3 19:02:14 2018 New Revision: 341436 URL: https://svnweb.freebsd.org/changeset/base/341436 Log: Document SA-18:13, EN-18:13, EN-18:14, EN-18:15. Sponsored by: The FreeBSD Foundation Modified: stable/11/release/doc/share/xml/errata.xml stable/11/release/doc/share/xml/security.xml Modified: stable/11/release/doc/share/xml/errata.xml ============================================================================== --- stable/11/release/doc/share/xml/errata.xml Mon Dec 3 18:00:46 2018 (r341435) +++ stable/11/release/doc/share/xml/errata.xml Mon Dec 3 19:02:14 2018 (r341436) @@ -57,6 +57,29 @@ Small kernel memory disclosures in two system calls + + + FreeBSD-EN-18:13.icmp + 27 November 2018 + ICMP buffer underwrite + + + + FreeBSD-EN-18:14.tzdata + 27 November 2018 + Timezone database information + update + + + + FreeBSD-EN-18:15.loader + 27 November 2018 + Deferred kernel loading breaks loader + password + Modified: stable/11/release/doc/share/xml/security.xml ============================================================================== --- stable/11/release/doc/share/xml/security.xml Mon Dec 3 18:00:46 2018 (r341435) +++ stable/11/release/doc/share/xml/security.xml Mon Dec 3 19:02:14 2018 (r341436) @@ -56,6 +56,13 @@ 12 September 2018 Improper ELF header parsing + + + FreeBSD-SA-18:13.nfs + 27 November 2018 + Multiple vulnerabilities + From owner-svn-src-all@freebsd.org Mon Dec 3 19:16:36 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Dec 3 19:34:07 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C542E13306CC 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 297E36A607 for ; Mon, 3 Dec 2018 19:34:07 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1543865637; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=LFLOxKdnTJKX38vEDu8PH5mu8j52+qLM/iR/3AZ9rwh5KfibKMxQhEbmA5CdyiAzzIqBs4OADsSch HG1K+TjJhdDiPPmsLGmUF4cQcIoa9YuLygKrGT+OEyuuGecQd13kSh8bX5Iou29xI+MIZTkUGwo9z6 t8LfhO4JxrbvZwwNxo9PsjjM6yB+ckJXe7HUolZ7Ui4uCIUwM5GcZaUT1SXq3IPCz7HxvOBCcFgv8k PIJ33ZwKZf5VQDiiYrVJYpZk7cJMGgbt+Pks+y2jH6YSzLySEJIEEAX01qAn5WtbRs6KpKVfKvsinA CZYPFMXLgK7lZ3BxKckx38hkryJrOeg== 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: 297E36A607 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Dec 3 19:35:22 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Dec 3 19:55:56 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Dec 3 20:01:52 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Dec 3 20:03:44 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Dec 3 20:54:20 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Dec 3 20:58:18 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Dec 3 21:07:11 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Dec 3 22:02:09 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 867B0130CEB5; Mon, 3 Dec 2018 22:02:09 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2E10C7141B; Mon, 3 Dec 2018 22:02:09 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0F0911BF47; Mon, 3 Dec 2018 22:02:09 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB3M28pI047394; Mon, 3 Dec 2018 22:02:08 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB3M28sX047393; Mon, 3 Dec 2018 22:02:08 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201812032202.wB3M28sX047393@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Mon, 3 Dec 2018 22:02:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341444 - stable/12/sbin/pfctl/tests/files X-SVN-Group: stable-12 X-SVN-Commit-Author: kp X-SVN-Commit-Paths: stable/12/sbin/pfctl/tests/files X-SVN-Commit-Revision: 341444 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2E10C7141B X-Spamd-Result: default: False [-0.15 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.41)[-0.406,0]; NEURAL_SPAM_LONG(0.01)[0.011,0]; NEURAL_SPAM_SHORT(0.25)[0.246,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Dec 2018 22:02:09 -0000 Author: kp Date: Mon Dec 3 22:02:08 2018 New Revision: 341444 URL: https://svnweb.freebsd.org/changeset/base/341444 Log: MFC r339627: pf tests: Fix incorrect test for PR 231323 Fix r339466. The test result file did not list the rdr rule. Additionally, the route-to rule needs a redirection address. PR: 233739 Modified: stable/12/sbin/pfctl/tests/files/pf1005.in stable/12/sbin/pfctl/tests/files/pf1005.ok Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/pfctl/tests/files/pf1005.in ============================================================================== --- stable/12/sbin/pfctl/tests/files/pf1005.in Mon Dec 3 21:07:10 2018 (r341443) +++ stable/12/sbin/pfctl/tests/files/pf1005.in Mon Dec 3 22:02:08 2018 (r341444) @@ -1,3 +1,3 @@ rdr on em0 proto tcp from any to any -> 1.1.1.1 port 2121 -pass out log quick on lo0 route-to lo0 from any to any -pass in log quick on lo0 route-to (lo0 localhost) from any to any +pass out log quick on lo0 route-to (lo0 localhost) inet from any to any +pass in log quick on lo0 route-to (lo0 localhost) inet6 from any to any Modified: stable/12/sbin/pfctl/tests/files/pf1005.ok ============================================================================== --- stable/12/sbin/pfctl/tests/files/pf1005.ok Mon Dec 3 21:07:10 2018 (r341443) +++ stable/12/sbin/pfctl/tests/files/pf1005.ok Mon Dec 3 22:02:08 2018 (r341444) @@ -1,2 +1,3 @@ -pass out log quick on lo0 route-to (lo0 ?) all flags S/SA keep state +rdr on em0 inet proto tcp all -> 1.1.1.1 port 2121 +pass out log quick on lo0 route-to (lo0 127.0.0.1) inet all flags S/SA keep state pass in log quick on lo0 route-to (lo0 ::1) inet6 all flags S/SA keep state From owner-svn-src-all@freebsd.org Mon Dec 3 22:09:24 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Dec 3 22:31:58 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Dec 3 23:39:46 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Mon Dec 3 23:42:06 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-all@freebsd.org Tue Dec 4 00:10:53 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 12602130F493 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 0DBA37565D 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 x144so1944058ybg.10 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=Nq3hZxStenpWFPZyHnWL5i4Pqusctqvrb76v37zzUxdl1+oT5H9Yf2/arO9CvKb+aH vMZ53P5JW8GMLHj8XCnzSfemLO1jPrUBWNW8YSc+VAUf8Uaa+/JFRrBji6274f3vJTFZ Z9SjV/DfluHWmjRxZUXMGfcuRCSwRf9UDANaRciWRd79QTURjeF1Cp2u9AVy+COnT410 45femEcErWY4h18EJ2CL8Z3KNb1+boBeuVpbO8SAAdtOW6MlmqoNiJyUNr3joGxJzwpX 2oeBIOyLEJQS7H/o9Q2fmzc0U/fm1F6lNwld3cYz/YsODV/YuTSVxggRxrrTxmYFy71n CWCg== X-Gm-Message-State: AA+aEWY507GQJRu9N3eFC13beX4lBDBryxgzW7RwGMuz1jJ9oTRAqEAH Eyq1VrEzSxeHETitYguO/qiofFOtOvR08usYpwhPKnLLrNY= 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: 0DBA37565D 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-all@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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-all@freebsd.org Tue Dec 4 00:15:48 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-all@freebsd.org Tue Dec 4 00:18:57 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-all@freebsd.org Tue Dec 4 00:22:09 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-all@freebsd.org Tue Dec 4 00:41:13 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2536A130FE10; Tue, 4 Dec 2018 00:41:13 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BE8E176837; Tue, 4 Dec 2018 00:41:12 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9F8121D86B; Tue, 4 Dec 2018 00:41:12 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB40fC2n027181; Tue, 4 Dec 2018 00:41:12 GMT (envelope-from eugen@FreeBSD.org) Received: (from eugen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB40fCm4027180; Tue, 4 Dec 2018 00:41:12 GMT (envelope-from eugen@FreeBSD.org) Message-Id: <201812040041.wB40fCm4027180@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eugen set sender to eugen@FreeBSD.org using -f From: Eugene Grosbein Date: Tue, 4 Dec 2018 00:41:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341451 - stable/12/sbin/ipfw X-SVN-Group: stable-12 X-SVN-Commit-Author: eugen X-SVN-Commit-Paths: stable/12/sbin/ipfw X-SVN-Commit-Revision: 341451 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: BE8E176837 X-Spamd-Result: default: False [-0.15 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.56)[-0.556,0]; NEURAL_SPAM_LONG(0.01)[0.011,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_SPAM_SHORT(0.39)[0.391,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Dec 2018 00:41:13 -0000 Author: eugen Date: Tue Dec 4 00:41:12 2018 New Revision: 341451 URL: https://svnweb.freebsd.org/changeset/base/341451 Log: MFC r340110: ipfw(8): clarify layer2 processing abilities Make it clear that ipfw action set for layer2 frames is a bit limited. PR: 59835 Reviewed by: yuripv Differential Revision: https://reviews.freebsd.org/D17719 Modified: stable/12/sbin/ipfw/ipfw.8 Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/ipfw/ipfw.8 ============================================================================== --- stable/12/sbin/ipfw/ipfw.8 Tue Dec 4 00:22:08 2018 (r341450) +++ stable/12/sbin/ipfw/ipfw.8 Tue Dec 4 00:41:12 2018 (r341451) @@ -511,6 +511,27 @@ ipfw add 10 skipto 4000 all from any to any layer2 out .Pp (yes, at the moment there is no way to differentiate between ether_demux and bdg_forward). +.Pp +Also note that only actions +.Cm allow, +.Cm deny, +.Cm netgraph, +.Cm ngtee +and related to +.Cm dummynet +are processed for +.Cm layer2 +frames and all other actions act as if they were +.Cm allow +for such frames. +Full set of actions is supported for IP packets without +.Cm layer2 +headers only. +For example, +.Cm divert +action does not divert +.Cm layer2 +frames. .Sh SYNTAX In general, each keyword or argument must be provided as a separate command line argument, with no leading or trailing From owner-svn-src-all@freebsd.org Tue Dec 4 02:30:12 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C992D131A12F; Tue, 4 Dec 2018 02:30:12 +0000 (UTC) (envelope-from ygy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6DE247E1DB; Tue, 4 Dec 2018 02:30:12 +0000 (UTC) (envelope-from ygy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4EE751EF80; Tue, 4 Dec 2018 02:30:12 +0000 (UTC) (envelope-from ygy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB42UC2J083544; Tue, 4 Dec 2018 02:30:12 GMT (envelope-from ygy@FreeBSD.org) Received: (from ygy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB42UCos083543; Tue, 4 Dec 2018 02:30:12 GMT (envelope-from ygy@FreeBSD.org) Message-Id: <201812040230.wB42UCos083543@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ygy set sender to ygy@FreeBSD.org using -f From: Guangyuan Yang Date: Tue, 4 Dec 2018 02:30:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341452 - stable/12/bin/pkill X-SVN-Group: stable-12 X-SVN-Commit-Author: ygy X-SVN-Commit-Paths: stable/12/bin/pkill X-SVN-Commit-Revision: 341452 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6DE247E1DB X-Spamd-Result: default: False [-0.06 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.56)[-0.556,0]; NEURAL_SPAM_LONG(0.01)[0.011,0]; NEURAL_SPAM_SHORT(0.48)[0.481,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Dec 2018 02:30:13 -0000 Author: ygy (doc committer) Date: Tue Dec 4 02:30:11 2018 New Revision: 341452 URL: https://svnweb.freebsd.org/changeset/base/341452 Log: MFC r341357: Clarify that patterns are extended regular expressions in pkill(1) manual page. PR: 231060 Submitted by: naddy Modified: stable/12/bin/pkill/pkill.1 Directory Properties: stable/12/ (props changed) Modified: stable/12/bin/pkill/pkill.1 ============================================================================== --- stable/12/bin/pkill/pkill.1 Tue Dec 4 00:41:12 2018 (r341451) +++ stable/12/bin/pkill/pkill.1 Tue Dec 4 02:30:11 2018 (r341452) @@ -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 June 5, 2017 +.Dd December 1, 2018 .Dt PKILL 1 .Os .Sh NAME @@ -221,7 +221,7 @@ This option is valid only when given as the first argu .Pp If any .Ar pattern -operands are specified, they are used as regular expressions to match +operands are specified, they are used as extended regular expressions to match the command name or full argument list of each process. If the .Fl f From owner-svn-src-all@freebsd.org Tue Dec 4 03:23:15 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-all@freebsd.org Tue Dec 4 03:24:39 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-all@freebsd.org Tue Dec 4 03:51:11 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-all@freebsd.org Tue Dec 4 04:55:53 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-all@freebsd.org Tue Dec 4 06:11:05 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-all@freebsd.org Tue Dec 4 07:30:03 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 16BAF1326F60; Tue, 4 Dec 2018 07:30:03 +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 BAFE36A7A3; Tue, 4 Dec 2018 07:30:02 +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 9C8522204D; Tue, 4 Dec 2018 07:30:02 +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 wB47U2v6038073; Tue, 4 Dec 2018 07:30:02 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB47U25s038071; Tue, 4 Dec 2018 07:30:02 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201812040730.wB47U25s038071@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Tue, 4 Dec 2018 07:30:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r341457 - stable/11/tools/tools/netmap X-SVN-Group: stable-11 X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: stable/11/tools/tools/netmap X-SVN-Commit-Revision: 341457 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: BAFE36A7A3 X-Spamd-Result: default: False [0.25 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.42)[-0.423,0]; NEURAL_SPAM_LONG(0.19)[0.192,0]; NEURAL_SPAM_SHORT(0.48)[0.485,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Dec 2018 07:30:03 -0000 Author: vmaffione Date: Tue Dec 4 07:30:02 2018 New Revision: 341457 URL: https://svnweb.freebsd.org/changeset/base/341457 Log: MFC r340325 netmap: pkt-gen: several updates from upstream Various improvements to the netmap pkt-gen program: - indentation fixes - support for IPV6 - fixes to checksum computation - support for NS_MOREFRAG - rate limiting in ping mode Reviewed by: bcr, 0mp Approved by: gnn (mentor) Differential Revision: https://reviews.freebsd.org/D17698 Modified: stable/11/tools/tools/netmap/pkt-gen.8 stable/11/tools/tools/netmap/pkt-gen.c Directory Properties: stable/11/ (props changed) Modified: stable/11/tools/tools/netmap/pkt-gen.8 ============================================================================== --- stable/11/tools/tools/netmap/pkt-gen.8 Tue Dec 4 06:11:04 2018 (r341456) +++ stable/11/tools/tools/netmap/pkt-gen.8 Tue Dec 4 07:30:02 2018 (r341457) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 23, 2018 +.Dd October 31, 2018 .Dt PKT-GEN 8 .Os .Sh NAME @@ -36,96 +36,215 @@ .Bl -item -compact .It .Nm +.Op Fl h46XzZNIWvrAB .Op Fl i Ar interface .Op Fl f Ar function .Op Fl n Ar count -.Op Fl t Ar pkts_to_send -.Op Fl r Ar pkts_to_receive .Op Fl l Ar pkt_size +.Op Fl b Ar burst_size .Op Fl d Ar dst_ip[:port[-dst_ip:port]] .Op Fl s Ar src_ip[:port[-src_ip:port]] -.Op Fl D Ar dst-mac -.Op Fl S Ar src-mac +.Op Fl D Ar dst_mac +.Op Fl S Ar src_mac .Op Fl a Ar cpu_id -.Op Fl b Ar burst size -.Op Fl c Ar cores +.Op Fl c Ar cpus .Op Fl p Ar threads .Op Fl T Ar report_ms -.Op Fl P +.Op Fl P Ar file .Op Fl w Ar wait_for_link_time .Op Fl R Ar rate -.Op Fl X .Op Fl H Ar len -.Op Fl P Ar xfile -.Op Fl z -.Op Fl Z +.Op Fl F Ar num_frags +.Op Fl M Ar frag_size +.Op Fl C Ar port_config +.El .Sh DESCRIPTION .Nm -generates and receives raw network packets using -.Xr netmap 4 . +leverages +.Xr netmap 4 +to generate and receive raw network packets in batches. The arguments are as follows: -.Pp .Bl -tag -width Ds +.It Fl h +Show program usage and exit. .It Fl i Ar interface -Network interface name. -.It Fl f Ar function tx rx ping pong -Set the function to transmit, receive of ping/pong. -.It Fl n count -Number of iterations (can be 0). -.It Fl t pkts_to_send -Number of packets to send. Also forces transmit mode. -.It Fl r Ar pkts_to_receive -Number of packets to receive. Also forces rx mode. +Name of the network interface that +.Nm +operates on. +It can be a system network interface (e.g., em0), +the name of a +.Xr vale 4 +port (e.g., valeSSS:PPP), the name of a netmap pipe or monitor, +or any valid netmap port name accepted by the +.Ar nm_open +library function, as documented in +.Xr netmap 4 +(NIOCREGIF section). +.It Fl f Ar function +The function to be executed by +.Nm . +Specify +.Cm tx +for transmission, +.Cm rx +for reception, +.Cm ping +for client-side ping-pong operation, and +.Cm pong +for server-side ping-pong operation. +.It Fl n Ar count +Number of iterations of the +.Nm +function, with 0 meaning infinite). +In case of +.Cm tx +or +.Cm rx , +.Ar count +is the number of packets to receive or transmit. +In case of +.Cm ping +or +.Cm pong , +.Ar count +is the number of ping-pong transactions. .It Fl l Ar pkt_size Packet size in bytes excluding CRC. +If passed a second time, use random sizes larger or equal than the +second one and lower than the first one. +.It Fl b Ar burst_size +Transmit or receive up to +.Ar burst_size +packets at a time. +.It Fl 4 +Use IPv4 addresses. +.It Fl 6 +Use IPv6 addresses. .It Fl d Ar dst_ip[:port[-dst_ip:port]] -Destination IPv4 address and port, single or range. +Destination IPv4/IPv6 address and port, single or range. .It Fl s Ar src_ip[:port[-src_ip:port]] -Source IPv4 address and port, single or range. -.It Fl D Ar dst-mac -Destination MAC address in colon notation. -.It Fl S Ar src-mac +Source IPv4/IPv6 address and port, single or range. +.It Fl D Ar dst_mac +Destination MAC address in colon notation (e.g., aa:bb:cc:dd:ee:00). +.It Fl S Ar src_mac Source MAC address in colon notation. .It Fl a Ar cpu_id -Tie +Pin the first thread of .Nm -to a particular CPU core using -.Xr setaffinity 2. -.It Fl b Ar burst size -Set the size of a burst of packets. -.It Fl c Ar cores -Number of cores to use. +to a particular CPU using +.Xr pthread_setaffinity_np 3 . +If more threads are used, they are pinned to the subsequent CPUs, +one per thread. +.It Fl c Ar cpus +Maximum number of CPUs to use (0 means to use all the available ones). .It Fl p Ar threads Number of threads to use. +By default, only a single thread is used +to handle all the netmap rings. +If +.Ar threads +is larger than one, each thread handles a single TX ring (in +.Cm tx +mode), a single RX ring (in +.Cm rx +mode), or a TX/RX ring couple. +The number of +.Ar threads +must be less or equal than the number of TX (or RX) ring available +in the device specified by +.Ar interface . .It Fl T Ar report_ms Number of milliseconds between reports. -.It Fl P -Use libpcap instead of netmap for reading or writing. .It Fl w Ar wait_for_link_time -Number of seconds to wait to make sure that the network link is up. A -network device driver may take some time to create a new -transmit/receive ring pair when +Number of seconds to wait before starting the +.Nm +function, useuful to make sure that the network link is up. +A network device driver may take some time to enter netmap mode, or +to create a new transmit/receive ring pair when .Xr netmap 4 requests one. .It Fl R Ar rate -Packet transmission rate. Not setting the packet transmission rate tells +Packet transmission rate. +Not setting the packet transmission rate tells .Nm -to transmit packets as quickly as possible. On servers from 2010 on-wards +to transmit packets as quickly as possible. +On servers from 2010 on-wards .Xr netmap 4 is able to completely use all of the bandwidth of a 10 or 40Gbps link, so this option should be used unless your intention is to saturate the link. .It Fl X -Dump payload transmitted or received. +Dump payload of each packet transmitted or received. .It Fl H Ar len -Add empty virtio-net-header with size 'len'. This option is only use -with Virtual Machine technologies that use virtio as a network interface. +Add empty virtio-net-header with size +.Ar len . +Valid sizes are 0, 10 and 12. +This option is only used with Virtual Machine technologies that use virtio +as a network interface. .It Fl P Ar file -Load the packet from a pcap file rather than constructing it inside of -.Nm +Load the packet to be transmitted from a pcap file rather than constructing +it within +.Nm . .It Fl z -Use random IPv4 src address/port +Use random IPv4/IPv6 src address/port. .It Fl Z -Use random IPv4 dst address/port +Use random IPv4/IPv6 dst address/port. +.It Fl N +Do not normalize units (i.e., use bps, pps instead of Mbps, Kpps, etc.). +.It Fl F Ar num_frags +Send multi-slot packets, each one with +.Ar num_frags +fragments. +A multi-slot packet is represented by two or more consecutive netmap slots +with the +.Ar NS_MOREFRAG +flag set (except for the last slot). +This is useful to transmit or receive packets larger than the netmap +buffer size. +.It Fl M Ar frag_size +In multi-slot mode, +.Ar frag_size +specifies the size of each fragment, if smaller than the packet length +divided by +.Ar num_frags . +.It Fl I +Use indirect buffers. +It is only valid for transmitting on VALE ports, +and it is implemented by setting the +.Ar NS_INDIRECT +flag in the netmap slots. +.It Fl W +Exit immediately if all the RX rings are empty the first time they are +examined. +.It Fl v +Increase the verbosity level. +.It Fl r +In +.Cm tx +mode, do not initialize packets, but send whatever the content of +the uninitialized netmap buffers is (rubbish mode). +.It Fl A +Compute mean and standard deviation (over a sliding window) for the +transmit or receive rate. +.It Fl B +Take Ethernet framing and CRC into account when computing the average bps. +This adds 4 bytes of CRC and 20 bytes of framing to each packet. +.It Fl C Ar tx_slots Ns Oo Cm \&, Ns Ar rx_slots Ns Oo Cm \&, Ns Ar tx_rings Ns Oo Cm \&, Ns Ar rx_rings Oc Oc Oc +Configuration in terms of number of rings and slots to be used when +opening the netmap port. +Such configuration has effect on software ports +created on the fly, such as VALE ports and netmap pipes. +The configuration may consist of 1 to 4 numbers separated by commas: +.Dq tx_slots,rx_slots,tx_rings,rx_rings . +Missing numbers or zeroes stand for default values. +As an additional convenience, if exactly one number is specified, +then this is assigned to both +.Ar tx_slots +and +.Ar rx_slots . +If there is no fourth number, then the third one is assigned to both +.Ar tx_rings +and +.Ar rx_rings . .El .Pp .Nm @@ -133,7 +252,7 @@ is a raw packet generator that can utilize either .Xr netmap 4 or .Xr bpf 4 -but which is most often uses with +but which is most often used with .Xr netmap 4 . The .Ar interface name @@ -146,7 +265,8 @@ system to balance traffic across the interface. .Nm can peel off one or more of the transmit or receive rings for its own use without interfering with packets that might otherwise be destined -for the host. For example on a system with a Chelsio Network +for the host. +For example on a system with a Chelsio Network Interface Card (NIC) the interface specification of .Ar -i netmap:ncxl0 gives @@ -156,20 +276,20 @@ the more commonly known cxl0 interface, which is used system's TCP/IP stack. .Sh EXAMPLES Capture and count all packets arriving on the operating system's cxl0 -interface. Using this will block packets from reaching the operating +interface. +Using this will block packets from reaching the operating system's network stack. -.Dl +.Bd -literal -offset indent +pkt-gen -i cxl0 -f rx +.Ed .Pp -.Nm --i cxl0 -f rx -.Pp Send a stream of fake DNS packets between two hosts with a packet -length of 128 bytes. You must set the destination MAC address for +length of 128 bytes. +You must set the destination MAC address for packets to be received by the target host. -.Pp -.Dl -.Nm --i netmap:ncxl0 -f tx -s 172.16.0.1:53 -d 172.16.1.3:53 -D 00:07:43:29:2a:e0 +.Bd -literal -offset intent +pkt-gen -i netmap:ncxl0 -f tx -s 172.16.0.1:53 -d 172.16.1.3:53 -D 00:07:43:29:2a:e0 +.Ed .Sh SEE ALSO .Xr netmap 4 , .Xr bridge 8 Modified: stable/11/tools/tools/netmap/pkt-gen.c ============================================================================== --- stable/11/tools/tools/netmap/pkt-gen.c Tue Dec 4 06:11:04 2018 (r341456) +++ stable/11/tools/tools/netmap/pkt-gen.c Tue Dec 4 07:30:02 2018 (r341457) @@ -1,6 +1,6 @@ /* * Copyright (C) 2011-2014 Matteo Landi, Luigi Rizzo. All rights reserved. - * Copyright (C) 2013-2014 Universita` di Pisa. All rights reserved. + * Copyright (C) 2013-2015 Universita` di Pisa. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -37,8 +37,6 @@ * */ -// #define TRASH_VHOST_HDR - #define _GNU_SOURCE /* for CPU_SET() */ #include #define NETMAP_WITH_LIBS @@ -49,12 +47,21 @@ #include // sysconf() #include #include /* ntohs */ +#ifndef _WIN32 #include /* sysctl */ +#endif #include /* getifaddrs */ #include #include #include #include +#include +#ifdef linux +#define IPV6_VERSION 0x60 +#define IPV6_DEFHLIM 64 +#endif +#include +#include #include @@ -62,6 +69,71 @@ #include #endif +#include "ctrs.h" + +static void usage(int); + +#ifdef _WIN32 +#define cpuset_t DWORD_PTR //uint64_t +static inline void CPU_ZERO(cpuset_t *p) +{ + *p = 0; +} + +static inline void CPU_SET(uint32_t i, cpuset_t *p) +{ + *p |= 1<< (i & 0x3f); +} + +#define pthread_setaffinity_np(a, b, c) !SetThreadAffinityMask(a, *c) //((void)a, 0) +#define TAP_CLONEDEV "/dev/tap" +#define AF_LINK 18 //defined in winsocks.h +#define CLOCK_REALTIME_PRECISE CLOCK_REALTIME +#include + +/* + * Convert an ASCII representation of an ethernet address to + * binary form. + */ +struct ether_addr * +ether_aton(const char *a) +{ + int i; + static struct ether_addr o; + unsigned int o0, o1, o2, o3, o4, o5; + + i = sscanf(a, "%x:%x:%x:%x:%x:%x", &o0, &o1, &o2, &o3, &o4, &o5); + + if (i != 6) + return (NULL); + + o.octet[0]=o0; + o.octet[1]=o1; + o.octet[2]=o2; + o.octet[3]=o3; + o.octet[4]=o4; + o.octet[5]=o5; + + return ((struct ether_addr *)&o); +} + +/* + * Convert a binary representation of an ethernet address to + * an ASCII string. + */ +char * +ether_ntoa(const struct ether_addr *n) +{ + int i; + static char a[18]; + + i = sprintf(a, "%02x:%02x:%02x:%02x:%02x:%02x", + n->octet[0], n->octet[1], n->octet[2], + n->octet[3], n->octet[4], n->octet[5]); + return (i < 17 ? NULL : (char *)&a); +} +#endif /* _WIN32 */ + #ifdef linux #define cpuset_t cpu_set_t @@ -90,12 +162,12 @@ #define cpuset_t uint64_t // XXX static inline void CPU_ZERO(cpuset_t *p) { - *p = 0; + *p = 0; } static inline void CPU_SET(uint32_t i, cpuset_t *p) { - *p |= 1<< (i & 0x3f); + *p |= 1<< (i & 0x3f); } #define pthread_setaffinity_np(a, b, c) ((void)a, 0) @@ -104,7 +176,7 @@ static inline void CPU_SET(uint32_t i, cpuset_t *p) #define IFF_PPROMISC IFF_PROMISC #include /* LLADDR */ #define clock_gettime(a,b) \ - do {struct timespec t0 = {0,0}; *(b) = t0; } while (0) + do {struct timespec t0 = {0,0}; *(b) = t0; } while (0) #endif /* __APPLE__ */ const char *default_payload="netmap pkt-gen DIRECT payload\n" @@ -114,10 +186,8 @@ const char *indirect_payload="netmap pkt-gen indirect "http://info.iet.unipi.it/~luigi/netmap/ "; int verbose = 0; +int normalize = 1; -#define SKIP_PAYLOAD 1 /* do not check payload. XXX unused */ - - #define VIRT_HDR_1 10 /* length of a base vnet-hdr */ #define VIRT_HDR_2 12 /* length of the extenede vnet-hdr */ #define VIRT_HDR_MAX VIRT_HDR_2 @@ -130,14 +200,34 @@ struct virt_header { struct pkt { struct virt_header vh; struct ether_header eh; - struct ip ip; - struct udphdr udp; - uint8_t body[MAX_BODYSIZE]; // XXX hardwired + union { + struct { + struct ip ip; + struct udphdr udp; + uint8_t body[MAX_BODYSIZE]; /* hardwired */ + } ipv4; + struct { + struct ip6_hdr ip; + struct udphdr udp; + uint8_t body[MAX_BODYSIZE]; /* hardwired */ + } ipv6; + }; } __attribute__((__packed__)); +#define PKT(p, f, af) \ + ((af) == AF_INET ? (p)->ipv4.f: (p)->ipv6.f) + struct ip_range { char *name; - uint32_t start, end; /* same as struct in_addr */ + union { + struct { + uint32_t start, end; /* same as struct in_addr */ + } ipv4; + struct { + struct in6_addr start, end; + uint8_t sgroup, egroup; + } ipv6; + }; uint16_t port0, port1; }; @@ -162,17 +252,22 @@ struct tstamp { */ struct glob_arg { + int af; /* address family AF_INET/AF_INET6 */ struct ip_range src_ip; struct ip_range dst_ip; struct mac_range dst_mac; struct mac_range src_mac; int pkt_size; + int pkt_min_size; int burst; int forever; - int npackets; /* total packets to send */ - int frags; /* fragments per packet */ + uint64_t npackets; /* total packets to send */ + int frags; /* fragments per packet */ + u_int mtu; /* size of each fragment */ int nthreads; - int cpus; + int cpus; /* cpus used for running */ + int system_cpus; /* cpus on the system */ + int options; /* testing */ #define OPT_PREFETCH 1 #define OPT_ACCESS 2 @@ -181,10 +276,10 @@ struct glob_arg { #define OPT_TS 16 /* add a timestamp */ #define OPT_INDIRECT 32 /* use indirect buffers, tx only */ #define OPT_DUMP 64 /* dump rx/tx traffic */ -#define OPT_MONITOR_TX 128 -#define OPT_MONITOR_RX 256 +#define OPT_RUBBISH 256 /* send wathever the buffers contain */ #define OPT_RANDOM_SRC 512 #define OPT_RANDOM_DST 1024 +#define OPT_PPS_STATS 2048 int dev_type; #ifndef NO_PCAP pcap_t *p; @@ -198,13 +293,18 @@ struct glob_arg { struct nm_desc *nmd; int report_interval; /* milliseconds between prints */ void *(*td_body)(void *); + int td_type; void *mmap_addr; char ifname[MAX_IFNAMELEN]; char *nmr_config; int dummy_send; int virt_header; /* send also the virt_header */ - int extra_bufs; /* goes in nr_arg3 */ char *packet_file; /* -P option */ +#define STATS_WIN 15 + int win_idx; + int64_t win[STATS_WIN]; + int wait_link; + int framing; /* #bits of framing (for bw output) */ }; enum dev_type { DEV_NONE, DEV_NETMAP, DEV_PCAP, DEV_TAP }; @@ -220,7 +320,11 @@ struct targ { int cancel; int fd; struct nm_desc *nmd; - volatile uint64_t count; + /* these ought to be volatile, but they are + * only sampled and errors should not accumulate + */ + struct my_ctrs ctr; + struct timespec tic, toc; int me; pthread_t thread; @@ -228,79 +332,166 @@ struct targ { struct pkt pkt; void *frame; + uint16_t seed[3]; + u_int frags; + u_int frag_size; }; +static __inline uint16_t +cksum_add(uint16_t sum, uint16_t a) +{ + uint16_t res; + res = sum + a; + return (res + (res < a)); +} + +static void +extract_ipv4_addr(char *name, uint32_t *addr, uint16_t *port) +{ + struct in_addr a; + char *pp; + + pp = strchr(name, ':'); + if (pp != NULL) { /* do we have ports ? */ + *pp++ = '\0'; + *port = (uint16_t)strtol(pp, NULL, 0); + } + + inet_pton(AF_INET, name, &a); + *addr = ntohl(a.s_addr); +} + +static void +extract_ipv6_addr(char *name, struct in6_addr *addr, uint16_t *port, + uint8_t *group) +{ + char *pp; + + /* + * We accept IPv6 address in the following form: + * group@[2001:DB8::1001]:port (w/ brackets and port) + * group@[2001:DB8::1] (w/ brackets and w/o port) + * group@2001:DB8::1234 (w/o brackets and w/o port) + */ + pp = strchr(name, '@'); + if (pp != NULL) { + *pp++ = '\0'; + *group = (uint8_t)strtol(name, NULL, 0); + if (*group > 7) + *group = 7; + name = pp; + } + if (name[0] == '[') + name++; + pp = strchr(name, ']'); + if (pp != NULL) + *pp++ = '\0'; + if (pp != NULL && *pp != ':') + pp = NULL; + if (pp != NULL) { /* do we have ports ? */ + *pp++ = '\0'; + *port = (uint16_t)strtol(pp, NULL, 0); + } + inet_pton(AF_INET6, name, addr); +} /* * extract the extremes from a range of ipv4 addresses. * addr_lo[-addr_hi][:port_lo[-port_hi]] */ -static void -extract_ip_range(struct ip_range *r) +static int +extract_ip_range(struct ip_range *r, int af) { - char *ap, *pp; + char *name, *ap, start[INET6_ADDRSTRLEN]; + char end[INET6_ADDRSTRLEN]; struct in_addr a; + uint32_t tmp; if (verbose) D("extract IP range from %s", r->name); - r->port0 = r->port1 = 0; - r->start = r->end = 0; + name = strdup(r->name); + if (name == NULL) { + D("strdup failed"); + usage(-1); + } /* the first - splits start/end of range */ - ap = index(r->name, '-'); /* do we have ports ? */ - if (ap) { + ap = strchr(name, '-'); + if (ap != NULL) *ap++ = '\0'; - } - /* grab the initial values (mandatory) */ - pp = index(r->name, ':'); - if (pp) { - *pp++ = '\0'; - r->port0 = r->port1 = strtol(pp, NULL, 0); - }; - inet_aton(r->name, &a); - r->start = r->end = ntohl(a.s_addr); - if (ap) { - pp = index(ap, ':'); - if (pp) { - *pp++ = '\0'; - if (*pp) - r->port1 = strtol(pp, NULL, 0); + r->port0 = 1234; /* default port */ + if (af == AF_INET6) { + r->ipv6.sgroup = 7; /* default group */ + extract_ipv6_addr(name, &r->ipv6.start, &r->port0, + &r->ipv6.sgroup); + } else + extract_ipv4_addr(name, &r->ipv4.start, &r->port0); + + r->port1 = r->port0; + if (af == AF_INET6) { + if (ap != NULL) { + r->ipv6.egroup = r->ipv6.sgroup; + extract_ipv6_addr(ap, &r->ipv6.end, &r->port1, + &r->ipv6.egroup); + } else { + r->ipv6.end = r->ipv6.start; + r->ipv6.egroup = r->ipv6.sgroup; } - if (*ap) { - inet_aton(ap, &a); - r->end = ntohl(a.s_addr); - } + } else { + if (ap != NULL) { + extract_ipv4_addr(ap, &r->ipv4.end, &r->port1); + if (r->ipv4.start > r->ipv4.end) { + tmp = r->ipv4.end; + r->ipv4.end = r->ipv4.start; + r->ipv4.start = tmp; + } + } else + r->ipv4.end = r->ipv4.start; } + if (r->port0 > r->port1) { - uint16_t tmp = r->port0; + tmp = r->port0; r->port0 = r->port1; r->port1 = tmp; } - if (r->start > r->end) { - uint32_t tmp = r->start; - r->start = r->end; - r->end = tmp; + if (af == AF_INET) { + a.s_addr = htonl(r->ipv4.start); + inet_ntop(af, &a, start, sizeof(start)); + a.s_addr = htonl(r->ipv4.end); + inet_ntop(af, &a, end, sizeof(end)); + } else { + inet_ntop(af, &r->ipv6.start, start, sizeof(start)); + inet_ntop(af, &r->ipv6.end, end, sizeof(end)); } - { - struct in_addr a; - char buf1[16]; // one ip address + if (af == AF_INET) + D("range is %s:%d to %s:%d", start, r->port0, end, r->port1); + else + D("range is %d@[%s]:%d to %d@[%s]:%d", r->ipv6.sgroup, + start, r->port0, r->ipv6.egroup, end, r->port1); - a.s_addr = htonl(r->end); - strncpy(buf1, inet_ntoa(a), sizeof(buf1)); - a.s_addr = htonl(r->start); - if (1) - D("range is %s:%d to %s:%d", - inet_ntoa(a), r->port0, buf1, r->port1); - } + free(name); + if (r->port0 != r->port1 || + (af == AF_INET && r->ipv4.start != r->ipv4.end) || + (af == AF_INET6 && + !IN6_ARE_ADDR_EQUAL(&r->ipv6.start, &r->ipv6.end))) + return (OPT_COPY); + return (0); } -static void +static int extract_mac_range(struct mac_range *r) { + struct ether_addr *e; if (verbose) D("extract MAC range from %s", r->name); - bcopy(ether_aton(r->name), &r->start, 6); - bcopy(ether_aton(r->name), &r->end, 6); + + e = ether_aton(r->name); + if (e == NULL) { + D("invalid MAC address '%s'", r->name); + return 1; + } + bcopy(e, &r->start, 6); + bcopy(e, &r->end, 6); #if 0 bcopy(targ->src_mac, eh->ether_shost, 6); p = index(targ->g->src_mac, '-'); @@ -315,6 +506,7 @@ extract_mac_range(struct mac_range *r) #endif if (verbose) D("%s starts at %s", r->name, ether_ntoa(&r->start)); + return 0; } static struct targ *targs; @@ -327,11 +519,10 @@ sigint_h(int sig) int i; (void)sig; /* UNUSED */ - D("received control-C on thread %p", pthread_self()); + D("received control-C on thread %p", (void *)pthread_self()); for (i = 0; i < global_nthreads; i++) { targs[i].cancel = 1; } - signal(SIGINT, SIG_DFL); } /* sysctl wrapper to return the number of active CPUs */ @@ -345,6 +536,12 @@ system_ncpus(void) sysctl(mib, 2, &ncpus, &len, NULL, 0); #elif defined(linux) ncpus = sysconf(_SC_NPROCESSORS_ONLN); +#elif defined(_WIN32) + { + SYSTEM_INFO sysinfo; + GetSystemInfo(&sysinfo); + ncpus = sysinfo.dwNumberOfProcessors; + } #else /* others */ ncpus = 1; #endif /* others */ @@ -375,7 +572,7 @@ system_ncpus(void) /* * parse the vale configuration in conf and put it in nmr. * Return the flag set if necessary. - * The configuration may consist of 0 to 4 numbers separated + * The configuration may consist of 1 to 4 numbers separated * by commas: #tx-slots,#rx-slots,#tx-rings,#rx-rings. * Missing numbers or zeroes stand for default values. * As an additional convenience, if exactly one number @@ -419,7 +616,7 @@ parse_nmr_config(const char* conf, struct nmreq *nmr) nmr->nr_rx_rings, nmr->nr_rx_slots); free(w); return (nmr->nr_tx_rings || nmr->nr_tx_slots || - nmr->nr_rx_rings || nmr->nr_rx_slots) ? + nmr->nr_rx_rings || nmr->nr_rx_slots) ? NM_OPEN_RING_CFG : 0; } @@ -432,7 +629,6 @@ static int source_hwaddr(const char *ifname, char *buf) { struct ifaddrs *ifaphead, *ifap; - int l = sizeof(ifap->ifa_name); if (getifaddrs(&ifaphead) != 0) { D("getifaddrs %s failed", ifname); @@ -446,7 +642,7 @@ source_hwaddr(const char *ifname, char *buf) if (!sdl || sdl->sdl_family != AF_LINK) continue; - if (strncmp(ifap->ifa_name, ifname, l) != 0) + if (strncmp(ifap->ifa_name, ifname, IFNAMSIZ) != 0) continue; mac = (uint8_t *)LLADDR(sdl); sprintf(buf, "%02x:%02x:%02x:%02x:%02x:%02x", @@ -481,19 +677,20 @@ setaffinity(pthread_t me, int i) return 0; } + /* Compute the checksum of the given ip header. */ -static uint16_t +static uint32_t checksum(const void *data, uint16_t len, uint32_t sum) { - const uint8_t *addr = data; + const uint8_t *addr = data; uint32_t i; - /* Checksum all the pairs of bytes first... */ - for (i = 0; i < (len & ~1U); i += 2) { - sum += (u_int16_t)ntohs(*((u_int16_t *)(addr + i))); - if (sum > 0xFFFF) - sum -= 0xFFFF; - } + /* Checksum all the pairs of bytes first... */ + for (i = 0; i < (len & ~1U); i += 2) { + sum += (u_int16_t)ntohs(*((u_int16_t *)(addr + i))); + if (sum > 0xFFFF) + sum -= 0xFFFF; + } /* * If there's a single byte left over, checksum it, too. * Network byte order is big-endian, so the remaining byte is @@ -507,8 +704,8 @@ checksum(const void *data, uint16_t len, uint32_t sum) return sum; } -static u_int16_t -wrapsum(u_int32_t sum) +static uint16_t +wrapsum(uint32_t sum) { sum = ~sum & 0xFFFF; return (htons(sum)); @@ -518,10 +715,11 @@ wrapsum(u_int32_t sum) * Look for consecutive ascii representations of the size of the packet. */ static void -dump_payload(char *p, int len, struct netmap_ring *ring, int cur) +dump_payload(const char *_p, int len, struct netmap_ring *ring, int cur) { char buf[128]; int i, j, i0; + const unsigned char *p = (const unsigned char *)_p; /* get the length in ASCII of the length of the packet. */ @@ -530,7 +728,7 @@ dump_payload(char *p, int len, struct netmap_ring *rin ring->slot[cur].flags, len); /* hexdump routine */ for (i = 0; i < len; ) { - memset(buf, sizeof(buf), ' '); + memset(buf, ' ', sizeof(buf)); sprintf(buf, "%5d: ", i); i0 = i; for (j=0; j < 16 && i < len; i++, j++) @@ -555,64 +753,198 @@ dump_payload(char *p, int len, struct netmap_ring *rin #define uh_sum check #endif /* linux */ -/* - * increment the addressed in the packet, - * starting from the least significant field. - * DST_IP DST_PORT SRC_IP SRC_PORT - */ static void -update_addresses(struct pkt *pkt, struct glob_arg *g) +update_ip(struct pkt *pkt, struct targ *t) { - uint32_t a; - uint16_t p; - struct ip *ip = &pkt->ip; - struct udphdr *udp = &pkt->udp; + struct glob_arg *g = t->g; + struct ip ip; + struct udphdr udp; + uint32_t oaddr, naddr; + uint16_t oport, nport; + uint16_t ip_sum, udp_sum; - do { - /* XXX for now it doesn't handle non-random src, random dst */ - if (g->options & OPT_RANDOM_SRC) { - udp->uh_sport = random(); - ip->ip_src.s_addr = random(); - } else { - p = ntohs(udp->uh_sport); - if (p < g->src_ip.port1) { /* just inc, no wrap */ - udp->uh_sport = htons(p + 1); + memcpy(&ip, &pkt->ipv4.ip, sizeof(ip)); + memcpy(&udp, &pkt->ipv4.udp, sizeof(udp)); + do { + ip_sum = udp_sum = 0; + naddr = oaddr = ntohl(ip.ip_src.s_addr); + nport = oport = ntohs(udp.uh_sport); + if (g->options & OPT_RANDOM_SRC) { + ip.ip_src.s_addr = nrand48(t->seed); + udp.uh_sport = nrand48(t->seed); + naddr = ntohl(ip.ip_src.s_addr); + nport = ntohs(udp.uh_sport); break; } - udp->uh_sport = htons(g->src_ip.port0); - - a = ntohl(ip->ip_src.s_addr); - if (a < g->src_ip.end) { /* just inc, no wrap */ - ip->ip_src.s_addr = htonl(a + 1); + if (oport < g->src_ip.port1) { + nport = oport + 1; + udp.uh_sport = htons(nport); break; } - ip->ip_src.s_addr = htonl(g->src_ip.start); - - udp->uh_sport = htons(g->src_ip.port0); + nport = g->src_ip.port0; + udp.uh_sport = htons(nport); + if (oaddr < g->src_ip.ipv4.end) { + naddr = oaddr + 1; + ip.ip_src.s_addr = htonl(naddr); + break; + } + naddr = g->src_ip.ipv4.start; + ip.ip_src.s_addr = htonl(naddr); + } while (0); + /* update checksums if needed */ + if (oaddr != naddr) { + ip_sum = cksum_add(ip_sum, ~oaddr >> 16); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Tue Dec 4 07:34:48 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EC2421327211; Tue, 4 Dec 2018 07:34:47 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 91BFA6AC38; Tue, 4 Dec 2018 07:34:47 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6F0BD221DC; Tue, 4 Dec 2018 07:34:47 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB47YlaO043013; Tue, 4 Dec 2018 07:34:47 GMT (envelope-from eugen@FreeBSD.org) Received: (from eugen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB47YlFQ043012; Tue, 4 Dec 2018 07:34:47 GMT (envelope-from eugen@FreeBSD.org) Message-Id: <201812040734.wB47YlFQ043012@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eugen set sender to eugen@FreeBSD.org using -f From: Eugene Grosbein Date: Tue, 4 Dec 2018 07:34:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r341458 - stable/11/sbin/ipfw X-SVN-Group: stable-11 X-SVN-Commit-Author: eugen X-SVN-Commit-Paths: stable/11/sbin/ipfw X-SVN-Commit-Revision: 341458 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 91BFA6AC38 X-Spamd-Result: default: False [-0.20 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.56)[-0.556,0]; NEURAL_SPAM_LONG(0.01)[0.011,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_SPAM_SHORT(0.34)[0.344,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Dec 2018 07:34:48 -0000 Author: eugen Date: Tue Dec 4 07:34:47 2018 New Revision: 341458 URL: https://svnweb.freebsd.org/changeset/base/341458 Log: MFC r340110: ipfw(8): clarify layer2 processing abilities Make it clear that ipfw action set for layer2 frames is a bit limited. PR: 59835 Reviewed by: yuripv Differential Revision: https://reviews.freebsd.org/D17719 Modified: stable/11/sbin/ipfw/ipfw.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/ipfw/ipfw.8 ============================================================================== --- stable/11/sbin/ipfw/ipfw.8 Tue Dec 4 07:30:02 2018 (r341457) +++ stable/11/sbin/ipfw/ipfw.8 Tue Dec 4 07:34:47 2018 (r341458) @@ -511,6 +511,27 @@ ipfw add 10 skipto 4000 all from any to any layer2 out .Pp (yes, at the moment there is no way to differentiate between ether_demux and bdg_forward). +.Pp +Also note that only actions +.Cm allow, +.Cm deny, +.Cm netgraph, +.Cm ngtee +and related to +.Cm dummynet +are processed for +.Cm layer2 +frames and all other actions act as if they were +.Cm allow +for such frames. +Full set of actions is supported for IP packets without +.Cm layer2 +headers only. +For example, +.Cm divert +action does not divert +.Cm layer2 +frames. .Sh SYNTAX In general, each keyword or argument must be provided as a separate command line argument, with no leading or trailing From owner-svn-src-all@freebsd.org Tue Dec 4 07:39:55 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2FBF21327527; Tue, 4 Dec 2018 07:39:55 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D74486B039; Tue, 4 Dec 2018 07:39:54 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B80C2221E1; Tue, 4 Dec 2018 07:39:54 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB47dsPq043308; Tue, 4 Dec 2018 07:39:54 GMT (envelope-from eugen@FreeBSD.org) Received: (from eugen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB47dsfC043306; Tue, 4 Dec 2018 07:39:54 GMT (envelope-from eugen@FreeBSD.org) Message-Id: <201812040739.wB47dsfC043306@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eugen set sender to eugen@FreeBSD.org using -f From: Eugene Grosbein Date: Tue, 4 Dec 2018 07:39:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341459 - in stable/12: share/man/man4 sys/netgraph X-SVN-Group: stable-12 X-SVN-Commit-Author: eugen X-SVN-Commit-Paths: in stable/12: share/man/man4 sys/netgraph X-SVN-Commit-Revision: 341459 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D74486B039 X-Spamd-Result: default: False [0.14 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.46)[-0.459,0]; NEURAL_SPAM_SHORT(0.45)[0.452,0]; NEURAL_SPAM_LONG(0.15)[0.147,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Dec 2018 07:39:55 -0000 Author: eugen Date: Tue Dec 4 07:39:54 2018 New Revision: 341459 URL: https://svnweb.freebsd.org/changeset/base/341459 Log: MFC r340135: Make ng_pptpgre(8) netgraph node be able to restore order for packets reordered in transit instead of dropping them altogether. It uses sequence numbers of PPtPGRE packets. A set of new sysctl(8) added to control this ability or disable it: net.graph.pptpgre.reorder_max (1) defines maximum length of node's private reorder queue used to keep data waiting for late packets. Zero value disables reordering. Default value 1 allows the node to restore the order for two packets swapped in transit. Greater values allow the node to deliver packets being late after more packets in sequence at cost of increased kernel memory usage. net.graph.pptpgre.reorder_timeout (1) defines time value in miliseconds used to wait for late packets. It may be useful to increase this if reordering spot is distant. Modified: stable/12/share/man/man4/ng_pptpgre.4 stable/12/sys/netgraph/ng_pptpgre.c stable/12/sys/netgraph/ng_pptpgre.h Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/ng_pptpgre.4 ============================================================================== --- stable/12/share/man/man4/ng_pptpgre.4 Tue Dec 4 07:34:47 2018 (r341458) +++ stable/12/share/man/man4/ng_pptpgre.4 Tue Dec 4 07:39:54 2018 (r341459) @@ -35,7 +35,7 @@ .\" $FreeBSD$ .\" $Whistle: ng_pptpgre.8,v 1.2 1999/12/08 00:20:53 archie Exp $ .\" -.Dd November 13, 2012 +.Dd November 4, 2018 .Dt NG_PPTPGRE 4 .Os .Sh NAME @@ -141,11 +141,33 @@ This command atomically gets and resets the node stati This node shuts down upon receipt of a .Dv NGM_SHUTDOWN control message, or when both hooks have been disconnected. +.Sh SYSCTL VARIABLES +A set of +.Xr sysctl 8 +variables controls ability of this node to deal with some +amount of packet reorder that sometimes happens in transit. +Packet reorder results in packet drops (unless the order is restored) +as PPP protocol can not deliver reordered data. +These variables are shown below together +with their default value and meaning: +.Bl -tag -width indent +.It Va net.graph.pptpgre.reorder_max: 1 +Defines maximum length of node's private reorder queue +used to keep data waiting for late packets. +Zero value disables reordering. +Default value allows the node to restore the order for two packets swapped +in transit. +Greater values allow the node to deliver packets being late after more +packets in sequence at cost of increased kernel memory usage. +.It Va net.graph.pptpgre.reorder_timeout: 1 +Defines time value in miliseconds used to wait for late packets. +.El .Sh SEE ALSO .Xr netgraph 4 , .Xr ng_ksocket 4 , .Xr ng_ppp 4 , -.Xr ngctl 8 +.Xr ngctl 8 , +.Xr sysctl 8 .Rs .%A K. Hamzeh .%A G. Pall Modified: stable/12/sys/netgraph/ng_pptpgre.c ============================================================================== --- stable/12/sys/netgraph/ng_pptpgre.c Tue Dec 4 07:34:47 2018 (r341458) +++ stable/12/sys/netgraph/ng_pptpgre.c Tue Dec 4 07:39:54 2018 (r341459) @@ -64,6 +64,7 @@ #include #include #include +#include #include #include @@ -124,6 +125,8 @@ typedef u_int64_t pptptime_t; #define PPTP_MIN_TIMEOUT (PPTP_TIME_SCALE / 83) /* 12 milliseconds */ #define PPTP_MAX_TIMEOUT (3 * PPTP_TIME_SCALE) /* 3 seconds */ +#define PPTP_REORDER_TIMEOUT 1 + /* When we receive a packet, we wait to see if there's an outgoing packet we can piggy-back the ACK off of. These parameters determine the mimimum and maxmimum length of time we're willing to wait in order to do that. @@ -142,6 +145,34 @@ typedef u_int64_t pptptime_t; #define SESSHASHSIZE 0x0020 #define SESSHASH(x) (((x) ^ ((x) >> 8)) & (SESSHASHSIZE - 1)) +SYSCTL_NODE(_net_graph, OID_AUTO, pptpgre, CTLFLAG_RW, 0, "PPTPGRE"); + +/* + * Reorder queue maximum length. Zero disables reorder. + * + * The node may keep reorder_max queue entries per session + * if reorder is enabled, plus allocate one more for short time. + * + * Be conservative in memory consumption by default. + * Lots of sessions with large queues can overflow M_NETGRAPH zone. + */ +static int reorder_max = 1; /* reorder up to two swapped packets in a row */ +SYSCTL_UINT(_net_graph_pptpgre, OID_AUTO, reorder_max, CTLFLAG_RWTUN, + &reorder_max, 0, "Reorder queue maximum length"); + +static int reorder_timeout = PPTP_REORDER_TIMEOUT; +SYSCTL_UINT(_net_graph_pptpgre, OID_AUTO, reorder_timeout, CTLFLAG_RWTUN, + &reorder_timeout, 0, "Reorder timeout is milliseconds"); + +/* Packet reorder FIFO queue */ +struct ng_pptpgre_roq { + SLIST_ENTRY(ng_pptpgre_roq) next; /* next entry of the queue */ + item_p item; /* netgraph item */ + u_int32_t seq; /* packet sequence number */ +}; +SLIST_HEAD(ng_pptpgre_roq_head, ng_pptpgre_roq); +typedef struct ng_pptpgre_roq_head roqh; + /* We keep packet retransmit and acknowlegement state in this struct */ struct ng_pptpgre_sess { node_p node; /* this node pointer */ @@ -161,6 +192,9 @@ struct ng_pptpgre_sess { u_int32_t winAck; /* seq when xmitWin will grow */ pptptime_t timeSent[PPTP_XMIT_WIN]; LIST_ENTRY(ng_pptpgre_sess) sessions; + roqh roq; /* reorder queue head */ + u_int8_t roq_len; /* reorder queue length */ + struct callout reorderTimer; /* reorder timeout handler */ }; typedef struct ng_pptpgre_sess *hpriv_p; @@ -187,13 +221,19 @@ static ng_disconnect_t ng_pptpgre_disconnect; static int ng_pptpgre_xmit(hpriv_p hpriv, item_p item); static void ng_pptpgre_start_send_ack_timer(hpriv_p hpriv); static void ng_pptpgre_start_recv_ack_timer(hpriv_p hpriv); +static void ng_pptpgre_start_reorder_timer(hpriv_p hpriv); static void ng_pptpgre_recv_ack_timeout(node_p node, hook_p hook, void *arg1, int arg2); static void ng_pptpgre_send_ack_timeout(node_p node, hook_p hook, void *arg1, int arg2); +static void ng_pptpgre_reorder_timeout(node_p node, hook_p hook, + void *arg1, int arg2); static hpriv_p ng_pptpgre_find_session(priv_p privp, u_int16_t cid); static void ng_pptpgre_reset(hpriv_p hpriv); static pptptime_t ng_pptpgre_time(void); +static void ng_pptpgre_ack(const hpriv_p hpriv); +static int ng_pptpgre_sendq(const hpriv_p hpriv, roqh *q, + const struct ng_pptpgre_roq *st); /* Parse type for struct ng_pptpgre_conf */ static const struct ng_parse_struct_field ng_pptpgre_conf_type_fields[] @@ -291,6 +331,10 @@ ng_pptpgre_constructor(node_p node) ng_callout_init(&priv->uppersess.rackTimer); priv->uppersess.node = node; + SLIST_INIT(&priv->uppersess.roq); + priv->uppersess.roq_len = 0; + ng_callout_init(&priv->uppersess.reorderTimer); + for (i = 0; i < SESSHASHSIZE; i++) LIST_INIT(&priv->sesshash[i]); @@ -348,6 +392,11 @@ ng_pptpgre_newhook(node_p node, hook_p hook, const cha hpriv->conf.cid = cid; hpriv->node = node; hpriv->hook = hook; + + SLIST_INIT(&hpriv->roq); + hpriv->roq_len = 0; + ng_callout_init(&hpriv->reorderTimer); + NG_HOOK_SET_PRIVATE(hook, hpriv); hash = SESSHASH(cid); @@ -646,7 +695,50 @@ done: return (error); } +static void +ng_pptpgre_ack(const hpriv_p hpriv) +{ + mtx_assert(&hpriv->mtx, MA_OWNED); + if (!(callout_pending(&hpriv->sackTimer))) { + /* If delayed ACK is disabled, send it now */ + if (!hpriv->conf.enableDelayedAck) { /* ack now */ + ng_pptpgre_xmit(hpriv, NULL); + /* ng_pptpgre_xmit() drops the mutex */ + return; + } + /* ack later */ + ng_pptpgre_start_send_ack_timer(hpriv); + mtx_unlock(&hpriv->mtx); + return; + } + mtx_unlock(&hpriv->mtx); +} + /* + * Delivers packets from the queue "q" to upper layers. Frees delivered + * entries with the exception of one equal to "st" that is allocated + * on caller's stack and not on the heap. + */ +static int +ng_pptpgre_sendq(const hpriv_p hpriv, roqh *q, const struct ng_pptpgre_roq *st) +{ + struct ng_pptpgre_roq *np; + struct mbuf *m; + int error = 0; + + mtx_assert(&hpriv->mtx, MA_NOTOWNED); + while (!SLIST_EMPTY(q)) { + np = SLIST_FIRST(q); + SLIST_REMOVE_HEAD(q, next); + NGI_GET_M(np->item, m); + NG_FWD_NEW_DATA(error, np->item, hpriv->hook, m); + if (np != st) + free(np, M_NETGRAPH); + } + return (error); +} + +/* * Handle an incoming packet. The packet includes the IP header. */ static int @@ -661,7 +753,14 @@ ng_pptpgre_rcvdata_lower(hook_p hook, item_p item) int error = 0; struct mbuf *m; - NGI_GET_M(item, m); + roqh sendq = SLIST_HEAD_INITIALIZER(sendq); /* send queue on stack */ + struct ng_pptpgre_roq *last = NULL; /* last packet in the sendq */ + struct ng_pptpgre_roq *np, *prev; + struct ng_pptpgre_roq temp = { { NULL }, NULL, 0 }; + long diff; + u_int32_t seq; + + m = NGI_M(item); /* Update stats */ priv->stats.recvPackets++; priv->stats.recvOctets += m->m_pkthdr.len; @@ -673,18 +772,23 @@ ng_pptpgre_rcvdata_lower(hook_p hook, item_p item) } /* Safely pull up the complete IP+GRE headers */ - if (m->m_len < sizeof(*ip) + sizeof(*gre) - && (m = m_pullup(m, sizeof(*ip) + sizeof(*gre))) == NULL) { - priv->stats.memoryFailures++; - ERROUT(ENOBUFS); + if (m->m_len < sizeof(*ip) + sizeof(*gre)) { + if ((m = m_pullup(m, sizeof(*ip) + sizeof(*gre))) == NULL) { + priv->stats.memoryFailures++; + _NGI_M(item) = NULL; + ERROUT(ENOBUFS); + } + _NGI_M(item) = m; } ip = mtod(m, const struct ip *); iphlen = ip->ip_hl << 2; if (m->m_len < iphlen + sizeof(*gre)) { if ((m = m_pullup(m, iphlen + sizeof(*gre))) == NULL) { priv->stats.memoryFailures++; + _NGI_M(item) = NULL; ERROUT(ENOBUFS); } + _NGI_M(item) = m; ip = mtod(m, const struct ip *); } gre = (const struct greheader *)((const u_char *)ip + iphlen); @@ -696,8 +800,10 @@ ng_pptpgre_rcvdata_lower(hook_p hook, item_p item) if (m->m_len < iphlen + grelen) { if ((m = m_pullup(m, iphlen + grelen)) == NULL) { priv->stats.memoryFailures++; + _NGI_M(item) = NULL; ERROUT(ENOBUFS); } + _NGI_M(item) = m; ip = mtod(m, const struct ip *); gre = (const struct greheader *)((const u_char *)ip + iphlen); } @@ -726,7 +832,6 @@ ng_pptpgre_rcvdata_lower(hook_p hook, item_p item) const u_int32_t ack = be32dec(&gre->data[gre->hasSeq]); const int index = ack - hpriv->recvAck - 1; long sample; - long diff; /* Sanity check ack value */ if (PPTP_SEQ_DIFF(ack, hpriv->xmitSeq) > 0) { @@ -773,54 +878,178 @@ ng_pptpgre_rcvdata_lower(hook_p hook, item_p item) badAck: /* See if frame contains any data */ - if (gre->hasSeq) { - const u_int32_t seq = be32dec(&gre->data[0]); + if (!gre->hasSeq) { /* no data to deliver */ + priv->stats.recvLoneAcks++; + mtx_unlock(&hpriv->mtx); + ERROUT(0); + } - /* Sanity check sequence number */ - if (PPTP_SEQ_DIFF(seq, hpriv->recvSeq) <= 0) { - if (seq == hpriv->recvSeq) - priv->stats.recvDuplicates++; - else - priv->stats.recvOutOfOrder++; + seq = be32dec(&gre->data[0]); + + diff = PPTP_SEQ_DIFF(seq, hpriv->recvSeq); + if (diff <= 0) { /* late or duplicate packet */ + if (diff < 0 && reorder_max == 0) /* reorder disabled */ + priv->stats.recvOutOfOrder++; /* late */ + else + priv->stats.recvDuplicates++; /* duplicate */ + mtx_unlock(&hpriv->mtx); + ERROUT(EINVAL); + } + + /* Trim mbuf down to internal payload */ + m_adj(m, iphlen + grelen); + if (extralen > 0) + m_adj(m, -extralen); + +#define INIT_SENDQ(t) do { \ + t.item = item; \ + t.seq = seq; \ + SLIST_INSERT_HEAD(&sendq, &t, next); \ + last = &t; \ + hpriv->recvSeq = seq; \ + goto deliver; \ + } while(0) + + if (diff == 1) + /* the packet came in order, place it at the start of sendq */ + INIT_SENDQ(temp); + + /* The packet came too early, try to enqueue it. + * + * Check for duplicate in the queue. After this loop, "prev" will be + * NULL if the packet should become new head of the queue, + * or else it should be inserted after the "prev". + */ + prev = SLIST_FIRST(&hpriv->roq); + SLIST_FOREACH(np, &hpriv->roq, next) { + diff = PPTP_SEQ_DIFF(np->seq, seq); + if (diff == 0) { /* do not add duplicate, drop it */ + priv->stats.recvDuplicates++; mtx_unlock(&hpriv->mtx); ERROUT(EINVAL); } - hpriv->recvSeq = seq; + if (diff > 0) { /* we found newer packet */ + if (np == prev) /* that is the head of the queue */ + prev = NULL; /* put current packet to the head */ + break; + } + prev = np; + } - /* We need to acknowledge this packet; do it soon... */ - if (!(callout_pending(&hpriv->sackTimer))) { - /* If delayed ACK is disabled, send it now */ - if (!hpriv->conf.enableDelayedAck) { /* ack now */ - ng_pptpgre_xmit(hpriv, NULL); - /* ng_pptpgre_xmit() drops the mutex */ - } else { /* ack later */ - ng_pptpgre_start_send_ack_timer(hpriv); - mtx_unlock(&hpriv->mtx); - } - } else - mtx_unlock(&hpriv->mtx); + priv->stats.recvOutOfOrder++; /* duplicate not found */ + if (hpriv->roq_len < reorder_max) + goto enqueue; /* reorder enabled and there is a room */ - /* Trim mbuf down to internal payload */ - m_adj(m, iphlen + grelen); - if (extralen > 0) - m_adj(m, -extralen); + /* + * There is no room in the queue or reorder disabled. + * + * It the latter case, we may still have non-empty reorder queue + * if reorder was disabled in process of reordering. + * Then we correctly deliver the queue without growing it. + * + * In both cases, no malloc()'s until the queue is shortened. + */ + priv->stats.recvReorderOverflow++; + if (prev == NULL) { /* new packet goes before the head */ + INIT_SENDQ(temp); /* of reorder queue, so put it to sendq */ + } +#undef INIT_SENDQ - mtx_assert(&hpriv->mtx, MA_NOTOWNED); + /* + * Current packet goes after the head of reorder queue. + * Move the head to sendq to make room for current packet. + */ + np = SLIST_FIRST(&hpriv->roq); + if (prev == np) + prev = NULL; + SLIST_REMOVE_HEAD(&hpriv->roq, next); + hpriv->roq_len--; /* we are allowed to use malloc() now */ + SLIST_INSERT_HEAD(&sendq, np, next); + last = np; + hpriv->recvSeq = np->seq; - /* Deliver frame to upper layers */ +enqueue: + np = malloc(sizeof(*np), M_NETGRAPH, M_NOWAIT | M_ZERO); + if (np == NULL) { + priv->stats.memoryFailures++; + /* + * Emergency: we cannot save new data. + * Flush the queue delivering all queued packets preceeding + * current one despite of gaps. + */ + while (!SLIST_EMPTY(&hpriv->roq)) { + np = SLIST_FIRST(&hpriv->roq); + if (np->seq > seq) + break; + SLIST_REMOVE_HEAD(&hpriv->roq, next); + hpriv->roq_len--; + if (last == NULL) + SLIST_INSERT_HEAD(&sendq, np, next); + else + SLIST_INSERT_AFTER(last, np, next); + last = np; + } + + /* + * Pretend we got all packets till the current one + * and acknowledge it. + */ + hpriv->recvSeq = seq; + ng_pptpgre_ack(hpriv); /* drops lock */ + ng_pptpgre_sendq(hpriv, &sendq, &temp); NG_FWD_NEW_DATA(error, item, hpriv->hook, m); + ERROUT(ENOMEM); + } + + /* Add current (early) packet to the reorder queue. */ + np->item = item; + np->seq = seq; + if (prev == NULL) + SLIST_INSERT_HEAD(&hpriv->roq, np, next); + else + SLIST_INSERT_AFTER(prev, np, next); + hpriv->roq_len++; + +deliver: + /* Look if we have some packets in sequence after sendq. */ + while (!SLIST_EMPTY(&hpriv->roq)) { + np = SLIST_FIRST(&hpriv->roq); + if (PPTP_SEQ_DIFF(np->seq, hpriv->recvSeq) > 1) + break; /* the gap in the sequence */ + + /* "np" is in sequence, move it to the sendq. */ + SLIST_REMOVE_HEAD(&hpriv->roq, next); + hpriv->roq_len--; + hpriv->recvSeq = np->seq; + + if (last == NULL) + SLIST_INSERT_HEAD(&sendq, np, next); + else + SLIST_INSERT_AFTER(last, np, next); + last = np; + } + + if (SLIST_EMPTY(&hpriv->roq)) { + if (callout_pending(&hpriv->reorderTimer)) + ng_uncallout(&hpriv->reorderTimer, hpriv->node); } else { - priv->stats.recvLoneAcks++; + if (!callout_pending(&hpriv->reorderTimer)) + ng_pptpgre_start_reorder_timer(hpriv); + } + + if (SLIST_EMPTY(&sendq)) { + /* Current packet has been queued, nothing to free/deliver. */ mtx_unlock(&hpriv->mtx); - NG_FREE_ITEM(item); - NG_FREE_M(m); /* no data to deliver */ + return (error); } + /* We need to acknowledge last packet; do it soon... */ + ng_pptpgre_ack(hpriv); /* drops lock */ + ng_pptpgre_sendq(hpriv, &sendq, &temp); return (error); done: NG_FREE_ITEM(item); - NG_FREE_M(m); return (error); } @@ -916,6 +1145,68 @@ ng_pptpgre_send_ack_timeout(node_p node, hook_p hook, mtx_assert(&hpriv->mtx, MA_NOTOWNED); } +/* + * Start a timer for the reorder queue. This assumes the timer is not + * already running. + */ +static void +ng_pptpgre_start_reorder_timer(hpriv_p hpriv) +{ + int ticks; + + /* Be conservative: timeout can happen up to 1 tick early */ + ticks = (((reorder_timeout * hz) + 1000 - 1) / 1000) + 1; + ng_callout(&hpriv->reorderTimer, hpriv->node, hpriv->hook, + ticks, ng_pptpgre_reorder_timeout, hpriv, 0); +} + +/* + * The oldest packet spent too much time in the reorder queue. + * Deliver it and next packets in sequence, if any. + */ +static void +ng_pptpgre_reorder_timeout(node_p node, hook_p hook, void *arg1, int arg2) +{ + const priv_p priv = NG_NODE_PRIVATE(node); + const hpriv_p hpriv = arg1; + roqh sendq = SLIST_HEAD_INITIALIZER(sendq); + struct ng_pptpgre_roq *np, *last = NULL; + + priv->stats.recvReorderTimeouts++; + mtx_lock(&hpriv->mtx); + if (SLIST_EMPTY(&hpriv->roq)) { /* should not happen */ + mtx_unlock(&hpriv->mtx); + return; + } + + last = np = SLIST_FIRST(&hpriv->roq); + hpriv->roq_len--; + SLIST_REMOVE_HEAD(&hpriv->roq, next); + SLIST_INSERT_HEAD(&sendq, np, next); + + /* Look if we have more packets in sequence */ + while (!SLIST_EMPTY(&hpriv->roq)) { + np = SLIST_FIRST(&hpriv->roq); + if (PPTP_SEQ_DIFF(np->seq, last->seq) > 1) + break; /* the gap in the sequence */ + + /* Next packet is in sequence, move it to the sendq. */ + hpriv->roq_len--; + SLIST_REMOVE_HEAD(&hpriv->roq, next); + SLIST_INSERT_AFTER(last, np, next); + last = np; + } + + hpriv->recvSeq = last->seq; + if (!SLIST_EMPTY(&hpriv->roq)) + ng_pptpgre_start_reorder_timer(hpriv); + + /* We need to acknowledge last packet; do it soon... */ + ng_pptpgre_ack(hpriv); /* drops lock */ + ng_pptpgre_sendq(hpriv, &sendq, NULL); + mtx_assert(&hpriv->mtx, MA_NOTOWNED); +} + /************************************************************************* MISC FUNCTIONS *************************************************************************/ @@ -943,6 +1234,8 @@ ng_pptpgre_find_session(priv_p privp, u_int16_t cid) static void ng_pptpgre_reset(hpriv_p hpriv) { + struct ng_pptpgre_roq *np; + /* Reset adaptive timeout state */ hpriv->ato = PPTP_MAX_TIMEOUT; hpriv->rtt = PPTP_TIME_SCALE / 10; @@ -965,6 +1258,16 @@ ng_pptpgre_reset(hpriv_p hpriv) /* Stop timers */ ng_uncallout(&hpriv->sackTimer, hpriv->node); ng_uncallout(&hpriv->rackTimer, hpriv->node); + ng_uncallout(&hpriv->reorderTimer, hpriv->node); + + /* Clear reorder queue */ + while (!SLIST_EMPTY(&hpriv->roq)) { + np = SLIST_FIRST(&hpriv->roq); + SLIST_REMOVE_HEAD(&hpriv->roq, next); + NG_FREE_ITEM(np->item); + free(np, M_NETGRAPH); + } + hpriv->roq_len = 0; } /* Modified: stable/12/sys/netgraph/ng_pptpgre.h ============================================================================== --- stable/12/sys/netgraph/ng_pptpgre.h Tue Dec 4 07:34:47 2018 (r341458) +++ stable/12/sys/netgraph/ng_pptpgre.h Tue Dec 4 07:39:54 2018 (r341459) @@ -100,6 +100,10 @@ struct ng_pptpgre_stats { u_int32_t recvLoneAcks; /* ack-only packets rec'd */ u_int32_t recvAckTimeouts; /* times peer failed to ack in time */ u_int32_t memoryFailures; /* times we couldn't allocate memory */ + u_int32_t recvReorderOverflow; /* times we dropped GRE packet + due to overflow of reorder queue */ + u_int32_t recvReorderTimeouts; /* times we flushed reorder queue + due to timeout */ }; /* Keep this in sync with the above structure definition */ @@ -120,6 +124,8 @@ struct ng_pptpgre_stats { { "recvLoneAcks", &ng_parse_uint32_type }, \ { "recvAckTimeouts", &ng_parse_uint32_type }, \ { "memoryFailures", &ng_parse_uint32_type }, \ + { "recvReorderOverflow", &ng_parse_uint32_type}, \ + { "recvReorderTimeouts", &ng_parse_uint32_type}, \ { NULL } \ } From owner-svn-src-all@freebsd.org Tue Dec 4 07:48:45 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C9B9A1327E6E; Tue, 4 Dec 2018 07:48:44 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 770FF6B848; Tue, 4 Dec 2018 07:48:44 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 57E8722388; Tue, 4 Dec 2018 07:48:44 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB47miHE048355; Tue, 4 Dec 2018 07:48:44 GMT (envelope-from eugen@FreeBSD.org) Received: (from eugen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB47mhmQ048353; Tue, 4 Dec 2018 07:48:43 GMT (envelope-from eugen@FreeBSD.org) Message-Id: <201812040748.wB47mhmQ048353@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eugen set sender to eugen@FreeBSD.org using -f From: Eugene Grosbein Date: Tue, 4 Dec 2018 07:48:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r341460 - in stable/11: share/man/man4 sys/netgraph X-SVN-Group: stable-11 X-SVN-Commit-Author: eugen X-SVN-Commit-Paths: in stable/11: share/man/man4 sys/netgraph X-SVN-Commit-Revision: 341460 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 770FF6B848 X-Spamd-Result: default: False [0.14 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.46)[-0.459,0]; NEURAL_SPAM_LONG(0.15)[0.147,0]; NEURAL_SPAM_SHORT(0.45)[0.452,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Dec 2018 07:48:45 -0000 Author: eugen Date: Tue Dec 4 07:48:43 2018 New Revision: 341460 URL: https://svnweb.freebsd.org/changeset/base/341460 Log: MFC r340135: Make ng_pptpgre(8) netgraph node be able to restore order for packets reordered in transit instead of dropping them altogether. It uses sequence numbers of PPtPGRE packets. A set of new sysctl(8) added to control this ability or disable it: net.graph.pptpgre.reorder_max (1) defines maximum length of node's private reorder queue used to keep data waiting for late packets. Zero value disables reordering. Default value 1 allows the node to restore the order for two packets swapped in transit. Greater values allow the node to deliver packets being late after more packets in sequence at cost of increased kernel memory usage. net.graph.pptpgre.reorder_timeout (1) defines time value in miliseconds used to wait for late packets. It may be useful to increase this if reordering spot is distant. Modified: stable/11/share/man/man4/ng_pptpgre.4 stable/11/sys/netgraph/ng_pptpgre.c stable/11/sys/netgraph/ng_pptpgre.h Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/ng_pptpgre.4 ============================================================================== --- stable/11/share/man/man4/ng_pptpgre.4 Tue Dec 4 07:39:54 2018 (r341459) +++ stable/11/share/man/man4/ng_pptpgre.4 Tue Dec 4 07:48:43 2018 (r341460) @@ -35,7 +35,7 @@ .\" $FreeBSD$ .\" $Whistle: ng_pptpgre.8,v 1.2 1999/12/08 00:20:53 archie Exp $ .\" -.Dd November 13, 2012 +.Dd November 4, 2018 .Dt NG_PPTPGRE 4 .Os .Sh NAME @@ -141,11 +141,33 @@ This command atomically gets and resets the node stati This node shuts down upon receipt of a .Dv NGM_SHUTDOWN control message, or when both hooks have been disconnected. +.Sh SYSCTL VARIABLES +A set of +.Xr sysctl 8 +variables controls ability of this node to deal with some +amount of packet reorder that sometimes happens in transit. +Packet reorder results in packet drops (unless the order is restored) +as PPP protocol can not deliver reordered data. +These variables are shown below together +with their default value and meaning: +.Bl -tag -width indent +.It Va net.graph.pptpgre.reorder_max: 1 +Defines maximum length of node's private reorder queue +used to keep data waiting for late packets. +Zero value disables reordering. +Default value allows the node to restore the order for two packets swapped +in transit. +Greater values allow the node to deliver packets being late after more +packets in sequence at cost of increased kernel memory usage. +.It Va net.graph.pptpgre.reorder_timeout: 1 +Defines time value in miliseconds used to wait for late packets. +.El .Sh SEE ALSO .Xr netgraph 4 , .Xr ng_ksocket 4 , .Xr ng_ppp 4 , -.Xr ngctl 8 +.Xr ngctl 8 , +.Xr sysctl 8 .Rs .%A K. Hamzeh .%A G. Pall Modified: stable/11/sys/netgraph/ng_pptpgre.c ============================================================================== --- stable/11/sys/netgraph/ng_pptpgre.c Tue Dec 4 07:39:54 2018 (r341459) +++ stable/11/sys/netgraph/ng_pptpgre.c Tue Dec 4 07:48:43 2018 (r341460) @@ -64,6 +64,7 @@ #include #include #include +#include #include #include @@ -124,6 +125,8 @@ typedef u_int64_t pptptime_t; #define PPTP_MIN_TIMEOUT (PPTP_TIME_SCALE / 83) /* 12 milliseconds */ #define PPTP_MAX_TIMEOUT (3 * PPTP_TIME_SCALE) /* 3 seconds */ +#define PPTP_REORDER_TIMEOUT 1 + /* When we receive a packet, we wait to see if there's an outgoing packet we can piggy-back the ACK off of. These parameters determine the mimimum and maxmimum length of time we're willing to wait in order to do that. @@ -142,6 +145,34 @@ typedef u_int64_t pptptime_t; #define SESSHASHSIZE 0x0020 #define SESSHASH(x) (((x) ^ ((x) >> 8)) & (SESSHASHSIZE - 1)) +SYSCTL_NODE(_net_graph, OID_AUTO, pptpgre, CTLFLAG_RW, 0, "PPTPGRE"); + +/* + * Reorder queue maximum length. Zero disables reorder. + * + * The node may keep reorder_max queue entries per session + * if reorder is enabled, plus allocate one more for short time. + * + * Be conservative in memory consumption by default. + * Lots of sessions with large queues can overflow M_NETGRAPH zone. + */ +static int reorder_max = 1; /* reorder up to two swapped packets in a row */ +SYSCTL_UINT(_net_graph_pptpgre, OID_AUTO, reorder_max, CTLFLAG_RWTUN, + &reorder_max, 0, "Reorder queue maximum length"); + +static int reorder_timeout = PPTP_REORDER_TIMEOUT; +SYSCTL_UINT(_net_graph_pptpgre, OID_AUTO, reorder_timeout, CTLFLAG_RWTUN, + &reorder_timeout, 0, "Reorder timeout is milliseconds"); + +/* Packet reorder FIFO queue */ +struct ng_pptpgre_roq { + SLIST_ENTRY(ng_pptpgre_roq) next; /* next entry of the queue */ + item_p item; /* netgraph item */ + u_int32_t seq; /* packet sequence number */ +}; +SLIST_HEAD(ng_pptpgre_roq_head, ng_pptpgre_roq); +typedef struct ng_pptpgre_roq_head roqh; + /* We keep packet retransmit and acknowlegement state in this struct */ struct ng_pptpgre_sess { node_p node; /* this node pointer */ @@ -161,6 +192,9 @@ struct ng_pptpgre_sess { u_int32_t winAck; /* seq when xmitWin will grow */ pptptime_t timeSent[PPTP_XMIT_WIN]; LIST_ENTRY(ng_pptpgre_sess) sessions; + roqh roq; /* reorder queue head */ + u_int8_t roq_len; /* reorder queue length */ + struct callout reorderTimer; /* reorder timeout handler */ }; typedef struct ng_pptpgre_sess *hpriv_p; @@ -187,13 +221,19 @@ static ng_disconnect_t ng_pptpgre_disconnect; static int ng_pptpgre_xmit(hpriv_p hpriv, item_p item); static void ng_pptpgre_start_send_ack_timer(hpriv_p hpriv); static void ng_pptpgre_start_recv_ack_timer(hpriv_p hpriv); +static void ng_pptpgre_start_reorder_timer(hpriv_p hpriv); static void ng_pptpgre_recv_ack_timeout(node_p node, hook_p hook, void *arg1, int arg2); static void ng_pptpgre_send_ack_timeout(node_p node, hook_p hook, void *arg1, int arg2); +static void ng_pptpgre_reorder_timeout(node_p node, hook_p hook, + void *arg1, int arg2); static hpriv_p ng_pptpgre_find_session(priv_p privp, u_int16_t cid); static void ng_pptpgre_reset(hpriv_p hpriv); static pptptime_t ng_pptpgre_time(void); +static void ng_pptpgre_ack(const hpriv_p hpriv); +static int ng_pptpgre_sendq(const hpriv_p hpriv, roqh *q, + const struct ng_pptpgre_roq *st); /* Parse type for struct ng_pptpgre_conf */ static const struct ng_parse_struct_field ng_pptpgre_conf_type_fields[] @@ -291,6 +331,10 @@ ng_pptpgre_constructor(node_p node) ng_callout_init(&priv->uppersess.rackTimer); priv->uppersess.node = node; + SLIST_INIT(&priv->uppersess.roq); + priv->uppersess.roq_len = 0; + ng_callout_init(&priv->uppersess.reorderTimer); + for (i = 0; i < SESSHASHSIZE; i++) LIST_INIT(&priv->sesshash[i]); @@ -348,6 +392,11 @@ ng_pptpgre_newhook(node_p node, hook_p hook, const cha hpriv->conf.cid = cid; hpriv->node = node; hpriv->hook = hook; + + SLIST_INIT(&hpriv->roq); + hpriv->roq_len = 0; + ng_callout_init(&hpriv->reorderTimer); + NG_HOOK_SET_PRIVATE(hook, hpriv); hash = SESSHASH(cid); @@ -646,7 +695,50 @@ done: return (error); } +static void +ng_pptpgre_ack(const hpriv_p hpriv) +{ + mtx_assert(&hpriv->mtx, MA_OWNED); + if (!(callout_pending(&hpriv->sackTimer))) { + /* If delayed ACK is disabled, send it now */ + if (!hpriv->conf.enableDelayedAck) { /* ack now */ + ng_pptpgre_xmit(hpriv, NULL); + /* ng_pptpgre_xmit() drops the mutex */ + return; + } + /* ack later */ + ng_pptpgre_start_send_ack_timer(hpriv); + mtx_unlock(&hpriv->mtx); + return; + } + mtx_unlock(&hpriv->mtx); +} + /* + * Delivers packets from the queue "q" to upper layers. Frees delivered + * entries with the exception of one equal to "st" that is allocated + * on caller's stack and not on the heap. + */ +static int +ng_pptpgre_sendq(const hpriv_p hpriv, roqh *q, const struct ng_pptpgre_roq *st) +{ + struct ng_pptpgre_roq *np; + struct mbuf *m; + int error = 0; + + mtx_assert(&hpriv->mtx, MA_NOTOWNED); + while (!SLIST_EMPTY(q)) { + np = SLIST_FIRST(q); + SLIST_REMOVE_HEAD(q, next); + NGI_GET_M(np->item, m); + NG_FWD_NEW_DATA(error, np->item, hpriv->hook, m); + if (np != st) + free(np, M_NETGRAPH); + } + return (error); +} + +/* * Handle an incoming packet. The packet includes the IP header. */ static int @@ -661,7 +753,14 @@ ng_pptpgre_rcvdata_lower(hook_p hook, item_p item) int error = 0; struct mbuf *m; - NGI_GET_M(item, m); + roqh sendq = SLIST_HEAD_INITIALIZER(sendq); /* send queue on stack */ + struct ng_pptpgre_roq *last = NULL; /* last packet in the sendq */ + struct ng_pptpgre_roq *np, *prev; + struct ng_pptpgre_roq temp = { { NULL }, NULL, 0 }; + long diff; + u_int32_t seq; + + m = NGI_M(item); /* Update stats */ priv->stats.recvPackets++; priv->stats.recvOctets += m->m_pkthdr.len; @@ -673,18 +772,23 @@ ng_pptpgre_rcvdata_lower(hook_p hook, item_p item) } /* Safely pull up the complete IP+GRE headers */ - if (m->m_len < sizeof(*ip) + sizeof(*gre) - && (m = m_pullup(m, sizeof(*ip) + sizeof(*gre))) == NULL) { - priv->stats.memoryFailures++; - ERROUT(ENOBUFS); + if (m->m_len < sizeof(*ip) + sizeof(*gre)) { + if ((m = m_pullup(m, sizeof(*ip) + sizeof(*gre))) == NULL) { + priv->stats.memoryFailures++; + _NGI_M(item) = NULL; + ERROUT(ENOBUFS); + } + _NGI_M(item) = m; } ip = mtod(m, const struct ip *); iphlen = ip->ip_hl << 2; if (m->m_len < iphlen + sizeof(*gre)) { if ((m = m_pullup(m, iphlen + sizeof(*gre))) == NULL) { priv->stats.memoryFailures++; + _NGI_M(item) = NULL; ERROUT(ENOBUFS); } + _NGI_M(item) = m; ip = mtod(m, const struct ip *); } gre = (const struct greheader *)((const u_char *)ip + iphlen); @@ -696,8 +800,10 @@ ng_pptpgre_rcvdata_lower(hook_p hook, item_p item) if (m->m_len < iphlen + grelen) { if ((m = m_pullup(m, iphlen + grelen)) == NULL) { priv->stats.memoryFailures++; + _NGI_M(item) = NULL; ERROUT(ENOBUFS); } + _NGI_M(item) = m; ip = mtod(m, const struct ip *); gre = (const struct greheader *)((const u_char *)ip + iphlen); } @@ -726,7 +832,6 @@ ng_pptpgre_rcvdata_lower(hook_p hook, item_p item) const u_int32_t ack = be32dec(&gre->data[gre->hasSeq]); const int index = ack - hpriv->recvAck - 1; long sample; - long diff; /* Sanity check ack value */ if (PPTP_SEQ_DIFF(ack, hpriv->xmitSeq) > 0) { @@ -773,54 +878,178 @@ ng_pptpgre_rcvdata_lower(hook_p hook, item_p item) badAck: /* See if frame contains any data */ - if (gre->hasSeq) { - const u_int32_t seq = be32dec(&gre->data[0]); + if (!gre->hasSeq) { /* no data to deliver */ + priv->stats.recvLoneAcks++; + mtx_unlock(&hpriv->mtx); + ERROUT(0); + } - /* Sanity check sequence number */ - if (PPTP_SEQ_DIFF(seq, hpriv->recvSeq) <= 0) { - if (seq == hpriv->recvSeq) - priv->stats.recvDuplicates++; - else - priv->stats.recvOutOfOrder++; + seq = be32dec(&gre->data[0]); + + diff = PPTP_SEQ_DIFF(seq, hpriv->recvSeq); + if (diff <= 0) { /* late or duplicate packet */ + if (diff < 0 && reorder_max == 0) /* reorder disabled */ + priv->stats.recvOutOfOrder++; /* late */ + else + priv->stats.recvDuplicates++; /* duplicate */ + mtx_unlock(&hpriv->mtx); + ERROUT(EINVAL); + } + + /* Trim mbuf down to internal payload */ + m_adj(m, iphlen + grelen); + if (extralen > 0) + m_adj(m, -extralen); + +#define INIT_SENDQ(t) do { \ + t.item = item; \ + t.seq = seq; \ + SLIST_INSERT_HEAD(&sendq, &t, next); \ + last = &t; \ + hpriv->recvSeq = seq; \ + goto deliver; \ + } while(0) + + if (diff == 1) + /* the packet came in order, place it at the start of sendq */ + INIT_SENDQ(temp); + + /* The packet came too early, try to enqueue it. + * + * Check for duplicate in the queue. After this loop, "prev" will be + * NULL if the packet should become new head of the queue, + * or else it should be inserted after the "prev". + */ + prev = SLIST_FIRST(&hpriv->roq); + SLIST_FOREACH(np, &hpriv->roq, next) { + diff = PPTP_SEQ_DIFF(np->seq, seq); + if (diff == 0) { /* do not add duplicate, drop it */ + priv->stats.recvDuplicates++; mtx_unlock(&hpriv->mtx); ERROUT(EINVAL); } - hpriv->recvSeq = seq; + if (diff > 0) { /* we found newer packet */ + if (np == prev) /* that is the head of the queue */ + prev = NULL; /* put current packet to the head */ + break; + } + prev = np; + } - /* We need to acknowledge this packet; do it soon... */ - if (!(callout_pending(&hpriv->sackTimer))) { - /* If delayed ACK is disabled, send it now */ - if (!hpriv->conf.enableDelayedAck) { /* ack now */ - ng_pptpgre_xmit(hpriv, NULL); - /* ng_pptpgre_xmit() drops the mutex */ - } else { /* ack later */ - ng_pptpgre_start_send_ack_timer(hpriv); - mtx_unlock(&hpriv->mtx); - } - } else - mtx_unlock(&hpriv->mtx); + priv->stats.recvOutOfOrder++; /* duplicate not found */ + if (hpriv->roq_len < reorder_max) + goto enqueue; /* reorder enabled and there is a room */ - /* Trim mbuf down to internal payload */ - m_adj(m, iphlen + grelen); - if (extralen > 0) - m_adj(m, -extralen); + /* + * There is no room in the queue or reorder disabled. + * + * It the latter case, we may still have non-empty reorder queue + * if reorder was disabled in process of reordering. + * Then we correctly deliver the queue without growing it. + * + * In both cases, no malloc()'s until the queue is shortened. + */ + priv->stats.recvReorderOverflow++; + if (prev == NULL) { /* new packet goes before the head */ + INIT_SENDQ(temp); /* of reorder queue, so put it to sendq */ + } +#undef INIT_SENDQ - mtx_assert(&hpriv->mtx, MA_NOTOWNED); + /* + * Current packet goes after the head of reorder queue. + * Move the head to sendq to make room for current packet. + */ + np = SLIST_FIRST(&hpriv->roq); + if (prev == np) + prev = NULL; + SLIST_REMOVE_HEAD(&hpriv->roq, next); + hpriv->roq_len--; /* we are allowed to use malloc() now */ + SLIST_INSERT_HEAD(&sendq, np, next); + last = np; + hpriv->recvSeq = np->seq; - /* Deliver frame to upper layers */ +enqueue: + np = malloc(sizeof(*np), M_NETGRAPH, M_NOWAIT | M_ZERO); + if (np == NULL) { + priv->stats.memoryFailures++; + /* + * Emergency: we cannot save new data. + * Flush the queue delivering all queued packets preceeding + * current one despite of gaps. + */ + while (!SLIST_EMPTY(&hpriv->roq)) { + np = SLIST_FIRST(&hpriv->roq); + if (np->seq > seq) + break; + SLIST_REMOVE_HEAD(&hpriv->roq, next); + hpriv->roq_len--; + if (last == NULL) + SLIST_INSERT_HEAD(&sendq, np, next); + else + SLIST_INSERT_AFTER(last, np, next); + last = np; + } + + /* + * Pretend we got all packets till the current one + * and acknowledge it. + */ + hpriv->recvSeq = seq; + ng_pptpgre_ack(hpriv); /* drops lock */ + ng_pptpgre_sendq(hpriv, &sendq, &temp); NG_FWD_NEW_DATA(error, item, hpriv->hook, m); + ERROUT(ENOMEM); + } + + /* Add current (early) packet to the reorder queue. */ + np->item = item; + np->seq = seq; + if (prev == NULL) + SLIST_INSERT_HEAD(&hpriv->roq, np, next); + else + SLIST_INSERT_AFTER(prev, np, next); + hpriv->roq_len++; + +deliver: + /* Look if we have some packets in sequence after sendq. */ + while (!SLIST_EMPTY(&hpriv->roq)) { + np = SLIST_FIRST(&hpriv->roq); + if (PPTP_SEQ_DIFF(np->seq, hpriv->recvSeq) > 1) + break; /* the gap in the sequence */ + + /* "np" is in sequence, move it to the sendq. */ + SLIST_REMOVE_HEAD(&hpriv->roq, next); + hpriv->roq_len--; + hpriv->recvSeq = np->seq; + + if (last == NULL) + SLIST_INSERT_HEAD(&sendq, np, next); + else + SLIST_INSERT_AFTER(last, np, next); + last = np; + } + + if (SLIST_EMPTY(&hpriv->roq)) { + if (callout_pending(&hpriv->reorderTimer)) + ng_uncallout(&hpriv->reorderTimer, hpriv->node); } else { - priv->stats.recvLoneAcks++; + if (!callout_pending(&hpriv->reorderTimer)) + ng_pptpgre_start_reorder_timer(hpriv); + } + + if (SLIST_EMPTY(&sendq)) { + /* Current packet has been queued, nothing to free/deliver. */ mtx_unlock(&hpriv->mtx); - NG_FREE_ITEM(item); - NG_FREE_M(m); /* no data to deliver */ + return (error); } + /* We need to acknowledge last packet; do it soon... */ + ng_pptpgre_ack(hpriv); /* drops lock */ + ng_pptpgre_sendq(hpriv, &sendq, &temp); return (error); done: NG_FREE_ITEM(item); - NG_FREE_M(m); return (error); } @@ -916,6 +1145,68 @@ ng_pptpgre_send_ack_timeout(node_p node, hook_p hook, mtx_assert(&hpriv->mtx, MA_NOTOWNED); } +/* + * Start a timer for the reorder queue. This assumes the timer is not + * already running. + */ +static void +ng_pptpgre_start_reorder_timer(hpriv_p hpriv) +{ + int ticks; + + /* Be conservative: timeout can happen up to 1 tick early */ + ticks = (((reorder_timeout * hz) + 1000 - 1) / 1000) + 1; + ng_callout(&hpriv->reorderTimer, hpriv->node, hpriv->hook, + ticks, ng_pptpgre_reorder_timeout, hpriv, 0); +} + +/* + * The oldest packet spent too much time in the reorder queue. + * Deliver it and next packets in sequence, if any. + */ +static void +ng_pptpgre_reorder_timeout(node_p node, hook_p hook, void *arg1, int arg2) +{ + const priv_p priv = NG_NODE_PRIVATE(node); + const hpriv_p hpriv = arg1; + roqh sendq = SLIST_HEAD_INITIALIZER(sendq); + struct ng_pptpgre_roq *np, *last = NULL; + + priv->stats.recvReorderTimeouts++; + mtx_lock(&hpriv->mtx); + if (SLIST_EMPTY(&hpriv->roq)) { /* should not happen */ + mtx_unlock(&hpriv->mtx); + return; + } + + last = np = SLIST_FIRST(&hpriv->roq); + hpriv->roq_len--; + SLIST_REMOVE_HEAD(&hpriv->roq, next); + SLIST_INSERT_HEAD(&sendq, np, next); + + /* Look if we have more packets in sequence */ + while (!SLIST_EMPTY(&hpriv->roq)) { + np = SLIST_FIRST(&hpriv->roq); + if (PPTP_SEQ_DIFF(np->seq, last->seq) > 1) + break; /* the gap in the sequence */ + + /* Next packet is in sequence, move it to the sendq. */ + hpriv->roq_len--; + SLIST_REMOVE_HEAD(&hpriv->roq, next); + SLIST_INSERT_AFTER(last, np, next); + last = np; + } + + hpriv->recvSeq = last->seq; + if (!SLIST_EMPTY(&hpriv->roq)) + ng_pptpgre_start_reorder_timer(hpriv); + + /* We need to acknowledge last packet; do it soon... */ + ng_pptpgre_ack(hpriv); /* drops lock */ + ng_pptpgre_sendq(hpriv, &sendq, NULL); + mtx_assert(&hpriv->mtx, MA_NOTOWNED); +} + /************************************************************************* MISC FUNCTIONS *************************************************************************/ @@ -943,6 +1234,8 @@ ng_pptpgre_find_session(priv_p privp, u_int16_t cid) static void ng_pptpgre_reset(hpriv_p hpriv) { + struct ng_pptpgre_roq *np; + /* Reset adaptive timeout state */ hpriv->ato = PPTP_MAX_TIMEOUT; hpriv->rtt = PPTP_TIME_SCALE / 10; @@ -965,6 +1258,16 @@ ng_pptpgre_reset(hpriv_p hpriv) /* Stop timers */ ng_uncallout(&hpriv->sackTimer, hpriv->node); ng_uncallout(&hpriv->rackTimer, hpriv->node); + ng_uncallout(&hpriv->reorderTimer, hpriv->node); + + /* Clear reorder queue */ + while (!SLIST_EMPTY(&hpriv->roq)) { + np = SLIST_FIRST(&hpriv->roq); + SLIST_REMOVE_HEAD(&hpriv->roq, next); + NG_FREE_ITEM(np->item); + free(np, M_NETGRAPH); + } + hpriv->roq_len = 0; } /* Modified: stable/11/sys/netgraph/ng_pptpgre.h ============================================================================== --- stable/11/sys/netgraph/ng_pptpgre.h Tue Dec 4 07:39:54 2018 (r341459) +++ stable/11/sys/netgraph/ng_pptpgre.h Tue Dec 4 07:48:43 2018 (r341460) @@ -100,6 +100,10 @@ struct ng_pptpgre_stats { u_int32_t recvLoneAcks; /* ack-only packets rec'd */ u_int32_t recvAckTimeouts; /* times peer failed to ack in time */ u_int32_t memoryFailures; /* times we couldn't allocate memory */ + u_int32_t recvReorderOverflow; /* times we dropped GRE packet + due to overflow of reorder queue */ + u_int32_t recvReorderTimeouts; /* times we flushed reorder queue + due to timeout */ }; /* Keep this in sync with the above structure definition */ @@ -120,6 +124,8 @@ struct ng_pptpgre_stats { { "recvLoneAcks", &ng_parse_uint32_type }, \ { "recvAckTimeouts", &ng_parse_uint32_type }, \ { "memoryFailures", &ng_parse_uint32_type }, \ + { "recvReorderOverflow", &ng_parse_uint32_type}, \ + { "recvReorderTimeouts", &ng_parse_uint32_type}, \ { NULL } \ } From owner-svn-src-all@freebsd.org Tue Dec 4 08:38:25 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8FE2F1329339 for ; Tue, 4 Dec 2018 08:38:25 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: from mail-yw1-xc32.google.com (mail-yw1-xc32.google.com [IPv6:2607:f8b0:4864:20::c32]) (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 9D8266D1DD for ; Tue, 4 Dec 2018 08:38:24 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: by mail-yw1-xc32.google.com with SMTP id x2so6610939ywc.9 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=ehNj+kMYGKvUQkG5vJvA8hmz09ybUPg9mkh+KdaFwhZtAvhpfDfWDy696nau0Fzlx6 DFEbGswHWwFNgJeGgJCdEm2p4v48XcWPS/YphN+1+WR3WqehKnS7/rxujL3qqpjX7WBG anHlUg+buSOLxzOTB8ZdT68L2GlZkXD+UqWYemraDqcwxW+iGUWlKsEaYtMZ9olwC4Yv HLzXQSNDZ7d45D/nmUEi5pQxbWEKUG5YsKYch4b55o5gcif41mOB8c3AUKJJQmHNkoXl GjQbLwTi4uCNWYRhGH+woDS0A0hYeE/D90mKX+yvit3rspDhKK7qd7KYBVsLiUHXQeF+ u5SQ== X-Gm-Message-State: AA+aEWbOc25FyIii6P3h1c7YR//cnGfJIy53X8HsfkU2Z0iA/Nx4Zj5Q p2JYuxWDETRd6Mnj0D4evHtkJnVDJ5NpRFCV+/+jBg== 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: 9D8266D1DD 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-all@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)[]; MX_GOOD(-0.01)[cached: alt1.aspmx.l.google.com]; DKIM_TRACE(0.00)[hardenedbsd.org:+]; RCVD_IN_DNSWL_NONE(0.00)[2.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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-all@freebsd.org Tue Dec 4 08:41:23 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-all@freebsd.org Tue Dec 4 08:52:51 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-all@freebsd.org Tue Dec 4 09:16:00 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-all@freebsd.org Tue Dec 4 09:16:21 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5E0F5132B21D; Tue, 4 Dec 2018 09:16:21 +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 03BAC6EF43; Tue, 4 Dec 2018 09:16:21 +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 D8FE22325E; Tue, 4 Dec 2018 09:16:20 +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 wB49GK8m093979; Tue, 4 Dec 2018 09:16:20 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB49GKS7093978; Tue, 4 Dec 2018 09:16:20 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201812040916.wB49GKS7093978@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 09:16:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341461 - stable/12/sys/netpfil/ipfw X-SVN-Group: stable-12 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: stable/12/sys/netpfil/ipfw X-SVN-Commit-Revision: 341461 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 03BAC6EF43 X-Spamd-Result: default: False [-0.79 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.56)[-0.556,0]; NEURAL_SPAM_LONG(0.01)[0.011,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_SHORT(-0.24)[-0.241,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Dec 2018 09:16:21 -0000 Author: ae Date: Tue Dec 4 09:16:20 2018 New Revision: 341461 URL: https://svnweb.freebsd.org/changeset/base/341461 Log: MFC r341073: Do not limit the mbuf queue length for keepalive packets. It was unlimited before overhaul, and one user reported that this limit can be reached easily. PR: 233562 Modified: stable/12/sys/netpfil/ipfw/ip_fw_dynamic.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netpfil/ipfw/ip_fw_dynamic.c ============================================================================== --- stable/12/sys/netpfil/ipfw/ip_fw_dynamic.c Tue Dec 4 07:48:43 2018 (r341460) +++ stable/12/sys/netpfil/ipfw/ip_fw_dynamic.c Tue Dec 4 09:16:20 2018 (r341461) @@ -349,7 +349,6 @@ VNET_DEFINE_STATIC(uint32_t, dyn_short_lifetime); * dyn_rst_lifetime and dyn_fin_lifetime should be strictly lower * than dyn_keepalive_period. */ -#define DYN_KEEPALIVE_MAXQ 512 VNET_DEFINE_STATIC(uint32_t, dyn_keepalive_interval); VNET_DEFINE_STATIC(uint32_t, dyn_keepalive_period); VNET_DEFINE_STATIC(uint32_t, dyn_keepalive); @@ -2351,7 +2350,7 @@ dyn_send_keepalive_ipv4(struct ip_fw_chain *chain) struct dyn_ipv4_state *s; uint32_t bucket; - mbufq_init(&q, DYN_KEEPALIVE_MAXQ); + mbufq_init(&q, INT_MAX); IPFW_UH_RLOCK(chain); /* * It is safe to not use hazard pointer and just do lockless @@ -2458,7 +2457,7 @@ dyn_send_keepalive_ipv6(struct ip_fw_chain *chain) struct dyn_ipv6_state *s; uint32_t bucket; - mbufq_init(&q, DYN_KEEPALIVE_MAXQ); + mbufq_init(&q, INT_MAX); IPFW_UH_RLOCK(chain); /* * It is safe to not use hazard pointer and just do lockless From owner-svn-src-all@freebsd.org Tue Dec 4 09:18:29 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 804D3132B504; Tue, 4 Dec 2018 09:18: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 33FDC6F219; Tue, 4 Dec 2018 09:18:29 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1512923271; Tue, 4 Dec 2018 09:18:29 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB49ISLB094130; Tue, 4 Dec 2018 09:18:28 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB49ISiw094129; Tue, 4 Dec 2018 09:18:28 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201812040918.wB49ISiw094129@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 09:18:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r341462 - stable/11/sys/netpfil/ipfw X-SVN-Group: stable-11 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: stable/11/sys/netpfil/ipfw X-SVN-Commit-Revision: 341462 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 33FDC6F219 X-Spamd-Result: default: False [-0.79 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.56)[-0.556,0]; NEURAL_SPAM_LONG(0.01)[0.011,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_SHORT(-0.24)[-0.241,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Dec 2018 09:18:29 -0000 Author: ae Date: Tue Dec 4 09:18:28 2018 New Revision: 341462 URL: https://svnweb.freebsd.org/changeset/base/341462 Log: MFC r341073: Do not limit the mbuf queue length for keepalive packets. It was unlimited before overhaul, and one user reported that this limit can be reached easily. PR: 233562 Modified: stable/11/sys/netpfil/ipfw/ip_fw_dynamic.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netpfil/ipfw/ip_fw_dynamic.c ============================================================================== --- stable/11/sys/netpfil/ipfw/ip_fw_dynamic.c Tue Dec 4 09:16:20 2018 (r341461) +++ stable/11/sys/netpfil/ipfw/ip_fw_dynamic.c Tue Dec 4 09:18:28 2018 (r341462) @@ -348,7 +348,6 @@ static VNET_DEFINE(uint32_t, dyn_short_lifetime); * dyn_rst_lifetime and dyn_fin_lifetime should be strictly lower * than dyn_keepalive_period. */ -#define DYN_KEEPALIVE_MAXQ 512 static VNET_DEFINE(uint32_t, dyn_keepalive_interval); static VNET_DEFINE(uint32_t, dyn_keepalive_period); static VNET_DEFINE(uint32_t, dyn_keepalive); @@ -2350,7 +2349,7 @@ dyn_send_keepalive_ipv4(struct ip_fw_chain *chain) struct dyn_ipv4_state *s; uint32_t bucket; - mbufq_init(&q, DYN_KEEPALIVE_MAXQ); + mbufq_init(&q, INT_MAX); IPFW_UH_RLOCK(chain); /* * It is safe to not use hazard pointer and just do lockless @@ -2457,7 +2456,7 @@ dyn_send_keepalive_ipv6(struct ip_fw_chain *chain) struct dyn_ipv6_state *s; uint32_t bucket; - mbufq_init(&q, DYN_KEEPALIVE_MAXQ); + mbufq_init(&q, INT_MAX); IPFW_UH_RLOCK(chain); /* * It is safe to not use hazard pointer and just do lockless From owner-svn-src-all@freebsd.org Tue Dec 4 10:30:32 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1DC22132E859; Tue, 4 Dec 2018 10:30:32 +0000 (UTC) (envelope-from jrm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B73B871E92; Tue, 4 Dec 2018 10:30:31 +0000 (UTC) (envelope-from jrm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9786623EC4; Tue, 4 Dec 2018 10:30:31 +0000 (UTC) (envelope-from jrm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB4AUVQg030067; Tue, 4 Dec 2018 10:30:31 GMT (envelope-from jrm@FreeBSD.org) Received: (from jrm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB4AUVpM030066; Tue, 4 Dec 2018 10:30:31 GMT (envelope-from jrm@FreeBSD.org) Message-Id: <201812041030.wB4AUVpM030066@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jrm set sender to jrm@FreeBSD.org using -f From: Joseph Mingrone Date: Tue, 4 Dec 2018 10:30:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org Subject: svn commit: r341463 - svnadmin/conf X-SVN-Group: svnadmin X-SVN-Commit-Author: jrm X-SVN-Commit-Paths: svnadmin/conf X-SVN-Commit-Revision: 341463 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B73B871E92 X-Spamd-Result: default: False [-0.70 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.539,0]; NEURAL_HAM_SHORT(-0.05)[-0.051,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.11)[-0.112,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Dec 2018 10:30:32 -0000 Author: jrm (ports committer) Date: Tue Dec 4 10:30:31 2018 New Revision: 341463 URL: https://svnweb.freebsd.org/changeset/base/341463 Log: Take in jimharris's commit bit for safekeeping at his request Approved by: core With hat: core-secretary Modified: svnadmin/conf/access Modified: svnadmin/conf/access ============================================================================== --- svnadmin/conf/access Tue Dec 4 09:18:28 2018 (r341462) +++ svnadmin/conf/access Tue Dec 4 10:30:31 2018 (r341463) @@ -110,7 +110,6 @@ jeff jhb jhibbits jilles -jimharris jkim jlh jmallett From owner-svn-src-all@freebsd.org Tue Dec 4 12:16:27 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 38B04130A53B; Tue, 4 Dec 2018 12:16:27 +0000 (UTC) (envelope-from Andre.Albsmeier@siemens.com) Received: from goliath.siemens.de (goliath.siemens.de [192.35.17.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "goliath.siemens.de", Issuer "Siemens Issuing CA Internet Server 2017" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AB6F4762FF; Tue, 4 Dec 2018 12:16:22 +0000 (UTC) (envelope-from Andre.Albsmeier@siemens.com) Received: from mail3.siemens.de (mail3.siemens.de [139.25.208.14]) by goliath.siemens.de (8.15.2/8.15.2) with ESMTPS id wB4CDHaw012243 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 4 Dec 2018 13:13:17 +0100 Received: from curry.mchp.siemens.de (curry.mchp.siemens.de [139.25.40.130]) by mail3.siemens.de (8.15.2/8.15.2) with ESMTP id wB4CDG0J030338; Tue, 4 Dec 2018 13:13:16 +0100 Received: (from user@localhost) by curry.mchp.siemens.de (8.15.2/8.15.2) id wB4CDHOM033482; Date: Tue, 4 Dec 2018 13:13:16 +0100 From: Andre Albsmeier To: Sean Eric Fagan Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: Re: svn commit: r339008 - in stable/11: include/rpcsvc lib/libutil libexec/rpc.rquotad sys/cddl/contrib/opensolaris/uts/common/fs/zfs usr.bin/quota Message-ID: <20181204121316.GA6385@bali> References: <201809290044.w8T0iNfu004260@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201809290044.w8T0iNfu004260@repo.freebsd.org> User-Agent: Mutt/1.7.2 (2016-11-26) X-Rspamd-Queue-Id: AB6F4762FF X-Spamd-Result: default: False [-3.08 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+exists:192.35.17.28.spf.siemens.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[siemens.com]; RCPT_COUNT_FIVE(0.00)[5]; NEURAL_HAM_LONG(-0.99)[-0.993,0]; RCVD_COUNT_THREE(0.00)[4]; IP_SCORE(-0.00)[country: DE(-0.01)]; MX_GOOD(-0.01)[gordi.siemens.com,hephaistos.siemens.com,meleagros.siemens.com,hylas.siemens.com,zetes.siemens.com,paxos.siemens.com,balduin.siemens.com]; NEURAL_HAM_SHORT(-0.78)[-0.778,0]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MID_RHS_NOT_FQDN(0.50)[]; ASN(0.00)[asn:15465, ipnet:192.35.16.0/22, country:DE]; RCVD_IN_DNSWL_HI(-0.50)[28.17.35.192.list.dnswl.org : 127.0.13.3] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Dec 2018 12:16:27 -0000 On Sat, 29-Sep-2018 at 00:44:23 +0000, Sean Eric Fagan wrote: > Author: sef > Date: Sat Sep 29 00:44:23 2018 > New Revision: 339008 > URL: https://svnweb.freebsd.org/changeset/base/339008 > > Log: > MFC r336017,r338799 > > r336017 > This exposes ZFS user and group quotas via the normal > quatactl(2) mechanism. (Read-only at this point, however.) > In particular, this is to allow rpc.rquotad query quotas > for NFS mounts, allowing users to see their quotas on the > hosts using the datasets. > > The changes specifically: > > * Add new RPC entry points for querying quotas. > * Changes the library routines to allow non-UFS quotas. This broke repquota on my UFS. I fixed it with: --- lib/libutil/quotafile.c.ORI 2018-09-29 11:56:05.000000000 +0200 +++ lib/libutil/quotafile.c 2018-12-04 13:00:04.450826000 +0100 @@ -125,18 +125,18 @@ strlcpy(qf->fsname, fs->fs_file, sizeof(qf->fsname)); if (stat(qf->fsname, &st) != 0) goto error; qf->dev = st.st_dev; qcmd = QCMD(Q_GETQUOTASIZE, quotatype); + serrno = hasquota(fs, quotatype, qf->qfname, sizeof(qf->qfname)); if (quotactl(qf->fsname, qcmd, 0, &qf->wordsize) == 0) return (qf); /* We only check the quota file for ufs */ if (strcmp(fs->fs_vfstype, "ufs")) { errno = 0; goto error; } - serrno = hasquota(fs, quotatype, qf->qfname, sizeof(qf->qfname)); if (serrno == 0) { errno = EOPNOTSUPP; goto error; } qf->accmode = openflags & O_ACCMODE; Apparently it wants qf->qfname to be filled in by hasquota(). No idea if calling hasquota() hurts for non-UFS... -Andre From owner-svn-src-all@freebsd.org Tue Dec 4 12:34:23 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-all@freebsd.org Tue Dec 4 14:07:46 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 63983130D5B6; Tue, 4 Dec 2018 14:07:46 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0763D79FC1; Tue, 4 Dec 2018 14:07:46 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D492D2637A; Tue, 4 Dec 2018 14:07:45 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB4E7j0D042186; Tue, 4 Dec 2018 14:07:45 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB4E7jaL042185; Tue, 4 Dec 2018 14:07:45 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201812041407.wB4E7jaL042185@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 14:07:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r341465 - stable/10/share/man/man4 X-SVN-Group: stable-10 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/10/share/man/man4 X-SVN-Commit-Revision: 341465 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0763D79FC1 X-Spamd-Result: default: False [-0.47 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.56)[-0.556,0]; NEURAL_SPAM_SHORT(0.17)[0.169,0]; NEURAL_HAM_LONG(-0.09)[-0.087,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Dec 2018 14:07:46 -0000 Author: emaste Date: Tue Dec 4 14:07:45 2018 New Revision: 341465 URL: https://svnweb.freebsd.org/changeset/base/341465 Log: MFC r323010: hv_vss.4: Fix spelling of 'responsibility' PR: 221300 Submitted by: Fabian Keil Obtained from: ElectroBSD Modified: stable/10/share/man/man4/hv_vss.4 Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/hv_vss.4 ============================================================================== --- stable/10/share/man/man4/hv_vss.4 Tue Dec 4 12:34:22 2018 (r341464) +++ stable/10/share/man/man4/hv_vss.4 Tue Dec 4 14:07:45 2018 (r341465) @@ -66,7 +66,7 @@ VM, and sends the result back to Hyper-V host. .Pp Generally, .Xr hv_vss_daemon 8 -takes the responsiblity to freeze/thaw UFS file system, +takes the responsibility to freeze/thaw UFS file system, and it is automatically launched after system boots. When Hyper-V host wants to take a snapshot of the .Fx From owner-svn-src-all@freebsd.org Tue Dec 4 15:02:20 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 947D8130F381; Tue, 4 Dec 2018 15:02:20 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 38DA27C7B4; Tue, 4 Dec 2018 15:02:20 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1878626D53; Tue, 4 Dec 2018 15:02:20 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB4F2JQ9070473; Tue, 4 Dec 2018 15:02:19 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB4F2JfU070472; Tue, 4 Dec 2018 15:02:19 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201812041502.wB4F2JfU070472@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 4 Dec 2018 15:02:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341466 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 341466 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 38DA27C7B4 X-Spamd-Result: default: False [-0.37 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.56)[-0.556,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_SPAM_SHORT(0.27)[0.274,0]; NEURAL_HAM_LONG(-0.09)[-0.087,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Dec 2018 15:02:20 -0000 Author: kib Date: Tue Dec 4 15:02:19 2018 New Revision: 341466 URL: https://svnweb.freebsd.org/changeset/base/341466 Log: MFC r341094: Improve sigonstack(). Modified: stable/12/sys/kern/kern_sig.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_sig.c ============================================================================== --- stable/12/sys/kern/kern_sig.c Tue Dec 4 14:07:45 2018 (r341465) +++ stable/12/sys/kern/kern_sig.c Tue Dec 4 15:02:19 2018 (r341466) @@ -615,20 +615,25 @@ signotify(struct thread *td) } } +/* + * Returns 1 (true) if altstack is configured for the thread, and the + * passed stack bottom address falls into the altstack range. Handles + * the 43 compat special case where the alt stack size is zero. + */ int sigonstack(size_t sp) { - struct thread *td = curthread; + struct thread *td; - return ((td->td_pflags & TDP_ALTSTACK) ? + td = curthread; + if ((td->td_pflags & TDP_ALTSTACK) == 0) + return (0); #if defined(COMPAT_43) - ((td->td_sigstk.ss_size == 0) ? - (td->td_sigstk.ss_flags & SS_ONSTACK) : - ((sp - (size_t)td->td_sigstk.ss_sp) < td->td_sigstk.ss_size)) -#else - ((sp - (size_t)td->td_sigstk.ss_sp) < td->td_sigstk.ss_size) + if (td->td_sigstk.ss_size == 0) + return ((td->td_sigstk.ss_flags & SS_ONSTACK) != 0); #endif - : 0); + return (sp >= (size_t)td->td_sigstk.ss_sp && + sp < td->td_sigstk.ss_size + (size_t)td->td_sigstk.ss_sp); } static __inline int From owner-svn-src-all@freebsd.org Tue Dec 4 15:04:50 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0B8DB130F452; Tue, 4 Dec 2018 15:04:50 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A53377C9A3; Tue, 4 Dec 2018 15:04:49 +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 876FB26D66; Tue, 4 Dec 2018 15:04:49 +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 wB4F4nCt073543; Tue, 4 Dec 2018 15:04:49 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB4F4nKs073542; Tue, 4 Dec 2018 15:04:49 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201812041504.wB4F4nKs073542@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:04:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r341467 - stable/11/sys/vm X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/sys/vm X-SVN-Commit-Revision: 341467 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A53377C9A3 X-Spamd-Result: default: False [-0.87 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.56)[-0.556,0]; NEURAL_HAM_SHORT(-0.23)[-0.230,0]; NEURAL_HAM_LONG(-0.09)[-0.087,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Dec 2018 15:04:50 -0000 Author: emaste Date: Tue Dec 4 15:04:48 2018 New Revision: 341467 URL: https://svnweb.freebsd.org/changeset/base/341467 Log: MFC r327860: ANSIfy function definitions in sys/vm/ Modified: stable/11/sys/vm/vm_glue.c stable/11/sys/vm/vm_unix.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/vm_glue.c ============================================================================== --- stable/11/sys/vm/vm_glue.c Tue Dec 4 15:02:19 2018 (r341466) +++ stable/11/sys/vm/vm_glue.c Tue Dec 4 15:04:48 2018 (r341467) @@ -111,9 +111,7 @@ __FBSDID("$FreeBSD$"); * space. */ int -kernacc(addr, len, rw) - void *addr; - int len, rw; +kernacc(void *addr, int len, int rw) { boolean_t rv; vm_offset_t saddr, eaddr; @@ -145,9 +143,7 @@ kernacc(addr, len, rw) * used in conjunction with this call. */ int -useracc(addr, len, rw) - void *addr; - int len, rw; +useracc(void *addr, int len, int rw) { boolean_t rv; vm_prot_t prot; @@ -532,12 +528,8 @@ intr_prof_stack_use(struct thread *td, struct trapfram * to user mode to avoid stack copying and relocation problems. */ int -vm_forkproc(td, p2, td2, vm2, flags) - struct thread *td; - struct proc *p2; - struct thread *td2; - struct vmspace *vm2; - int flags; +vm_forkproc(struct thread *td, struct proc *p2, struct thread *td2, + struct vmspace *vm2, int flags) { struct proc *p1 = td->td_proc; int error; Modified: stable/11/sys/vm/vm_unix.c ============================================================================== --- stable/11/sys/vm/vm_unix.c Tue Dec 4 15:02:19 2018 (r341466) +++ stable/11/sys/vm/vm_unix.c Tue Dec 4 15:04:48 2018 (r341467) @@ -71,9 +71,7 @@ struct obreak_args { */ /* ARGSUSED */ int -sys_obreak(td, uap) - struct thread *td; - struct obreak_args *uap; +sys_obreak(struct thread *td, struct obreak_args *uap) { struct vmspace *vm = td->td_proc->p_vmspace; vm_map_t map = &vm->vm_map; @@ -245,9 +243,7 @@ struct ovadvise_args { */ /* ARGSUSED */ int -sys_ovadvise(td, uap) - struct thread *td; - struct ovadvise_args *uap; +sys_ovadvise(struct thread *td, struct ovadvise_args *uap) { /* START_GIANT_OPTIONAL */ /* END_GIANT_OPTIONAL */ From owner-svn-src-all@freebsd.org Tue Dec 4 15:06:25 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4998D130F56E; Tue, 4 Dec 2018 15:06:25 +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 E19507CBFD; Tue, 4 Dec 2018 15:06:24 +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 C20D826D67; Tue, 4 Dec 2018 15:06:24 +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 wB4F6Ov7073654; Tue, 4 Dec 2018 15:06:24 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB4F6O8S073653; Tue, 4 Dec 2018 15:06:24 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201812041506.wB4F6O8S073653@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 4 Dec 2018 15:06:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341468 - stable/12/sys/amd64/amd64 X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/amd64/amd64 X-SVN-Commit-Revision: 341468 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E19507CBFD X-Spamd-Result: default: False [-0.87 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.56)[-0.556,0]; NEURAL_HAM_SHORT(-0.23)[-0.230,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.09)[-0.087,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Dec 2018 15:06:25 -0000 Author: kib Date: Tue Dec 4 15:06:24 2018 New Revision: 341468 URL: https://svnweb.freebsd.org/changeset/base/341468 Log: MFC r341096: Fix assert condition in pmap_large_unmap(). Modified: stable/12/sys/amd64/amd64/pmap.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/amd64/pmap.c ============================================================================== --- stable/12/sys/amd64/amd64/pmap.c Tue Dec 4 15:04:48 2018 (r341467) +++ stable/12/sys/amd64/amd64/pmap.c Tue Dec 4 15:06:24 2018 (r341468) @@ -8441,9 +8441,10 @@ pmap_large_unmap(void *svaa, vm_size_t len) KASSERT((va & PDPMASK) == 0, ("PDPMASK bit set, va %#lx pdpe %#lx pdp %#lx", va, (u_long)pdpe, pdp)); - KASSERT(len <= NBPDP, - ("len < NBPDP, sva %#lx va %#lx pdpe %#lx pdp %#lx " - "len %#lx", sva, va, (u_long)pdpe, pdp, len)); + KASSERT(va + NBPDP <= sva + len, + ("unmap covers partial 1GB page, sva %#lx va %#lx " + "pdpe %#lx pdp %#lx len %#lx", sva, va, + (u_long)pdpe, pdp, len)); *pdpe = 0; inc = NBPDP; continue; @@ -8457,9 +8458,10 @@ pmap_large_unmap(void *svaa, vm_size_t len) KASSERT((va & PDRMASK) == 0, ("PDRMASK bit set, va %#lx pde %#lx pd %#lx", va, (u_long)pde, pd)); - KASSERT(len <= NBPDR, - ("len < NBPDR, sva %#lx va %#lx pde %#lx pd %#lx " - "len %#lx", sva, va, (u_long)pde, pd, len)); + KASSERT(va + NBPDR <= sva + len, + ("unmap covers partial 2MB page, sva %#lx va %#lx " + "pde %#lx pd %#lx len %#lx", sva, va, (u_long)pde, + pd, len)); pde_store(pde, 0); inc = NBPDR; m = PHYS_TO_VM_PAGE(DMAP_TO_PHYS((vm_offset_t)pde)); From owner-svn-src-all@freebsd.org Tue Dec 4 15:12:29 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-all@freebsd.org Tue Dec 4 15:25:16 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-all@freebsd.org Tue Dec 4 16:01:28 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-all@freebsd.org Tue Dec 4 16:12:45 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-all@freebsd.org Tue Dec 4 16:43:51 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-all@freebsd.org Tue Dec 4 16:48:49 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-all@freebsd.org Tue Dec 4 16:49:15 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-all@freebsd.org Tue Dec 4 16:53:29 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 692761312BF1; Tue, 4 Dec 2018 16:53:29 +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 0B5FD82B3E; Tue, 4 Dec 2018 16:53:29 +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 E1C0227FFC; Tue, 4 Dec 2018 16:53:28 +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 wB4GrSwG031004; Tue, 4 Dec 2018 16:53:28 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB4GrSm8031003; Tue, 4 Dec 2018 16:53:28 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201812041653.wB4GrSm8031003@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 4 Dec 2018 16:53:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r341476 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 341476 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0B5FD82B3E X-Spamd-Result: default: False [-0.45 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.50)[-0.502,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_SPAM_SHORT(0.14)[0.135,0]; NEURAL_HAM_LONG(-0.09)[-0.087,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Dec 2018 16:53:29 -0000 Author: kib Date: Tue Dec 4 16:53:28 2018 New Revision: 341476 URL: https://svnweb.freebsd.org/changeset/base/341476 Log: MFC r341094: Improve sigonstack(). Modified: stable/11/sys/kern/kern_sig.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_sig.c ============================================================================== --- stable/11/sys/kern/kern_sig.c Tue Dec 4 16:49:14 2018 (r341475) +++ stable/11/sys/kern/kern_sig.c Tue Dec 4 16:53:28 2018 (r341476) @@ -617,20 +617,25 @@ signotify(struct thread *td) } } +/* + * Returns 1 (true) if altstack is configured for the thread, and the + * passed stack bottom address falls into the altstack range. Handles + * the 43 compat special case where the alt stack size is zero. + */ int sigonstack(size_t sp) { - struct thread *td = curthread; + struct thread *td; - return ((td->td_pflags & TDP_ALTSTACK) ? + td = curthread; + if ((td->td_pflags & TDP_ALTSTACK) == 0) + return (0); #if defined(COMPAT_43) - ((td->td_sigstk.ss_size == 0) ? - (td->td_sigstk.ss_flags & SS_ONSTACK) : - ((sp - (size_t)td->td_sigstk.ss_sp) < td->td_sigstk.ss_size)) -#else - ((sp - (size_t)td->td_sigstk.ss_sp) < td->td_sigstk.ss_size) + if (td->td_sigstk.ss_size == 0) + return ((td->td_sigstk.ss_flags & SS_ONSTACK) != 0); #endif - : 0); + return (sp >= (size_t)td->td_sigstk.ss_sp && + sp < td->td_sigstk.ss_size + (size_t)td->td_sigstk.ss_sp); } static __inline int From owner-svn-src-all@freebsd.org Tue Dec 4 17:28:29 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-all@freebsd.org Tue Dec 4 17:35:54 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-all@freebsd.org Tue Dec 4 17:41:02 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 886041313E99; Tue, 4 Dec 2018 17:41:01 +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 3B69A84A9D; Tue, 4 Dec 2018 17:41:01 +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 1B77871A; Tue, 4 Dec 2018 17:41:01 +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 wB4Hf0xT052779; Tue, 4 Dec 2018 17:41:00 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB4Heuqv052754; Tue, 4 Dec 2018 17:40:56 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201812041740.wB4Heuqv052754@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Tue, 4 Dec 2018 17:40:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r341477 - in stable/11/sys: conf dev/cxgbe dev/e1000 dev/ixgbe dev/ixl dev/netmap dev/re modules/netmap net X-SVN-Group: stable-11 X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: in stable/11/sys: conf dev/cxgbe dev/e1000 dev/ixgbe dev/ixl dev/netmap dev/re modules/netmap net X-SVN-Commit-Revision: 341477 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3B69A84A9D X-Spamd-Result: default: False [-0.52 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.38)[-0.384,0]; NEURAL_SPAM_LONG(0.08)[0.078,0]; NEURAL_HAM_SHORT(-0.22)[-0.218,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Dec 2018 17:41:02 -0000 Author: vmaffione Date: Tue Dec 4 17:40:56 2018 New Revision: 341477 URL: https://svnweb.freebsd.org/changeset/base/341477 Log: MFC r339639 netmap: align codebase to the current upstream (sha 8374e1a7e6941) Changelist: - Move large parts of VALE code to a new file and header netmap_bdg.[ch]. This is useful to reuse the code within upcoming projects. - Improvements and bug fixes to pipes and monitors. - Introduce nm_os_onattach(), nm_os_onenter() and nm_os_onexit() to handle differences between FreeBSD and Linux. - Introduce some new helper functions to handle more host rings and fake rings (netmap_all_rings(), netmap_real_rings(), ...) - Added new sysctl to enable/disable hw checksum in emulated netmap mode. - nm_inject: add support for NS_MOREFRAG Approved by: gnn (mentor) Differential Revision: https://reviews.freebsd.org/D17364 Added: stable/11/sys/dev/netmap/netmap_bdg.c (contents, props changed) stable/11/sys/dev/netmap/netmap_bdg.h (contents, props changed) stable/11/sys/dev/netmap/netmap_legacy.c (contents, props changed) stable/11/sys/dev/netmap/netmap_pt.c (contents, props changed) stable/11/sys/net/netmap_legacy.h (contents, props changed) stable/11/sys/net/netmap_virt.h (contents, props changed) Modified: stable/11/sys/conf/files stable/11/sys/dev/cxgbe/t4_netmap.c stable/11/sys/dev/e1000/if_em.c stable/11/sys/dev/e1000/if_igb.c stable/11/sys/dev/e1000/if_lem.c stable/11/sys/dev/ixgbe/if_ix.c stable/11/sys/dev/ixgbe/if_ixv.c stable/11/sys/dev/ixgbe/ix_txrx.c stable/11/sys/dev/ixgbe/ixgbe_netmap.c stable/11/sys/dev/ixl/ixl_pf_main.c stable/11/sys/dev/ixl/ixl_txrx.c stable/11/sys/dev/netmap/if_em_netmap.h stable/11/sys/dev/netmap/if_igb_netmap.h stable/11/sys/dev/netmap/if_ixl_netmap.h stable/11/sys/dev/netmap/if_lem_netmap.h stable/11/sys/dev/netmap/if_re_netmap.h stable/11/sys/dev/netmap/if_vtnet_netmap.h stable/11/sys/dev/netmap/ixgbe_netmap.h stable/11/sys/dev/netmap/netmap.c stable/11/sys/dev/netmap/netmap_freebsd.c stable/11/sys/dev/netmap/netmap_generic.c stable/11/sys/dev/netmap/netmap_kern.h stable/11/sys/dev/netmap/netmap_mbq.c stable/11/sys/dev/netmap/netmap_mbq.h stable/11/sys/dev/netmap/netmap_mem2.c stable/11/sys/dev/netmap/netmap_mem2.h stable/11/sys/dev/netmap/netmap_monitor.c stable/11/sys/dev/netmap/netmap_offloadings.c stable/11/sys/dev/netmap/netmap_pipe.c stable/11/sys/dev/netmap/netmap_vale.c stable/11/sys/dev/re/if_re.c stable/11/sys/modules/netmap/Makefile stable/11/sys/net/iflib.c stable/11/sys/net/netmap.h stable/11/sys/net/netmap_user.h Modified: stable/11/sys/conf/files ============================================================================== --- stable/11/sys/conf/files Tue Dec 4 16:53:28 2018 (r341476) +++ stable/11/sys/conf/files Tue Dec 4 17:40:56 2018 (r341477) @@ -2476,7 +2476,10 @@ dev/netmap/netmap_mem2.c optional netmap dev/netmap/netmap_monitor.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: stable/11/sys/dev/cxgbe/t4_netmap.c ============================================================================== --- stable/11/sys/dev/cxgbe/t4_netmap.c Tue Dec 4 16:53:28 2018 (r341476) +++ stable/11/sys/dev/cxgbe/t4_netmap.c Tue Dec 4 17:40:56 2018 (r341477) @@ -909,7 +909,7 @@ t4_nm_intr(void *arg) struct adapter *sc = vi->pi->adapter; struct ifnet *ifp = vi->ifp; struct netmap_adapter *na = NA(ifp); - struct netmap_kring *kring = &na->rx_rings[nm_rxq->nid]; + struct netmap_kring *kring = na->rx_rings[nm_rxq->nid]; struct netmap_ring *ring = kring->ring; struct iq_desc *d = &nm_rxq->iq_desc[nm_rxq->iq_cidx]; const void *cpl; @@ -950,7 +950,7 @@ t4_nm_intr(void *arg) case CPL_RX_PKT: ring->slot[fl_cidx].len = G_RSPD_LEN(lq) - sc->params.sge.fl_pktshift; - ring->slot[fl_cidx].flags = kring->nkr_slot_flags; + ring->slot[fl_cidx].flags = 0; fl_cidx += (lq & F_RSPD_NEWBUF) ? 1 : 0; fl_credits += (lq & F_RSPD_NEWBUF) ? 1 : 0; if (__predict_false(fl_cidx == nm_rxq->fl_sidx)) Modified: stable/11/sys/dev/e1000/if_em.c ============================================================================== --- stable/11/sys/dev/e1000/if_em.c Tue Dec 4 16:53:28 2018 (r341476) +++ stable/11/sys/dev/e1000/if_em.c Tue Dec 4 17:40:56 2018 (r341477) @@ -3644,7 +3644,7 @@ em_setup_transmit_ring(struct tx_ring *txr) } #ifdef DEV_NETMAP if (slot) { - int si = netmap_idx_n2k(&na->tx_rings[txr->me], i); + int si = netmap_idx_n2k(na->tx_rings[txr->me], i); uint64_t paddr; void *addr; @@ -4436,7 +4436,7 @@ em_setup_receive_ring(struct rx_ring *rxr) rxbuf = &rxr->rx_buffers[j]; #ifdef DEV_NETMAP if (slot) { - int si = netmap_idx_n2k(&na->rx_rings[rxr->me], j); + int si = netmap_idx_n2k(na->rx_rings[rxr->me], j); uint64_t paddr; void *addr; @@ -4741,7 +4741,7 @@ em_initialize_receive_unit(struct adapter *adapter) */ if (if_getcapenable(ifp) & IFCAP_NETMAP) { struct netmap_adapter *na = netmap_getna(adapter->ifp); - rdt -= nm_kr_rxspace(&na->rx_rings[i]); + rdt -= nm_kr_rxspace(na->rx_rings[i]); } #endif /* DEV_NETMAP */ E1000_WRITE_REG(hw, E1000_RDT(i), rdt); Modified: stable/11/sys/dev/e1000/if_igb.c ============================================================================== --- stable/11/sys/dev/e1000/if_igb.c Tue Dec 4 16:53:28 2018 (r341476) +++ stable/11/sys/dev/e1000/if_igb.c Tue Dec 4 17:40:56 2018 (r341477) @@ -3604,7 +3604,7 @@ igb_setup_transmit_ring(struct tx_ring *txr) } #ifdef DEV_NETMAP if (slot) { - int si = netmap_idx_n2k(&na->tx_rings[txr->me], i); + int si = netmap_idx_n2k(na->tx_rings[txr->me], i); /* no need to set the address */ netmap_load_map(na, txr->txtag, txbuf->map, NMB(na, slot + si)); } @@ -4420,7 +4420,7 @@ igb_setup_receive_ring(struct rx_ring *rxr) #ifdef DEV_NETMAP if (slot) { /* slot sj is mapped to the j-th NIC-ring entry */ - int sj = netmap_idx_n2k(&na->rx_rings[rxr->me], j); + int sj = netmap_idx_n2k(na->rx_rings[rxr->me], j); uint64_t paddr; void *addr; @@ -4806,7 +4806,7 @@ igb_initialize_receive_units(struct adapter *adapter) */ if (ifp->if_capenable & IFCAP_NETMAP) { struct netmap_adapter *na = NA(adapter->ifp); - struct netmap_kring *kring = &na->rx_rings[i]; + struct netmap_kring *kring = na->rx_rings[i]; int t = rxr->next_to_refresh - nm_kr_rxspace(kring); if (t >= adapter->num_rx_desc) Modified: stable/11/sys/dev/e1000/if_lem.c ============================================================================== --- stable/11/sys/dev/e1000/if_lem.c Tue Dec 4 16:53:28 2018 (r341476) +++ stable/11/sys/dev/e1000/if_lem.c Tue Dec 4 17:40:56 2018 (r341477) @@ -2792,7 +2792,7 @@ lem_setup_transmit_structures(struct adapter *adapter) #ifdef DEV_NETMAP if (slot) { /* the i-th NIC entry goes to slot si */ - int si = netmap_idx_n2k(&na->tx_rings[0], i); + int si = netmap_idx_n2k(na->tx_rings[0], i); uint64_t paddr; void *addr; @@ -3374,7 +3374,7 @@ lem_setup_receive_structures(struct adapter *adapter) #ifdef DEV_NETMAP if (slot) { /* the i-th NIC entry goes to slot si */ - int si = netmap_idx_n2k(&na->rx_rings[0], i); + int si = netmap_idx_n2k(na->rx_rings[0], i); uint64_t paddr; void *addr; @@ -3498,7 +3498,7 @@ lem_initialize_receive_unit(struct adapter *adapter) /* preserve buffers already made available to clients */ if (if_getcapenable(ifp) & IFCAP_NETMAP) { struct netmap_adapter *na = netmap_getna(adapter->ifp); - rctl -= nm_kr_rxspace(&na->rx_rings[0]); + rctl -= nm_kr_rxspace(na->rx_rings[0]); } #endif /* DEV_NETMAP */ E1000_WRITE_REG(&adapter->hw, E1000_RDT(0), rctl); Modified: stable/11/sys/dev/ixgbe/if_ix.c ============================================================================== --- stable/11/sys/dev/ixgbe/if_ix.c Tue Dec 4 16:53:28 2018 (r341476) +++ stable/11/sys/dev/ixgbe/if_ix.c Tue Dec 4 17:40:56 2018 (r341477) @@ -2986,7 +2986,7 @@ ixgbe_init_locked(struct adapter *adapter) if ((adapter->feat_en & IXGBE_FEATURE_NETMAP) && (ifp->if_capenable & IFCAP_NETMAP)) { struct netmap_adapter *na = NA(adapter->ifp); - struct netmap_kring *kring = &na->rx_rings[i]; + struct netmap_kring *kring = na->rx_rings[i]; int t = na->num_rx_desc - 1 - nm_kr_rxspace(kring); IXGBE_WRITE_REG(hw, IXGBE_RDT(rxr->me), t); Modified: stable/11/sys/dev/ixgbe/if_ixv.c ============================================================================== --- stable/11/sys/dev/ixgbe/if_ixv.c Tue Dec 4 16:53:28 2018 (r341476) +++ stable/11/sys/dev/ixgbe/if_ixv.c Tue Dec 4 17:40:56 2018 (r341477) @@ -1490,7 +1490,7 @@ ixv_initialize_receive_units(struct adapter *adapter) if ((adapter->feat_en & IXGBE_FEATURE_NETMAP) && (ifp->if_capenable & IFCAP_NETMAP)) { struct netmap_adapter *na = NA(adapter->ifp); - struct netmap_kring *kring = &na->rx_rings[i]; + struct netmap_kring *kring = na->rx_rings[i]; int t = na->num_rx_desc - 1 - nm_kr_rxspace(kring); IXGBE_WRITE_REG(hw, IXGBE_VFRDT(rxr->me), t); Modified: stable/11/sys/dev/ixgbe/ix_txrx.c ============================================================================== --- stable/11/sys/dev/ixgbe/ix_txrx.c Tue Dec 4 16:53:28 2018 (r341476) +++ stable/11/sys/dev/ixgbe/ix_txrx.c Tue Dec 4 17:40:56 2018 (r341477) @@ -589,7 +589,7 @@ ixgbe_setup_transmit_ring(struct tx_ring *txr) * netmap_idx_n2k() handles wraparounds properly. */ if ((adapter->feat_en & IXGBE_FEATURE_NETMAP) && slot) { - int si = netmap_idx_n2k(&na->tx_rings[txr->me], i); + int si = netmap_idx_n2k(na->tx_rings[txr->me], i); netmap_load_map(na, txr->txtag, txbuf->map, NMB(na, slot + si)); } @@ -991,7 +991,7 @@ ixgbe_txeof(struct tx_ring *txr) if ((adapter->feat_en & IXGBE_FEATURE_NETMAP) && (adapter->ifp->if_capenable & IFCAP_NETMAP)) { struct netmap_adapter *na = NA(adapter->ifp); - struct netmap_kring *kring = &na->tx_rings[txr->me]; + struct netmap_kring *kring = na->tx_rings[txr->me]; txd = txr->tx_base; bus_dmamap_sync(txr->txdma.dma_tag, txr->txdma.dma_map, BUS_DMASYNC_POSTREAD); @@ -1402,7 +1402,7 @@ ixgbe_setup_receive_ring(struct rx_ring *rxr) * an mbuf, so end the block with a continue; */ if ((adapter->feat_en & IXGBE_FEATURE_NETMAP) && slot) { - int sj = netmap_idx_n2k(&na->rx_rings[rxr->me], j); + int sj = netmap_idx_n2k(na->rx_rings[rxr->me], j); uint64_t paddr; void *addr; Modified: stable/11/sys/dev/ixgbe/ixgbe_netmap.c ============================================================================== --- stable/11/sys/dev/ixgbe/ixgbe_netmap.c Tue Dec 4 16:53:28 2018 (r341476) +++ stable/11/sys/dev/ixgbe/ixgbe_netmap.c Tue Dec 4 17:40:56 2018 (r341477) @@ -409,7 +409,6 @@ ixgbe_netmap_rxsync(struct netmap_kring *kring, int fl */ if (netmap_no_pendintr || force_update) { int crclen = (ix_crcstrip) ? 0 : 4; - uint16_t slot_flags = kring->nkr_slot_flags; nic_i = rxr->next_to_check; // or also k2n(kring->nr_hwtail) nm_i = netmap_idx_n2k(kring, nic_i); @@ -421,7 +420,7 @@ ixgbe_netmap_rxsync(struct netmap_kring *kring, int fl if ((staterr & IXGBE_RXD_STAT_DD) == 0) break; ring->slot[nm_i].len = le16toh(curr->wb.upper.length) - crclen; - ring->slot[nm_i].flags = slot_flags; + ring->slot[nm_i].flags = 0; bus_dmamap_sync(rxr->ptag, rxr->rx_buffers[nic_i].pmap, BUS_DMASYNC_POSTREAD); nm_i = nm_next(nm_i, lim); Modified: stable/11/sys/dev/ixl/ixl_pf_main.c ============================================================================== --- stable/11/sys/dev/ixl/ixl_pf_main.c Tue Dec 4 16:53:28 2018 (r341476) +++ stable/11/sys/dev/ixl/ixl_pf_main.c Tue Dec 4 17:40:56 2018 (r341477) @@ -2252,7 +2252,7 @@ ixl_initialize_vsi(struct ixl_vsi *vsi) /* preserve queue */ if (vsi->ifp->if_capenable & IFCAP_NETMAP) { struct netmap_adapter *na = NA(vsi->ifp); - struct netmap_kring *kring = &na->rx_rings[i]; + struct netmap_kring *kring = na->rx_rings[i]; int t = na->num_rx_desc - 1 - nm_kr_rxspace(kring); wr32(vsi->hw, I40E_QRX_TAIL(que->me), t); } else Modified: stable/11/sys/dev/ixl/ixl_txrx.c ============================================================================== --- stable/11/sys/dev/ixl/ixl_txrx.c Tue Dec 4 16:53:28 2018 (r341476) +++ stable/11/sys/dev/ixl/ixl_txrx.c Tue Dec 4 17:40:56 2018 (r341477) @@ -613,7 +613,7 @@ ixl_init_tx_ring(struct ixl_queue *que) * netmap slot index, si */ if (slot) { - int si = netmap_idx_n2k(&na->tx_rings[que->me], i); + int si = netmap_idx_n2k(na->tx_rings[que->me], i); netmap_load_map(na, buf->tag, buf->map, NMB(na, slot + si)); } #endif /* DEV_NETMAP */ @@ -1414,7 +1414,7 @@ ixl_init_rx_ring(struct ixl_queue *que) * an mbuf, so end the block with a continue; */ if (slot) { - int sj = netmap_idx_n2k(&na->rx_rings[que->me], j); + int sj = netmap_idx_n2k(na->rx_rings[que->me], j); uint64_t paddr; void *addr; Modified: stable/11/sys/dev/netmap/if_em_netmap.h ============================================================================== --- stable/11/sys/dev/netmap/if_em_netmap.h Tue Dec 4 16:53:28 2018 (r341476) +++ stable/11/sys/dev/netmap/if_em_netmap.h Tue Dec 4 17:40:56 2018 (r341477) @@ -233,8 +233,6 @@ em_netmap_rxsync(struct netmap_kring *kring, int flags * First part: import newly received packets. */ if (netmap_no_pendintr || force_update) { - uint16_t slot_flags = kring->nkr_slot_flags; - nic_i = rxr->next_to_check; nm_i = netmap_idx_n2k(kring, nic_i); @@ -245,7 +243,7 @@ em_netmap_rxsync(struct netmap_kring *kring, int flags if ((staterr & E1000_RXD_STAT_DD) == 0) break; ring->slot[nm_i].len = le16toh(curr->wb.upper.length); - ring->slot[nm_i].flags = slot_flags; + ring->slot[nm_i].flags = 0; bus_dmamap_sync(rxr->rxtag, rxr->rx_buffers[nic_i].map, BUS_DMASYNC_POSTREAD); nm_i = nm_next(nm_i, lim); Modified: stable/11/sys/dev/netmap/if_igb_netmap.h ============================================================================== --- stable/11/sys/dev/netmap/if_igb_netmap.h Tue Dec 4 16:53:28 2018 (r341476) +++ stable/11/sys/dev/netmap/if_igb_netmap.h Tue Dec 4 17:40:56 2018 (r341477) @@ -215,8 +215,6 @@ igb_netmap_rxsync(struct netmap_kring *kring, int flag * First part: import newly received packets. */ if (netmap_no_pendintr || force_update) { - uint16_t slot_flags = kring->nkr_slot_flags; - nic_i = rxr->next_to_check; nm_i = netmap_idx_n2k(kring, nic_i); @@ -227,7 +225,7 @@ igb_netmap_rxsync(struct netmap_kring *kring, int flag if ((staterr & E1000_RXD_STAT_DD) == 0) break; ring->slot[nm_i].len = le16toh(curr->wb.upper.length); - ring->slot[nm_i].flags = slot_flags; + ring->slot[nm_i].flags = 0; bus_dmamap_sync(rxr->ptag, rxr->rx_buffers[nic_i].pmap, BUS_DMASYNC_POSTREAD); nm_i = nm_next(nm_i, lim); Modified: stable/11/sys/dev/netmap/if_ixl_netmap.h ============================================================================== --- stable/11/sys/dev/netmap/if_ixl_netmap.h Tue Dec 4 16:53:28 2018 (r341476) +++ stable/11/sys/dev/netmap/if_ixl_netmap.h Tue Dec 4 17:40:56 2018 (r341477) @@ -59,7 +59,7 @@ extern int ixl_rx_miss, ixl_rx_miss_bufs, ixl_crcstrip /* * device-specific sysctl variables: * - * ixl_crcstrip: 0: keep CRC in rx frames (default), 1: strip it. + * ixl_crcstrip: 0: NIC keeps CRC in rx frames, 1: NIC strips it (default). * During regular operations the CRC is stripped, but on some * hardware reception of frames not multiple of 64 is slower, * so using crcstrip=0 helps in benchmarks. @@ -67,14 +67,14 @@ extern int ixl_rx_miss, ixl_rx_miss_bufs, ixl_crcstrip * ixl_rx_miss, ixl_rx_miss_bufs: * count packets that might be missed due to lost interrupts. */ +int ixl_rx_miss, ixl_rx_miss_bufs, ixl_crcstrip = 1; SYSCTL_DECL(_dev_netmap); /* * The xl driver by default strips CRCs and we do not override it. */ -int ixl_rx_miss, ixl_rx_miss_bufs, ixl_crcstrip = 1; #if 0 SYSCTL_INT(_dev_netmap, OID_AUTO, ixl_crcstrip, - CTLFLAG_RW, &ixl_crcstrip, 1, "strip CRC on rx frames"); + CTLFLAG_RW, &ixl_crcstrip, 1, "NIC strips CRC on rx frames"); #endif SYSCTL_INT(_dev_netmap, OID_AUTO, ixl_rx_miss, CTLFLAG_RW, &ixl_rx_miss, 0, "potentially missed rx intr"); @@ -130,7 +130,7 @@ ixl_netmap_attach(struct ixl_vsi *vsi) na.ifp = vsi->ifp; na.na_flags = NAF_BDG_MAYSLEEP; // XXX check that queues is set. - printf("queues is %p\n", vsi->queues); + nm_prinf("queues is %p\n", vsi->queues); if (vsi->queues) { na.num_tx_desc = vsi->queues[0].num_desc; na.num_rx_desc = vsi->queues[0].num_desc; @@ -332,7 +332,6 @@ ixl_netmap_rxsync(struct netmap_kring *kring, int flag */ if (netmap_no_pendintr || force_update) { int crclen = ixl_crcstrip ? 0 : 4; - uint16_t slot_flags = kring->nkr_slot_flags; nic_i = rxr->next_check; // or also k2n(kring->nr_hwtail) nm_i = netmap_idx_n2k(kring, nic_i); @@ -347,7 +346,7 @@ ixl_netmap_rxsync(struct netmap_kring *kring, int flag break; ring->slot[nm_i].len = ((qword & I40E_RXD_QW1_LENGTH_PBUF_MASK) >> I40E_RXD_QW1_LENGTH_PBUF_SHIFT) - crclen; - ring->slot[nm_i].flags = slot_flags; + ring->slot[nm_i].flags = 0; bus_dmamap_sync(rxr->ptag, rxr->buffers[nic_i].pmap, BUS_DMASYNC_POSTREAD); nm_i = nm_next(nm_i, lim); Modified: stable/11/sys/dev/netmap/if_lem_netmap.h ============================================================================== --- stable/11/sys/dev/netmap/if_lem_netmap.h Tue Dec 4 16:53:28 2018 (r341476) +++ stable/11/sys/dev/netmap/if_lem_netmap.h Tue Dec 4 17:40:56 2018 (r341477) @@ -35,12 +35,8 @@ #include #include -#include -#include /* vtophys ? */ #include -extern int netmap_adaptive_io; - /* * Register/unregister. We are already under netmap lock. */ @@ -81,6 +77,22 @@ lem_netmap_reg(struct netmap_adapter *na, int onoff) } +static void +lem_netmap_intr(struct netmap_adapter *na, int onoff) +{ + struct ifnet *ifp = na->ifp; + struct adapter *adapter = ifp->if_softc; + + EM_CORE_LOCK(adapter); + if (onoff) { + lem_enable_intr(adapter); + } else { + lem_disable_intr(adapter); + } + EM_CORE_UNLOCK(adapter); +} + + /* * Reconcile kernel and user view of the transmit ring. */ @@ -99,10 +111,6 @@ lem_netmap_txsync(struct netmap_kring *kring, int flag /* device-specific */ struct adapter *adapter = ifp->if_softc; -#ifdef NIC_PARAVIRT - struct paravirt_csb *csb = adapter->csb; - uint64_t *csbd = (uint64_t *)(csb + 1); -#endif /* NIC_PARAVIRT */ bus_dmamap_sync(adapter->txdma.dma_tag, adapter->txdma.dma_map, BUS_DMASYNC_POSTREAD); @@ -113,19 +121,6 @@ lem_netmap_txsync(struct netmap_kring *kring, int flag nm_i = kring->nr_hwcur; if (nm_i != head) { /* we have new packets to send */ -#ifdef NIC_PARAVIRT - int do_kick = 0; - uint64_t t = 0; // timestamp - int n = head - nm_i; - if (n < 0) - n += lim + 1; - if (csb) { - t = rdtsc(); /* last timestamp */ - csbd[16] += t - csbd[0]; /* total Wg */ - csbd[17] += n; /* Wg count */ - csbd[0] = t; - } -#endif /* NIC_PARAVIRT */ nic_i = netmap_idx_k2n(kring, nm_i); while (nm_i != head) { struct netmap_slot *slot = &ring->slot[nm_i]; @@ -166,38 +161,8 @@ lem_netmap_txsync(struct netmap_kring *kring, int flag bus_dmamap_sync(adapter->txdma.dma_tag, adapter->txdma.dma_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); -#ifdef NIC_PARAVIRT - /* set unconditionally, then also kick if needed */ - if (csb) { - t = rdtsc(); - if (csb->host_need_txkick == 2) { - /* can compute an update of delta */ - int64_t delta = t - csbd[3]; - if (delta < 0) - delta = -delta; - if (csbd[8] == 0 || delta < csbd[8]) { - csbd[8] = delta; - csbd[9]++; - } - csbd[10]++; - } - csb->guest_tdt = nic_i; - csbd[18] += t - csbd[0]; // total wp - csbd[19] += n; - } - if (!csb || !csb->guest_csb_on || (csb->host_need_txkick & 1)) - do_kick = 1; - if (do_kick) -#endif /* NIC_PARAVIRT */ /* (re)start the tx unit up to slot nic_i (excluded) */ E1000_WRITE_REG(&adapter->hw, E1000_TDT(0), nic_i); -#ifdef NIC_PARAVIRT - if (do_kick) { - uint64_t t1 = rdtsc(); - csbd[20] += t1 - t; // total Np - csbd[21]++; - } -#endif /* NIC_PARAVIRT */ } /* @@ -206,93 +171,6 @@ lem_netmap_txsync(struct netmap_kring *kring, int flag if (ticks != kring->last_reclaim || flags & NAF_FORCE_RECLAIM || nm_kr_txempty(kring)) { kring->last_reclaim = ticks; /* record completed transmissions using TDH */ -#ifdef NIC_PARAVIRT - /* host updates tdh unconditionally, and we have - * no side effects on reads, so we can read from there - * instead of exiting. - */ - if (csb) { - static int drain = 0, nodrain=0, good = 0, bad = 0, fail = 0; - u_int x = adapter->next_tx_to_clean; - csbd[19]++; // XXX count reclaims - nic_i = csb->host_tdh; - if (csb->guest_csb_on) { - if (nic_i == x) { - bad++; - csbd[24]++; // failed reclaims - /* no progress, request kick and retry */ - csb->guest_need_txkick = 1; - mb(); // XXX barrier - nic_i = csb->host_tdh; - } else { - good++; - } - if (nic_i != x) { - csb->guest_need_txkick = 2; - if (nic_i == csb->guest_tdt) - drain++; - else - nodrain++; -#if 1 - if (netmap_adaptive_io) { - /* new mechanism: last half ring (or so) - * released one slot at a time. - * This effectively makes the system spin. - * - * Take next_to_clean + 1 as a reference. - * tdh must be ahead or equal - * On entry, the logical order is - * x < tdh = nic_i - * We first push tdh up to avoid wraps. - * The limit is tdh-ll (half ring). - * if tdh-256 < x we report x; - * else we report tdh-256 - */ - u_int tdh = nic_i; - u_int ll = csbd[15]; - u_int delta = lim/8; - if (netmap_adaptive_io == 2 || ll > delta) - csbd[15] = ll = delta; - else if (netmap_adaptive_io == 1 && ll > 1) { - csbd[15]--; - } - - if (nic_i >= kring->nkr_num_slots) { - RD(5, "bad nic_i %d on input", nic_i); - } - x = nm_next(x, lim); - if (tdh < x) - tdh += lim + 1; - if (tdh <= x + ll) { - nic_i = x; - csbd[25]++; //report n + 1; - } else { - tdh = nic_i; - if (tdh < ll) - tdh += lim + 1; - nic_i = tdh - ll; - csbd[26]++; // report tdh - ll - } - } -#endif - } else { - /* we stop, count whether we are idle or not */ - int bh_active = csb->host_need_txkick & 2 ? 4 : 0; - csbd[27+ csb->host_need_txkick]++; - if (netmap_adaptive_io == 1) { - if (bh_active && csbd[15] > 1) - csbd[15]--; - else if (!bh_active && csbd[15] < lim/2) - csbd[15]++; - } - bad--; - fail++; - } - } - RD(1, "drain %d nodrain %d good %d retry %d fail %d", - drain, nodrain, good, bad, fail); - } else -#endif /* !NIC_PARAVIRT */ nic_i = E1000_READ_REG(&adapter->hw, E1000_TDH(0)); if (nic_i >= kring->nkr_num_slots) { /* XXX can it happen ? */ D("TDH wrap %d", nic_i); @@ -324,21 +202,10 @@ lem_netmap_rxsync(struct netmap_kring *kring, int flag /* device-specific */ struct adapter *adapter = ifp->if_softc; -#ifdef NIC_PARAVIRT - struct paravirt_csb *csb = adapter->csb; - uint32_t csb_mode = csb && csb->guest_csb_on; - uint32_t do_host_rxkick = 0; -#endif /* NIC_PARAVIRT */ if (head > lim) return netmap_ring_reinit(kring); -#ifdef NIC_PARAVIRT - if (csb_mode) { - force_update = 1; - csb->guest_need_rxkick = 0; - } -#endif /* NIC_PARAVIRT */ /* XXX check sync modes */ bus_dmamap_sync(adapter->rxdma.dma_tag, adapter->rxdma.dma_map, BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); @@ -347,8 +214,6 @@ lem_netmap_rxsync(struct netmap_kring *kring, int flag * First part: import newly received packets. */ if (netmap_no_pendintr || force_update) { - uint16_t slot_flags = kring->nkr_slot_flags; - nic_i = adapter->next_rx_desc_to_check; nm_i = netmap_idx_n2k(kring, nic_i); @@ -357,23 +222,6 @@ lem_netmap_rxsync(struct netmap_kring *kring, int flag uint32_t staterr = le32toh(curr->status); int len; -#ifdef NIC_PARAVIRT - if (csb_mode) { - if ((staterr & E1000_RXD_STAT_DD) == 0) { - /* don't bother to retry if more than 1 pkt */ - if (n > 1) - break; - csb->guest_need_rxkick = 1; - wmb(); - staterr = le32toh(curr->status); - if ((staterr & E1000_RXD_STAT_DD) == 0) { - break; - } else { /* we are good */ - csb->guest_need_rxkick = 0; - } - } - } else -#endif /* NIC_PARAVIRT */ if ((staterr & E1000_RXD_STAT_DD) == 0) break; len = le16toh(curr->length) - 4; // CRC @@ -382,7 +230,7 @@ lem_netmap_rxsync(struct netmap_kring *kring, int flag len = 0; } ring->slot[nm_i].len = len; - ring->slot[nm_i].flags = slot_flags; + ring->slot[nm_i].flags = 0; bus_dmamap_sync(adapter->rxtag, adapter->rx_buffer_area[nic_i].map, BUS_DMASYNC_POSTREAD); @@ -390,18 +238,6 @@ lem_netmap_rxsync(struct netmap_kring *kring, int flag nic_i = nm_next(nic_i, lim); } if (n) { /* update the state variables */ -#ifdef NIC_PARAVIRT - if (csb_mode) { - if (n > 1) { - /* leave one spare buffer so we avoid rxkicks */ - nm_i = nm_prev(nm_i, lim); - nic_i = nm_prev(nic_i, lim); - n--; - } else { - csb->guest_need_rxkick = 1; - } - } -#endif /* NIC_PARAVIRT */ ND("%d new packets at nic %d nm %d tail %d", n, adapter->next_rx_desc_to_check, @@ -440,10 +276,6 @@ lem_netmap_rxsync(struct netmap_kring *kring, int flag curr->status = 0; bus_dmamap_sync(adapter->rxtag, rxbuf->map, BUS_DMASYNC_PREREAD); -#ifdef NIC_PARAVIRT - if (csb_mode && csb->host_rxkick_at == nic_i) - do_host_rxkick = 1; -#endif /* NIC_PARAVIRT */ nm_i = nm_next(nm_i, lim); nic_i = nm_next(nic_i, lim); } @@ -455,12 +287,6 @@ lem_netmap_rxsync(struct netmap_kring *kring, int flag * so move nic_i back by one unit */ nic_i = nm_prev(nic_i, lim); -#ifdef NIC_PARAVIRT - /* set unconditionally, then also kick if needed */ - if (csb) - csb->guest_rdt = nic_i; - if (!csb_mode || do_host_rxkick) -#endif /* NIC_PARAVIRT */ E1000_WRITE_REG(&adapter->hw, E1000_RDT(0), nic_i); } @@ -486,6 +312,7 @@ lem_netmap_attach(struct adapter *adapter) na.nm_rxsync = lem_netmap_rxsync; na.nm_register = lem_netmap_reg; na.num_tx_rings = na.num_rx_rings = 1; + na.nm_intr = lem_netmap_intr; netmap_attach(&na); } Modified: stable/11/sys/dev/netmap/if_re_netmap.h ============================================================================== --- stable/11/sys/dev/netmap/if_re_netmap.h Tue Dec 4 16:53:28 2018 (r341476) +++ stable/11/sys/dev/netmap/if_re_netmap.h Tue Dec 4 17:40:56 2018 (r341477) @@ -199,7 +199,6 @@ re_netmap_rxsync(struct netmap_kring *kring, int flags * is to stop right before nm_hwcur. */ if (netmap_no_pendintr || force_update) { - uint16_t slot_flags = kring->nkr_slot_flags; uint32_t stop_i = nm_prev(kring->nr_hwcur, lim); nic_i = sc->rl_ldata.rl_rx_prodidx; /* next pkt to check */ @@ -216,7 +215,7 @@ re_netmap_rxsync(struct netmap_kring *kring, int flags /* XXX subtract crc */ total_len = (total_len < 4) ? 0 : total_len - 4; ring->slot[nm_i].len = total_len; - ring->slot[nm_i].flags = slot_flags; + ring->slot[nm_i].flags = 0; /* sync was in re_newbuf() */ bus_dmamap_sync(sc->rl_ldata.rl_rx_mtag, rxd[nic_i].rx_dmamap, BUS_DMASYNC_POSTREAD); @@ -303,7 +302,7 @@ re_netmap_tx_init(struct rl_softc *sc) /* l points in the netmap ring, i points in the NIC ring */ for (i = 0; i < n; i++) { uint64_t paddr; - int l = netmap_idx_n2k(&na->tx_rings[0], i); + int l = netmap_idx_n2k(na->tx_rings[0], i); void *addr = PNMB(na, slot + l, &paddr); desc[i].rl_bufaddr_lo = htole32(RL_ADDR_LO(paddr)); @@ -329,11 +328,11 @@ re_netmap_rx_init(struct rl_softc *sc) * Do not release the slots owned by userspace, * and also keep one empty. */ - max_avail = n - 1 - nm_kr_rxspace(&na->rx_rings[0]); + max_avail = n - 1 - nm_kr_rxspace(na->rx_rings[0]); for (nic_i = 0; nic_i < n; nic_i++) { void *addr; uint64_t paddr; - uint32_t nm_i = netmap_idx_n2k(&na->rx_rings[0], nic_i); + uint32_t nm_i = netmap_idx_n2k(na->rx_rings[0], nic_i); addr = PNMB(na, slot + nm_i, &paddr); Modified: stable/11/sys/dev/netmap/if_vtnet_netmap.h ============================================================================== --- stable/11/sys/dev/netmap/if_vtnet_netmap.h Tue Dec 4 16:53:28 2018 (r341476) +++ stable/11/sys/dev/netmap/if_vtnet_netmap.h Tue Dec 4 17:40:56 2018 (r341477) @@ -122,12 +122,13 @@ vtnet_netmap_txsync(struct netmap_kring *kring, int fl struct SOFTC_T *sc = ifp->if_softc; struct vtnet_txq *txq = &sc->vtnet_txqs[ring_nr]; struct virtqueue *vq = txq->vtntx_vq; + int interrupts = !(kring->nr_kflags & NKR_NOINTR); /* * First part: process new packets to send. */ rmb(); - + nm_i = kring->nr_hwcur; if (nm_i != head) { /* we have new packets to send */ struct sglist *sg = txq->vtntx_sg; @@ -179,10 +180,12 @@ vtnet_netmap_txsync(struct netmap_kring *kring, int fl ring->head, ring->tail, virtqueue_nused(vq), (virtqueue_dump(vq), 1)); virtqueue_notify(vq); - virtqueue_enable_intr(vq); // like postpone with 0 + if (interrupts) { + virtqueue_enable_intr(vq); // like postpone with 0 + } } - + /* Free used slots. We only consider our own used buffers, recognized * by the token we passed to virtqueue_add_outbuf. */ @@ -209,7 +212,7 @@ vtnet_netmap_txsync(struct netmap_kring *kring, int fl if (nm_i != kring->nr_hwtail /* && vtnet_txq_below_threshold(txq) == 0*/) { ND(3, "disable intr, hwcur %d", nm_i); virtqueue_disable_intr(vq); - } else { + } else if (interrupts) { ND(3, "enable intr, hwcur %d", nm_i); virtqueue_postpone_intr(vq, VQ_POSTPONE_SHORT); } @@ -277,6 +280,7 @@ vtnet_netmap_rxsync(struct netmap_kring *kring, int fl u_int const lim = kring->nkr_num_slots - 1; u_int const head = kring->rhead; int force_update = (flags & NAF_FORCE_READ) || kring->nr_kflags & NKR_PENDINTR; + int interrupts = !(kring->nr_kflags & NKR_NOINTR); /* device-specific */ struct SOFTC_T *sc = ifp->if_softc; @@ -297,7 +301,6 @@ vtnet_netmap_rxsync(struct netmap_kring *kring, int fl * and vtnet_netmap_init_buffers(). */ if (netmap_no_pendintr || force_update) { - uint16_t slot_flags = kring->nkr_slot_flags; struct netmap_adapter *token; nm_i = kring->nr_hwtail; @@ -309,7 +312,7 @@ vtnet_netmap_rxsync(struct netmap_kring *kring, int fl break; if (likely(token == (void *)rxq)) { ring->slot[nm_i].len = len; - ring->slot[nm_i].flags = slot_flags; + ring->slot[nm_i].flags = 0; nm_i = nm_next(nm_i, lim); n++; } else { @@ -334,7 +337,9 @@ vtnet_netmap_rxsync(struct netmap_kring *kring, int fl kring->nr_hwcur = err; virtqueue_notify(vq); /* After draining the queue may need an intr from the hypervisor */ - vtnet_rxq_enable_intr(rxq); + if (interrupts) { + vtnet_rxq_enable_intr(rxq); + } } ND("[C] h %d c %d t %d hwcur %d hwtail %d", @@ -345,6 +350,28 @@ vtnet_netmap_rxsync(struct netmap_kring *kring, int fl } +/* Enable/disable interrupts on all virtqueues. */ +static void +vtnet_netmap_intr(struct netmap_adapter *na, int onoff) +{ + struct SOFTC_T *sc = na->ifp->if_softc; + int i; + + for (i = 0; i < sc->vtnet_max_vq_pairs; i++) { + struct vtnet_rxq *rxq = &sc->vtnet_rxqs[i]; + struct vtnet_txq *txq = &sc->vtnet_txqs[i]; + struct virtqueue *txvq = txq->vtntx_vq; + + if (onoff) { + vtnet_rxq_enable_intr(rxq); + virtqueue_enable_intr(txvq); + } else { + vtnet_rxq_disable_intr(rxq); + virtqueue_disable_intr(txvq); + } + } +} + /* Make RX virtqueues buffers pointing to netmap buffers. */ static int vtnet_netmap_init_rx_buffers(struct SOFTC_T *sc) @@ -356,7 +383,7 @@ vtnet_netmap_init_rx_buffers(struct SOFTC_T *sc) if (!nm_native_on(na)) return 0; for (r = 0; r < na->num_rx_rings; r++) { - struct netmap_kring *kring = &na->rx_rings[r]; + struct netmap_kring *kring = na->rx_rings[r]; struct vtnet_rxq *rxq = &sc->vtnet_rxqs[r]; struct virtqueue *vq = rxq->vtnrx_vq; struct netmap_slot* slot; @@ -380,29 +407,6 @@ vtnet_netmap_init_rx_buffers(struct SOFTC_T *sc) return 1; } -/* Update the virtio-net device configurations. Number of queues can - * change dinamically, by 'ethtool --set-channels $IFNAME combined $N'. - * This is actually the only way virtio-net can currently enable - * the multiqueue mode. - * XXX note that we seem to lose packets if the netmap ring has more - * slots than the queue - */ -static int -vtnet_netmap_config(struct netmap_adapter *na, u_int *txr, u_int *txd, - u_int *rxr, u_int *rxd) -{ - struct ifnet *ifp = na->ifp; - struct SOFTC_T *sc = ifp->if_softc; - - *txr = *rxr = sc->vtnet_max_vq_pairs; - *rxd = 512; // sc->vtnet_rx_nmbufs; - *txd = *rxd; // XXX - D("vtnet config txq=%d, txd=%d rxq=%d, rxd=%d", - *txr, *txd, *rxr, *rxd); - - return 0; -} - static void vtnet_netmap_attach(struct SOFTC_T *sc) { @@ -416,7 +420,7 @@ vtnet_netmap_attach(struct SOFTC_T *sc) na.nm_register = vtnet_netmap_reg; na.nm_txsync = vtnet_netmap_txsync; na.nm_rxsync = vtnet_netmap_rxsync; - na.nm_config = vtnet_netmap_config; + na.nm_intr = vtnet_netmap_intr; na.num_tx_rings = na.num_rx_rings = sc->vtnet_max_vq_pairs; D("max rings %d", sc->vtnet_max_vq_pairs); netmap_attach(&na); Modified: stable/11/sys/dev/netmap/ixgbe_netmap.h ============================================================================== --- stable/11/sys/dev/netmap/ixgbe_netmap.h Tue Dec 4 16:53:28 2018 (r341476) +++ stable/11/sys/dev/netmap/ixgbe_netmap.h Tue Dec 4 17:40:56 2018 (r341477) @@ -53,7 +53,7 @@ void ixgbe_netmap_attach(struct adapter *adapter); /* * device-specific sysctl variables: * - * ix_crcstrip: 0: keep CRC in rx frames (default), 1: strip it. + * ix_crcstrip: 0: NIC keeps CRC in rx frames (default), 1: NIC strips it. * During regular operations the CRC is stripped, but on some * hardware reception of frames not multiple of 64 is slower, * so using crcstrip=0 helps in benchmarks. @@ -65,7 +65,7 @@ SYSCTL_DECL(_dev_netmap); static int ix_rx_miss, ix_rx_miss_bufs; int ix_crcstrip; SYSCTL_INT(_dev_netmap, OID_AUTO, ix_crcstrip, - CTLFLAG_RW, &ix_crcstrip, 0, "strip CRC on rx frames"); + CTLFLAG_RW, &ix_crcstrip, 0, "NIC strips CRC on rx frames"); SYSCTL_INT(_dev_netmap, OID_AUTO, ix_rx_miss, CTLFLAG_RW, &ix_rx_miss, 0, "potentially missed rx intr"); SYSCTL_INT(_dev_netmap, OID_AUTO, ix_rx_miss_bufs, @@ -109,7 +109,21 @@ set_crcstrip(struct ixgbe_hw *hw, int onoff) IXGBE_WRITE_REG(hw, IXGBE_RDRXCTL, rxc); } +static void +ixgbe_netmap_intr(struct netmap_adapter *na, int onoff) +{ + struct ifnet *ifp = na->ifp; + struct adapter *adapter = ifp->if_softc; + IXGBE_CORE_LOCK(adapter); + if (onoff) { + ixgbe_enable_intr(adapter); // XXX maybe ixgbe_stop ? + } else { + ixgbe_disable_intr(adapter); // XXX maybe ixgbe_stop ? + } + IXGBE_CORE_UNLOCK(adapter); +} + /* * Register/unregister. We are already under netmap lock. * Only called on the first register or the last unregister. @@ -311,7 +325,7 @@ ixgbe_netmap_txsync(struct netmap_kring *kring, int fl * good way. */ nic_i = IXGBE_READ_REG(&adapter->hw, IXGBE_IS_VF(adapter) ? - IXGBE_VFTDH(kring->ring_id) : IXGBE_TDH(kring->ring_id)); + IXGBE_VFTDH(kring->ring_id) : IXGBE_TDH(kring->ring_id)); if (nic_i >= kring->nkr_num_slots) { /* XXX can it happen ? */ D("TDH wrap %d", nic_i); nic_i -= kring->nkr_num_slots; @@ -381,7 +395,6 @@ ixgbe_netmap_rxsync(struct netmap_kring *kring, int fl */ if (netmap_no_pendintr || force_update) { int crclen = (ix_crcstrip || IXGBE_IS_VF(adapter) ) ? 0 : 4; - uint16_t slot_flags = kring->nkr_slot_flags; nic_i = rxr->next_to_check; // or also k2n(kring->nr_hwtail) nm_i = netmap_idx_n2k(kring, nic_i); @@ -393,7 +406,7 @@ ixgbe_netmap_rxsync(struct netmap_kring *kring, int fl if ((staterr & IXGBE_RXD_STAT_DD) == 0) break; ring->slot[nm_i].len = le16toh(curr->wb.upper.length) - crclen; - ring->slot[nm_i].flags = slot_flags; + ring->slot[nm_i].flags = 0; bus_dmamap_sync(rxr->ptag, rxr->rx_buffers[nic_i].pmap, BUS_DMASYNC_POSTREAD); nm_i = nm_next(nm_i, lim); @@ -486,6 +499,7 @@ ixgbe_netmap_attach(struct adapter *adapter) na.nm_rxsync = ixgbe_netmap_rxsync; na.nm_register = ixgbe_netmap_reg; na.num_tx_rings = na.num_rx_rings = adapter->num_queues; + na.nm_intr = ixgbe_netmap_intr; netmap_attach(&na); } Modified: stable/11/sys/dev/netmap/netmap.c ============================================================================== --- stable/11/sys/dev/netmap/netmap.c Tue Dec 4 16:53:28 2018 (r341476) +++ stable/11/sys/dev/netmap/netmap.c Tue Dec 4 17:40:56 2018 (r341477) @@ -1,5 +1,9 @@ /* - * Copyright (C) 2011-2014 Matteo Landi, Luigi Rizzo. All rights reserved. + * Copyright (C) 2011-2014 Matteo Landi + * Copyright (C) 2011-2016 Luigi Rizzo + * Copyright (C) 2011-2016 Giuseppe Lettieri + * Copyright (C) 2011-2016 Vincenzo Maffione + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -133,13 +137,12 @@ ports attached to the switch) * > select()able file descriptor on which events are reported. * * Internally, we allocate a netmap_priv_d structure, that will be - * initialized on ioctl(NIOCREGIF). + * initialized on ioctl(NIOCREGIF). There is one netmap_priv_d + * structure for each open(). * * os-specific: - * FreeBSD: netmap_open (netmap_freebsd.c). The priv is - * per-thread. - * linux: linux_netmap_open (netmap_linux.c). The priv is - * per-open. + * FreeBSD: see netmap_open() (netmap_freebsd.c) + * linux: see linux_netmap_open() (netmap_linux.c) * * > 2. on each descriptor, the process issues an ioctl() to identify * > the interface that should report events to the file descriptor. @@ -257,7 +260,7 @@ ports attached to the switch) * * Any network interface known to the system (including a persistent VALE * port) can be attached to a VALE switch by issuing the - * NETMAP_BDG_ATTACH subcommand. After the attachment, persistent VALE ports + * NETMAP_REQ_VALE_ATTACH command. After the attachment, persistent VALE ports * look exactly like ephemeral VALE ports (as created in step 2 above). The * attachment of other interfaces, instead, requires the creation of a * netmap_bwrap_adapter. Moreover, the attached interface must be put in @@ -299,18 +302,17 @@ ports attached to the switch) * netmap_transmit() * na->nm_notify == netmap_notify() * 2) ioctl(NIOCRXSYNC)/netmap_poll() in process context - * kring->nm_sync() == netmap_rxsync_from_host_compat + * kring->nm_sync() == netmap_rxsync_from_host * netmap_rxsync_from_host(na, NULL, NULL) * - tx to host stack * ioctl(NIOCTXSYNC)/netmap_poll() in process context - * kring->nm_sync() == netmap_txsync_to_host_compat + * kring->nm_sync() == netmap_txsync_to_host * netmap_txsync_to_host(na) - * NM_SEND_UP() - * FreeBSD: na->if_input() == ?? XXX + * nm_os_send_up() + * FreeBSD: na->if_input() == ether_input() * linux: netif_rx() with NM_MAGIC_PRIORITY_RX * * - * * -= SYSTEM DEVICE WITH GENERIC SUPPORT =- * * na == NA(ifp) == generic_netmap_adapter created in generic_netmap_attach() @@ -319,10 +321,11 @@ ports attached to the switch) * concurrently: * 1) ioctl(NIOCTXSYNC)/netmap_poll() in process context * kring->nm_sync() == generic_netmap_txsync() - * linux: dev_queue_xmit() with NM_MAGIC_PRIORITY_TX - * generic_ndo_start_xmit() - * orig. dev. start_xmit - * FreeBSD: na->if_transmit() == orig. dev if_transmit + * nm_os_generic_xmit_frame() + * linux: dev_queue_xmit() with NM_MAGIC_PRIORITY_TX + * ifp->ndo_start_xmit == generic_ndo_start_xmit() + * gna->save_start_xmit == orig. dev. start_xmit + * FreeBSD: na->if_transmit() == orig. dev if_transmit * 2) generic_mbuf_destructor() * na->nm_notify() == netmap_notify() * - rx from netmap userspace: @@ -333,24 +336,15 @@ ports attached to the switch) * generic_rx_handler() * mbq_safe_enqueue() * na->nm_notify() == netmap_notify() - * - rx from host stack: - * concurrently: + * - rx from host stack + * FreeBSD: same as native + * Linux: same as native except: * 1) host stack - * linux: generic_ndo_start_xmit() - * netmap_transmit() - * FreeBSD: ifp->if_input() == netmap_transmit - * both: - * na->nm_notify() == netmap_notify() - * 2) ioctl(NIOCRXSYNC)/netmap_poll() in process context - * kring->nm_sync() == netmap_rxsync_from_host_compat *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Tue Dec 4 17:44:13 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 68E2113141DD; Tue, 4 Dec 2018 17:44:13 +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 1CB7284F14; Tue, 4 Dec 2018 17:44:13 +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 F3574893; Tue, 4 Dec 2018 17:44:12 +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 wB4HiCGP057377; Tue, 4 Dec 2018 17:44:12 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB4HiCRa057375; Tue, 4 Dec 2018 17:44:12 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201812041744.wB4HiCRa057375@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Tue, 4 Dec 2018 17:44:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r341478 - in stable/11/sys/dev: netmap virtio/network X-SVN-Group: stable-11 X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: in stable/11/sys/dev: netmap virtio/network X-SVN-Commit-Revision: 341478 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1CB7284F14 X-Spamd-Result: default: False [-0.52 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_SHORT(-0.22)[-0.218,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_MEDIUM(-0.38)[-0.384,0]; NEURAL_SPAM_LONG(0.08)[0.078,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Dec 2018 17:44:13 -0000 Author: vmaffione Date: Tue Dec 4 17:44:12 2018 New Revision: 341478 URL: https://svnweb.freebsd.org/changeset/base/341478 Log: MFC r340436 vtnet: fix netmap support netmap(4) support for vtnet(4) was incomplete and had multiple bugs. This commit fixes those bugs to bring netmap on vtnet in a functional state. Changelist: - handle errors returned by virtqueue_enqueue() properly (they were previously ignored) - make sure netmap XOR rest of the kernel access each virtqueue. - compute the number of netmap slots for TX and RX separately, according to whether indirect descriptors are used or not for a given virtqueue. - make sure sglist are freed according to their type (mbufs or netmap buffers) - add support for mulitiqueue and netmap host (aka sw) rings. - intercept VQ interrupts directly instead of intercepting them in txq_eof and rxq_eof. This simplifies the code and makes it easier to make sure taskqueues are not running for a VQ while it is in netmap mode. - implement vntet_netmap_config() to cope with changes in the number of queues. Reviewed by: bryanv Approved by: gnn (mentor) Sponsored by: Sunny Valley Networks Differential Revision: https://reviews.freebsd.org/D17916 Modified: stable/11/sys/dev/netmap/if_vtnet_netmap.h stable/11/sys/dev/virtio/network/if_vtnet.c stable/11/sys/dev/virtio/network/if_vtnetvar.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/netmap/if_vtnet_netmap.h ============================================================================== --- stable/11/sys/dev/netmap/if_vtnet_netmap.h Tue Dec 4 17:40:56 2018 (r341477) +++ stable/11/sys/dev/netmap/if_vtnet_netmap.h Tue Dec 4 17:44:12 2018 (r341478) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014 Vincenzo Maffione, Luigi Rizzo. All rights reserved. + * Copyright (C) 2014-2018 Vincenzo Maffione, Luigi Rizzo. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -33,74 +33,148 @@ #include /* vtophys ? */ #include +/* + * Return 1 if the queue identified by 't' and 'idx' is in netmap mode. + */ +static int +vtnet_netmap_queue_on(struct vtnet_softc *sc, enum txrx t, int idx) +{ + struct netmap_adapter *na = NA(sc->vtnet_ifp); -#define SOFTC_T vtnet_softc + if (!nm_native_on(na)) + return 0; -/* Free all the unused buffer in all the RX virtqueues. - * This function is called when entering and exiting netmap mode. - * - buffers queued by the virtio driver return skbuf/mbuf pointer - * and need to be freed; - * - buffers queued by netmap return the txq/rxq, and do not need work - */ + if (t == NR_RX) + return !!(idx < na->num_rx_rings && + na->rx_rings[idx]->nr_mode == NKR_NETMAP_ON); + + return !!(idx < na->num_tx_rings && + na->tx_rings[idx]->nr_mode == NKR_NETMAP_ON); +} + static void -vtnet_netmap_free_bufs(struct SOFTC_T* sc) +vtnet_free_used(struct virtqueue *vq, int netmap_bufs, enum txrx t, int idx) { - int i, nmb = 0, n = 0, last; + void *cookie; + int deq = 0; - for (i = 0; i < sc->vtnet_max_vq_pairs; i++) { - struct vtnet_rxq *rxq = &sc->vtnet_rxqs[i]; - struct virtqueue *vq; - struct mbuf *m; - struct vtnet_txq *txq = &sc->vtnet_txqs[i]; - struct vtnet_tx_header *txhdr; + while ((cookie = virtqueue_dequeue(vq, NULL)) != NULL) { + if (netmap_bufs) { + /* These are netmap buffers: there is nothing to do. */ + } else { + /* These are mbufs that we need to free. */ + struct mbuf *m; - last = 0; - vq = rxq->vtnrx_vq; - while ((m = virtqueue_drain(vq, &last)) != NULL) { - n++; - if (m != (void *)rxq) + if (t == NR_TX) { + struct vtnet_tx_header *txhdr = cookie; + m = txhdr->vth_mbuf; m_freem(m); - else - nmb++; - } - - last = 0; - vq = txq->vtntx_vq; - while ((txhdr = virtqueue_drain(vq, &last)) != NULL) { - n++; - if (txhdr != (void *)txq) { - m_freem(txhdr->vth_mbuf); uma_zfree(vtnet_tx_header_zone, txhdr); - } else - nmb++; + } else { + m = cookie; + m_freem(m); + } } + deq++; } - D("freed %d mbufs, %d netmap bufs on %d queues", - n - nmb, nmb, i); + + if (deq) + nm_prinf("%d sgs dequeued from %s-%d (netmap=%d)\n", + deq, nm_txrx2str(t), idx, netmap_bufs); } /* Register and unregister. */ static int -vtnet_netmap_reg(struct netmap_adapter *na, int onoff) +vtnet_netmap_reg(struct netmap_adapter *na, int state) { - struct ifnet *ifp = na->ifp; - struct SOFTC_T *sc = ifp->if_softc; + struct ifnet *ifp = na->ifp; + struct vtnet_softc *sc = ifp->if_softc; + int success; + enum txrx t; + int i; + /* Drain the taskqueues to make sure that there are no worker threads + * accessing the virtqueues. */ + vtnet_drain_taskqueues(sc); + VTNET_CORE_LOCK(sc); - ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); - /* enable or disable flags and callbacks in na and ifp */ - if (onoff) { + + /* We need nm_netmap_on() to return true when called by + * vtnet_init_locked() below. */ + if (state) nm_set_native_flags(na); + + /* We need to trigger a device reset in order to unexpose guest buffers + * published to the host. */ + ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); + /* Get pending used buffers. The way they are freed depends on whether + * they are netmap buffer or they are mbufs. We can tell apart the two + * cases by looking at kring->nr_mode, before this is possibly updated + * in the loop below. */ + for (i = 0; i < sc->vtnet_act_vq_pairs; i++) { + struct vtnet_txq *txq = &sc->vtnet_txqs[i]; + struct vtnet_rxq *rxq = &sc->vtnet_rxqs[i]; + struct netmap_kring *kring; + + VTNET_TXQ_LOCK(txq); + kring = NMR(na, NR_TX)[i]; + vtnet_free_used(txq->vtntx_vq, + kring->nr_mode == NKR_NETMAP_ON, NR_TX, i); + VTNET_TXQ_UNLOCK(txq); + + VTNET_RXQ_LOCK(rxq); + kring = NMR(na, NR_RX)[i]; + vtnet_free_used(rxq->vtnrx_vq, + kring->nr_mode == NKR_NETMAP_ON, NR_RX, i); + VTNET_RXQ_UNLOCK(rxq); + } + vtnet_init_locked(sc); + success = (ifp->if_drv_flags & IFF_DRV_RUNNING) ? 0 : ENXIO; + + if (state) { + for_rx_tx(t) { + /* Hardware rings. */ + for (i = 0; i < nma_get_nrings(na, t); i++) { + struct netmap_kring *kring = NMR(na, t)[i]; + + if (nm_kring_pending_on(kring)) + kring->nr_mode = NKR_NETMAP_ON; + } + + /* Host rings. */ + for (i = 0; i < nma_get_host_nrings(na, t); i++) { + struct netmap_kring *kring = + NMR(na, t)[nma_get_nrings(na, t) + i]; + + if (nm_kring_pending_on(kring)) + kring->nr_mode = NKR_NETMAP_ON; + } + } } else { nm_clear_native_flags(na); + for_rx_tx(t) { + /* Hardware rings. */ + for (i = 0; i < nma_get_nrings(na, t); i++) { + struct netmap_kring *kring = NMR(na, t)[i]; + + if (nm_kring_pending_off(kring)) + kring->nr_mode = NKR_NETMAP_OFF; + } + + /* Host rings. */ + for (i = 0; i < nma_get_host_nrings(na, t); i++) { + struct netmap_kring *kring = + NMR(na, t)[nma_get_nrings(na, t) + i]; + + if (nm_kring_pending_off(kring)) + kring->nr_mode = NKR_NETMAP_OFF; + } + } } - /* drain queues so netmap and native drivers - * do not interfere with each other - */ - vtnet_netmap_free_bufs(sc); - vtnet_init_locked(sc); /* also enable intr */ - VTNET_CORE_UNLOCK(sc); - return (ifp->if_drv_flags & IFF_DRV_RUNNING ? 0 : 1); + + VTNET_CORE_UNLOCK(sc); + + return success; } @@ -109,20 +183,19 @@ static int vtnet_netmap_txsync(struct netmap_kring *kring, int flags) { struct netmap_adapter *na = kring->na; - struct ifnet *ifp = na->ifp; + struct ifnet *ifp = na->ifp; struct netmap_ring *ring = kring->ring; u_int ring_nr = kring->ring_id; u_int nm_i; /* index into the netmap ring */ - u_int nic_i; /* index into the NIC ring */ - u_int n; u_int const lim = kring->nkr_num_slots - 1; u_int const head = kring->rhead; /* device-specific */ - struct SOFTC_T *sc = ifp->if_softc; + struct vtnet_softc *sc = ifp->if_softc; struct vtnet_txq *txq = &sc->vtnet_txqs[ring_nr]; struct virtqueue *vq = txq->vtntx_vq; int interrupts = !(kring->nr_kflags & NKR_NOINTR); + u_int n; /* * First part: process new packets to send. @@ -133,15 +206,13 @@ vtnet_netmap_txsync(struct netmap_kring *kring, int fl if (nm_i != head) { /* we have new packets to send */ struct sglist *sg = txq->vtntx_sg; - nic_i = netmap_idx_k2n(kring, nm_i); - for (n = 0; nm_i != head; n++) { + for (; nm_i != head; nm_i = nm_next(nm_i, lim)) { /* we use an empty header here */ - static struct virtio_net_hdr_mrg_rxbuf hdr; struct netmap_slot *slot = &ring->slot[nm_i]; u_int len = slot->len; uint64_t paddr; void *addr = PNMB(na, slot, &paddr); - int err; + int err; NM_CHECK_ADDR_LEN(na, addr, len); @@ -150,88 +221,63 @@ vtnet_netmap_txsync(struct netmap_kring *kring, int fl * and kick the hypervisor (if necessary). */ sglist_reset(sg); // cheap - // if vtnet_hdr_size > 0 ... - err = sglist_append(sg, &hdr, sc->vtnet_hdr_size); - // XXX later, support multi segment - err = sglist_append_phys(sg, paddr, len); - /* use na as the cookie */ - err = virtqueue_enqueue(vq, txq, sg, sg->sg_nseg, 0); - if (unlikely(err < 0)) { - D("virtqueue_enqueue failed"); - break; - } - - nm_i = nm_next(nm_i, lim); - nic_i = nm_next(nic_i, lim); + err = sglist_append(sg, &txq->vtntx_shrhdr, sc->vtnet_hdr_size); + err |= sglist_append_phys(sg, paddr, len); + KASSERT(err == 0, ("%s: cannot append to sglist %d", + __func__, err)); + err = virtqueue_enqueue(vq, /*cookie=*/txq, sg, + /*readable=*/sg->sg_nseg, + /*writeable=*/0); + if (unlikely(err)) { + if (err != ENOSPC) + nm_prerr("virtqueue_enqueue(%s) failed: %d\n", + kring->name, err); + break; + } } - /* Update hwcur depending on where we stopped. */ - kring->nr_hwcur = nm_i; /* note we migth break early */ - /* No more free TX slots? Ask the hypervisor for notifications, - * possibly only when a considerable amount of work has been - * done. - */ - ND(3,"sent %d packets, hwcur %d", n, nm_i); - virtqueue_disable_intr(vq); virtqueue_notify(vq); - } else { - if (ring->head != ring->tail) - ND(5, "pure notify ? head %d tail %d nused %d %d", - ring->head, ring->tail, virtqueue_nused(vq), - (virtqueue_dump(vq), 1)); - virtqueue_notify(vq); - if (interrupts) { - virtqueue_enable_intr(vq); // like postpone with 0 - } + + /* Update hwcur depending on where we stopped. */ + kring->nr_hwcur = nm_i; /* note we migth break early */ } - - /* Free used slots. We only consider our own used buffers, recognized - * by the token we passed to virtqueue_add_outbuf. + /* Free used slots. We only consider our own used buffers, recognized + * by the token we passed to virtqueue_enqueue. */ - n = 0; - for (;;) { - struct vtnet_tx_header *txhdr = virtqueue_dequeue(vq, NULL); - if (txhdr == NULL) - break; - if (likely(txhdr == (void *)txq)) { - n++; - if (virtqueue_nused(vq) < 32) { // XXX slow release - break; - } - } else { /* leftover from previous transmission */ - m_freem(txhdr->vth_mbuf); - uma_zfree(vtnet_tx_header_zone, txhdr); - } - } - if (n) { + n = 0; + for (;;) { + void *token = virtqueue_dequeue(vq, NULL); + if (token == NULL) + break; + if (unlikely(token != (void *)txq)) + nm_prerr("BUG: TX token mismatch\n"); + else + n++; + } + if (n > 0) { kring->nr_hwtail += n; if (kring->nr_hwtail > lim) kring->nr_hwtail -= lim + 1; } - if (nm_i != kring->nr_hwtail /* && vtnet_txq_below_threshold(txq) == 0*/) { - ND(3, "disable intr, hwcur %d", nm_i); - virtqueue_disable_intr(vq); - } else if (interrupts) { - ND(3, "enable intr, hwcur %d", nm_i); - virtqueue_postpone_intr(vq, VQ_POSTPONE_SHORT); - } - return 0; + if (interrupts && virtqueue_nfree(vq) < 32) + virtqueue_postpone_intr(vq, VQ_POSTPONE_LONG); + + return 0; } static int -vtnet_refill_rxq(struct netmap_kring *kring, u_int nm_i, u_int head) +vtnet_netmap_kring_refill(struct netmap_kring *kring, u_int nm_i, u_int head) { struct netmap_adapter *na = kring->na; - struct ifnet *ifp = na->ifp; + struct ifnet *ifp = na->ifp; struct netmap_ring *ring = kring->ring; u_int ring_nr = kring->ring_id; u_int const lim = kring->nkr_num_slots - 1; - u_int n; /* device-specific */ - struct SOFTC_T *sc = ifp->if_softc; + struct vtnet_softc *sc = ifp->if_softc; struct vtnet_rxq *rxq = &sc->vtnet_rxqs[ring_nr]; struct virtqueue *vq = rxq->vtnrx_vq; @@ -239,12 +285,11 @@ vtnet_refill_rxq(struct netmap_kring *kring, u_int nm_ struct sglist_seg ss[2]; struct sglist sg = { ss, 0, 0, 2 }; - for (n = 0; nm_i != head; n++) { - static struct virtio_net_hdr_mrg_rxbuf hdr; + for (; nm_i != head; nm_i = nm_next(nm_i, lim)) { struct netmap_slot *slot = &ring->slot[nm_i]; uint64_t paddr; void *addr = PNMB(na, slot, &paddr); - int err = 0; + int err; if (addr == NETMAP_BUF_BASE(na)) { /* bad buf */ if (netmap_ring_reinit(kring)) @@ -252,99 +297,134 @@ vtnet_refill_rxq(struct netmap_kring *kring, u_int nm_ } slot->flags &= ~NS_BUF_CHANGED; - sglist_reset(&sg); // cheap - err = sglist_append(&sg, &hdr, sc->vtnet_hdr_size); - err = sglist_append_phys(&sg, paddr, NETMAP_BUF_SIZE(na)); + sglist_reset(&sg); + err = sglist_append(&sg, &rxq->vtnrx_shrhdr, sc->vtnet_hdr_size); + err |= sglist_append_phys(&sg, paddr, NETMAP_BUF_SIZE(na)); + KASSERT(err == 0, ("%s: cannot append to sglist %d", + __func__, err)); /* writable for the host */ - err = virtqueue_enqueue(vq, rxq, &sg, 0, sg.sg_nseg); - if (err < 0) { - D("virtqueue_enqueue failed"); + err = virtqueue_enqueue(vq, /*cookie=*/rxq, &sg, + /*readable=*/0, /*writeable=*/sg.sg_nseg); + if (unlikely(err)) { + if (err != ENOSPC) + nm_prerr("virtqueue_enqueue(%s) failed: %d\n", + kring->name, err); break; } - nm_i = nm_next(nm_i, lim); } + return nm_i; } +/* + * Publish netmap buffers on a RX virtqueue. + * Returns -1 if this virtqueue is not being opened in netmap mode. + * If the virtqueue is being opened in netmap mode, return 0 on success and + * a positive error code on failure. + */ +static int +vtnet_netmap_rxq_populate(struct vtnet_rxq *rxq) +{ + struct netmap_adapter *na = NA(rxq->vtnrx_sc->vtnet_ifp); + struct netmap_kring *kring; + int error; + + if (!nm_native_on(na) || rxq->vtnrx_id >= na->num_rx_rings) + return -1; + + kring = na->rx_rings[rxq->vtnrx_id]; + if (!(nm_kring_pending_on(kring) || + kring->nr_pending_mode == NKR_NETMAP_ON)) + return -1; + + /* Expose all the RX netmap buffers. Note that the number of + * netmap slots in the RX ring matches the maximum number of + * 2-elements sglist that the RX virtqueue can accommodate. */ + error = vtnet_netmap_kring_refill(kring, 0, na->num_rx_desc); + virtqueue_notify(rxq->vtnrx_vq); + + return error < 0 ? ENXIO : 0; +} + /* Reconcile kernel and user view of the receive ring. */ static int vtnet_netmap_rxsync(struct netmap_kring *kring, int flags) { struct netmap_adapter *na = kring->na; - struct ifnet *ifp = na->ifp; + struct ifnet *ifp = na->ifp; struct netmap_ring *ring = kring->ring; u_int ring_nr = kring->ring_id; u_int nm_i; /* index into the netmap ring */ - // u_int nic_i; /* index into the NIC ring */ - u_int n; u_int const lim = kring->nkr_num_slots - 1; u_int const head = kring->rhead; - int force_update = (flags & NAF_FORCE_READ) || kring->nr_kflags & NKR_PENDINTR; + int force_update = (flags & NAF_FORCE_READ) || + (kring->nr_kflags & NKR_PENDINTR); int interrupts = !(kring->nr_kflags & NKR_NOINTR); /* device-specific */ - struct SOFTC_T *sc = ifp->if_softc; + struct vtnet_softc *sc = ifp->if_softc; struct vtnet_rxq *rxq = &sc->vtnet_rxqs[ring_nr]; struct virtqueue *vq = rxq->vtnrx_vq; - /* XXX netif_carrier_ok ? */ - - if (head > lim) - return netmap_ring_reinit(kring); - rmb(); /* * First part: import newly received packets. - * Only accept our - * own buffers (matching the token). We should only get - * matching buffers, because of vtnet_netmap_free_rx_unused_bufs() - * and vtnet_netmap_init_buffers(). + * Only accept our own buffers (matching the token). We should only get + * matching buffers. We may need to stop early to avoid hwtail to overrun + * hwcur. */ if (netmap_no_pendintr || force_update) { - struct netmap_adapter *token; + uint32_t hwtail_lim = nm_prev(kring->nr_hwcur, lim); + void *token; - nm_i = kring->nr_hwtail; - n = 0; - for (;;) { + vtnet_rxq_disable_intr(rxq); + + nm_i = kring->nr_hwtail; + while (nm_i != hwtail_lim) { int len; - token = virtqueue_dequeue(vq, &len); - if (token == NULL) - break; - if (likely(token == (void *)rxq)) { - ring->slot[nm_i].len = len; - ring->slot[nm_i].flags = 0; - nm_i = nm_next(nm_i, lim); - n++; - } else { - D("This should not happen"); - } + token = virtqueue_dequeue(vq, &len); + if (token == NULL) { + if (interrupts && vtnet_rxq_enable_intr(rxq)) { + vtnet_rxq_disable_intr(rxq); + continue; + } + break; + } + if (unlikely(token != (void *)rxq)) { + nm_prerr("BUG: RX token mismatch\n"); + } else { + /* Skip the virtio-net header. */ + len -= sc->vtnet_hdr_size; + if (unlikely(len < 0)) { + RD(1, "Truncated virtio-net-header, " + "missing %d bytes", -len); + len = 0; + } + ring->slot[nm_i].len = len; + ring->slot[nm_i].flags = 0; + nm_i = nm_next(nm_i, lim); + } } kring->nr_hwtail = nm_i; kring->nr_kflags &= ~NKR_PENDINTR; } - ND("[B] h %d c %d hwcur %d hwtail %d", - ring->head, ring->cur, kring->nr_hwcur, - kring->nr_hwtail); + ND("[B] h %d c %d hwcur %d hwtail %d", ring->head, ring->cur, + kring->nr_hwcur, kring->nr_hwtail); /* * Second part: skip past packets that userspace has released. */ nm_i = kring->nr_hwcur; /* netmap ring index */ if (nm_i != head) { - int err = vtnet_refill_rxq(kring, nm_i, head); - if (err < 0) - return 1; - kring->nr_hwcur = err; + int nm_j = vtnet_netmap_kring_refill(kring, nm_i, head); + if (nm_j < 0) + return nm_j; + kring->nr_hwcur = nm_j; virtqueue_notify(vq); - /* After draining the queue may need an intr from the hypervisor */ - if (interrupts) { - vtnet_rxq_enable_intr(rxq); - } } - ND("[C] h %d c %d t %d hwcur %d hwtail %d", - ring->head, ring->cur, ring->tail, - kring->nr_hwcur, kring->nr_hwtail); + ND("[C] h %d c %d t %d hwcur %d hwtail %d", ring->head, ring->cur, + ring->tail, kring->nr_hwcur, kring->nr_hwtail); return 0; } @@ -352,9 +432,9 @@ vtnet_netmap_rxsync(struct netmap_kring *kring, int fl /* Enable/disable interrupts on all virtqueues. */ static void -vtnet_netmap_intr(struct netmap_adapter *na, int onoff) +vtnet_netmap_intr(struct netmap_adapter *na, int state) { - struct SOFTC_T *sc = na->ifp->if_softc; + struct vtnet_softc *sc = na->ifp->if_softc; int i; for (i = 0; i < sc->vtnet_max_vq_pairs; i++) { @@ -362,7 +442,7 @@ vtnet_netmap_intr(struct netmap_adapter *na, int onoff struct vtnet_txq *txq = &sc->vtnet_txqs[i]; struct virtqueue *txvq = txq->vtntx_vq; - if (onoff) { + if (state) { vtnet_rxq_enable_intr(rxq); virtqueue_enable_intr(txvq); } else { @@ -372,60 +452,88 @@ vtnet_netmap_intr(struct netmap_adapter *na, int onoff } } -/* Make RX virtqueues buffers pointing to netmap buffers. */ static int -vtnet_netmap_init_rx_buffers(struct SOFTC_T *sc) +vtnet_netmap_tx_slots(struct vtnet_softc *sc) { - struct ifnet *ifp = sc->vtnet_ifp; - struct netmap_adapter* na = NA(ifp); - unsigned int r; + int div; - if (!nm_native_on(na)) - return 0; - for (r = 0; r < na->num_rx_rings; r++) { - struct netmap_kring *kring = na->rx_rings[r]; - struct vtnet_rxq *rxq = &sc->vtnet_rxqs[r]; - struct virtqueue *vq = rxq->vtnrx_vq; - struct netmap_slot* slot; - int err = 0; + /* We need to prepend a virtio-net header to each netmap buffer to be + * transmitted, therefore calling virtqueue_enqueue() passing sglist + * with 2 elements. + * TX virtqueues use indirect descriptors if the feature was negotiated + * with the host, and if sc->vtnet_tx_nsegs > 1. With indirect + * descriptors, a single virtio descriptor is sufficient to reference + * each TX sglist. Without them, we need two separate virtio descriptors + * for each TX sglist. We therefore compute the number of netmap TX + * slots according to these assumptions. + */ + if ((sc->vtnet_flags & VTNET_FLAG_INDIRECT) && sc->vtnet_tx_nsegs > 1) + div = 1; + else + div = 2; - slot = netmap_reset(na, NR_RX, r, 0); - if (!slot) { - D("strange, null netmap ring %d", r); - return 0; - } - /* Add up to na>-num_rx_desc-1 buffers to this RX virtqueue. - * It's important to leave one virtqueue slot free, otherwise - * we can run into ring->cur/ring->tail wraparounds. - */ - err = vtnet_refill_rxq(kring, 0, na->num_rx_desc-1); - if (err < 0) - return 0; - virtqueue_notify(vq); - } + return virtqueue_size(sc->vtnet_txqs[0].vtntx_vq) / div; +} - return 1; +static int +vtnet_netmap_rx_slots(struct vtnet_softc *sc) +{ + int div; + + /* We need to prepend a virtio-net header to each netmap buffer to be + * received, therefore calling virtqueue_enqueue() passing sglist + * with 2 elements. + * RX virtqueues use indirect descriptors if the feature was negotiated + * with the host, and if sc->vtnet_rx_nsegs > 1. With indirect + * descriptors, a single virtio descriptor is sufficient to reference + * each RX sglist. Without them, we need two separate virtio descriptors + * for each RX sglist. We therefore compute the number of netmap RX + * slots according to these assumptions. + */ + if ((sc->vtnet_flags & VTNET_FLAG_INDIRECT) && sc->vtnet_rx_nsegs > 1) + div = 1; + else + div = 2; + + return virtqueue_size(sc->vtnet_rxqs[0].vtnrx_vq) / div; } +static int +vtnet_netmap_config(struct netmap_adapter *na, struct nm_config_info *info) +{ + struct vtnet_softc *sc = na->ifp->if_softc; + + info->num_tx_rings = sc->vtnet_act_vq_pairs; + info->num_rx_rings = sc->vtnet_act_vq_pairs; + info->num_tx_descs = vtnet_netmap_tx_slots(sc); + info->num_rx_descs = vtnet_netmap_rx_slots(sc); + info->rx_buf_maxsize = NETMAP_BUF_SIZE(na); + + return 0; +} + static void -vtnet_netmap_attach(struct SOFTC_T *sc) +vtnet_netmap_attach(struct vtnet_softc *sc) { struct netmap_adapter na; bzero(&na, sizeof(na)); na.ifp = sc->vtnet_ifp; - na.num_tx_desc = 1024;// sc->vtnet_rx_nmbufs; - na.num_rx_desc = 1024; // sc->vtnet_rx_nmbufs; + na.na_flags = 0; + na.num_tx_desc = vtnet_netmap_tx_slots(sc); + na.num_rx_desc = vtnet_netmap_rx_slots(sc); + na.num_tx_rings = na.num_rx_rings = sc->vtnet_max_vq_pairs; + na.rx_buf_maxsize = 0; na.nm_register = vtnet_netmap_reg; na.nm_txsync = vtnet_netmap_txsync; na.nm_rxsync = vtnet_netmap_rxsync; na.nm_intr = vtnet_netmap_intr; - na.num_tx_rings = na.num_rx_rings = sc->vtnet_max_vq_pairs; - D("max rings %d", sc->vtnet_max_vq_pairs); + na.nm_config = vtnet_netmap_config; + netmap_attach(&na); - D("virtio attached txq=%d, txd=%d rxq=%d, rxd=%d", + nm_prinf("vtnet attached txq=%d, txd=%d rxq=%d, rxd=%d\n", na.num_tx_rings, na.num_tx_desc, na.num_tx_rings, na.num_rx_desc); } Modified: stable/11/sys/dev/virtio/network/if_vtnet.c ============================================================================== --- stable/11/sys/dev/virtio/network/if_vtnet.c Tue Dec 4 17:40:56 2018 (r341477) +++ stable/11/sys/dev/virtio/network/if_vtnet.c Tue Dec 4 17:44:12 2018 (r341478) @@ -1186,6 +1186,12 @@ vtnet_rxq_populate(struct vtnet_rxq *rxq) struct virtqueue *vq; int nbufs, error; +#ifdef DEV_NETMAP + error = vtnet_netmap_rxq_populate(rxq); + if (error >= 0) + return (error); +#endif /* DEV_NETMAP */ + vq = rxq->vtnrx_vq; error = ENOSPC; @@ -1215,12 +1221,20 @@ vtnet_rxq_free_mbufs(struct vtnet_rxq *rxq) struct virtqueue *vq; struct mbuf *m; int last; +#ifdef DEV_NETMAP + int netmap_bufs = vtnet_netmap_queue_on(rxq->vtnrx_sc, NR_RX, + rxq->vtnrx_id); +#else /* !DEV_NETMAP */ + int netmap_bufs = 0; +#endif /* !DEV_NETMAP */ vq = rxq->vtnrx_vq; last = 0; - while ((m = virtqueue_drain(vq, &last)) != NULL) - m_freem(m); + while ((m = virtqueue_drain(vq, &last)) != NULL) { + if (!netmap_bufs) + m_freem(m); + } KASSERT(virtqueue_empty(vq), ("%s: mbufs remaining in rx queue %p", __func__, rxq)); @@ -1766,12 +1780,6 @@ vtnet_rxq_eof(struct vtnet_rxq *rxq) VTNET_RXQ_LOCK_ASSERT(rxq); -#ifdef DEV_NETMAP - if (netmap_rx_irq(ifp, 0, &deq)) { - return (FALSE); - } -#endif /* DEV_NETMAP */ - while (count-- > 0) { m = virtqueue_dequeue(vq, &len); if (m == NULL) @@ -1865,6 +1873,11 @@ vtnet_rx_vq_intr(void *xrxq) return; } +#ifdef DEV_NETMAP + if (netmap_rx_irq(ifp, rxq->vtnrx_id, &more) != NM_IRQ_PASS) + return; +#endif /* DEV_NETMAP */ + VTNET_RXQ_LOCK(rxq); again: @@ -1965,13 +1978,21 @@ vtnet_txq_free_mbufs(struct vtnet_txq *txq) struct virtqueue *vq; struct vtnet_tx_header *txhdr; int last; +#ifdef DEV_NETMAP + int netmap_bufs = vtnet_netmap_queue_on(txq->vtntx_sc, NR_TX, + txq->vtntx_id); +#else /* !DEV_NETMAP */ + int netmap_bufs = 0; +#endif /* !DEV_NETMAP */ vq = txq->vtntx_vq; last = 0; while ((txhdr = virtqueue_drain(vq, &last)) != NULL) { - m_freem(txhdr->vth_mbuf); - uma_zfree(vtnet_tx_header_zone, txhdr); + if (!netmap_bufs) { + m_freem(txhdr->vth_mbuf); + uma_zfree(vtnet_tx_header_zone, txhdr); + } } KASSERT(virtqueue_empty(vq), @@ -2459,13 +2480,6 @@ vtnet_txq_eof(struct vtnet_txq *txq) deq = 0; VTNET_TXQ_LOCK_ASSERT(txq); -#ifdef DEV_NETMAP - if (netmap_tx_irq(txq->vtntx_sc->vtnet_ifp, txq->vtntx_id)) { - virtqueue_disable_intr(vq); // XXX luigi - return 0; // XXX or 1 ? - } -#endif /* DEV_NETMAP */ - while ((txhdr = virtqueue_dequeue(vq, NULL)) != NULL) { m = txhdr->vth_mbuf; deq++; @@ -2507,6 +2521,11 @@ vtnet_tx_vq_intr(void *xtxq) return; } +#ifdef DEV_NETMAP + if (netmap_tx_irq(ifp, txq->vtntx_id) != NM_IRQ_PASS) + return; +#endif /* DEV_NETMAP */ + VTNET_TXQ_LOCK(txq); if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { @@ -2763,11 +2782,6 @@ vtnet_drain_rxtx_queues(struct vtnet_softc *sc) struct vtnet_txq *txq; int i; -#ifdef DEV_NETMAP - if (nm_native_on(NA(sc->vtnet_ifp))) - return; -#endif /* DEV_NETMAP */ - for (i = 0; i < sc->vtnet_act_vq_pairs; i++) { rxq = &sc->vtnet_rxqs[i]; vtnet_rxq_free_mbufs(rxq); @@ -2932,11 +2946,6 @@ vtnet_init_rx_queues(struct vtnet_softc *sc) ("%s: too many rx mbufs %d for %d segments", __func__, sc->vtnet_rx_nmbufs, sc->vtnet_rx_nsegs)); -#ifdef DEV_NETMAP - if (vtnet_netmap_init_rx_buffers(sc)) - return 0; -#endif /* DEV_NETMAP */ - for (i = 0; i < sc->vtnet_act_vq_pairs; i++) { rxq = &sc->vtnet_rxqs[i]; @@ -3086,13 +3095,6 @@ vtnet_init(void *xsc) struct vtnet_softc *sc; sc = xsc; - -#ifdef DEV_NETMAP - if (!NA(sc->vtnet_ifp)) { - D("try to attach again"); - vtnet_netmap_attach(sc); - } -#endif /* DEV_NETMAP */ VTNET_CORE_LOCK(sc); vtnet_init_locked(sc); Modified: stable/11/sys/dev/virtio/network/if_vtnetvar.h ============================================================================== --- stable/11/sys/dev/virtio/network/if_vtnetvar.h Tue Dec 4 17:40:56 2018 (r341477) +++ stable/11/sys/dev/virtio/network/if_vtnetvar.h Tue Dec 4 17:44:12 2018 (r341478) @@ -77,6 +77,9 @@ struct vtnet_rxq { struct vtnet_rxq_stats vtnrx_stats; struct taskqueue *vtnrx_tq; struct task vtnrx_intrtask; +#ifdef DEV_NETMAP + struct virtio_net_hdr_mrg_rxbuf vtnrx_shrhdr; +#endif /* DEV_NETMAP */ char vtnrx_name[16]; } __aligned(CACHE_LINE_SIZE); @@ -112,6 +115,9 @@ struct vtnet_txq { #ifndef VTNET_LEGACY_TX struct task vtntx_defrtask; #endif +#ifdef DEV_NETMAP + struct virtio_net_hdr_mrg_rxbuf vtntx_shrhdr; +#endif /* DEV_NETMAP */ char vtntx_name[16]; } __aligned(CACHE_LINE_SIZE); From owner-svn-src-all@freebsd.org Tue Dec 4 17:46:07 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3CFDF13142DB; Tue, 4 Dec 2018 17:46:07 +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 D6E51850B8; Tue, 4 Dec 2018 17:46:06 +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 B7FD9895; Tue, 4 Dec 2018 17:46:06 +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 wB4Hk6PH057526; Tue, 4 Dec 2018 17:46:06 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB4Hk6RS057525; Tue, 4 Dec 2018 17:46:06 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201812041746.wB4Hk6RS057525@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Tue, 4 Dec 2018 17:46:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r341479 - stable/11/share/man/man9 X-SVN-Group: stable-11 X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: stable/11/share/man/man9 X-SVN-Commit-Revision: 341479 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D6E51850B8 X-Spamd-Result: default: False [-0.80 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.50)[-0.502,0]; NEURAL_HAM_SHORT(-0.21)[-0.214,0]; NEURAL_HAM_LONG(-0.09)[-0.087,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Dec 2018 17:46:07 -0000 Author: vmaffione Date: Tue Dec 4 17:46:06 2018 New Revision: 341479 URL: https://svnweb.freebsd.org/changeset/base/341479 Log: MFC r340475 ifnet(9): Add description of IFCAP_NETMAP Describe IFCAP_NETMAP adding a cross reference to netmap(4). Reviewed by: bcr, 0mp Approved by: gnn (mentor) Differential Revision: https://reviews.freebsd.org/D17988 Modified: stable/11/share/man/man9/ifnet.9 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man9/ifnet.9 ============================================================================== --- stable/11/share/man/man9/ifnet.9 Tue Dec 4 17:44:12 2018 (r341478) +++ stable/11/share/man/man9/ifnet.9 Tue Dec 4 17:46:06 2018 (r341479) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 22, 2017 +.Dd November 14, 2018 .Dt IFNET 9 .Os .Sh NAME @@ -762,6 +762,9 @@ interfaces (implies .Dv IFCAP_TSO ) . .It Dv IFCAP_LINKSTATE This Ethernet interface supports dynamic link state changes. +.It Dv IFCAP_NETMAP +This Ethernet interface supports +.Xr netmap 4 . .El .Pp The ability of advanced network interfaces to offload certain From owner-svn-src-all@freebsd.org Tue Dec 4 17:47:44 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3E6A21314387; Tue, 4 Dec 2018 17:47:44 +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 DA8AF852D6; Tue, 4 Dec 2018 17: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 BB983898; Tue, 4 Dec 2018 17:47:43 +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 wB4HlhkT057842; Tue, 4 Dec 2018 17:47:43 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB4Hlhre057841; Tue, 4 Dec 2018 17:47:43 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201812041747.wB4Hlhre057841@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Tue, 4 Dec 2018 17:47:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r341480 - stable/11/sys/dev/netmap X-SVN-Group: stable-11 X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: stable/11/sys/dev/netmap X-SVN-Commit-Revision: 341480 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: DA8AF852D6 X-Spamd-Result: default: False [-0.80 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.50)[-0.502,0]; NEURAL_HAM_LONG(-0.09)[-0.087,0]; NEURAL_HAM_SHORT(-0.21)[-0.214,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Dec 2018 17:47:44 -0000 Author: vmaffione Date: Tue Dec 4 17:47:43 2018 New Revision: 341480 URL: https://svnweb.freebsd.org/changeset/base/341480 Log: MFC r341144 netmap: set IFCAP_NETMAP in if_capabilities Revision r307394 removed (by mistake) the code that sets IFCAP_NETMAP in if_capabilities on netmap_attach. This patch reverts this change. Reviewed by: np Approved by: gnn (mentor) Differential Revision: https://reviews.freebsd.org/D17987 Modified: stable/11/sys/dev/netmap/netmap_freebsd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/netmap/netmap_freebsd.c ============================================================================== --- stable/11/sys/dev/netmap/netmap_freebsd.c Tue Dec 4 17:46:06 2018 (r341479) +++ stable/11/sys/dev/netmap/netmap_freebsd.c Tue Dec 4 17:47:43 2018 (r341480) @@ -1547,6 +1547,7 @@ out: void nm_os_onattach(struct ifnet *ifp) { + ifp->if_capabilities |= IFCAP_NETMAP; } void From owner-svn-src-all@freebsd.org Tue Dec 4 17:49:46 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C966A13144C1; Tue, 4 Dec 2018 17:49:45 +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 6D4CA856D3; Tue, 4 Dec 2018 17:49:45 +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 4E17789A; Tue, 4 Dec 2018 17:49:45 +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 wB4HnjqV057977; Tue, 4 Dec 2018 17:49:45 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB4Hnib4057975; Tue, 4 Dec 2018 17:49:44 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201812041749.wB4Hnib4057975@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Tue, 4 Dec 2018 17:49:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r341481 - stable/11/sys/dev/cxgbe X-SVN-Group: stable-11 X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: stable/11/sys/dev/cxgbe X-SVN-Commit-Revision: 341481 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6D4CA856D3 X-Spamd-Result: default: False [-0.92 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.50)[-0.502,0]; NEURAL_HAM_SHORT(-0.33)[-0.329,0]; NEURAL_HAM_LONG(-0.09)[-0.087,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Dec 2018 17:49:46 -0000 Author: vmaffione Date: Tue Dec 4 17:49:44 2018 New Revision: 341481 URL: https://svnweb.freebsd.org/changeset/base/341481 Log: MFC r341145 cxgbe: revert r309725 After the fix contained in r341144, cxgbe does not need anymore to set the IFCAP_NETMAP flag manually. Reviewed by: np Approved by: gnn (mentor) Differential Revision: https://reviews.freebsd.org/D17987 Modified: stable/11/sys/dev/cxgbe/t4_main.c stable/11/sys/dev/cxgbe/t4_netmap.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/cxgbe/t4_main.c ============================================================================== --- stable/11/sys/dev/cxgbe/t4_main.c Tue Dec 4 17:47:43 2018 (r341480) +++ stable/11/sys/dev/cxgbe/t4_main.c Tue Dec 4 17:49:44 2018 (r341481) @@ -1480,10 +1480,6 @@ cxgbe_vi_attach(device_t dev, struct vi_info *vi) if (vi->nofldrxq != 0) ifp->if_capabilities |= IFCAP_TOE; #endif -#ifdef DEV_NETMAP - if (vi->nnmrxq != 0) - ifp->if_capabilities |= IFCAP_NETMAP; -#endif ifp->if_capenable = T4_CAP_ENABLE; ifp->if_hwassist = CSUM_TCP | CSUM_UDP | CSUM_IP | CSUM_TSO | CSUM_UDP_IPV6 | CSUM_TCP_IPV6; @@ -1497,7 +1493,7 @@ cxgbe_vi_attach(device_t dev, struct vi_info *vi) ether_ifattach(ifp, vi->hw_addr); #ifdef DEV_NETMAP - if (ifp->if_capabilities & IFCAP_NETMAP) + if (vi->nnmrxq != 0) cxgbe_nm_attach(vi); #endif sb = sbuf_new_auto(); Modified: stable/11/sys/dev/cxgbe/t4_netmap.c ============================================================================== --- stable/11/sys/dev/cxgbe/t4_netmap.c Tue Dec 4 17:47:43 2018 (r341480) +++ stable/11/sys/dev/cxgbe/t4_netmap.c Tue Dec 4 17:49:44 2018 (r341481) @@ -864,7 +864,7 @@ cxgbe_nm_attach(struct vi_info *vi) na.nm_register = cxgbe_netmap_reg; na.num_tx_rings = vi->nnmtxq; na.num_rx_rings = vi->nnmrxq; - netmap_attach(&na); + netmap_attach(&na); /* This adds IFCAP_NETMAP to if_capabilities */ } void From owner-svn-src-all@freebsd.org Tue Dec 4 17:53:58 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4818F131480D; Tue, 4 Dec 2018 17:53:58 +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 EE77485CC1; Tue, 4 Dec 2018 17:53:57 +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 DE228A4A; Tue, 4 Dec 2018 17:53:56 +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 wB4Hrubm062961; Tue, 4 Dec 2018 17:53:56 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB4HruP1062960; Tue, 4 Dec 2018 17:53:56 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201812041753.wB4HruP1062960@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Tue, 4 Dec 2018 17:53:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r341482 - stable/11/share/man/man4 X-SVN-Group: stable-11 X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: stable/11/share/man/man4 X-SVN-Commit-Revision: 341482 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: EE77485CC1 X-Spamd-Result: default: False [-0.70 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.42)[-0.416,0]; NEURAL_SPAM_LONG(0.04)[0.037,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_SHORT(-0.33)[-0.326,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Dec 2018 17:53:58 -0000 Author: vmaffione Date: Tue Dec 4 17:53:56 2018 New Revision: 341482 URL: https://svnweb.freebsd.org/changeset/base/341482 Log: MFC r341430 netmap(4): improve man page Reviewed by: bcr Differential Revision: https://reviews.freebsd.org/D18057 Modified: stable/11/share/man/man4/netmap.4 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/netmap.4 ============================================================================== --- stable/11/share/man/man4/netmap.4 Tue Dec 4 17:49:44 2018 (r341481) +++ stable/11/share/man/man4/netmap.4 Tue Dec 4 17:53:56 2018 (r341482) @@ -27,45 +27,60 @@ .\" .\" $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 -.Pp -.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 .Nm is a framework for extremely fast and efficient packet I/O -for both userspace and kernel clients. +for userspace and kernel clients, and for Virtual Machines. It runs on .Fx -and Linux, and includes -.Nm VALE , -a very fast and modular in-kernel software switch/dataplane, -and -.Nm netmap pipes , -a shared memory packet transport channel. -All these are accessed interchangeably with the same API. +Linux and some versions of Windows, and supports a variety of +.Nm netmap ports , +including +.Bl -tag -width XXXX +.It Nm physical NIC ports +to access individual queues of network interfaces; +.It Nm host ports +to inject packets into the host stack; +.It Nm VALE ports +implementing a very fast and modular in-kernel software switch/dataplane; +.It Nm netmap pipes +a shared memory packet transport channel; +.It Nm netmap monitors +a mechanism similar to +.Xr bpf 4 +to capture traffic +.El .Pp -.Nm , -.Nm VALE -and -.Nm netmap pipes -are at least one order of magnitude faster than +All these +.Nm netmap ports +are accessed interchangeably with the same API, +and are at least one order of magnitude faster than standard OS mechanisms -(sockets, bpf, tun/tap interfaces, native switches, pipes), -reaching 14.88 million packets per second (Mpps) -with much less than one core on a 10 Gbit NIC, -about 20 Mpps per core for VALE ports, -and over 100 Mpps for netmap pipes. +(sockets, bpf, tun/tap interfaces, native switches, pipes). +With suitably fast hardware (NICs, PCIe buses, CPUs), +packet I/O using +.Nm +on supported NICs +reaches 14.88 million packets per second (Mpps) +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 . +NICs without native +.Nm +support can still use the API in emulated mode, +which uses unmodified device drivers and is 3-5 times faster than +.Xr bpf 4 +or raw sockets. .Pp Userspace clients can dynamically switch NICs into .Nm @@ -73,8 +88,10 @@ mode and send and receive raw packets through memory mapped buffers. Similarly, .Nm VALE -switch instances and ports, and +switch instances and ports, .Nm netmap pipes +and +.Nm netmap monitors can be created dynamically, providing high speed packet I/O between processes, virtual machines, NICs and the host stack. @@ -86,20 +103,20 @@ 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 . -.Nm VALE -and -.Nm netmap pipes +.Xr epoll 7 . +All types of +.Nm netmap ports +and the +.Nm VALE switch are implemented by a single kernel module, which also emulates the .Nm -API over standard drivers for devices without native -.Nm -support. +API over standard drivers. For best performance, .Nm -requires explicit support in device drivers. +requires native support in device drivers. +A list of such devices is at the end of this document. .Pp In the rest of this (long) manual page we document various aspects of the @@ -116,7 +133,7 @@ which can be connected to a physical interface to the host stack, or to a .Nm VALE -switch). +switch. Ports use preallocated circular queues of buffers .Em ( rings ) residing in an mmapped region. @@ -152,8 +169,9 @@ ports (including and .Nm netmap pipe ports). -Simpler, higher level functions are described in section -.Xr LIBRARIES . +Simpler, higher level functions are described in the +.Sx LIBRARIES +section. .Pp Ports and rings are created and controlled through a file descriptor, created by opening a special device @@ -166,16 +184,18 @@ has multiple modes of operation controlled by the .Vt struct nmreq argument. .Va arg.nr_name -specifies the port name, as follows: +specifies the netmap port name, as follows: .Bl -tag -width XXXX -.It Dv OS network interface name (e.g. 'em0', 'eth1', ... ) +.It Dv OS network interface name (e.g., 'em0', 'eth1', ... ) the data path of the NIC is disconnected from the host stack, and the file descriptor is bound to the NIC (one or all queues), or to the host stack; -.It Dv valeXXX:YYY (arbitrary XXX and YYY) -the file descriptor is bound to port YYY of a VALE switch called XXX, -both dynamically created if necessary. -The string cannot exceed IFNAMSIZ characters, and YYY cannot +.It Dv valeSSS:PPP +the file descriptor is bound to port PPP of VALE switch SSS. +Switch instances and ports are dynamically created if necessary. +.Pp +Both SSS and PPP have the form [0-9a-zA-Z_]+ , the string +cannot exceed IFNAMSIZ characters, and PPP cannot be the name of any existing OS network interface. .El .Pp @@ -193,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 @@ -219,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 { ... @@ -242,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 { ... @@ -271,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 */ @@ -312,20 +342,17 @@ one slot is always kept empty. The ring size .Va ( num_slots ) should not be assumed to be a power of two. -.br -(NOTE: older versions of netmap used head/count format to indicate -the content of a ring). .Pp .Va head is the first slot available to userspace; -.br +.Pp .Va cur is the wakeup point: select/poll will unblock when .Va tail passes .Va cur ; -.br +.Pp .Va tail is the first slot reserved to the kernel. .Pp @@ -349,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 @@ -397,7 +423,7 @@ Below is an example of the evolution of a TX ring: .Fn select and .Fn poll -will block if there is no space in the ring, i.e. +will block if there is no space in the ring, i.e., .Dl ring->cur == ring->tail and return when new slots have become available. .Pp @@ -431,7 +457,7 @@ slots up to are returned to the kernel for further receives, and .Va tail may advance to report new incoming packets. -.br +.Pp Below is an example of the evolution of an RX ring: .Bd -literal after the syscall, there are some (h)eld and some (R)eceived slots @@ -476,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 @@ -488,7 +513,7 @@ packet must not be used in the learning bridge code. indicates that the packet's payload is in a user-supplied buffer whose user virtual address is in the 'ptr' field of the slot. The size can reach 65535 bytes. -.br +.Pp This is only supported on the transmit ring of .Nm VALE ports, and it helps reducing data copies in the interconnection @@ -570,8 +595,8 @@ indicate the size of transmit and receive rings. indicate the number of transmit and receive rings. Both ring number and sizes may be configured at runtime -using interface-specific functions (e.g. -.Xr ethtool +using interface-specific functions (e.g., +.Xr ethtool 8 ). .El .It Dv NIOCREGIF @@ -585,6 +610,15 @@ it from the host stack. Multiple file descriptors can be bound to the same port, with proper synchronization left to the user. .Pp +The recommended way to bind a file descriptor to a port is +to use function +.Va nm_open(..) +(see +.Sx LIBRARIES ) +which parses names to access specific port types and +enable features. +In the following we document the main features. +.Pp .Dv NIOCREGIF can also bind a file descriptor to one endpoint of a .Em netmap pipe , consisting of two netmap ports with a crossover connection. @@ -638,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 @@ -650,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 @@ -667,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 @@ -681,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. @@ -700,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 @@ -728,13 +768,13 @@ 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 , +.Xr pcap_open_live 3 , binds a file descriptor to a port. .Bl -tag -width XX .It Va ifname -is a port name, in the form "netmap:XXX" for a NIC and "valeXXX:YYY" for a +is a port name, in the form "netmap:PPP" for a NIC and "valeSSS:PPP" for a .Nm VALE port. .It Va req @@ -743,7 +783,7 @@ The nm_flags and nm_ringid values are overwritten by p ifname and flags, and other fields can be overridden through the other two arguments. .It Va arg -points to a struct nm_desc containing arguments (e.g. from a previously +points to a struct nm_desc containing arguments (e.g., from a previously open file descriptor) that should override the defaults. The fields are used as described below .It Va flags @@ -751,52 +791,70 @@ 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 lem 4 , -.Xr re 4 . +.Xr ixl 4 , +.Xr re 4 , +.Xr vtnet 4 . .Pp -On Linux -.Xr e1000 4 , -.Xr e1000e 4 , -.Xr igb 4 , -.Xr ixgbe 4 , -.Xr mlx4 4 , -.Xr forcedeth 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 mode through emulation. Performance is inferior to native netmap -mode but still significantly higher than sockets, and approaching -that of in-kernel solutions such as Linux's -.Xr pktgen . +mode but still significantly higher than various raw socket types +(bpf, PF_PACKET, etc.). +Note that for slow devices (such as 1 Gbit/s and slower NICs, +or several 10 Gbit/s NICs whose hardware is unable to sustain line rate), +emulated and native mode will likely have similar or same throughput. .Pp +When emulation is in use, packet sniffer programs such as tcpdump +could see received packets before they are diverted by netmap. +This behaviour is not intentional, being just an artifact of the implementation +of emulation. +Note that in case the netmap application subsequently moves packets received +from the emulated adapter onto the host RX ring, the sniffer will intercept +those packets again, since the packets are injected to the host stack as they +were received by the network interface. +.Pp Emulation is also available for devices with native netmap support, which can be used for testing or performance comparison. The sysctl variable @@ -805,15 +863,22 @@ 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. -0 uses the best available option, 1 forces native and -fails if not available, 2 forces emulated hence never fails. +.Pp +0 uses the best available option; +.Pp +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 @@ -855,15 +920,17 @@ 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 +.Xr epoll 7 and -.Xr kqueue +.Xr kqueue 2 to wake up processes when significant events occur, and .Xr mmap 2 to map memory. @@ -893,7 +960,7 @@ directory in .Fx distributions. .Pp -.Xr pkt-gen +.Xr pkt-gen 8 is a general purpose traffic source/sink. .Pp As an example @@ -904,11 +971,11 @@ is a traffic sink. Both print traffic statistics, to help monitor how the system performs. .Pp -.Xr pkt-gen +.Xr pkt-gen 8 has many options can be uses to set packet sizes, addresses, rates, and use multiple send/receive threads and cores. .Pp -.Xr bridge +.Xr bridge 4 is another test program which interconnects two .Nm ports. @@ -1000,7 +1067,7 @@ to replenish the receive ring: .Ed .Ss ACCESSING THE HOST STACK The host stack is for all practical purposes just a regular ring pair, -which you can access with the netmap API (e.g. with +which you can access with the netmap API (e.g., with .Dl nm_open("netmap:eth0^", ... ) ; All packets that the host would send to an interface in .Nm @@ -1010,13 +1077,13 @@ TX ring are send up to the host stack. A simple way to test the performance of a .Nm VALE switch is to attach a sender and a receiver to it, -e.g. running the following in two different terminals: +e.g., running the following in two different terminals: .Dl pkt-gen -i vale1:a -f rx # receiver .Dl pkt-gen -i vale1:b -f tx # sender The same example can be used to test netmap pipes, by simply -changing port names, e.g. -.Dl pkt-gen -i vale:x{3 -f rx # receiver on the master side -.Dl pkt-gen -i vale:x}3 -f tx # sender on the slave side +changing port names, e.g., +.Dl pkt-gen -i vale2:x{3 -f rx # receiver on the master side +.Dl pkt-gen -i vale2:x}3 -f tx # sender on the slave side .Pp The following command attaches an interface and the host stack to a switch: @@ -1030,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/ @@ -1088,7 +1156,7 @@ multiqueue, schedulers, packet filters. Multiple transmit and receive rings are supported natively and can be configured with ordinary OS tools, such as -.Xr ethtool +.Xr ethtool 8 or device-specific sysctl variables. The same goes for Receive Packet Steering (RPS) From owner-svn-src-all@freebsd.org Tue Dec 4 17:57:02 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B3CB41314A66; Tue, 4 Dec 2018 17:57:02 +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 5B4D5860D7; Tue, 4 Dec 2018 17:57:02 +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 38153A4C; Tue, 4 Dec 2018 17:57:02 +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 wB4Hv2i2063311; Tue, 4 Dec 2018 17:57:02 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB4Hv2dZ063310; Tue, 4 Dec 2018 17:57:02 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201812041757.wB4Hv2dZ063310@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Tue, 4 Dec 2018 17:57:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341483 - stable/12/share/man/man4 X-SVN-Group: stable-12 X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: stable/12/share/man/man4 X-SVN-Commit-Revision: 341483 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5B4D5860D7 X-Spamd-Result: default: False [-0.78 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.45)[-0.447,0]; NEURAL_HAM_SHORT(-0.33)[-0.327,0]; NEURAL_HAM_LONG(-0.00)[-0.004,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Dec 2018 17:57:02 -0000 Author: vmaffione Date: Tue Dec 4 17:57:01 2018 New Revision: 341483 URL: https://svnweb.freebsd.org/changeset/base/341483 Log: MFC r341430 netmap(4): improve man page Reviewed by: bcr Differential Revision: https://reviews.freebsd.org/D18057 Modified: stable/12/share/man/man4/netmap.4 Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/netmap.4 ============================================================================== --- stable/12/share/man/man4/netmap.4 Tue Dec 4 17:53:56 2018 (r341482) +++ stable/12/share/man/man4/netmap.4 Tue Dec 4 17:57:01 2018 (r341483) @@ -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-all@freebsd.org Tue Dec 4 17:57:04 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-all@freebsd.org Tue Dec 4 18:13:48 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-all@freebsd.org Tue Dec 4 18:28:27 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-all@freebsd.org Tue Dec 4 18:31:22 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 629A713163DA; Tue, 4 Dec 2018 18:31:22 +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 08B4B6A700; Tue, 4 Dec 2018 18:31:22 +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 C6B3F1072; Tue, 4 Dec 2018 18:31:21 +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 wB4IVLFl083514; Tue, 4 Dec 2018 18:31:21 GMT (envelope-from gordon@FreeBSD.org) Received: (from gordon@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB4IVLNZ083513; Tue, 4 Dec 2018 18:31:21 GMT (envelope-from gordon@FreeBSD.org) Message-Id: <201812041831.wB4IVLNZ083513@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:31:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341485 - stable/12/usr.sbin/bhyve X-SVN-Group: stable-12 X-SVN-Commit-Author: gordon X-SVN-Commit-Paths: stable/12/usr.sbin/bhyve X-SVN-Commit-Revision: 341485 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 08B4B6A700 X-Spamd-Result: default: False [-0.39 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.48)[-0.475,0]; NEURAL_SPAM_SHORT(0.13)[0.133,0]; NEURAL_HAM_LONG(-0.05)[-0.046,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Dec 2018 18:31:22 -0000 Author: gordon Date: Tue Dec 4 18:31:21 2018 New Revision: 341485 URL: https://svnweb.freebsd.org/changeset/base/341485 Log: MFC r341484 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: stable/12/usr.sbin/bhyve/fwctl.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/bhyve/fwctl.c ============================================================================== --- stable/12/usr.sbin/bhyve/fwctl.c Tue Dec 4 18:28:25 2018 (r341484) +++ stable/12/usr.sbin/bhyve/fwctl.c Tue Dec 4 18:31:21 2018 (r341485) @@ -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-all@freebsd.org Tue Dec 4 18:32:52 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EF508131661F; Tue, 4 Dec 2018 18:32:51 +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 93CDF6A9A1; Tue, 4 Dec 2018 18:32:51 +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 5C4E110C8; Tue, 4 Dec 2018 18:32:51 +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 wB4IWpBE084586; Tue, 4 Dec 2018 18:32:51 GMT (envelope-from gordon@FreeBSD.org) Received: (from gordon@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB4IWp3l084585; Tue, 4 Dec 2018 18:32:51 GMT (envelope-from gordon@FreeBSD.org) Message-Id: <201812041832.wB4IWp3l084585@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:32:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r341486 - stable/11/usr.sbin/bhyve X-SVN-Group: stable-11 X-SVN-Commit-Author: gordon X-SVN-Commit-Paths: stable/11/usr.sbin/bhyve X-SVN-Commit-Revision: 341486 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 93CDF6A9A1 X-Spamd-Result: default: False [-0.39 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.48)[-0.475,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_SPAM_SHORT(0.13)[0.133,0]; NEURAL_HAM_LONG(-0.05)[-0.046,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Dec 2018 18:32:52 -0000 Author: gordon Date: Tue Dec 4 18:32:50 2018 New Revision: 341486 URL: https://svnweb.freebsd.org/changeset/base/341486 Log: MFC r341484 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: stable/11/usr.sbin/bhyve/fwctl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/bhyve/fwctl.c ============================================================================== --- stable/11/usr.sbin/bhyve/fwctl.c Tue Dec 4 18:31:21 2018 (r341485) +++ stable/11/usr.sbin/bhyve/fwctl.c Tue Dec 4 18:32:50 2018 (r341486) @@ -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-all@freebsd.org Tue Dec 4 18:38:04 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0F6BD131687F; Tue, 4 Dec 2018 18:38:04 +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 AA6D06AD13; Tue, 4 Dec 2018 18:38:03 +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 7234310CE; Tue, 4 Dec 2018 18:38:03 +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 wB4Ic3Rn084886; Tue, 4 Dec 2018 18:38:03 GMT (envelope-from gordon@FreeBSD.org) Received: (from gordon@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB4Ic3IG084885; Tue, 4 Dec 2018 18:38:03 GMT (envelope-from gordon@FreeBSD.org) Message-Id: <201812041838.wB4Ic3IG084885@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:38:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r341487 - releng/12.0/usr.sbin/bhyve X-SVN-Group: releng X-SVN-Commit-Author: gordon X-SVN-Commit-Paths: releng/12.0/usr.sbin/bhyve X-SVN-Commit-Revision: 341487 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: AA6D06AD13 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Dec 2018 18:38:04 -0000 Author: gordon Date: Tue Dec 4 18:38:03 2018 New Revision: 341487 URL: https://svnweb.freebsd.org/changeset/base/341487 Log: Fix insufficient bounds checking in bhyve(8) device model. [SA-18:14.bhyve] Submitted by: jhb Reported by: Reno Robert Approved by: so Approved by: re (implicit) Security: FreeBSD-SA-18:14.bhyve Security: CVE-2018-17160 Modified: releng/12.0/usr.sbin/bhyve/fwctl.c Modified: releng/12.0/usr.sbin/bhyve/fwctl.c ============================================================================== --- releng/12.0/usr.sbin/bhyve/fwctl.c Tue Dec 4 18:32:50 2018 (r341486) +++ releng/12.0/usr.sbin/bhyve/fwctl.c Tue Dec 4 18:38:03 2018 (r341487) @@ -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-all@freebsd.org Tue Dec 4 18:38:33 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5C95713168E7; Tue, 4 Dec 2018 18:38:33 +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 01CEA6AE1E; Tue, 4 Dec 2018 18:38:33 +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 D892B10D1; Tue, 4 Dec 2018 18:38:32 +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 wB4IcWQu084952; Tue, 4 Dec 2018 18:38:32 GMT (envelope-from gordon@FreeBSD.org) Received: (from gordon@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB4IcWD3084949; Tue, 4 Dec 2018 18:38:32 GMT (envelope-from gordon@FreeBSD.org) Message-Id: <201812041838.wB4IcWD3084949@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:38:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r341488 - in releng/11.2: . sys/conf usr.sbin/bhyve X-SVN-Group: releng X-SVN-Commit-Author: gordon X-SVN-Commit-Paths: in releng/11.2: . sys/conf usr.sbin/bhyve X-SVN-Commit-Revision: 341488 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 01CEA6AE1E 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Dec 2018 18:38:33 -0000 Author: gordon Date: Tue Dec 4 18:38:32 2018 New Revision: 341488 URL: https://svnweb.freebsd.org/changeset/base/341488 Log: Fix insufficient bounds checking in bhyve(8) device model. [SA-18:14.bhyve] Submitted by: jhb Reported by: Reno Robert Approved by: so Security: FreeBSD-SA-18:14.bhyve Security: CVE-2018-17160 Modified: releng/11.2/UPDATING releng/11.2/sys/conf/newvers.sh releng/11.2/usr.sbin/bhyve/fwctl.c Modified: releng/11.2/UPDATING ============================================================================== --- releng/11.2/UPDATING Tue Dec 4 18:38:03 2018 (r341487) +++ releng/11.2/UPDATING Tue Dec 4 18:38:32 2018 (r341488) @@ -16,6 +16,11 @@ from older versions of FreeBSD, try WITHOUT_CLANG and the tip of head, and then rebuild without this option. The bootstrap process from older version of current across the gcc/clang cutover is a bit fragile. +20181204 p6 FreeBSD-SA-18:14.bhyve + + Fix insufficient bounds checking in bhyve(8) device model. + [SA-18:14.bhyve] + 20181127 p5 FreeBSD-SA-18:13.nfs FreeBSD-EN-18:13.icmp FreeBSD-EN-18:14.tzdata Modified: releng/11.2/sys/conf/newvers.sh ============================================================================== --- releng/11.2/sys/conf/newvers.sh Tue Dec 4 18:38:03 2018 (r341487) +++ releng/11.2/sys/conf/newvers.sh Tue Dec 4 18:38:32 2018 (r341488) @@ -44,7 +44,7 @@ TYPE="FreeBSD" REVISION="11.2" -BRANCH="RELEASE-p5" +BRANCH="RELEASE-p6" if [ -n "${BRANCH_OVERRIDE}" ]; then BRANCH=${BRANCH_OVERRIDE} fi Modified: releng/11.2/usr.sbin/bhyve/fwctl.c ============================================================================== --- releng/11.2/usr.sbin/bhyve/fwctl.c Tue Dec 4 18:38:03 2018 (r341487) +++ releng/11.2/usr.sbin/bhyve/fwctl.c Tue Dec 4 18:38:32 2018 (r341488) @@ -77,8 +77,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); }; @@ -117,7 +117,7 @@ errop_set(int err) } static int -errop_start(int len) +errop_start(uint32_t len) { errop_code = ENOENT; @@ -126,7 +126,7 @@ errop_start(int len) } static void -errop_data(uint32_t data, int len) +errop_data(uint32_t data, uint32_t len) { /* ignore */ @@ -186,7 +186,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) @@ -198,7 +198,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; @@ -283,8 +283,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; @@ -344,13 +344,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(); @@ -399,7 +400,7 @@ static int fwctl_response(uint32_t *retval) { uint32_t *dp; - int remlen; + ssize_t remlen; switch(rinfo.resp_count) { case 0: @@ -434,7 +435,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-all@freebsd.org Tue Dec 4 18:45:58 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-all@freebsd.org Tue Dec 4 18:51:29 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-all@freebsd.org Tue Dec 4 18:55:37 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B9BD713178EA for ; Tue, 4 Dec 2018 18:55:36 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x82a.google.com (mail-qt1-x82a.google.com [IPv6:2607:f8b0:4864:20::82a]) (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 BBDD66C7DB for ; Tue, 4 Dec 2018 18:55:35 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x82a.google.com with SMTP id l11so19363142qtp.0 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=D1t4F6uSZTDDUwNVY1E6XCUlLSGdroFr/DWuVbsqsIlXw06cm8jSeKcLIinxbxKdtm hddwGg66tCwGpjX7bQXvZGX0vtZ+hyXwdul0LAAFs/E3LkmGRLc0GSSRc80L9LOySRnN lZyLhySTgx44Wxd/S6bZHAoKT1xvi3YiYP/LaL7G9AvuDrEFiTow57/7GIn4OIEl28Z/ YzBv12HmRjts0nl/MrD253+m4dBYnC66+4foKoAq/HuZ2vzFWDa1posKr4NzLyx9TGRC L2JZqdHZVQRxY5W3QmaiqGSBk5nJS7kE1GT+d54/0P/8L+CnZlrwdvSZpakO0iLzM/cB 2kOg== X-Gm-Message-State: AA+aEWaAed2272a5ZySc+XAMfppct2M4Ybsy51N500l20++RhpZRT5gS +NvhxHSbut4+RCaXE9RM1+VliSr7W4czAJzNsnO78A== 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: BBDD66C7DB X-Spamd-Result: default: False [-4.55 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,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(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-all@freebsd.org]; DMARC_NA(0.00)[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)[a.2.8.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_SHORT(-0.97)[-0.975,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.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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Dec 2018 18:55:37 -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-all@freebsd.org Tue Dec 4 19:06:14 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0A96C1317F61; Tue, 4 Dec 2018 19:06:14 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 877D26D0F6; Tue, 4 Dec 2018 19:06:13 +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 60C2B15DA; Tue, 4 Dec 2018 19:06:13 +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 wB4J6Dld001125; Tue, 4 Dec 2018 19:06:13 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB4J6Br6001116; Tue, 4 Dec 2018 19:06:11 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201812041906.wB4J6Br6001116@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 4 Dec 2018 19:06:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341490 - in stable/12/sys: amd64/amd64 amd64/ia32 arm/arm fs/procfs i386/i386 kern sparc64/sparc64 X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/12/sys: amd64/amd64 amd64/ia32 arm/arm fs/procfs i386/i386 kern sparc64/sparc64 X-SVN-Commit-Revision: 341490 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 877D26D0F6 X-Spamd-Result: default: False [-0.39 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.48)[-0.475,0]; NEURAL_SPAM_SHORT(0.13)[0.133,0]; NEURAL_HAM_LONG(-0.05)[-0.046,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Dec 2018 19:06:14 -0000 Author: markj Date: Tue Dec 4 19:06:11 2018 New Revision: 341490 URL: https://svnweb.freebsd.org/changeset/base/341490 Log: MFC r341442, r341443: Plug memory disclosures via ptrace(2). Modified: stable/12/sys/amd64/amd64/machdep.c stable/12/sys/amd64/ia32/ia32_reg.c stable/12/sys/arm/arm/machdep_kdb.c stable/12/sys/fs/procfs/procfs_dbregs.c stable/12/sys/fs/procfs/procfs_fpregs.c stable/12/sys/fs/procfs/procfs_regs.c stable/12/sys/i386/i386/machdep.c stable/12/sys/kern/sys_process.c stable/12/sys/sparc64/sparc64/machdep.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/amd64/machdep.c ============================================================================== --- stable/12/sys/amd64/amd64/machdep.c Tue Dec 4 18:51:28 2018 (r341489) +++ stable/12/sys/amd64/amd64/machdep.c Tue Dec 4 19:06:11 2018 (r341490) @@ -2046,6 +2046,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; @@ -2077,6 +2078,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: stable/12/sys/amd64/ia32/ia32_reg.c ============================================================================== --- stable/12/sys/amd64/ia32/ia32_reg.c Tue Dec 4 18:51:28 2018 (r341489) +++ stable/12/sys/amd64/ia32/ia32_reg.c Tue Dec 4 19:06:11 2018 (r341490) @@ -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: stable/12/sys/arm/arm/machdep_kdb.c ============================================================================== --- stable/12/sys/arm/arm/machdep_kdb.c Tue Dec 4 18:51:28 2018 (r341489) +++ stable/12/sys/arm/arm/machdep_kdb.c Tue Dec 4 19:06:11 2018 (r341490) @@ -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: stable/12/sys/fs/procfs/procfs_dbregs.c ============================================================================== --- stable/12/sys/fs/procfs/procfs_dbregs.c Tue Dec 4 18:51:28 2018 (r341489) +++ stable/12/sys/fs/procfs/procfs_dbregs.c Tue Dec 4 19:06:11 2018 (r341490) @@ -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: stable/12/sys/fs/procfs/procfs_fpregs.c ============================================================================== --- stable/12/sys/fs/procfs/procfs_fpregs.c Tue Dec 4 18:51:28 2018 (r341489) +++ stable/12/sys/fs/procfs/procfs_fpregs.c Tue Dec 4 19:06:11 2018 (r341490) @@ -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: stable/12/sys/fs/procfs/procfs_regs.c ============================================================================== --- stable/12/sys/fs/procfs/procfs_regs.c Tue Dec 4 18:51:28 2018 (r341489) +++ stable/12/sys/fs/procfs/procfs_regs.c Tue Dec 4 19:06:11 2018 (r341490) @@ -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: stable/12/sys/i386/i386/machdep.c ============================================================================== --- stable/12/sys/i386/i386/machdep.c Tue Dec 4 18:51:28 2018 (r341489) +++ stable/12/sys/i386/i386/machdep.c Tue Dec 4 19:06:11 2018 (r341490) @@ -2817,6 +2817,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; @@ -2832,6 +2833,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: stable/12/sys/kern/sys_process.c ============================================================================== --- stable/12/sys/kern/sys_process.c Tue Dec 4 18:51:28 2018 (r341489) +++ stable/12/sys/kern/sys_process.c Tue Dec 4 19:06:11 2018 (r341490) @@ -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) @@ -548,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 @@ -573,7 +577,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 +594,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 +672,7 @@ sys_ptrace(struct thread *td, struct ptrace_args *uap) } #undef COPYIN #undef COPYOUT +#undef BZERO #ifdef COMPAT_FREEBSD32 /* Modified: stable/12/sys/sparc64/sparc64/machdep.c ============================================================================== --- stable/12/sys/sparc64/sparc64/machdep.c Tue Dec 4 18:51:28 2018 (r341489) +++ stable/12/sys/sparc64/sparc64/machdep.c Tue Dec 4 19:06:11 2018 (r341490) @@ -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-all@freebsd.org Tue Dec 4 19:07:13 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 47694131800A; Tue, 4 Dec 2018 19:07:13 +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 B99DB6D25E; Tue, 4 Dec 2018 19:07:12 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9978115DF; Tue, 4 Dec 2018 19:07:12 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB4J7Cru001217; Tue, 4 Dec 2018 19:07:12 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB4J7Ag6001205; Tue, 4 Dec 2018 19:07:10 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201812041907.wB4J7Ag6001205@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 4 Dec 2018 19:07:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r341491 - in stable/11/sys: amd64/amd64 amd64/ia32 arm/arm fs/procfs i386/i386 kern sparc64/sparc64 X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/11/sys: amd64/amd64 amd64/ia32 arm/arm fs/procfs i386/i386 kern sparc64/sparc64 X-SVN-Commit-Revision: 341491 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B99DB6D25E X-Spamd-Result: default: False [-0.18 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.48)[-0.475,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_SPAM_SHORT(0.34)[0.342,0]; NEURAL_HAM_LONG(-0.05)[-0.046,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Dec 2018 19:07:13 -0000 Author: markj Date: Tue Dec 4 19:07:10 2018 New Revision: 341491 URL: https://svnweb.freebsd.org/changeset/base/341491 Log: MFC r341442, r341443: Plug memory disclosures via ptrace(2). Modified: stable/11/sys/amd64/amd64/machdep.c stable/11/sys/amd64/ia32/ia32_reg.c stable/11/sys/arm/arm/machdep_kdb.c stable/11/sys/fs/procfs/procfs_dbregs.c stable/11/sys/fs/procfs/procfs_fpregs.c stable/11/sys/fs/procfs/procfs_regs.c stable/11/sys/i386/i386/machdep.c stable/11/sys/kern/sys_process.c stable/11/sys/sparc64/sparc64/machdep.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/amd64/machdep.c ============================================================================== --- stable/11/sys/amd64/amd64/machdep.c Tue Dec 4 19:06:11 2018 (r341490) +++ stable/11/sys/amd64/amd64/machdep.c Tue Dec 4 19:07:10 2018 (r341491) @@ -2025,6 +2025,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; @@ -2056,6 +2057,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: stable/11/sys/amd64/ia32/ia32_reg.c ============================================================================== --- stable/11/sys/amd64/ia32/ia32_reg.c Tue Dec 4 19:06:11 2018 (r341490) +++ stable/11/sys/amd64/ia32/ia32_reg.c Tue Dec 4 19:07:10 2018 (r341491) @@ -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: stable/11/sys/arm/arm/machdep_kdb.c ============================================================================== --- stable/11/sys/arm/arm/machdep_kdb.c Tue Dec 4 19:06:11 2018 (r341490) +++ stable/11/sys/arm/arm/machdep_kdb.c Tue Dec 4 19:07:10 2018 (r341491) @@ -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: stable/11/sys/fs/procfs/procfs_dbregs.c ============================================================================== --- stable/11/sys/fs/procfs/procfs_dbregs.c Tue Dec 4 19:06:11 2018 (r341490) +++ stable/11/sys/fs/procfs/procfs_dbregs.c Tue Dec 4 19:07:10 2018 (r341491) @@ -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: stable/11/sys/fs/procfs/procfs_fpregs.c ============================================================================== --- stable/11/sys/fs/procfs/procfs_fpregs.c Tue Dec 4 19:06:11 2018 (r341490) +++ stable/11/sys/fs/procfs/procfs_fpregs.c Tue Dec 4 19:07:10 2018 (r341491) @@ -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: stable/11/sys/fs/procfs/procfs_regs.c ============================================================================== --- stable/11/sys/fs/procfs/procfs_regs.c Tue Dec 4 19:06:11 2018 (r341490) +++ stable/11/sys/fs/procfs/procfs_regs.c Tue Dec 4 19:07:10 2018 (r341491) @@ -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: stable/11/sys/i386/i386/machdep.c ============================================================================== --- stable/11/sys/i386/i386/machdep.c Tue Dec 4 19:06:11 2018 (r341490) +++ stable/11/sys/i386/i386/machdep.c Tue Dec 4 19:07:10 2018 (r341491) @@ -2954,6 +2954,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; @@ -2969,6 +2970,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: stable/11/sys/kern/sys_process.c ============================================================================== --- stable/11/sys/kern/sys_process.c Tue Dec 4 19:06:11 2018 (r341490) +++ stable/11/sys/kern/sys_process.c Tue Dec 4 19:07:10 2018 (r341491) @@ -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) @@ -548,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 @@ -573,7 +577,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 +594,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 +672,7 @@ sys_ptrace(struct thread *td, struct ptrace_args *uap) } #undef COPYIN #undef COPYOUT +#undef BZERO #ifdef COMPAT_FREEBSD32 /* Modified: stable/11/sys/sparc64/sparc64/machdep.c ============================================================================== --- stable/11/sys/sparc64/sparc64/machdep.c Tue Dec 4 19:06:11 2018 (r341490) +++ stable/11/sys/sparc64/sparc64/machdep.c Tue Dec 4 19:07:10 2018 (r341491) @@ -1057,6 +1057,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-all@freebsd.org Tue Dec 4 19:55:40 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 64013131A1B9; Tue, 4 Dec 2018 19:55:40 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AA5166F7BA; Tue, 4 Dec 2018 19:55:39 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 885AB1DEE; Tue, 4 Dec 2018 19:55:39 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB4Jtd9s027377; Tue, 4 Dec 2018 19:55:39 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB4JtdVk027376; Tue, 4 Dec 2018 19:55:39 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201812041955.wB4JtdVk027376@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 4 Dec 2018 19:55:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r341492 - stable/11/release/doc/share/xml X-SVN-Group: stable-11 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: stable/11/release/doc/share/xml X-SVN-Commit-Revision: 341492 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: AA5166F7BA X-Spamd-Result: default: False [-0.26 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.50)[-0.502,0]; NEURAL_SPAM_SHORT(0.33)[0.326,0]; NEURAL_HAM_LONG(-0.09)[-0.087,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Dec 2018 19:55:40 -0000 Author: gjb Date: Tue Dec 4 19:55:39 2018 New Revision: 341492 URL: https://svnweb.freebsd.org/changeset/base/341492 Log: Document SA-18:14. Sponsored by: The FreeBSD Foundation Modified: stable/11/release/doc/share/xml/security.xml Modified: stable/11/release/doc/share/xml/security.xml ============================================================================== --- stable/11/release/doc/share/xml/security.xml Tue Dec 4 19:07:10 2018 (r341491) +++ stable/11/release/doc/share/xml/security.xml Tue Dec 4 19:55:39 2018 (r341492) @@ -63,6 +63,13 @@ 27 November 2018 Multiple vulnerabilities + + + FreeBSD-SA-18:14.bhyve + 4 December 2018 + Insufficient bounds checking + From owner-svn-src-all@freebsd.org Tue Dec 4 19:59:34 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-all@freebsd.org Tue Dec 4 20:36:09 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-all@freebsd.org Tue Dec 4 20:40:29 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 328B413210C1; Tue, 4 Dec 2018 20:40:29 +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 CA56E71AB3; Tue, 4 Dec 2018 20:40:28 +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 A59532463; Tue, 4 Dec 2018 20:40:28 +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 wB4KeSus047928; Tue, 4 Dec 2018 20:40:28 GMT (envelope-from garga@FreeBSD.org) Received: (from garga@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB4KeS61047927; Tue, 4 Dec 2018 20:40:28 GMT (envelope-from garga@FreeBSD.org) Message-Id: <201812042040.wB4KeS61047927@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 20:40:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341493 - stable/12/sbin/savecore X-SVN-Group: stable-12 X-SVN-Commit-Author: garga X-SVN-Commit-Paths: stable/12/sbin/savecore X-SVN-Commit-Revision: 341493 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: CA56E71AB3 X-Spamd-Result: default: False [-0.33 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.50)[-0.502,0]; NEURAL_SPAM_SHORT(0.26)[0.264,0]; NEURAL_HAM_LONG(-0.09)[-0.087,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Dec 2018 20:40:29 -0000 Author: garga (ports committer) Date: Tue Dec 4 20:40:28 2018 New Revision: 341493 URL: https://svnweb.freebsd.org/changeset/base/341493 Log: MFC r341464: Restore /var/crash permissions to 0750, as declared in mtree file. After r337337 it changed to 0755. Reviewed by: loos Approved by: loos Sponsored by: Rubicon Communications, LLC (Netgate) Differential Revision: https://reviews.freebsd.org/D18355 Modified: stable/12/sbin/savecore/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/savecore/Makefile ============================================================================== --- stable/12/sbin/savecore/Makefile Tue Dec 4 19:55:39 2018 (r341492) +++ stable/12/sbin/savecore/Makefile Tue Dec 4 20:40:28 2018 (r341493) @@ -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-all@freebsd.org Tue Dec 4 20:41:01 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-all@freebsd.org Tue Dec 4 21:48:57 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-all@freebsd.org Tue Dec 4 21:56:46 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-all@freebsd.org Tue Dec 4 21:57:27 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-all@freebsd.org Tue Dec 4 22:05:37 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A77D913230F6; Tue, 4 Dec 2018 22:05:37 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 440FD74AFA; Tue, 4 Dec 2018 22:05:37 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9CAAC32DF; Tue, 4 Dec 2018 22:05:36 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB4M5aao093149; Tue, 4 Dec 2018 22:05:36 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB4M5ahT093148; Tue, 4 Dec 2018 22:05:36 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201812042205.wB4M5ahT093148@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Tue, 4 Dec 2018 22:05:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341497 - stable/12/sys/netinet/tcp_stacks X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet/tcp_stacks X-SVN-Commit-Revision: 341497 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 440FD74AFA X-Spamd-Result: default: False [-0.02 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.48)[-0.475,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_SPAM_SHORT(0.50)[0.496,0]; NEURAL_HAM_LONG(-0.05)[-0.046,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Dec 2018 22:05:37 -0000 Author: tuexen Date: Tue Dec 4 22:05:36 2018 New Revision: 341497 URL: https://svnweb.freebsd.org/changeset/base/341497 Log: MFC r340738: Improve two KASSERTs in the TCP RACK stack. There are two locations where an always true comparison was made in a KASSERT. Replace this by an appropriate check and use a consistent panic message. Also use this code when checking a similar condition. PR: 229664 Reviewed by: rrs@ MFC after: 1 week Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D18021 Modified: stable/12/sys/netinet/tcp_stacks/rack.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/tcp_stacks/rack.c ============================================================================== --- stable/12/sys/netinet/tcp_stacks/rack.c Tue Dec 4 21:57:26 2018 (r341496) +++ stable/12/sys/netinet/tcp_stacks/rack.c Tue Dec 4 22:05:36 2018 (r341497) @@ -7053,12 +7053,10 @@ again: tlen = rsm->r_end - rsm->r_start; if (tlen > tp->t_maxseg) tlen = tp->t_maxseg; -#ifdef INVARIANTS - if (SEQ_GT(tp->snd_una, rsm->r_start)) { - panic("tp:%p rack:%p snd_una:%u rsm:%p r_start:%u", - tp, rack, tp->snd_una, rsm, rsm->r_start); - } -#endif + KASSERT(SEQ_LEQ(tp->snd_una, rsm->r_start), + ("%s:%d: r.start:%u < SND.UNA:%u; tp:%p, rack:%p, rsm:%p", + __func__, __LINE__, + rsm->r_start, tp->snd_una, tp, rack, rsm)); sb_offset = rsm->r_start - tp->snd_una; cwin = min(tp->snd_wnd, tlen); len = cwin; @@ -7069,12 +7067,14 @@ again: len = rsm->r_end - rsm->r_start; sack_rxmit = 1; sendalot = 0; + KASSERT(SEQ_LEQ(tp->snd_una, rsm->r_start), + ("%s:%d: r.start:%u < SND.UNA:%u; tp:%p, rack:%p, rsm:%p", + __func__, __LINE__, + rsm->r_start, tp->snd_una, tp, rack, rsm)); sb_offset = rsm->r_start - tp->snd_una; if (len >= tp->t_maxseg) { len = tp->t_maxseg; } - KASSERT(sb_offset >= 0, ("%s: sack block to the left of una : %d", - __func__, sb_offset)); } else if ((rack->rc_in_persist == 0) && ((rsm = tcp_rack_output(tp, rack, cts)) != NULL)) { long tlen; @@ -7099,6 +7099,10 @@ again: } #endif tlen = rsm->r_end - rsm->r_start; + KASSERT(SEQ_LEQ(tp->snd_una, rsm->r_start), + ("%s:%d: r.start:%u < SND.UNA:%u; tp:%p, rack:%p, rsm:%p", + __func__, __LINE__, + rsm->r_start, tp->snd_una, tp, rack, rsm)); sb_offset = rsm->r_start - tp->snd_una; if (tlen > rack->r_ctl.rc_prr_sndcnt) { len = rack->r_ctl.rc_prr_sndcnt; @@ -7120,8 +7124,6 @@ again: goto just_return_nolock; } } - KASSERT(sb_offset >= 0, ("%s: sack block to the left of una : %d", - __func__, sb_offset)); if (len > 0) { sub_from_prr = 1; sack_rxmit = 1; From owner-svn-src-all@freebsd.org Tue Dec 4 22:10:10 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 56A5913231FA; Tue, 4 Dec 2018 22:10:10 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EEC2074CEF; Tue, 4 Dec 2018 22:10:09 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CE5B53306; Tue, 4 Dec 2018 22:10:09 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB4MA9Mw093451; Tue, 4 Dec 2018 22:10:09 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB4MA9rk093449; Tue, 4 Dec 2018 22:10:09 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201812042210.wB4MA9rk093449@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Tue, 4 Dec 2018 22:10:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341498 - in stable/12/sys/netinet: . tcp_stacks X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: in stable/12/sys/netinet: . tcp_stacks X-SVN-Commit-Revision: 341498 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: EEC2074CEF X-Spamd-Result: default: False [-0.02 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.48)[-0.475,0]; NEURAL_SPAM_SHORT(0.50)[0.496,0]; NEURAL_HAM_LONG(-0.05)[-0.046,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Dec 2018 22:10:10 -0000 Author: tuexen Date: Tue Dec 4 22:10:09 2018 New Revision: 341498 URL: https://svnweb.freebsd.org/changeset/base/341498 Log: MFC r340774: Ensure that TCP RST-segments announce consistently a receiver window of zero. This was already done when sending them via tcp_respond(). Reviewed by: rrs@ Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D17949 Modified: stable/12/sys/netinet/tcp_output.c stable/12/sys/netinet/tcp_stacks/rack.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/tcp_output.c ============================================================================== --- stable/12/sys/netinet/tcp_output.c Tue Dec 4 22:05:36 2018 (r341497) +++ stable/12/sys/netinet/tcp_output.c Tue Dec 4 22:10:09 2018 (r341498) @@ -1171,14 +1171,18 @@ send: /* * Calculate receive window. Don't shrink window, * but avoid silly window syndrome. + * If a RST segment is sent, advertise a window of zero. */ - if (recwin < (so->so_rcv.sb_hiwat / 4) && - recwin < tp->t_maxseg) + if (flags & TH_RST) { recwin = 0; - if (SEQ_GT(tp->rcv_adv, tp->rcv_nxt) && - recwin < (tp->rcv_adv - tp->rcv_nxt)) - recwin = (tp->rcv_adv - tp->rcv_nxt); - + } else { + if (recwin < (so->so_rcv.sb_hiwat / 4) && + recwin < tp->t_maxseg) + recwin = 0; + if (SEQ_GT(tp->rcv_adv, tp->rcv_nxt) && + recwin < (tp->rcv_adv - tp->rcv_nxt)) + recwin = (tp->rcv_adv - tp->rcv_nxt); + } /* * According to RFC1323 the window field in a SYN (i.e., a * or ) segment itself is never scaled. The Modified: stable/12/sys/netinet/tcp_stacks/rack.c ============================================================================== --- stable/12/sys/netinet/tcp_stacks/rack.c Tue Dec 4 22:05:36 2018 (r341497) +++ stable/12/sys/netinet/tcp_stacks/rack.c Tue Dec 4 22:10:09 2018 (r341498) @@ -8189,15 +8189,20 @@ send: /* * Calculate receive window. Don't shrink window, but avoid silly * window syndrome. + * If a RST segment is sent, advertise a window of zero. */ - if (recwin < (long)(so->so_rcv.sb_hiwat / 4) && - recwin < (long)tp->t_maxseg) + if (flags & TH_RST) { recwin = 0; - if (SEQ_GT(tp->rcv_adv, tp->rcv_nxt) && - recwin < (long)(tp->rcv_adv - tp->rcv_nxt)) - recwin = (long)(tp->rcv_adv - tp->rcv_nxt); - if (recwin > (long)TCP_MAXWIN << tp->rcv_scale) - recwin = (long)TCP_MAXWIN << tp->rcv_scale; + } else { + if (recwin < (long)(so->so_rcv.sb_hiwat / 4) && + recwin < (long)tp->t_maxseg) + recwin = 0; + if (SEQ_GT(tp->rcv_adv, tp->rcv_nxt) && + recwin < (long)(tp->rcv_adv - tp->rcv_nxt)) + recwin = (long)(tp->rcv_adv - tp->rcv_nxt); + if (recwin > (long)TCP_MAXWIN << tp->rcv_scale) + recwin = (long)TCP_MAXWIN << tp->rcv_scale; + } /* * According to RFC1323 the window field in a SYN (i.e., a or From owner-svn-src-all@freebsd.org Tue Dec 4 22:11:42 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 47B491323315; Tue, 4 Dec 2018 22:11:42 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E399874F27; Tue, 4 Dec 2018 22:11:41 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C5BBD3453; Tue, 4 Dec 2018 22:11:41 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB4MBfp6097623; Tue, 4 Dec 2018 22:11:41 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB4MBfO4097622; Tue, 4 Dec 2018 22:11:41 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201812042211.wB4MBfO4097622@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Tue, 4 Dec 2018 22:11:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341499 - stable/12/sys/netinet/tcp_stacks X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet/tcp_stacks X-SVN-Commit-Revision: 341499 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E399874F27 X-Spamd-Result: default: False [-0.11 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.50)[-0.502,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_SPAM_SHORT(0.48)[0.475,0]; NEURAL_HAM_LONG(-0.09)[-0.087,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Dec 2018 22:11:42 -0000 Author: tuexen Date: Tue Dec 4 22:11:41 2018 New Revision: 341499 URL: https://svnweb.freebsd.org/changeset/base/341499 Log: MFC r340777: Ensure that the default RTT stack can make an RTT measurement if the TCP connection was initiated using the RACK stack, but the peer does not support the TCP RACK extension. This ensures that the TCP behaviour on the wire is the same if the TCP connection is initated using the RACK stack or the default stack. Reviewed by: rrs@ Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D18032 Modified: stable/12/sys/netinet/tcp_stacks/rack.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/tcp_stacks/rack.c ============================================================================== --- stable/12/sys/netinet/tcp_stacks/rack.c Tue Dec 4 22:10:09 2018 (r341498) +++ stable/12/sys/netinet/tcp_stacks/rack.c Tue Dec 4 22:11:41 2018 (r341499) @@ -8493,9 +8493,7 @@ out: pass, rsm); if ((tp->t_flags & TF_FORCEDATA) == 0 || (rack->rc_in_persist == 0)) { -#ifdef NETFLIX_STATS tcp_seq startseq = tp->snd_nxt; -#endif /* * Advance snd_nxt over sequence space of this segment. @@ -8527,6 +8525,17 @@ out: tp->t_acktime = ticks; } tp->snd_max = tp->snd_nxt; + /* + * Time this transmission if not a retransmission and + * not currently timing anything. + * This is only relevant in case of switching back to + * the base stack. + */ + if (tp->t_rtttime == 0) { + tp->t_rtttime = ticks; + tp->t_rtseq = startseq; + TCPSTAT_INC(tcps_segstimed); + } #ifdef NETFLIX_STATS if (!(tp->t_flags & TF_GPUTINPROG) && len) { tp->t_flags |= TF_GPUTINPROG; From owner-svn-src-all@freebsd.org Tue Dec 4 22:13:06 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9EFAF13234DA; Tue, 4 Dec 2018 22:13:06 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 413747521E; Tue, 4 Dec 2018 22:13:06 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1F2BF3497; Tue, 4 Dec 2018 22:13:06 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB4MD5UH098439; Tue, 4 Dec 2018 22:13:05 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB4MD5LJ098438; Tue, 4 Dec 2018 22:13:05 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201812042213.wB4MD5LJ098438@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Tue, 4 Dec 2018 22:13:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341500 - stable/12/sys/netinet/tcp_stacks X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet/tcp_stacks X-SVN-Commit-Revision: 341500 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 413747521E X-Spamd-Result: default: False [-0.11 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.50)[-0.502,0]; NEURAL_SPAM_SHORT(0.48)[0.475,0]; NEURAL_HAM_LONG(-0.09)[-0.087,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Dec 2018 22:13:06 -0000 Author: tuexen Date: Tue Dec 4 22:13:05 2018 New Revision: 341500 URL: https://svnweb.freebsd.org/changeset/base/341500 Log: MFC r340781: Ensure that the TCP RACK stack honours the setting of the net.inet.tcp.drop_synfin sysctl-variable. Reviewed by: rrs@ Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D18033 Modified: stable/12/sys/netinet/tcp_stacks/rack.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/tcp_stacks/rack.c ============================================================================== --- stable/12/sys/netinet/tcp_stacks/rack.c Tue Dec 4 22:11:41 2018 (r341499) +++ stable/12/sys/netinet/tcp_stacks/rack.c Tue Dec 4 22:13:05 2018 (r341500) @@ -6528,6 +6528,10 @@ rack_hpts_do_segment(struct mbuf *m, struct tcphdr *th TCP_LOG_EVENT(tp, th, &so->so_rcv, &so->so_snd, TCP_LOG_IN, 0, tlen, &log, true); } + if ((thflags & TH_SYN) && (thflags & TH_FIN) && V_drop_synfin) { + way_out = 4; + goto done_with_input; + } /* * Segment received on connection. Reset idle time and keep-alive * timer. XXX: This should be done after segment validation to From owner-svn-src-all@freebsd.org Tue Dec 4 22:14:19 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9697E1323595; Tue, 4 Dec 2018 22:14:19 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3ADE4753BF; Tue, 4 Dec 2018 22:14:19 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 18F4D3498; Tue, 4 Dec 2018 22:14:19 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB4MEIkD098549; Tue, 4 Dec 2018 22:14:18 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB4MEIIl098548; Tue, 4 Dec 2018 22:14:18 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201812042214.wB4MEIIl098548@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Tue, 4 Dec 2018 22:14:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341501 - stable/12/sys/netinet/tcp_stacks X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet/tcp_stacks X-SVN-Commit-Revision: 341501 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3ADE4753BF X-Spamd-Result: default: False [-0.11 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.50)[-0.502,0]; NEURAL_SPAM_SHORT(0.48)[0.475,0]; NEURAL_HAM_LONG(-0.09)[-0.087,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Dec 2018 22:14:19 -0000 Author: tuexen Date: Tue Dec 4 22:14:18 2018 New Revision: 341501 URL: https://svnweb.freebsd.org/changeset/base/341501 Log: MFC r340782: A TCP stack is required to check SEG.ACK first, when processing a segment in the SYN-SENT state as stated in Section 3.9 of RFC 793, page 66. Ensure this is also done by the TCP RACK stack. Reviewed by: rrs@ Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D18034 Modified: stable/12/sys/netinet/tcp_stacks/rack.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/tcp_stacks/rack.c ============================================================================== --- stable/12/sys/netinet/tcp_stacks/rack.c Tue Dec 4 22:13:05 2018 (r341500) +++ stable/12/sys/netinet/tcp_stacks/rack.c Tue Dec 4 22:14:18 2018 (r341501) @@ -6533,6 +6533,15 @@ rack_hpts_do_segment(struct mbuf *m, struct tcphdr *th goto done_with_input; } /* + * If a segment with the ACK-bit set arrives in the SYN-SENT state + * check SEQ.ACK first as described on page 66 of RFC 793, section 3.9. + */ + if ((tp->t_state == TCPS_SYN_SENT) && (thflags & TH_ACK) && + (SEQ_LEQ(th->th_ack, tp->iss) || SEQ_GT(th->th_ack, tp->snd_max))) { + rack_do_dropwithreset(m, tp, th, BANDLIM_RST_OPENPORT, tlen); + return; + } + /* * Segment received on connection. Reset idle time and keep-alive * timer. XXX: This should be done after segment validation to * ignore broken/spoofed segs. From owner-svn-src-all@freebsd.org Tue Dec 4 22:15:57 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BA0D71323633; Tue, 4 Dec 2018 22:15:57 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 607417551E; Tue, 4 Dec 2018 22:15:57 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 410F6349C; Tue, 4 Dec 2018 22:15:57 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB4MFvkq098705; Tue, 4 Dec 2018 22:15:57 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB4MFuMG098704; Tue, 4 Dec 2018 22:15:56 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201812042215.wB4MFuMG098704@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Tue, 4 Dec 2018 22:15:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341502 - in stable/12/sys/netinet: . cc X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: in stable/12/sys/netinet: . cc X-SVN-Commit-Revision: 341502 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 607417551E X-Spamd-Result: default: False [-0.11 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.50)[-0.502,0]; NEURAL_SPAM_SHORT(0.48)[0.475,0]; NEURAL_HAM_LONG(-0.09)[-0.087,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Dec 2018 22:15:57 -0000 Author: tuexen Date: Tue Dec 4 22:15:56 2018 New Revision: 341502 URL: https://svnweb.freebsd.org/changeset/base/341502 Log: MFC r341335: Limit option_len for the TCP_CCALGOOPT. Limiting the length to 2048 bytes seems to be acceptable, since the values used right now are using 8 bytes. This issue was found by using syzkaller. Reviewed by: glebius, bz, rrs Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D18366 Modified: stable/12/sys/netinet/cc/cc.h stable/12/sys/netinet/tcp_usrreq.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/cc/cc.h ============================================================================== --- stable/12/sys/netinet/cc/cc.h Tue Dec 4 22:14:18 2018 (r341501) +++ stable/12/sys/netinet/cc/cc.h Tue Dec 4 22:15:56 2018 (r341502) @@ -184,4 +184,6 @@ extern struct rwlock cc_list_lock; #define CC_LIST_WUNLOCK() rw_wunlock(&cc_list_lock) #define CC_LIST_LOCK_ASSERT() rw_assert(&cc_list_lock, RA_LOCKED) +#define CC_ALGOOPT_LIMIT 2048 + #endif /* _NETINET_CC_CC_H_ */ Modified: stable/12/sys/netinet/tcp_usrreq.c ============================================================================== --- stable/12/sys/netinet/tcp_usrreq.c Tue Dec 4 22:14:18 2018 (r341501) +++ stable/12/sys/netinet/tcp_usrreq.c Tue Dec 4 22:15:56 2018 (r341502) @@ -1769,6 +1769,8 @@ tcp_default_ctloutput(struct socket *so, struct sockop switch (sopt->sopt_name) { case TCP_CCALGOOPT: INP_WUNLOCK(inp); + if (sopt->sopt_valsize > CC_ALGOOPT_LIMIT) + return (EINVAL); pbuf = malloc(sopt->sopt_valsize, M_TEMP, M_WAITOK | M_ZERO); error = sooptcopyin(sopt, pbuf, sopt->sopt_valsize, sopt->sopt_valsize); From owner-svn-src-all@freebsd.org Tue Dec 4 22:25:25 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AF0A11323B37; Tue, 4 Dec 2018 22:25:25 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 450E875D85; Tue, 4 Dec 2018 22:25:25 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 246A239B6; Tue, 4 Dec 2018 22:25:25 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB4MPOSj003970; Tue, 4 Dec 2018 22:25:24 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB4MPO3Z003968; Tue, 4 Dec 2018 22:25:24 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201812042225.wB4MPO3Z003968@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Tue, 4 Dec 2018 22:25:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r341503 - in stable/11/sys/netinet: . cc X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: in stable/11/sys/netinet: . cc X-SVN-Commit-Revision: 341503 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 450E875D85 X-Spamd-Result: default: False [-0.11 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.50)[-0.502,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_SPAM_SHORT(0.48)[0.475,0]; NEURAL_HAM_LONG(-0.09)[-0.087,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Dec 2018 22:25:25 -0000 Author: tuexen Date: Tue Dec 4 22:25:24 2018 New Revision: 341503 URL: https://svnweb.freebsd.org/changeset/base/341503 Log: MFC r341335: Limit option_len for the TCP_CCALGOOPT. Limiting the length to 2048 bytes seems to be acceptable, since the values used right now are using 8 bytes. This issue was found by using syzkaller. Reviewed by: glebius, bz, rrs Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D18366 Modified: stable/11/sys/netinet/cc/cc.h stable/11/sys/netinet/tcp_usrreq.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/cc/cc.h ============================================================================== --- stable/11/sys/netinet/cc/cc.h Tue Dec 4 22:15:56 2018 (r341502) +++ stable/11/sys/netinet/cc/cc.h Tue Dec 4 22:25:24 2018 (r341503) @@ -175,4 +175,6 @@ extern struct rwlock cc_list_lock; #define CC_LIST_WUNLOCK() rw_wunlock(&cc_list_lock) #define CC_LIST_LOCK_ASSERT() rw_assert(&cc_list_lock, RA_LOCKED) +#define CC_ALGOOPT_LIMIT 2048 + #endif /* _NETINET_CC_CC_H_ */ Modified: stable/11/sys/netinet/tcp_usrreq.c ============================================================================== --- stable/11/sys/netinet/tcp_usrreq.c Tue Dec 4 22:15:56 2018 (r341502) +++ stable/11/sys/netinet/tcp_usrreq.c Tue Dec 4 22:25:24 2018 (r341503) @@ -1549,6 +1549,8 @@ tcp_default_ctloutput(struct socket *so, struct sockop switch (sopt->sopt_name) { case TCP_CCALGOOPT: INP_WUNLOCK(inp); + if (sopt->sopt_valsize > CC_ALGOOPT_LIMIT) + return (EINVAL); pbuf = malloc(sopt->sopt_valsize, M_TEMP, M_WAITOK | M_ZERO); error = sooptcopyin(sopt, pbuf, sopt->sopt_valsize, sopt->sopt_valsize); From owner-svn-src-all@freebsd.org Tue Dec 4 22:47:00 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E4BCE1324377; Tue, 4 Dec 2018 22:46:59 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 88CAF76C3E; Tue, 4 Dec 2018 22:46:59 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 641833DAE; Tue, 4 Dec 2018 22:46:59 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB4Mkxv2014726; Tue, 4 Dec 2018 22:46:59 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB4Mkx1e014725; Tue, 4 Dec 2018 22:46:59 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201812042246.wB4Mkx1e014725@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Tue, 4 Dec 2018 22:46:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341504 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 341504 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 88CAF76C3E X-Spamd-Result: default: False [-0.11 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.50)[-0.502,0]; NEURAL_SPAM_SHORT(0.48)[0.475,0]; NEURAL_HAM_LONG(-0.09)[-0.087,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Dec 2018 22:47:00 -0000 Author: tuexen Date: Tue Dec 4 22:46:58 2018 New Revision: 341504 URL: https://svnweb.freebsd.org/changeset/base/341504 Log: MFC r339989, r339991: Improve a comment to refer to the actual sections in the TCP specification for the comparisons made. Thanks to lstewart@ for the suggestion. Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D17595 Modified: stable/12/sys/netinet/tcp_syncache.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/tcp_syncache.c ============================================================================== --- stable/12/sys/netinet/tcp_syncache.c Tue Dec 4 22:25:24 2018 (r341503) +++ stable/12/sys/netinet/tcp_syncache.c Tue Dec 4 22:46:58 2018 (r341504) @@ -581,15 +581,28 @@ syncache_chkrst(struct in_conninfo *inc, struct tcphdr /* * If the RST bit is set, check the sequence number to see * if this is a valid reset segment. + * * RFC 793 page 37: * In all states except SYN-SENT, all reset (RST) segments * are validated by checking their SEQ-fields. A reset is * valid if its sequence number is in the window. * - * The sequence number in the reset segment is normally an - * echo of our outgoing acknowlegement numbers, but some hosts - * send a reset with the sequence number at the rightmost edge - * of our receive window, and we have to handle this case. + * RFC 793 page 69: + * There are four cases for the acceptability test for an incoming + * segment: + * + * Segment Receive Test + * Length Window + * ------- ------- ------------------------------------------- + * 0 0 SEG.SEQ = RCV.NXT + * 0 >0 RCV.NXT =< SEG.SEQ < RCV.NXT+RCV.WND + * >0 0 not acceptable + * >0 >0 RCV.NXT =< SEG.SEQ < RCV.NXT+RCV.WND + * or RCV.NXT =< SEG.SEQ+SEG.LEN-1 < RCV.NXT+RCV.WND + * + * Note that when receiving a SYN segment in the LISTEN state, + * IRS is set to SEG.SEQ and RCV.NXT is set to SEG.SEQ+1, as + * described in RFC 793, page 66. */ if ((SEQ_GEQ(th->th_seq, sc->sc_irs + 1) && SEQ_LT(th->th_seq, sc->sc_irs + 1 + sc->sc_wnd)) || From owner-svn-src-all@freebsd.org Tue Dec 4 22:51:14 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-all@freebsd.org Tue Dec 4 22:52:17 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EB8A71324636; Tue, 4 Dec 2018 22:52:16 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9200177245; Tue, 4 Dec 2018 22:52:16 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 72F0C3F41; Tue, 4 Dec 2018 22:52:16 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB4MqG5I019592; Tue, 4 Dec 2018 22:52:16 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB4MqGL6019590; Tue, 4 Dec 2018 22:52:16 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201812042252.wB4MqGL6019590@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Tue, 4 Dec 2018 22:52:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r341506 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 341506 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9200177245 X-Spamd-Result: default: False [-0.11 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.50)[-0.502,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_SPAM_SHORT(0.48)[0.475,0]; NEURAL_HAM_LONG(-0.09)[-0.087,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Dec 2018 22:52:17 -0000 Author: tuexen Date: Tue Dec 4 22:52:15 2018 New Revision: 341506 URL: https://svnweb.freebsd.org/changeset/base/341506 Log: MFC r339042: Mitigate providing a timing signal if the COOKIE or AUTH validation fails. Thanks to jmg@ for reporting the issue, which was discussed in https://admbugs.freebsd.org/show_bug.cgi?id=878 Modified: stable/11/sys/netinet/sctp_auth.c stable/11/sys/netinet/sctp_input.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_auth.c ============================================================================== --- stable/11/sys/netinet/sctp_auth.c Tue Dec 4 22:51:13 2018 (r341505) +++ stable/11/sys/netinet/sctp_auth.c Tue Dec 4 22:52:15 2018 (r341506) @@ -1735,7 +1735,7 @@ sctp_handle_auth(struct sctp_tcb *stcb, struct sctp_au m, offset, computed_digest); /* compare the computed digest with the one in the AUTH chunk */ - if (memcmp(digest, computed_digest, digestlen) != 0) { + if (timingsafe_bcmp(digest, computed_digest, digestlen) != 0) { SCTP_STAT_INCR(sctps_recvauthfailed); SCTPDBG(SCTP_DEBUG_AUTH1, "SCTP Auth: HMAC digest check failed\n"); Modified: stable/11/sys/netinet/sctp_input.c ============================================================================== --- stable/11/sys/netinet/sctp_input.c Tue Dec 4 22:51:13 2018 (r341505) +++ stable/11/sys/netinet/sctp_input.c Tue Dec 4 22:52:15 2018 (r341506) @@ -2552,7 +2552,7 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, in return (NULL); } /* compare the received digest with the computed digest */ - if (memcmp(calc_sig, sig, SCTP_SIGNATURE_SIZE) != 0) { + if (timingsafe_bcmp(calc_sig, sig, SCTP_SIGNATURE_SIZE) != 0) { /* try the old cookie? */ if ((cookie->time_entered.tv_sec == (long)ep->time_of_secret_change) && (ep->current_secret_number != ep->last_secret_number)) { @@ -2561,7 +2561,7 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, in (uint8_t *)ep->secret_key[(int)ep->last_secret_number], SCTP_SECRET_SIZE, m, cookie_offset, calc_sig, 0); /* compare */ - if (memcmp(calc_sig, sig, SCTP_SIGNATURE_SIZE) == 0) + if (timingsafe_bcmp(calc_sig, sig, SCTP_SIGNATURE_SIZE) == 0) cookie_ok = 1; } } else { From owner-svn-src-all@freebsd.org Tue Dec 4 23:46:45 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-all@freebsd.org Tue Dec 4 23:53:44 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-all@freebsd.org Wed Dec 5 00:46:12 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 05:06:19 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 06:31:52 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 10:22:16 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 10:23:39 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 10:30:54 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 10:57:58 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 10:58:04 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 11:57:18 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:15:58 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:16:40 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:17:16 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:17:47 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:18:21 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:18:51 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:19:22 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:19:53 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:20:23 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:20:52 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:21:21 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:22:08 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:22:44 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:23:15 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:23:45 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:24:14 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:24:44 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:25:14 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:25:49 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:26:18 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:26:48 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:27:18 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:27:49 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:28:18 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:28:47 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:29:17 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:29:47 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:30:17 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:30:49 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:31:15 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:31:47 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:32:17 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:32:48 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:38:36 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:39:06 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:39:36 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:40:06 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:40:37 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:41:08 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:41:38 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:42:07 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:42:37 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:43:08 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:43:39 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:44:11 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:44:39 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:45:10 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:45:39 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:46:10 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:46:40 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:47:13 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:47:42 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:48:11 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 13:48:40 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Dec 2018 13:48:40 -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-all@freebsd.org Wed Dec 5 13:49:12 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 14:11:24 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 14:17:24 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 14:18:54 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 14:19:26 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 14:19:58 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 14:20:28 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 14:20:59 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 14:21:33 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 14:22:01 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 14:22:32 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 14:23:03 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 14:23:33 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 14:24:04 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 14:24:35 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 14:25:04 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 14:25:36 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 15:05:27 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0935A131793D; Wed, 5 Dec 2018 15:05:27 +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 A2CFD77DEA; Wed, 5 Dec 2018 15:05:26 +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 7D21316035; Wed, 5 Dec 2018 15:05:26 +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 wB5F5QMq025145; Wed, 5 Dec 2018 15:05:26 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5F5QW2025144; Wed, 5 Dec 2018 15:05:26 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201812051505.wB5F5QW2025144@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:05:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r341588 - stable/11/sys/modules/netmap X-SVN-Group: stable-11 X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: stable/11/sys/modules/netmap X-SVN-Commit-Revision: 341588 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A2CFD77DEA X-Spamd-Result: default: False [-0.83 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.538,0]; NEURAL_HAM_LONG(-0.09)[-0.087,0]; NEURAL_HAM_SHORT(-0.21)[-0.206,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Dec 2018 15:05:27 -0000 Author: vmaffione Date: Wed Dec 5 15:05:26 2018 New Revision: 341588 URL: https://svnweb.freebsd.org/changeset/base/341588 Log: netmap: fix module Makefile Reported by: mav Modified: stable/11/sys/modules/netmap/Makefile Modified: stable/11/sys/modules/netmap/Makefile ============================================================================== --- stable/11/sys/modules/netmap/Makefile Wed Dec 5 14:25:34 2018 (r341587) +++ stable/11/sys/modules/netmap/Makefile Wed Dec 5 15:05:26 2018 (r341588) @@ -22,7 +22,6 @@ SRCS += netmap_pipe.c SRCS += netmap_monitor.c SRCS += netmap_pt.c SRCS += netmap_legacy.c -SRCS += if_ptnet.c SRCS += opt_inet.h opt_inet6.h .include From owner-svn-src-all@freebsd.org Wed Dec 5 15:24:44 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1B96E1317F7A 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 A5F907887C 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: A5F907887C 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 15:38:53 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 15:42:32 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 15:53:35 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 15:56:45 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 16:02:56 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 16:23:08 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 16:43:05 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 16:55:46 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 17:06:02 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 17:10:08 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E526013215C8; Wed, 5 Dec 2018 17:10:07 +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 7309A7E186; Wed, 5 Dec 2018 17:10:07 +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 541AA174FD; Wed, 5 Dec 2018 17:10:07 +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 wB5HA7l3089095; Wed, 5 Dec 2018 17:10:07 GMT (envelope-from yuripv@FreeBSD.org) Received: (from yuripv@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5HA7IZ089094; Wed, 5 Dec 2018 17:10:07 GMT (envelope-from yuripv@FreeBSD.org) Message-Id: <201812051710.wB5HA7IZ089094@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: yuripv set sender to yuripv@FreeBSD.org using -f From: Yuri Pankov Date: Wed, 5 Dec 2018 17:10:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341596 - stable/12/usr.bin/localedef X-SVN-Group: stable-12 X-SVN-Commit-Author: yuripv X-SVN-Commit-Paths: stable/12/usr.bin/localedef X-SVN-Commit-Revision: 341596 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7309A7E186 X-Spamd-Result: default: False [-1.05 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.538,0]; NEURAL_HAM_SHORT(-0.43)[-0.427,0]; NEURAL_HAM_LONG(-0.09)[-0.087,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Dec 2018 17:10:08 -0000 Author: yuripv Date: Wed Dec 5 17:10:06 2018 New Revision: 341596 URL: https://svnweb.freebsd.org/changeset/base/341596 Log: MFC r339827: localedef: define characters in "space" class also as "print", except for the known conflicts ("control" characters can't be "print"able). POSIX doesn't explicitly forbid this, and actually includes character in "print". PR: 225692 Reviewed by: bapt, cem (previous version), pfg (previous version) Differential Revision: https://reviews.freebsd.org/D17467 Modified: stable/12/usr.bin/localedef/ctype.c Modified: stable/12/usr.bin/localedef/ctype.c ============================================================================== --- stable/12/usr.bin/localedef/ctype.c Wed Dec 5 17:06:00 2018 (r341595) +++ stable/12/usr.bin/localedef/ctype.c Wed Dec 5 17:10:06 2018 (r341596) @@ -120,7 +120,13 @@ add_ctype_impl(ctype_node_t *ctn) ctn->ctype |= (_ISDIGIT | _ISGRAPH | _ISPRINT | _ISXDIGIT | _E4); break; case T_ISSPACE: - ctn->ctype |= _ISSPACE; + /* + * This can be troublesome as , , + * , , and are defined both + * as space and cntrl, and POSIX doesn't allow cntrl/print + * combination. We will take care of this in dump_ctype(). + */ + ctn->ctype |= (_ISSPACE | _ISPRINT); break; case T_ISCNTRL: ctn->ctype |= _ISCNTRL; @@ -378,9 +384,15 @@ dump_ctype(void) ctn->ctype |= _ISPRINT; /* - * Finally, POSIX requires that certain combinations - * are invalid. We don't flag this as a fatal error, - * but we will warn about. + * POSIX requires that certain combinations are invalid. + * Try fixing the cases we know about (see add_ctype_impl()). + */ + if ((ctn->ctype & (_ISSPACE|_ISCNTRL)) == (_ISSPACE|_ISCNTRL)) + ctn->ctype &= ~_ISPRINT; + + /* + * Finally, don't flag remaining cases as a fatal error, + * and just warn about them. */ if ((ctn->ctype & _ISALPHA) && (ctn->ctype & (_ISPUNCT|_ISDIGIT))) From owner-svn-src-all@freebsd.org Wed Dec 5 17:13:35 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0B7B213218F2; Wed, 5 Dec 2018 17:13:35 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9D6947E694; Wed, 5 Dec 2018 17:13:34 +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 5EA751769F; Wed, 5 Dec 2018 17:13:34 +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 wB5HDYqd094172; Wed, 5 Dec 2018 17:13:34 GMT (envelope-from yuripv@FreeBSD.org) Received: (from yuripv@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5HDY4k094171; Wed, 5 Dec 2018 17:13:34 GMT (envelope-from yuripv@FreeBSD.org) Message-Id: <201812051713.wB5HDY4k094171@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: yuripv set sender to yuripv@FreeBSD.org using -f From: Yuri Pankov Date: Wed, 5 Dec 2018 17:13:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341597 - stable/12 X-SVN-Group: stable-12 X-SVN-Commit-Author: yuripv X-SVN-Commit-Paths: stable/12 X-SVN-Commit-Revision: 341597 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9D6947E694 X-Spamd-Result: default: False [-1.11 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.56)[-0.560,0]; NEURAL_HAM_LONG(-0.13)[-0.127,0]; NEURAL_HAM_SHORT(-0.42)[-0.419,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Dec 2018 17:13:35 -0000 Author: yuripv Date: Wed Dec 5 17:13:33 2018 New Revision: 341597 URL: https://svnweb.freebsd.org/changeset/base/341597 Log: Actually mark r341596 as MFC. Modified: Directory Properties: stable/12/ (props changed) From owner-svn-src-all@freebsd.org Wed Dec 5 17:28:41 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 17:29:15 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 17:35:16 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 17:42:12 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 18:19:30 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 18:26:41 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 18:47:00 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 179D81324073 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 6DB2D8318B 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: 6DB2D8318B 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 18:56:49 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 19:16:15 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C32B11324E67; Wed, 5 Dec 2018 19:16:15 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 53B90858AB; Wed, 5 Dec 2018 19:16:15 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 34C6518A9C; Wed, 5 Dec 2018 19:16:15 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5JGF1I060295; Wed, 5 Dec 2018 19:16:15 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5JGDlt060284; Wed, 5 Dec 2018 19:16:13 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201812051916.wB5JGDlt060284@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Wed, 5 Dec 2018 19:16:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r341603 - in releng/12.0: sbin/savecore sys/amd64/amd64 sys/amd64/ia32 sys/arm/arm sys/fs/procfs sys/i386/i386 sys/kern sys/sparc64/sparc64 X-SVN-Group: releng X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: in releng/12.0: sbin/savecore sys/amd64/amd64 sys/amd64/ia32 sys/arm/arm sys/fs/procfs sys/i386/i386 sys/kern sys/sparc64/sparc64 X-SVN-Commit-Revision: 341603 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 53B90858AB X-Spamd-Result: default: False [0.00 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.40)[-0.399,0]; NEURAL_SPAM_SHORT(0.43)[0.426,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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Dec 2018 19:16:16 -0000 Author: gjb Date: Wed Dec 5 19:16:12 2018 New Revision: 341603 URL: https://svnweb.freebsd.org/changeset/base/341603 Log: MFS12 r341490, r341493: r341490 (markj): MFC r341442, r341443: Plug memory disclosures via ptrace(2). r341493 (garga): MFC r341464: Restore /var/crash permissions to 0750, as declared in mtree file. After r337337 it changed to 0755. As this would have otherwise been resolved as a post-release EN/SA from so@, this does not warrant adding RC4 to the 12.0 schedule. Approved by: re (implicit), so Sponsored by: The FreeBSD Foundation Modified: releng/12.0/sbin/savecore/Makefile releng/12.0/sys/amd64/amd64/machdep.c releng/12.0/sys/amd64/ia32/ia32_reg.c releng/12.0/sys/arm/arm/machdep_kdb.c releng/12.0/sys/fs/procfs/procfs_dbregs.c releng/12.0/sys/fs/procfs/procfs_fpregs.c releng/12.0/sys/fs/procfs/procfs_regs.c releng/12.0/sys/i386/i386/machdep.c releng/12.0/sys/kern/sys_process.c releng/12.0/sys/sparc64/sparc64/machdep.c Directory Properties: releng/12.0/ (props changed) Modified: releng/12.0/sbin/savecore/Makefile ============================================================================== --- releng/12.0/sbin/savecore/Makefile Wed Dec 5 18:26:40 2018 (r341602) +++ releng/12.0/sbin/savecore/Makefile Wed Dec 5 19:16:12 2018 (r341603) @@ -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 Modified: releng/12.0/sys/amd64/amd64/machdep.c ============================================================================== --- releng/12.0/sys/amd64/amd64/machdep.c Wed Dec 5 18:26:40 2018 (r341602) +++ releng/12.0/sys/amd64/amd64/machdep.c Wed Dec 5 19:16:12 2018 (r341603) @@ -2043,6 +2043,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; @@ -2074,6 +2075,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: releng/12.0/sys/amd64/ia32/ia32_reg.c ============================================================================== --- releng/12.0/sys/amd64/ia32/ia32_reg.c Wed Dec 5 18:26:40 2018 (r341602) +++ releng/12.0/sys/amd64/ia32/ia32_reg.c Wed Dec 5 19:16:12 2018 (r341603) @@ -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: releng/12.0/sys/arm/arm/machdep_kdb.c ============================================================================== --- releng/12.0/sys/arm/arm/machdep_kdb.c Wed Dec 5 18:26:40 2018 (r341602) +++ releng/12.0/sys/arm/arm/machdep_kdb.c Wed Dec 5 19:16:12 2018 (r341603) @@ -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: releng/12.0/sys/fs/procfs/procfs_dbregs.c ============================================================================== --- releng/12.0/sys/fs/procfs/procfs_dbregs.c Wed Dec 5 18:26:40 2018 (r341602) +++ releng/12.0/sys/fs/procfs/procfs_dbregs.c Wed Dec 5 19:16:12 2018 (r341603) @@ -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: releng/12.0/sys/fs/procfs/procfs_fpregs.c ============================================================================== --- releng/12.0/sys/fs/procfs/procfs_fpregs.c Wed Dec 5 18:26:40 2018 (r341602) +++ releng/12.0/sys/fs/procfs/procfs_fpregs.c Wed Dec 5 19:16:12 2018 (r341603) @@ -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: releng/12.0/sys/fs/procfs/procfs_regs.c ============================================================================== --- releng/12.0/sys/fs/procfs/procfs_regs.c Wed Dec 5 18:26:40 2018 (r341602) +++ releng/12.0/sys/fs/procfs/procfs_regs.c Wed Dec 5 19:16:12 2018 (r341603) @@ -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: releng/12.0/sys/i386/i386/machdep.c ============================================================================== --- releng/12.0/sys/i386/i386/machdep.c Wed Dec 5 18:26:40 2018 (r341602) +++ releng/12.0/sys/i386/i386/machdep.c Wed Dec 5 19:16:12 2018 (r341603) @@ -2817,6 +2817,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; @@ -2832,6 +2833,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: releng/12.0/sys/kern/sys_process.c ============================================================================== --- releng/12.0/sys/kern/sys_process.c Wed Dec 5 18:26:40 2018 (r341602) +++ releng/12.0/sys/kern/sys_process.c Wed Dec 5 19:16:12 2018 (r341603) @@ -540,6 +540,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) @@ -547,6 +550,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 @@ -572,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; @@ -589,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); @@ -661,6 +671,7 @@ sys_ptrace(struct thread *td, struct ptrace_args *uap) } #undef COPYIN #undef COPYOUT +#undef BZERO #ifdef COMPAT_FREEBSD32 /* Modified: releng/12.0/sys/sparc64/sparc64/machdep.c ============================================================================== --- releng/12.0/sys/sparc64/sparc64/machdep.c Wed Dec 5 18:26:40 2018 (r341602) +++ releng/12.0/sys/sparc64/sparc64/machdep.c Wed Dec 5 19:16:12 2018 (r341603) @@ -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-all@freebsd.org Wed Dec 5 19:18:17 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 19:53:10 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 20:23:13 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 20:36:23 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 21:03:49 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-all@freebsd.org Wed Dec 5 21:49:40 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CCBE41328249; Wed, 5 Dec 2018 21:49:40 +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 7386F6CC0C; Wed, 5 Dec 2018 21:49:40 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5467D1A371; Wed, 5 Dec 2018 21:49:40 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB5Lneqj039005; Wed, 5 Dec 2018 21:49:40 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5LndpM039002; Wed, 5 Dec 2018 21:49:39 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201812052149.wB5LndpM039002@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 5 Dec 2018 21:49:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r341606 - stable/10/usr.sbin/bhyve X-SVN-Group: stable-10 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/10/usr.sbin/bhyve X-SVN-Commit-Revision: 341606 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7386F6CC0C X-Spamd-Result: default: False [-0.35 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.48)[-0.477,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_SPAM_SHORT(0.23)[0.226,0]; NEURAL_HAM_LONG(-0.10)[-0.099,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Dec 2018 21:49:41 -0000 Author: emaste Date: Wed Dec 5 21:49:39 2018 New Revision: 341606 URL: https://svnweb.freebsd.org/changeset/base/341606 Log: MFC r298454 (araujo): Use MIN()/MAX() macros from sys/param.h. Modified: stable/10/usr.sbin/bhyve/fwctl.c stable/10/usr.sbin/bhyve/pci_ahci.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/bhyve/fwctl.c ============================================================================== --- stable/10/usr.sbin/bhyve/fwctl.c Wed Dec 5 19:53:09 2018 (r341605) +++ stable/10/usr.sbin/bhyve/fwctl.c Wed Dec 5 21:49:39 2018 (r341606) @@ -348,7 +348,7 @@ fwctl_request_data(uint32_t value) /* Make sure remaining size is >= 0 */ rinfo.req_size -= sizeof(uint32_t); - remlen = (rinfo.req_size > 0) ? rinfo.req_size: 0; + remlen = MAX(rinfo.req_size, 0); (*rinfo.req_op->op_data)(value, remlen); Modified: stable/10/usr.sbin/bhyve/pci_ahci.c ============================================================================== --- stable/10/usr.sbin/bhyve/pci_ahci.c Wed Dec 5 19:53:09 2018 (r341605) +++ stable/10/usr.sbin/bhyve/pci_ahci.c Wed Dec 5 21:49:39 2018 (r341606) @@ -798,7 +798,7 @@ read_prdt(struct ahci_port *p, int slot, uint8_t *cfis dbcsz = (prdt->dbc & DBCMASK) + 1; ptr = paddr_guest2host(ahci_ctx(p->pr_sc), prdt->dba, dbcsz); - sublen = len < dbcsz ? len : dbcsz; + sublen = MIN(len, dbcsz); memcpy(to, ptr, sublen); len -= sublen; to += sublen; @@ -912,7 +912,7 @@ write_prdt(struct ahci_port *p, int slot, uint8_t *cfi dbcsz = (prdt->dbc & DBCMASK) + 1; ptr = paddr_guest2host(ahci_ctx(p->pr_sc), prdt->dba, dbcsz); - sublen = len < dbcsz ? len : dbcsz; + sublen = MIN(len, dbcsz); memcpy(ptr, from, sublen); len -= sublen; from += sublen; From owner-svn-src-all@freebsd.org Wed Dec 5 21:51:40 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 61A19132831A; Wed, 5 Dec 2018 21:51:40 +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 0994F6CF5B; Wed, 5 Dec 2018 21:51:40 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DEAD21A4D6; Wed, 5 Dec 2018 21:51:39 +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 wB5Lpdnm039172; Wed, 5 Dec 2018 21:51:39 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB5LpdGG039171; Wed, 5 Dec 2018 21:51:39 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201812052151.wB5LpdGG039171@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 5 Dec 2018 21:51:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r341607 - stable/10/usr.sbin/bhyve X-SVN-Group: stable-10 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/10/usr.sbin/bhyve X-SVN-Commit-Revision: 341607 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0994F6CF5B X-Spamd-Result: default: False [-0.73 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.46)[-0.456,0]; NEURAL_HAM_SHORT(-0.20)[-0.200,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.07)[-0.070,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Dec 2018 21:51:40 -0000 Author: emaste Date: Wed Dec 5 21:51:39 2018 New Revision: 341607 URL: https://svnweb.freebsd.org/changeset/base/341607 Log: MFC r341484: 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 Security: CVE-2018-17160 Modified: stable/10/usr.sbin/bhyve/fwctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/bhyve/fwctl.c ============================================================================== --- stable/10/usr.sbin/bhyve/fwctl.c Wed Dec 5 21:49:39 2018 (r341606) +++ stable/10/usr.sbin/bhyve/fwctl.c Wed Dec 5 21:51:39 2018 (r341607) @@ -77,8 +77,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); }; @@ -117,7 +117,7 @@ errop_set(int err) } static int -errop_start(int len) +errop_start(uint32_t len) { errop_code = ENOENT; @@ -126,7 +126,7 @@ errop_start(int len) } static void -errop_data(uint32_t data, int len) +errop_data(uint32_t data, uint32_t len) { /* ignore */ @@ -186,7 +186,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) @@ -198,7 +198,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; @@ -283,8 +283,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; @@ -344,13 +344,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(); @@ -399,7 +400,7 @@ static int fwctl_response(uint32_t *retval) { uint32_t *dp; - int remlen; + ssize_t remlen; switch(rinfo.resp_count) { case 0: @@ -434,7 +435,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-all@freebsd.org Thu Dec 6 00:09:43 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Dec 6 00:13:40 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 03C92132B8BD; Thu, 6 Dec 2018 00:13:40 +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 A81B2716B3; Thu, 6 Dec 2018 00:13:39 +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 88B4D1BB8D; Thu, 6 Dec 2018 00:13:39 +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 wB60DdmK015931; Thu, 6 Dec 2018 00:13:39 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB60Da4p015913; Thu, 6 Dec 2018 00:13:36 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201812060013.wB60Da4p015913@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 00:13:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r341609 - in vendor/NetBSD/bmake/dist: . mk unit-tests X-SVN-Group: vendor X-SVN-Commit-Author: sjg X-SVN-Commit-Paths: in vendor/NetBSD/bmake/dist: . mk unit-tests X-SVN-Commit-Revision: 341609 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A81B2716B3 X-Spamd-Result: default: False [-0.67 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.37)[-0.375,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.30)[-0.298,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Dec 2018 00:13:40 -0000 Author: sjg Date: Thu Dec 6 00:13:35 2018 New Revision: 341609 URL: https://svnweb.freebsd.org/changeset/base/341609 Log: Import bmake-20180919 Added: vendor/NetBSD/bmake/dist/unit-tests/varquote.exp vendor/NetBSD/bmake/dist/unit-tests/varquote.mk (contents, props changed) Modified: vendor/NetBSD/bmake/dist/ChangeLog vendor/NetBSD/bmake/dist/FILES vendor/NetBSD/bmake/dist/Makefile.config.in vendor/NetBSD/bmake/dist/VERSION vendor/NetBSD/bmake/dist/bmake.1 vendor/NetBSD/bmake/dist/dir.c vendor/NetBSD/bmake/dist/make.1 vendor/NetBSD/bmake/dist/mk/ChangeLog vendor/NetBSD/bmake/dist/mk/dirdeps-options.mk vendor/NetBSD/bmake/dist/mk/dirdeps.mk vendor/NetBSD/bmake/dist/mk/gendirdeps.mk vendor/NetBSD/bmake/dist/mk/install-mk vendor/NetBSD/bmake/dist/mk/meta.autodep.mk vendor/NetBSD/bmake/dist/mk/meta.stage.mk vendor/NetBSD/bmake/dist/unit-tests/Makefile.in vendor/NetBSD/bmake/dist/var.c Modified: vendor/NetBSD/bmake/dist/ChangeLog ============================================================================== --- vendor/NetBSD/bmake/dist/ChangeLog Thu Dec 6 00:09:39 2018 (r341608) +++ vendor/NetBSD/bmake/dist/ChangeLog Thu Dec 6 00:13:35 2018 (r341609) @@ -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: vendor/NetBSD/bmake/dist/FILES ============================================================================== --- vendor/NetBSD/bmake/dist/FILES Thu Dec 6 00:09:39 2018 (r341608) +++ vendor/NetBSD/bmake/dist/FILES Thu Dec 6 00:13:35 2018 (r341609) @@ -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: vendor/NetBSD/bmake/dist/Makefile.config.in ============================================================================== --- vendor/NetBSD/bmake/dist/Makefile.config.in Thu Dec 6 00:09:39 2018 (r341608) +++ vendor/NetBSD/bmake/dist/Makefile.config.in Thu Dec 6 00:13:35 2018 (r341609) @@ -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: vendor/NetBSD/bmake/dist/VERSION ============================================================================== --- vendor/NetBSD/bmake/dist/VERSION Thu Dec 6 00:09:39 2018 (r341608) +++ vendor/NetBSD/bmake/dist/VERSION Thu Dec 6 00:13:35 2018 (r341609) @@ -1,2 +1,2 @@ # keep this compatible with sh and make -_MAKE_VERSION=20180512 +_MAKE_VERSION=20180919 Modified: vendor/NetBSD/bmake/dist/bmake.1 ============================================================================== --- vendor/NetBSD/bmake/dist/bmake.1 Thu Dec 6 00:09:39 2018 (r341608) +++ vendor/NetBSD/bmake/dist/bmake.1 Thu Dec 6 00:13:35 2018 (r341609) @@ -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: vendor/NetBSD/bmake/dist/dir.c ============================================================================== --- vendor/NetBSD/bmake/dist/dir.c Thu Dec 6 00:09:39 2018 (r341608) +++ vendor/NetBSD/bmake/dist/dir.c Thu Dec 6 00:13:35 2018 (r341609) @@ -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: vendor/NetBSD/bmake/dist/make.1 ============================================================================== --- vendor/NetBSD/bmake/dist/make.1 Thu Dec 6 00:09:39 2018 (r341608) +++ vendor/NetBSD/bmake/dist/make.1 Thu Dec 6 00:13:35 2018 (r341609) @@ -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 MAKE 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: vendor/NetBSD/bmake/dist/mk/ChangeLog ============================================================================== --- vendor/NetBSD/bmake/dist/mk/ChangeLog Thu Dec 6 00:09:39 2018 (r341608) +++ vendor/NetBSD/bmake/dist/mk/ChangeLog Thu Dec 6 00:13:35 2018 (r341609) @@ -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: vendor/NetBSD/bmake/dist/mk/dirdeps-options.mk ============================================================================== --- vendor/NetBSD/bmake/dist/mk/dirdeps-options.mk Thu Dec 6 00:09:39 2018 (r341608) +++ vendor/NetBSD/bmake/dist/mk/dirdeps-options.mk Thu Dec 6 00:13:35 2018 (r341609) @@ -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: vendor/NetBSD/bmake/dist/mk/dirdeps.mk ============================================================================== --- vendor/NetBSD/bmake/dist/mk/dirdeps.mk Thu Dec 6 00:09:39 2018 (r341608) +++ vendor/NetBSD/bmake/dist/mk/dirdeps.mk Thu Dec 6 00:13:35 2018 (r341609) @@ -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: vendor/NetBSD/bmake/dist/mk/gendirdeps.mk ============================================================================== --- vendor/NetBSD/bmake/dist/mk/gendirdeps.mk Thu Dec 6 00:09:39 2018 (r341608) +++ vendor/NetBSD/bmake/dist/mk/gendirdeps.mk Thu Dec 6 00:13:35 2018 (r341609) @@ -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: vendor/NetBSD/bmake/dist/mk/install-mk ============================================================================== --- vendor/NetBSD/bmake/dist/mk/install-mk Thu Dec 6 00:09:39 2018 (r341608) +++ vendor/NetBSD/bmake/dist/mk/install-mk Thu Dec 6 00:13:35 2018 (r341609) @@ -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: vendor/NetBSD/bmake/dist/mk/meta.autodep.mk ============================================================================== --- vendor/NetBSD/bmake/dist/mk/meta.autodep.mk Thu Dec 6 00:09:39 2018 (r341608) +++ vendor/NetBSD/bmake/dist/mk/meta.autodep.mk Thu Dec 6 00:13:35 2018 (r341609) @@ -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: vendor/NetBSD/bmake/dist/mk/meta.stage.mk ============================================================================== --- vendor/NetBSD/bmake/dist/mk/meta.stage.mk Thu Dec 6 00:09:39 2018 (r341608) +++ vendor/NetBSD/bmake/dist/mk/meta.stage.mk Thu Dec 6 00:13:35 2018 (r341609) @@ -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: vendor/NetBSD/bmake/dist/unit-tests/Makefile.in ============================================================================== --- vendor/NetBSD/bmake/dist/unit-tests/Makefile.in Thu Dec 6 00:09:39 2018 (r341608) +++ vendor/NetBSD/bmake/dist/unit-tests/Makefile.in Thu Dec 6 00:13:35 2018 (r341609) @@ -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 Added: vendor/NetBSD/bmake/dist/unit-tests/varquote.exp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/NetBSD/bmake/dist/unit-tests/varquote.exp Thu Dec 6 00:13:35 2018 (r341609) @@ -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 Added: vendor/NetBSD/bmake/dist/unit-tests/varquote.mk ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/NetBSD/bmake/dist/unit-tests/varquote.mk Thu Dec 6 00:13:35 2018 (r341609) @@ -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: vendor/NetBSD/bmake/dist/var.c ============================================================================== --- vendor/NetBSD/bmake/dist/var.c Thu Dec 6 00:09:39 2018 (r341608) +++ vendor/NetBSD/bmake/dist/var.c Thu Dec 6 00:13:35 2018 (r341609) @@ -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; From owner-svn-src-all@freebsd.org Thu Dec 6 00:13:52 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 39904132B8E3; Thu, 6 Dec 2018 00:13:52 +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 D5DA5717A2; Thu, 6 Dec 2018 00:13:51 +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 8DFB91BB8E; Thu, 6 Dec 2018 00:13:51 +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 wB60DpwD015983; Thu, 6 Dec 2018 00:13:51 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB60DpuF015982; Thu, 6 Dec 2018 00:13:51 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201812060013.wB60DpuF015982@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 00:13:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r341610 - vendor/NetBSD/bmake/20180919 X-SVN-Group: vendor X-SVN-Commit-Author: sjg X-SVN-Commit-Paths: vendor/NetBSD/bmake/20180919 X-SVN-Commit-Revision: 341610 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D5DA5717A2 X-Spamd-Result: default: False [-0.84 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.47)[-0.467,0]; NEURAL_HAM_SHORT(-0.27)[-0.266,0]; NEURAL_HAM_LONG(-0.11)[-0.112,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Dec 2018 00:13:52 -0000 Author: sjg Date: Thu Dec 6 00:13:51 2018 New Revision: 341610 URL: https://svnweb.freebsd.org/changeset/base/341610 Log: tag bmake-20180919 Added: vendor/NetBSD/bmake/20180919/ - copied from r341609, vendor/NetBSD/bmake/dist/ From owner-svn-src-all@freebsd.org Thu Dec 6 01:04:57 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Dec 6 01:15:44 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A4E7C132CE1F 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 1ECF373728 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: 1ECF373728 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Dec 2018 01:15:44 -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-all@freebsd.org Thu Dec 6 02:37:35 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B959C133139F; Thu, 6 Dec 2018 02:37:35 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5E34676FBA; Thu, 6 Dec 2018 02:37:35 +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 3F5B61D58E; Thu, 6 Dec 2018 02:37:35 +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 wB62bZ6e088236; Thu, 6 Dec 2018 02:37:35 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB62bZqJ088235; Thu, 6 Dec 2018 02:37:35 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201812060237.wB62bZqJ088235@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Thu, 6 Dec 2018 02:37:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341612 - stable/12/lib/libc/sys X-SVN-Group: stable-12 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/12/lib/libc/sys X-SVN-Commit-Revision: 341612 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5E34676FBA X-Spamd-Result: default: False [-0.84 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.48)[-0.477,0]; NEURAL_HAM_SHORT(-0.26)[-0.261,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.10)[-0.099,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Dec 2018 02:37:35 -0000 Author: asomers Date: Thu Dec 6 02:37:34 2018 New Revision: 341612 URL: https://svnweb.freebsd.org/changeset/base/341612 Log: MFC r340455: fcntl.2: document an additional error condition Modified: stable/12/lib/libc/sys/fcntl.2 Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libc/sys/fcntl.2 ============================================================================== --- stable/12/lib/libc/sys/fcntl.2 Thu Dec 6 01:04:56 2018 (r341611) +++ stable/12/lib/libc/sys/fcntl.2 Thu Dec 6 02:37:34 2018 (r341612) @@ -28,7 +28,7 @@ .\" @(#)fcntl.2 8.2 (Berkeley) 1/12/94 .\" $FreeBSD$ .\" -.Dd May 2, 2018 +.Dd Nov 15, 2018 .Dt FCNTL 2 .Os .Sh NAME @@ -562,6 +562,10 @@ or and the data to which .Fa arg points is not valid. +.Pp +The argument +.Fa cmd +is invalid. .It Bq Er EMFILE The argument .Fa cmd From owner-svn-src-all@freebsd.org Thu Dec 6 04:28:40 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6F454130D175; Thu, 6 Dec 2018 04:28:40 +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 133C17B943; Thu, 6 Dec 2018 04:28:40 +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 E779B1E871; Thu, 6 Dec 2018 04:28:39 +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 wB64Sdqt045268; Thu, 6 Dec 2018 04:28:39 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB64Sdv5045267; Thu, 6 Dec 2018 04:28:39 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201812060428.wB64Sdv5045267@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 04:28:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r341615 - in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 341615 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 133C17B943 X-Spamd-Result: default: False [-0.71 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.48)[-0.477,0]; NEURAL_HAM_LONG(-0.10)[-0.099,0]; NEURAL_HAM_SHORT(-0.13)[-0.130,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Dec 2018 04:28:40 -0000 Author: cy Date: Thu Dec 6 04:28:39 2018 New Revision: 341615 URL: https://svnweb.freebsd.org/changeset/base/341615 Log: MFC r341265: Remove an old comment/code and replace with a comment that directly references a NetBSD commit. Modified: stable/11/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c stable/12/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Directory Properties: stable/10/ (props changed) stable/12/ (props changed) Modified: stable/11/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c ============================================================================== --- stable/11/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Thu Dec 6 04:25:12 2018 (r341614) +++ stable/11/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Thu Dec 6 04:28:39 2018 (r341615) @@ -542,12 +542,7 @@ ipf_send_icmp_err(type, fin, dst) code = fin->fin_icode; #ifdef USE_INET6 -#if 0 - /* XXX Fix an off by one error: s/>/>=/ - was: - if ((code < 0) || (code > sizeof(icmptoicmp6unreach)/sizeof(int))) - Fix obtained from NetBSD ip_fil_netbsd.c r1.4: */ -#endif + /* See NetBSD ip_fil_netbsd.c r1.4: */ if ((code < 0) || (code >= sizeof(icmptoicmp6unreach)/sizeof(int))) return -1; #endif From owner-svn-src-all@freebsd.org Thu Dec 6 02:38:43 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ED5EB13314C9; Thu, 6 Dec 2018 02:38:42 +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 961A97716F; Thu, 6 Dec 2018 02:38:42 +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 779171D596; Thu, 6 Dec 2018 02:38:42 +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 wB62cgIq088350; Thu, 6 Dec 2018 02:38:42 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB62cgf7088349; Thu, 6 Dec 2018 02:38:42 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201812060238.wB62cgf7088349@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Thu, 6 Dec 2018 02:38:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341613 - stable/12/sbin/mount_fusefs X-SVN-Group: stable-12 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/12/sbin/mount_fusefs X-SVN-Commit-Revision: 341613 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 961A97716F X-Spamd-Result: default: False [-0.84 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.48)[-0.477,0]; NEURAL_HAM_SHORT(-0.26)[-0.261,0]; NEURAL_HAM_LONG(-0.10)[-0.099,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Dec 2018 02:38:43 -0000 Author: asomers Date: Thu Dec 6 02:38:42 2018 New Revision: 341613 URL: https://svnweb.freebsd.org/changeset/base/341613 Log: MFC r340525: mount_fusefs.8: expand HISTORY section Note that fuse was available from ports long before joining the base system. Also, update the upstream URL. Modified: stable/12/sbin/mount_fusefs/mount_fusefs.8 Modified: stable/12/sbin/mount_fusefs/mount_fusefs.8 ============================================================================== --- stable/12/sbin/mount_fusefs/mount_fusefs.8 Thu Dec 6 02:37:34 2018 (r341612) +++ stable/12/sbin/mount_fusefs/mount_fusefs.8 Thu Dec 6 02:38:42 2018 (r341613) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 3, 2016 +.Dd November 17, 2018 .Dt MOUNT_FUSEFS 8 .Os .Sh NAME @@ -339,12 +339,16 @@ does not call any external utility and also provides a .Xr umount 8 .Sh HISTORY .Nm -appeared in -.Fx 10.0 -as the part of the +was written as the part of the .Fx -implementation of the Fuse userspace filesystem -framework (see http://fuse.sourceforge.net). +implementation of the Fuse userspace filesystem framework (see +.Xr https://github.com/libfuse/libfuse ) +and first appeared in the +.Pa sysutils/fusefs-kmod +port, supporting +.Fx 6.0 . +It was added to the base system in +.Fx 10.0 . .Sh CAVEATS This user interface is .Fx From owner-svn-src-all@freebsd.org Thu Dec 6 04:30:25 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Dec 6 04:28:41 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 17FBE130D17D; Thu, 6 Dec 2018 04:28:41 +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 AB9817B945; Thu, 6 Dec 2018 04:28:40 +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 8DE8C1E873; Thu, 6 Dec 2018 04:28:40 +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 wB64Seva045281; Thu, 6 Dec 2018 04:28:40 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB64Setl045280; Thu, 6 Dec 2018 04:28:40 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201812060428.wB64Setl045280@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 04:28:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r341615 - in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-10 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 341615 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: AB9817B945 X-Spamd-Result: default: False [-0.71 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.48)[-0.477,0]; NEURAL_HAM_SHORT(-0.13)[-0.130,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.10)[-0.099,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Dec 2018 04:28:41 -0000 Author: cy Date: Thu Dec 6 04:28:39 2018 New Revision: 341615 URL: https://svnweb.freebsd.org/changeset/base/341615 Log: MFC r341265: Remove an old comment/code and replace with a comment that directly references a NetBSD commit. Modified: stable/10/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c stable/12/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Directory Properties: stable/11/ (props changed) stable/12/ (props changed) Modified: stable/10/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c ============================================================================== --- stable/10/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Thu Dec 6 04:25:12 2018 (r341614) +++ stable/10/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Thu Dec 6 04:28:39 2018 (r341615) @@ -537,12 +537,7 @@ ipf_send_icmp_err(type, fin, dst) code = fin->fin_icode; #ifdef USE_INET6 -#if 0 - /* XXX Fix an off by one error: s/>/>=/ - was: - if ((code < 0) || (code > sizeof(icmptoicmp6unreach)/sizeof(int))) - Fix obtained from NetBSD ip_fil_netbsd.c r1.4: */ -#endif + /* See NetBSD ip_fil_netbsd.c r1.4: */ if ((code < 0) || (code >= sizeof(icmptoicmp6unreach)/sizeof(int))) return -1; #endif From owner-svn-src-all@freebsd.org Thu Dec 6 04:25:13 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Dec 6 04:28:40 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B970C130D179; Thu, 6 Dec 2018 04:28:40 +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 6050D7B944; Thu, 6 Dec 2018 04:28:40 +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 400581E872; Thu, 6 Dec 2018 04:28:40 +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 wB64SegA045275; Thu, 6 Dec 2018 04:28:40 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB64Se3O045274; Thu, 6 Dec 2018 04:28:40 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201812060428.wB64Se3O045274@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 04:28:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341615 - in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 341615 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6050D7B944 X-Spamd-Result: default: False [-0.71 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.48)[-0.477,0]; NEURAL_HAM_SHORT(-0.13)[-0.130,0]; NEURAL_HAM_LONG(-0.10)[-0.099,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Dec 2018 04:28:40 -0000 Author: cy Date: Thu Dec 6 04:28:39 2018 New Revision: 341615 URL: https://svnweb.freebsd.org/changeset/base/341615 Log: MFC r341265: Remove an old comment/code and replace with a comment that directly references a NetBSD commit. Modified: stable/12/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c stable/11/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Directory Properties: stable/10/ (props changed) stable/11/ (props changed) Modified: stable/12/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c ============================================================================== --- stable/12/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Thu Dec 6 04:25:12 2018 (r341614) +++ stable/12/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Thu Dec 6 04:28:39 2018 (r341615) @@ -542,12 +542,7 @@ ipf_send_icmp_err(type, fin, dst) code = fin->fin_icode; #ifdef USE_INET6 -#if 0 - /* XXX Fix an off by one error: s/>/>=/ - was: - if ((code < 0) || (code > sizeof(icmptoicmp6unreach)/sizeof(int))) - Fix obtained from NetBSD ip_fil_netbsd.c r1.4: */ -#endif + /* See NetBSD ip_fil_netbsd.c r1.4: */ if ((code < 0) || (code >= sizeof(icmptoicmp6unreach)/sizeof(int))) return -1; #endif From owner-svn-src-all@freebsd.org Thu Dec 6 05:04:31 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6EB6E130EE07; Thu, 6 Dec 2018 05:04:31 +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 09AA77D911; Thu, 6 Dec 2018 05:04:31 +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 D8FAD1EF18; Thu, 6 Dec 2018 05:04:30 +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 wB654UR3065512; Thu, 6 Dec 2018 05:04:30 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB654TmJ065503; Thu, 6 Dec 2018 05:04:29 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201812060504.wB654TmJ065503@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 05:04:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r341618 - in vendor/wpa/dist: . hostapd hs20/client src/ap src/common src/crypto src/drivers src/eap_common src/eap_peer src/eap_server src/eapol_auth src/eapol_supp src/fst src/l2_pack... X-SVN-Group: vendor X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in vendor/wpa/dist: . hostapd hs20/client src/ap src/common src/crypto src/drivers src/eap_common src/eap_peer src/eap_server src/eapol_auth src/eapol_supp src/fst src/l2_packet src/p2p src/pae src/ra... X-SVN-Commit-Revision: 341618 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 09AA77D911 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_LONG(0.04)[0.035,0]; NEURAL_SPAM_SHORT(0.30)[0.301,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Dec 2018 05:04:32 -0000 Author: cy Date: Thu Dec 6 05:04:28 2018 New Revision: 341618 URL: https://svnweb.freebsd.org/changeset/base/341618 Log: Import wpa_supplicant/hostapd 2.7 Added: vendor/wpa/dist/src/ap/dpp_hostapd.c (contents, props changed) vendor/wpa/dist/src/ap/dpp_hostapd.h (contents, props changed) vendor/wpa/dist/src/ap/eth_p_oui.c (contents, props changed) vendor/wpa/dist/src/ap/eth_p_oui.h (contents, props changed) vendor/wpa/dist/src/ap/fils_hlp.c (contents, props changed) vendor/wpa/dist/src/ap/fils_hlp.h (contents, props changed) vendor/wpa/dist/src/ap/gas_query_ap.c (contents, props changed) vendor/wpa/dist/src/ap/gas_query_ap.h (contents, props changed) vendor/wpa/dist/src/ap/ieee802_11_he.c (contents, props changed) vendor/wpa/dist/src/common/dhcp.h (contents, props changed) vendor/wpa/dist/src/common/dpp.c (contents, props changed) vendor/wpa/dist/src/common/dpp.h (contents, props changed) vendor/wpa/dist/src/common/gas_server.c (contents, props changed) vendor/wpa/dist/src/common/gas_server.h (contents, props changed) vendor/wpa/dist/src/crypto/crypto_linux.c (contents, props changed) vendor/wpa/dist/src/crypto/crypto_nettle.c (contents, props changed) vendor/wpa/dist/src/crypto/crypto_wolfssl.c (contents, props changed) vendor/wpa/dist/src/crypto/fips_prf_wolfssl.c (contents, props changed) vendor/wpa/dist/src/crypto/sha384-kdf.c (contents, props changed) vendor/wpa/dist/src/crypto/sha384.c (contents, props changed) vendor/wpa/dist/src/crypto/sha512-kdf.c (contents, props changed) vendor/wpa/dist/src/crypto/sha512-prf.c (contents, props changed) vendor/wpa/dist/src/crypto/sha512.h (contents, props changed) vendor/wpa/dist/src/crypto/tls_wolfssl.c (contents, props changed) vendor/wpa/dist/src/drivers/driver_macsec_linux.c (contents, props changed) vendor/wpa/dist/src/drivers/driver_wired_common.c (contents, props changed) vendor/wpa/dist/src/drivers/driver_wired_common.h (contents, props changed) vendor/wpa/dist/src/utils/crc32.c (contents, props changed) vendor/wpa/dist/src/utils/crc32.h (contents, props changed) vendor/wpa/dist/src/utils/json.c (contents, props changed) vendor/wpa/dist/src/utils/json.h (contents, props changed) vendor/wpa/dist/wpa_supplicant/dpp_supplicant.c (contents, props changed) vendor/wpa/dist/wpa_supplicant/dpp_supplicant.h (contents, props changed) vendor/wpa/dist/wpa_supplicant/examples/dpp-qrcode.py (contents, props changed) vendor/wpa/dist/wpa_supplicant/op_classes.c (contents, props changed) vendor/wpa/dist/wpa_supplicant/rrm.c (contents, props changed) Deleted: vendor/wpa/dist/src/ap/peerkey_auth.c vendor/wpa/dist/src/rsn_supp/peerkey.c vendor/wpa/dist/src/rsn_supp/peerkey.h Modified: vendor/wpa/dist/CONTRIBUTIONS vendor/wpa/dist/COPYING vendor/wpa/dist/README vendor/wpa/dist/hostapd/Android.mk vendor/wpa/dist/hostapd/ChangeLog vendor/wpa/dist/hostapd/Makefile vendor/wpa/dist/hostapd/README vendor/wpa/dist/hostapd/android.config vendor/wpa/dist/hostapd/config_file.c vendor/wpa/dist/hostapd/config_file.h vendor/wpa/dist/hostapd/ctrl_iface.c vendor/wpa/dist/hostapd/defconfig vendor/wpa/dist/hostapd/hlr_auc_gw.c vendor/wpa/dist/hostapd/hostapd.android.rc vendor/wpa/dist/hostapd/hostapd.conf vendor/wpa/dist/hostapd/hostapd.eap_user_sqlite vendor/wpa/dist/hostapd/hostapd_cli.c vendor/wpa/dist/hostapd/main.c vendor/wpa/dist/hs20/client/est.c vendor/wpa/dist/hs20/client/oma_dm_client.c vendor/wpa/dist/hs20/client/osu_client.c vendor/wpa/dist/hs20/client/osu_client.h vendor/wpa/dist/src/ap/Makefile vendor/wpa/dist/src/ap/acs.c vendor/wpa/dist/src/ap/acs.h vendor/wpa/dist/src/ap/ap_config.c vendor/wpa/dist/src/ap/ap_config.h vendor/wpa/dist/src/ap/ap_drv_ops.c vendor/wpa/dist/src/ap/ap_drv_ops.h vendor/wpa/dist/src/ap/ap_mlme.c vendor/wpa/dist/src/ap/authsrv.c vendor/wpa/dist/src/ap/beacon.c vendor/wpa/dist/src/ap/beacon.h vendor/wpa/dist/src/ap/bss_load.c vendor/wpa/dist/src/ap/ctrl_iface_ap.c vendor/wpa/dist/src/ap/ctrl_iface_ap.h vendor/wpa/dist/src/ap/dfs.c vendor/wpa/dist/src/ap/dfs.h vendor/wpa/dist/src/ap/dhcp_snoop.c vendor/wpa/dist/src/ap/drv_callbacks.c vendor/wpa/dist/src/ap/eap_user_db.c vendor/wpa/dist/src/ap/gas_serv.c vendor/wpa/dist/src/ap/gas_serv.h vendor/wpa/dist/src/ap/hostapd.c vendor/wpa/dist/src/ap/hostapd.h vendor/wpa/dist/src/ap/hs20.c vendor/wpa/dist/src/ap/hs20.h vendor/wpa/dist/src/ap/hw_features.c vendor/wpa/dist/src/ap/ieee802_11.c vendor/wpa/dist/src/ap/ieee802_11.h vendor/wpa/dist/src/ap/ieee802_11_auth.c vendor/wpa/dist/src/ap/ieee802_11_auth.h vendor/wpa/dist/src/ap/ieee802_11_ht.c vendor/wpa/dist/src/ap/ieee802_11_shared.c vendor/wpa/dist/src/ap/ieee802_11_vht.c vendor/wpa/dist/src/ap/ieee802_1x.c vendor/wpa/dist/src/ap/ieee802_1x.h vendor/wpa/dist/src/ap/ndisc_snoop.c vendor/wpa/dist/src/ap/neighbor_db.c vendor/wpa/dist/src/ap/neighbor_db.h vendor/wpa/dist/src/ap/pmksa_cache_auth.c vendor/wpa/dist/src/ap/pmksa_cache_auth.h vendor/wpa/dist/src/ap/rrm.c vendor/wpa/dist/src/ap/rrm.h vendor/wpa/dist/src/ap/sta_info.c vendor/wpa/dist/src/ap/sta_info.h vendor/wpa/dist/src/ap/taxonomy.c vendor/wpa/dist/src/ap/tkip_countermeasures.c vendor/wpa/dist/src/ap/vlan_init.c vendor/wpa/dist/src/ap/wmm.c vendor/wpa/dist/src/ap/wnm_ap.c vendor/wpa/dist/src/ap/wnm_ap.h vendor/wpa/dist/src/ap/wpa_auth.c vendor/wpa/dist/src/ap/wpa_auth.h vendor/wpa/dist/src/ap/wpa_auth_ft.c vendor/wpa/dist/src/ap/wpa_auth_glue.c vendor/wpa/dist/src/ap/wpa_auth_i.h vendor/wpa/dist/src/ap/wpa_auth_ie.c vendor/wpa/dist/src/ap/wpa_auth_ie.h vendor/wpa/dist/src/ap/wps_hostapd.c vendor/wpa/dist/src/common/common_module_tests.c vendor/wpa/dist/src/common/ctrl_iface_common.c vendor/wpa/dist/src/common/ctrl_iface_common.h vendor/wpa/dist/src/common/defs.h vendor/wpa/dist/src/common/gas.c vendor/wpa/dist/src/common/gas.h vendor/wpa/dist/src/common/hw_features_common.c vendor/wpa/dist/src/common/hw_features_common.h vendor/wpa/dist/src/common/ieee802_11_common.c vendor/wpa/dist/src/common/ieee802_11_common.h vendor/wpa/dist/src/common/ieee802_11_defs.h vendor/wpa/dist/src/common/ieee802_1x_defs.h vendor/wpa/dist/src/common/privsep_commands.h vendor/wpa/dist/src/common/qca-vendor.h vendor/wpa/dist/src/common/sae.c vendor/wpa/dist/src/common/sae.h vendor/wpa/dist/src/common/version.h vendor/wpa/dist/src/common/wpa_common.c vendor/wpa/dist/src/common/wpa_common.h vendor/wpa/dist/src/common/wpa_ctrl.h vendor/wpa/dist/src/common/wpa_helpers.c vendor/wpa/dist/src/crypto/Makefile vendor/wpa/dist/src/crypto/aes-ctr.c vendor/wpa/dist/src/crypto/aes-internal-dec.c vendor/wpa/dist/src/crypto/aes-internal-enc.c vendor/wpa/dist/src/crypto/aes-siv.c vendor/wpa/dist/src/crypto/aes.h vendor/wpa/dist/src/crypto/aes_siv.h vendor/wpa/dist/src/crypto/aes_wrap.h vendor/wpa/dist/src/crypto/crypto.h vendor/wpa/dist/src/crypto/crypto_gnutls.c vendor/wpa/dist/src/crypto/crypto_internal-modexp.c vendor/wpa/dist/src/crypto/crypto_libtomcrypt.c vendor/wpa/dist/src/crypto/crypto_module_tests.c vendor/wpa/dist/src/crypto/crypto_none.c vendor/wpa/dist/src/crypto/crypto_openssl.c vendor/wpa/dist/src/crypto/des-internal.c vendor/wpa/dist/src/crypto/dh_groups.c vendor/wpa/dist/src/crypto/ms_funcs.c vendor/wpa/dist/src/crypto/ms_funcs.h vendor/wpa/dist/src/crypto/random.c vendor/wpa/dist/src/crypto/sha1-internal.c vendor/wpa/dist/src/crypto/sha256-internal.c vendor/wpa/dist/src/crypto/sha256-kdf.c vendor/wpa/dist/src/crypto/sha384-prf.c vendor/wpa/dist/src/crypto/sha384.h vendor/wpa/dist/src/crypto/tls.h vendor/wpa/dist/src/crypto/tls_gnutls.c vendor/wpa/dist/src/crypto/tls_internal.c vendor/wpa/dist/src/crypto/tls_none.c vendor/wpa/dist/src/crypto/tls_openssl.c vendor/wpa/dist/src/drivers/driver.h vendor/wpa/dist/src/drivers/driver_atheros.c vendor/wpa/dist/src/drivers/driver_bsd.c vendor/wpa/dist/src/drivers/driver_common.c vendor/wpa/dist/src/drivers/driver_hostap.c vendor/wpa/dist/src/drivers/driver_macsec_qca.c vendor/wpa/dist/src/drivers/driver_ndis.c vendor/wpa/dist/src/drivers/driver_nl80211.c vendor/wpa/dist/src/drivers/driver_nl80211.h vendor/wpa/dist/src/drivers/driver_nl80211_capa.c vendor/wpa/dist/src/drivers/driver_nl80211_event.c vendor/wpa/dist/src/drivers/driver_nl80211_monitor.c vendor/wpa/dist/src/drivers/driver_nl80211_scan.c vendor/wpa/dist/src/drivers/driver_privsep.c vendor/wpa/dist/src/drivers/driver_wext.c vendor/wpa/dist/src/drivers/driver_wired.c vendor/wpa/dist/src/drivers/drivers.c vendor/wpa/dist/src/drivers/drivers.mak vendor/wpa/dist/src/drivers/drivers.mk vendor/wpa/dist/src/drivers/nl80211_copy.h vendor/wpa/dist/src/eap_common/eap_eke_common.c vendor/wpa/dist/src/eap_common/eap_fast_common.c vendor/wpa/dist/src/eap_common/eap_pwd_common.c vendor/wpa/dist/src/eap_common/eap_pwd_common.h vendor/wpa/dist/src/eap_common/eap_sim_common.c vendor/wpa/dist/src/eap_peer/eap.c vendor/wpa/dist/src/eap_peer/eap.h vendor/wpa/dist/src/eap_peer/eap_aka.c vendor/wpa/dist/src/eap_peer/eap_config.h vendor/wpa/dist/src/eap_peer/eap_eke.c vendor/wpa/dist/src/eap_peer/eap_fast.c vendor/wpa/dist/src/eap_peer/eap_fast_pac.c vendor/wpa/dist/src/eap_peer/eap_gpsk.c vendor/wpa/dist/src/eap_peer/eap_i.h vendor/wpa/dist/src/eap_peer/eap_ikev2.c vendor/wpa/dist/src/eap_peer/eap_leap.c vendor/wpa/dist/src/eap_peer/eap_mschapv2.c vendor/wpa/dist/src/eap_peer/eap_pax.c vendor/wpa/dist/src/eap_peer/eap_peap.c vendor/wpa/dist/src/eap_peer/eap_proxy.h vendor/wpa/dist/src/eap_peer/eap_proxy_dummy.c vendor/wpa/dist/src/eap_peer/eap_psk.c vendor/wpa/dist/src/eap_peer/eap_pwd.c vendor/wpa/dist/src/eap_peer/eap_sake.c vendor/wpa/dist/src/eap_peer/eap_sim.c vendor/wpa/dist/src/eap_peer/eap_tls.c vendor/wpa/dist/src/eap_peer/eap_tls_common.c vendor/wpa/dist/src/eap_peer/eap_tls_common.h vendor/wpa/dist/src/eap_peer/eap_ttls.c vendor/wpa/dist/src/eap_peer/ikev2.c vendor/wpa/dist/src/eap_peer/tncc.c vendor/wpa/dist/src/eap_server/eap.h vendor/wpa/dist/src/eap_server/eap_i.h vendor/wpa/dist/src/eap_server/eap_server.c vendor/wpa/dist/src/eap_server/eap_server_aka.c vendor/wpa/dist/src/eap_server/eap_server_eke.c vendor/wpa/dist/src/eap_server/eap_server_fast.c vendor/wpa/dist/src/eap_server/eap_server_gpsk.c vendor/wpa/dist/src/eap_server/eap_server_gtc.c vendor/wpa/dist/src/eap_server/eap_server_ikev2.c vendor/wpa/dist/src/eap_server/eap_server_mschapv2.c vendor/wpa/dist/src/eap_server/eap_server_pax.c vendor/wpa/dist/src/eap_server/eap_server_psk.c vendor/wpa/dist/src/eap_server/eap_server_pwd.c vendor/wpa/dist/src/eap_server/eap_server_sake.c vendor/wpa/dist/src/eap_server/eap_server_sim.c vendor/wpa/dist/src/eap_server/eap_server_tls.c vendor/wpa/dist/src/eap_server/eap_server_tls_common.c vendor/wpa/dist/src/eap_server/eap_server_ttls.c vendor/wpa/dist/src/eap_server/eap_server_wsc.c vendor/wpa/dist/src/eap_server/eap_tls_common.h vendor/wpa/dist/src/eap_server/ikev2.c vendor/wpa/dist/src/eap_server/tncs.c vendor/wpa/dist/src/eapol_auth/eapol_auth_sm.c vendor/wpa/dist/src/eapol_auth/eapol_auth_sm.h vendor/wpa/dist/src/eapol_supp/eapol_supp_sm.c vendor/wpa/dist/src/eapol_supp/eapol_supp_sm.h vendor/wpa/dist/src/fst/fst_ctrl_aux.h vendor/wpa/dist/src/fst/fst_ctrl_iface.c vendor/wpa/dist/src/fst/fst_group.c vendor/wpa/dist/src/fst/fst_iface.h vendor/wpa/dist/src/fst/fst_session.c vendor/wpa/dist/src/l2_packet/l2_packet.h vendor/wpa/dist/src/l2_packet/l2_packet_linux.c vendor/wpa/dist/src/l2_packet/l2_packet_privsep.c vendor/wpa/dist/src/p2p/p2p.c vendor/wpa/dist/src/p2p/p2p.h vendor/wpa/dist/src/p2p/p2p_go_neg.c vendor/wpa/dist/src/p2p/p2p_group.c vendor/wpa/dist/src/p2p/p2p_i.h vendor/wpa/dist/src/p2p/p2p_pd.c vendor/wpa/dist/src/p2p/p2p_sd.c vendor/wpa/dist/src/pae/ieee802_1x_cp.c vendor/wpa/dist/src/pae/ieee802_1x_kay.c vendor/wpa/dist/src/pae/ieee802_1x_kay.h vendor/wpa/dist/src/pae/ieee802_1x_kay_i.h vendor/wpa/dist/src/pae/ieee802_1x_secy_ops.c vendor/wpa/dist/src/pae/ieee802_1x_secy_ops.h vendor/wpa/dist/src/radius/radius.c vendor/wpa/dist/src/radius/radius.h vendor/wpa/dist/src/radius/radius_client.c vendor/wpa/dist/src/radius/radius_das.c vendor/wpa/dist/src/radius/radius_das.h vendor/wpa/dist/src/radius/radius_server.c vendor/wpa/dist/src/radius/radius_server.h vendor/wpa/dist/src/rsn_supp/Makefile vendor/wpa/dist/src/rsn_supp/pmksa_cache.c vendor/wpa/dist/src/rsn_supp/pmksa_cache.h vendor/wpa/dist/src/rsn_supp/preauth.c vendor/wpa/dist/src/rsn_supp/tdls.c vendor/wpa/dist/src/rsn_supp/wpa.c vendor/wpa/dist/src/rsn_supp/wpa.h vendor/wpa/dist/src/rsn_supp/wpa_ft.c vendor/wpa/dist/src/rsn_supp/wpa_i.h vendor/wpa/dist/src/rsn_supp/wpa_ie.c vendor/wpa/dist/src/rsn_supp/wpa_ie.h vendor/wpa/dist/src/tls/libtommath.c vendor/wpa/dist/src/tls/rsa.c vendor/wpa/dist/src/tls/tlsv1_client.c vendor/wpa/dist/src/tls/tlsv1_client_read.c vendor/wpa/dist/src/tls/tlsv1_common.c vendor/wpa/dist/src/tls/tlsv1_cred.c vendor/wpa/dist/src/tls/tlsv1_server.c vendor/wpa/dist/src/tls/x509v3.c vendor/wpa/dist/src/utils/Makefile vendor/wpa/dist/src/utils/base64.c vendor/wpa/dist/src/utils/base64.h vendor/wpa/dist/src/utils/browser-wpadebug.c vendor/wpa/dist/src/utils/common.c vendor/wpa/dist/src/utils/common.h vendor/wpa/dist/src/utils/eloop.h vendor/wpa/dist/src/utils/http_curl.c vendor/wpa/dist/src/utils/os.h vendor/wpa/dist/src/utils/os_none.c vendor/wpa/dist/src/utils/os_unix.c vendor/wpa/dist/src/utils/os_win32.c vendor/wpa/dist/src/utils/trace.c vendor/wpa/dist/src/utils/utils_module_tests.c vendor/wpa/dist/src/utils/uuid.c vendor/wpa/dist/src/utils/uuid.h vendor/wpa/dist/src/utils/wpa_debug.c vendor/wpa/dist/src/utils/wpa_debug.h vendor/wpa/dist/src/utils/wpabuf.c vendor/wpa/dist/src/utils/xml-utils.c vendor/wpa/dist/src/wps/wps.c vendor/wpa/dist/src/wps/wps_common.c vendor/wpa/dist/src/wps/wps_er.c vendor/wpa/dist/src/wps/wps_registrar.c vendor/wpa/dist/wpa_supplicant/Android.mk vendor/wpa/dist/wpa_supplicant/ChangeLog vendor/wpa/dist/wpa_supplicant/Makefile vendor/wpa/dist/wpa_supplicant/README vendor/wpa/dist/wpa_supplicant/README-HS20 vendor/wpa/dist/wpa_supplicant/android.config vendor/wpa/dist/wpa_supplicant/ap.c vendor/wpa/dist/wpa_supplicant/ap.h vendor/wpa/dist/wpa_supplicant/autoscan.c vendor/wpa/dist/wpa_supplicant/bgscan.c vendor/wpa/dist/wpa_supplicant/bgscan_learn.c vendor/wpa/dist/wpa_supplicant/bgscan_simple.c vendor/wpa/dist/wpa_supplicant/bss.c vendor/wpa/dist/wpa_supplicant/bss.h vendor/wpa/dist/wpa_supplicant/config.c vendor/wpa/dist/wpa_supplicant/config.h vendor/wpa/dist/wpa_supplicant/config_file.c vendor/wpa/dist/wpa_supplicant/config_ssid.h vendor/wpa/dist/wpa_supplicant/config_winreg.c vendor/wpa/dist/wpa_supplicant/ctrl_iface.c vendor/wpa/dist/wpa_supplicant/ctrl_iface_named_pipe.c vendor/wpa/dist/wpa_supplicant/ctrl_iface_udp.c vendor/wpa/dist/wpa_supplicant/ctrl_iface_unix.c vendor/wpa/dist/wpa_supplicant/dbus/dbus_new.c vendor/wpa/dist/wpa_supplicant/dbus/dbus_new.h vendor/wpa/dist/wpa_supplicant/dbus/dbus_new_handlers.c vendor/wpa/dist/wpa_supplicant/dbus/dbus_new_handlers.h vendor/wpa/dist/wpa_supplicant/dbus/dbus_new_handlers_p2p.c vendor/wpa/dist/wpa_supplicant/dbus/dbus_new_handlers_wps.c vendor/wpa/dist/wpa_supplicant/defconfig vendor/wpa/dist/wpa_supplicant/doc/docbook/eapol_test.8 vendor/wpa/dist/wpa_supplicant/doc/docbook/eapol_test.sgml vendor/wpa/dist/wpa_supplicant/doc/docbook/wpa_background.8 vendor/wpa/dist/wpa_supplicant/doc/docbook/wpa_background.sgml vendor/wpa/dist/wpa_supplicant/doc/docbook/wpa_cli.8 vendor/wpa/dist/wpa_supplicant/doc/docbook/wpa_cli.sgml vendor/wpa/dist/wpa_supplicant/doc/docbook/wpa_gui.8 vendor/wpa/dist/wpa_supplicant/doc/docbook/wpa_gui.sgml vendor/wpa/dist/wpa_supplicant/doc/docbook/wpa_passphrase.8 vendor/wpa/dist/wpa_supplicant/doc/docbook/wpa_passphrase.sgml vendor/wpa/dist/wpa_supplicant/doc/docbook/wpa_priv.8 vendor/wpa/dist/wpa_supplicant/doc/docbook/wpa_priv.sgml vendor/wpa/dist/wpa_supplicant/doc/docbook/wpa_supplicant.8 vendor/wpa/dist/wpa_supplicant/doc/docbook/wpa_supplicant.conf.5 vendor/wpa/dist/wpa_supplicant/doc/docbook/wpa_supplicant.sgml vendor/wpa/dist/wpa_supplicant/driver_i.h vendor/wpa/dist/wpa_supplicant/events.c vendor/wpa/dist/wpa_supplicant/examples/wps-ap-cli vendor/wpa/dist/wpa_supplicant/gas_query.c vendor/wpa/dist/wpa_supplicant/gas_query.h vendor/wpa/dist/wpa_supplicant/hs20_supplicant.c vendor/wpa/dist/wpa_supplicant/hs20_supplicant.h vendor/wpa/dist/wpa_supplicant/ibss_rsn.c vendor/wpa/dist/wpa_supplicant/interworking.c vendor/wpa/dist/wpa_supplicant/interworking.h vendor/wpa/dist/wpa_supplicant/mbo.c vendor/wpa/dist/wpa_supplicant/mesh.c vendor/wpa/dist/wpa_supplicant/mesh_mpm.c vendor/wpa/dist/wpa_supplicant/mesh_rsn.c vendor/wpa/dist/wpa_supplicant/notify.c vendor/wpa/dist/wpa_supplicant/notify.h vendor/wpa/dist/wpa_supplicant/offchannel.c vendor/wpa/dist/wpa_supplicant/p2p_supplicant.c vendor/wpa/dist/wpa_supplicant/preauth_test.c vendor/wpa/dist/wpa_supplicant/scan.c vendor/wpa/dist/wpa_supplicant/sme.c vendor/wpa/dist/wpa_supplicant/sme.h vendor/wpa/dist/wpa_supplicant/wifi_display.c vendor/wpa/dist/wpa_supplicant/wmm_ac.c vendor/wpa/dist/wpa_supplicant/wnm_sta.c vendor/wpa/dist/wpa_supplicant/wnm_sta.h vendor/wpa/dist/wpa_supplicant/wpa_cli.c vendor/wpa/dist/wpa_supplicant/wpa_passphrase.c vendor/wpa/dist/wpa_supplicant/wpa_priv.c vendor/wpa/dist/wpa_supplicant/wpa_supplicant.c vendor/wpa/dist/wpa_supplicant/wpa_supplicant.conf vendor/wpa/dist/wpa_supplicant/wpa_supplicant_i.h vendor/wpa/dist/wpa_supplicant/wpa_supplicant_template.conf vendor/wpa/dist/wpa_supplicant/wpas_glue.c vendor/wpa/dist/wpa_supplicant/wpas_kay.c vendor/wpa/dist/wpa_supplicant/wpas_kay.h vendor/wpa/dist/wpa_supplicant/wps_supplicant.c Modified: vendor/wpa/dist/CONTRIBUTIONS ============================================================================== --- vendor/wpa/dist/CONTRIBUTIONS Thu Dec 6 04:36:02 2018 (r341617) +++ vendor/wpa/dist/CONTRIBUTIONS Thu Dec 6 05:04:28 2018 (r341618) @@ -140,7 +140,7 @@ The license terms used for hostap.git files Modified BSD license (no advertisement clause): -Copyright (c) 2002-2016, Jouni Malinen and contributors +Copyright (c) 2002-2018, Jouni Malinen and contributors All Rights Reserved. Redistribution and use in source and binary forms, with or without Modified: vendor/wpa/dist/COPYING ============================================================================== --- vendor/wpa/dist/COPYING Thu Dec 6 04:36:02 2018 (r341617) +++ vendor/wpa/dist/COPYING Thu Dec 6 05:04:28 2018 (r341618) @@ -1,7 +1,7 @@ wpa_supplicant and hostapd -------------------------- -Copyright (c) 2002-2016, Jouni Malinen and contributors +Copyright (c) 2002-2018, Jouni Malinen and contributors All Rights Reserved. Modified: vendor/wpa/dist/README ============================================================================== --- vendor/wpa/dist/README Thu Dec 6 04:36:02 2018 (r341617) +++ vendor/wpa/dist/README Thu Dec 6 05:04:28 2018 (r341618) @@ -1,7 +1,7 @@ wpa_supplicant and hostapd -------------------------- -Copyright (c) 2002-2016, Jouni Malinen and contributors +Copyright (c) 2002-2018, Jouni Malinen and contributors All Rights Reserved. These programs are licensed under the BSD license (the one with Modified: vendor/wpa/dist/hostapd/Android.mk ============================================================================== --- vendor/wpa/dist/hostapd/Android.mk Thu Dec 6 04:36:02 2018 (r341617) +++ vendor/wpa/dist/hostapd/Android.mk Thu Dec 6 05:04:28 2018 (r341618) @@ -38,6 +38,9 @@ endif L_CFLAGS += -DCONFIG_CTRL_IFACE_CLIENT_DIR=\"/data/misc/wifi/sockets\" L_CFLAGS += -DCONFIG_CTRL_IFACE_DIR=\"/data/system/hostapd\" +# Use Android specific directory for hostapd_cli command completion history +L_CFLAGS += -DCONFIG_HOSTAPD_CLI_HISTORY_DIR=\"/data/misc/wifi\" + # To force sizeof(enum) = 4 ifeq ($(TARGET_ARCH),arm) L_CFLAGS += -mabi=aapcs-linux @@ -212,11 +215,6 @@ L_CFLAGS += -DCONFIG_RSN_PREAUTH CONFIG_L2_PACKET=y endif -ifdef CONFIG_PEERKEY -L_CFLAGS += -DCONFIG_PEERKEY -OBJS += src/ap/peerkey_auth.c -endif - ifdef CONFIG_HS20 NEED_AES_OMAC1=y CONFIG_PROXYARP=y @@ -244,13 +242,22 @@ NEED_AES_OMAC1=y endif ifdef CONFIG_IEEE80211R -L_CFLAGS += -DCONFIG_IEEE80211R +L_CFLAGS += -DCONFIG_IEEE80211R -DCONFIG_IEEE80211R_AP OBJS += src/ap/wpa_auth_ft.c NEED_SHA256=y NEED_AES_OMAC1=y NEED_AES_UNWRAP=y +NEED_AES_SIV=y +NEED_ETH_P_OUI=y +NEED_SHA256=y +NEED_HMAC_SHA256_KDF=y endif +ifdef NEED_ETH_P_OUI +L_CFLAGS += -DCONFIG_ETH_P_OUI +OBJS += src/ap/eth_p_oui.c +endif + ifdef CONFIG_SAE L_CFLAGS += -DCONFIG_SAE OBJS += src/common/sae.c @@ -258,8 +265,30 @@ NEED_ECC=y NEED_DH_GROUPS=y endif +ifdef CONFIG_OWE +L_CFLAGS += -DCONFIG_OWE +NEED_ECC=y +NEED_HMAC_SHA256_KDF=y +NEED_HMAC_SHA384_KDF=y +NEED_HMAC_SHA512_KDF=y +NEED_SHA256=y +NEED_SHA384=y +NEED_SHA512=y +endif + +ifdef CONFIG_FILS +L_CFLAGS += -DCONFIG_FILS +OBJS += src/ap/fils_hlp.c +NEED_SHA384=y +NEED_AES_SIV=y +ifdef CONFIG_FILS_SK_PFS +L_CFLAGS += -DCONFIG_FILS_SK_PFS +NEED_ECC=y +endif +endif + ifdef CONFIG_WNM -L_CFLAGS += -DCONFIG_WNM +L_CFLAGS += -DCONFIG_WNM -DCONFIG_WNM_AP OBJS += src/ap/wnm_ap.c endif @@ -271,6 +300,10 @@ ifdef CONFIG_IEEE80211AC L_CFLAGS += -DCONFIG_IEEE80211AC endif +ifdef CONFIG_IEEE80211AX +L_CFLAGS += -DCONFIG_IEEE80211AX +endif + ifdef CONFIG_MBO L_CFLAGS += -DCONFIG_MBO OBJS += src/ap/mbo_ap.c @@ -422,6 +455,7 @@ ifdef CONFIG_EAP_PWD L_CFLAGS += -DEAP_SERVER_PWD OBJS += src/eap_server/eap_server_pwd.c src/eap_common/eap_pwd_common.c NEED_SHA256=y +NEED_ECC=y endif ifdef CONFIG_EAP_EKE @@ -499,6 +533,23 @@ endif endif +ifdef CONFIG_DPP +L_CFLAGS += -DCONFIG_DPP +OBJS += src/common/dpp.c +OBJS += src/ap/dpp_hostapd.c +OBJS += src/ap/gas_query_ap.c +NEED_AES_SIV=y +NEED_HMAC_SHA256_KDF=y +NEED_HMAC_SHA384_KDF=y +NEED_HMAC_SHA512_KDF=y +NEED_SHA256=y +NEED_SHA384=y +NEED_SHA512=y +NEED_JSON=y +NEED_GAS=y +NEED_BASE64=y +endif + ifdef CONFIG_EAP_IKEV2 L_CFLAGS += -DEAP_SERVER_IKEV2 OBJS += src/eap_server/eap_server_ikev2.c src/eap_server/ikev2.c @@ -581,25 +632,40 @@ NEED_SHA256=y NEED_TLS_PRF_SHA256=y LIBS += -lcrypto LIBS_h += -lcrypto +ifndef CONFIG_TLS_DEFAULT_CIPHERS +CONFIG_TLS_DEFAULT_CIPHERS = "DEFAULT:!EXP:!LOW" endif +L_CFLAGS += -DTLS_DEFAULT_CIPHERS=\"$(CONFIG_TLS_DEFAULT_CIPHERS)\" +endif ifeq ($(CONFIG_TLS), gnutls) +ifndef CONFIG_CRYPTO +# default to libgcrypt +CONFIG_CRYPTO=gnutls +endif ifdef TLS_FUNCS OBJS += src/crypto/tls_gnutls.c LIBS += -lgnutls -lgpg-error endif -OBJS += src/crypto/crypto_gnutls.c -HOBJS += src/crypto/crypto_gnutls.c +OBJS += src/crypto/crypto_$(CONFIG_CRYPTO).c +HOBJS += src/crypto/crypto_$(CONFIG_CRYPTO).c ifdef NEED_FIPS186_2_PRF OBJS += src/crypto/fips_prf_internal.c OBJS += src/crypto/sha1-internal.c endif +ifeq ($(CONFIG_CRYPTO), gnutls) LIBS += -lgcrypt LIBS_h += -lgcrypt -CONFIG_INTERNAL_SHA256=y CONFIG_INTERNAL_RC4=y CONFIG_INTERNAL_DH_GROUP5=y endif +ifeq ($(CONFIG_CRYPTO), nettle) +LIBS += -lnettle -lgmp +LIBS_p += -lnettle -lgmp +CONFIG_INTERNAL_RC4=y +CONFIG_INTERNAL_DH_GROUP5=y +endif +endif ifeq ($(CONFIG_TLS), internal) ifndef CONFIG_CRYPTO @@ -715,7 +781,13 @@ endif ifdef NEED_AES_EAX AESOBJS += src/crypto/aes-eax.c NEED_AES_CTR=y +NEED_AES_OMAC1=y endif +ifdef NEED_AES_SIV +AESOBJS += src/crypto/aes-siv.c +NEED_AES_CTR=y +NEED_AES_OMAC1=y +endif ifdef NEED_AES_CTR AESOBJS += src/crypto/aes-ctr.c endif @@ -749,8 +821,10 @@ endif SHA1OBJS = ifdef NEED_SHA1 ifneq ($(CONFIG_TLS), openssl) +ifneq ($(CONFIG_TLS), gnutls) SHA1OBJS += src/crypto/sha1.c endif +endif SHA1OBJS += src/crypto/sha1-prf.c ifdef CONFIG_INTERNAL_SHA1 SHA1OBJS += src/crypto/sha1-internal.c @@ -774,8 +848,10 @@ OBJS += $(SHA1OBJS) endif ifneq ($(CONFIG_TLS), openssl) +ifneq ($(CONFIG_TLS), gnutls) OBJS += src/crypto/md5.c endif +endif ifdef NEED_MD5 ifdef CONFIG_INTERNAL_MD5 @@ -811,8 +887,10 @@ endif ifdef NEED_SHA256 L_CFLAGS += -DCONFIG_SHA256 ifneq ($(CONFIG_TLS), openssl) +ifneq ($(CONFIG_TLS), gnutls) OBJS += src/crypto/sha256.c endif +endif OBJS += src/crypto/sha256-prf.c ifdef CONFIG_INTERNAL_SHA256 OBJS += src/crypto/sha256-internal.c @@ -820,11 +898,36 @@ endif ifdef NEED_TLS_PRF_SHA256 OBJS += src/crypto/sha256-tlsprf.c endif +ifdef NEED_HMAC_SHA256_KDF +OBJS += src/crypto/sha256-kdf.c endif +ifdef NEED_HMAC_SHA384_KDF +OBJS += src/crypto/sha384-kdf.c +endif +ifdef NEED_HMAC_SHA512_KDF +OBJS += src/crypto/sha512-kdf.c +endif +endif ifdef NEED_SHA384 L_CFLAGS += -DCONFIG_SHA384 +ifneq ($(CONFIG_TLS), openssl) +ifneq ($(CONFIG_TLS), gnutls) +OBJS += src/crypto/sha384.c +endif +endif OBJS += src/crypto/sha384-prf.c endif +ifdef NEED_SHA512 +L_CFLAGS += -DCONFIG_SHA512 +ifneq ($(CONFIG_TLS), openssl) +ifneq ($(CONFIG_TLS), linux) +ifneq ($(CONFIG_TLS), gnutls) +OBJS += src/crypto/sha512.c +endif +endif +endif +OBJS += src/crypto/sha512-prf.c +endif ifdef CONFIG_INTERNAL_SHA384 L_CFLAGS += -DCONFIG_INTERNAL_SHA384 @@ -881,6 +984,11 @@ ifdef NEED_BASE64 OBJS += src/utils/base64.c endif +ifdef NEED_JSON +OBJS += src/utils/json.c +L_CFLAGS += -DCONFIG_JSON +endif + ifdef NEED_AP_MLME OBJS += src/ap/wmm.c OBJS += src/ap/ap_list.c @@ -897,6 +1005,10 @@ ifdef CONFIG_IEEE80211AC OBJS += src/ap/ieee802_11_vht.c endif +ifdef CONFIG_IEEE80211AX +OBJS += src/ap/ieee802_11_he.c +endif + ifdef CONFIG_P2P_MANAGER L_CFLAGS += -DCONFIG_P2P_MANAGER OBJS += src/ap/p2p_hostapd.c @@ -910,6 +1022,10 @@ endif ifdef CONFIG_INTERWORKING L_CFLAGS += -DCONFIG_INTERWORKING +NEED_GAS=y +endif + +ifdef NEED_GAS OBJS += src/common/gas.c OBJS += src/ap/gas_serv.c endif @@ -935,6 +1051,10 @@ ifdef CONFIG_NO_STDOUT_DEBUG L_CFLAGS += -DCONFIG_NO_STDOUT_DEBUG endif +ifdef CONFIG_DEBUG_SYSLOG +L_CFLAGS += -DCONFIG_DEBUG_SYSLOG +endif + ifdef CONFIG_DEBUG_LINUX_TRACING L_CFLAGS += -DCONFIG_DEBUG_LINUX_TRACING endif @@ -968,6 +1088,7 @@ endif include $(CLEAR_VARS) LOCAL_MODULE := hostapd_cli LOCAL_MODULE_TAGS := debug +LOCAL_PROPRIETARY_MODULE := true LOCAL_SHARED_LIBRARIES := libc libcutils liblog LOCAL_CFLAGS := $(L_CFLAGS) LOCAL_SRC_FILES := $(OBJS_c) @@ -978,6 +1099,7 @@ include $(BUILD_EXECUTABLE) include $(CLEAR_VARS) LOCAL_MODULE := hostapd LOCAL_MODULE_TAGS := optional +LOCAL_PROPRIETARY_MODULE := true ifdef CONFIG_DRIVER_CUSTOM LOCAL_STATIC_LIBRARIES := libCustomWifi endif Modified: vendor/wpa/dist/hostapd/ChangeLog ============================================================================== --- vendor/wpa/dist/hostapd/ChangeLog Thu Dec 6 04:36:02 2018 (r341617) +++ vendor/wpa/dist/hostapd/ChangeLog Thu Dec 6 05:04:28 2018 (r341618) @@ -1,5 +1,60 @@ ChangeLog for hostapd +2018-12-02 - v2.7 + * fixed WPA packet number reuse with replayed messages and key + reinstallation + [http://w1.fi/security/2017-1/] (CVE-2017-13082) + * added support for FILS (IEEE 802.11ai) shared key authentication + * added support for OWE (Opportunistic Wireless Encryption, RFC 8110; + and transition mode defined by WFA) + * added support for DPP (Wi-Fi Device Provisioning Protocol) + * FT: + - added local generation of PMK-R0/PMK-R1 for FT-PSK + (ft_psk_generate_local=1) + - replaced inter-AP protocol with a cleaner design that is more + easily extensible; this breaks backward compatibility and requires + all APs in the ESS to be updated at the same time to maintain FT + functionality + - added support for wildcard R0KH/R1KH + - replaced r0_key_lifetime (minutes) parameter with + ft_r0_key_lifetime (seconds) + - fixed wpa_psk_file use for FT-PSK + - fixed FT-SAE PMKID matching + - added expiration to PMK-R0 and PMK-R1 cache + - added IEEE VLAN support (including tagged VLANs) + - added support for SHA384 based AKM + * SAE + - fixed some PMKSA caching cases with SAE + - added support for configuring SAE password separately of the + WPA2 PSK/passphrase + - added option to require MFP for SAE associations + (sae_require_pmf=1) + - fixed PTK and EAPOL-Key integrity and key-wrap algorithm selection + for SAE; + note: this is not backwards compatible, i.e., both the AP and + station side implementations will need to be update at the same + time to maintain interoperability + - added support for Password Identifier + * hostapd_cli: added support for command history and completion + * added support for requesting beacon report + * large number of other fixes, cleanup, and extensions + * added option to configure EAPOL-Key retry limits + (wpa_group_update_count and wpa_pairwise_update_count) + * removed all PeerKey functionality + * fixed nl80211 AP mode configuration regression with Linux 4.15 and + newer + * added support for using wolfSSL cryptographic library + * fixed some 20/40 MHz coexistence cases where the BSS could drop to + 20 MHz even when 40 MHz would be allowed + * Hotspot 2.0 + - added support for setting Venue URL ANQP-element (venue_url) + - added support for advertising Hotspot 2.0 operator icons + - added support for Roaming Consortium Selection element + - added support for Terms and Conditions + - added support for OSEN connection in a shared RSN BSS + * added support for using OpenSSL 1.1.1 + * added EAP-pwd server support for salted passwords + 2016-10-02 - v2.6 * fixed EAP-pwd last fragment validation [http://w1.fi/security/2015-7/] (CVE-2015-5314) Modified: vendor/wpa/dist/hostapd/Makefile ============================================================================== --- vendor/wpa/dist/hostapd/Makefile Thu Dec 6 04:36:02 2018 (r341617) +++ vendor/wpa/dist/hostapd/Makefile Thu Dec 6 05:04:28 2018 (r341618) @@ -258,11 +258,6 @@ CFLAGS += -DCONFIG_RSN_PREAUTH CONFIG_L2_PACKET=y endif -ifdef CONFIG_PEERKEY -CFLAGS += -DCONFIG_PEERKEY -OBJS += ../src/ap/peerkey_auth.o -endif - ifdef CONFIG_HS20 NEED_AES_OMAC1=y CONFIG_PROXYARP=y @@ -290,13 +285,22 @@ NEED_AES_OMAC1=y endif ifdef CONFIG_IEEE80211R -CFLAGS += -DCONFIG_IEEE80211R +CFLAGS += -DCONFIG_IEEE80211R -DCONFIG_IEEE80211R_AP OBJS += ../src/ap/wpa_auth_ft.o NEED_SHA256=y NEED_AES_OMAC1=y NEED_AES_UNWRAP=y +NEED_AES_SIV=y +NEED_ETH_P_OUI=y +NEED_SHA256=y +NEED_HMAC_SHA256_KDF=y endif +ifdef NEED_ETH_P_OUI +CFLAGS += -DCONFIG_ETH_P_OUI +OBJS += ../src/ap/eth_p_oui.o +endif + ifdef CONFIG_SAE CFLAGS += -DCONFIG_SAE OBJS += ../src/common/sae.o @@ -305,8 +309,30 @@ NEED_DH_GROUPS=y NEED_AP_MLME=y endif +ifdef CONFIG_OWE +CFLAGS += -DCONFIG_OWE +NEED_ECC=y +NEED_HMAC_SHA256_KDF=y +NEED_HMAC_SHA384_KDF=y +NEED_HMAC_SHA512_KDF=y +NEED_SHA256=y +NEED_SHA384=y +NEED_SHA512=y +endif + +ifdef CONFIG_FILS +CFLAGS += -DCONFIG_FILS +OBJS += ../src/ap/fils_hlp.o +NEED_SHA384=y +NEED_AES_SIV=y +ifdef CONFIG_FILS_SK_PFS +CFLAGS += -DCONFIG_FILS_SK_PFS +NEED_ECC=y +endif +endif + ifdef CONFIG_WNM -CFLAGS += -DCONFIG_WNM +CFLAGS += -DCONFIG_WNM -DCONFIG_WNM_AP OBJS += ../src/ap/wnm_ap.o endif @@ -318,6 +344,11 @@ ifdef CONFIG_IEEE80211AC CFLAGS += -DCONFIG_IEEE80211AC endif +ifdef CONFIG_IEEE80211AX +CFLAGS += -DCONFIG_IEEE80211AX +OBJS += ../src/ap/ieee802_11_he.o +endif + ifdef CONFIG_MBO CFLAGS += -DCONFIG_MBO OBJS += ../src/ap/mbo_ap.o @@ -458,6 +489,7 @@ ifdef CONFIG_EAP_PWD CFLAGS += -DEAP_SERVER_PWD OBJS += ../src/eap_server/eap_server_pwd.o ../src/eap_common/eap_pwd_common.o NEED_SHA256=y +NEED_ECC=y endif ifdef CONFIG_EAP_EKE @@ -535,6 +567,23 @@ endif endif +ifdef CONFIG_DPP +CFLAGS += -DCONFIG_DPP +OBJS += ../src/common/dpp.o +OBJS += ../src/ap/dpp_hostapd.o +OBJS += ../src/ap/gas_query_ap.o +NEED_AES_SIV=y +NEED_HMAC_SHA256_KDF=y +NEED_HMAC_SHA384_KDF=y +NEED_HMAC_SHA512_KDF=y +NEED_SHA256=y +NEED_SHA384=y +NEED_SHA512=y +NEED_JSON=y +NEED_GAS=y +NEED_BASE64=y +endif + ifdef CONFIG_EAP_IKEV2 CFLAGS += -DEAP_SERVER_IKEV2 OBJS += ../src/eap_server/eap_server_ikev2.o ../src/eap_server/ikev2.o @@ -602,7 +651,29 @@ CFLAGS += -DCONFIG_TLSV12 NEED_SHA256=y endif +ifeq ($(CONFIG_TLS), wolfssl) +CONFIG_CRYPTO=wolfssl +ifdef TLS_FUNCS +OBJS += ../src/crypto/tls_wolfssl.o +LIBS += -lwolfssl -lm +endif +OBJS += ../src/crypto/crypto_wolfssl.o +HOBJS += ../src/crypto/crypto_wolfssl.o +ifdef NEED_FIPS186_2_PRF +OBJS += ../src/crypto/fips_prf_wolfssl.o +endif +NEED_SHA256=y +NEED_TLS_PRF_SHA256=y +LIBS += -lwolfssl -lm +LIBS_h += -lwolfssl -lm +ifdef CONFIG_TLS_ADD_DL +LIBS += -ldl +LIBS_h += -ldl +endif +endif + ifeq ($(CONFIG_TLS), openssl) +CONFIG_CRYPTO=openssl ifdef TLS_FUNCS OBJS += ../src/crypto/tls_openssl.o OBJS += ../src/crypto/tls_openssl_ocsp.o @@ -617,29 +688,46 @@ NEED_SHA256=y NEED_TLS_PRF_SHA256=y LIBS += -lcrypto LIBS_h += -lcrypto +LIBS_n += -lcrypto ifdef CONFIG_TLS_ADD_DL LIBS += -ldl LIBS_h += -ldl endif +ifndef CONFIG_TLS_DEFAULT_CIPHERS +CONFIG_TLS_DEFAULT_CIPHERS = "DEFAULT:!EXP:!LOW" endif +CFLAGS += -DTLS_DEFAULT_CIPHERS=\"$(CONFIG_TLS_DEFAULT_CIPHERS)\" +endif ifeq ($(CONFIG_TLS), gnutls) +ifndef CONFIG_CRYPTO +# default to libgcrypt +CONFIG_CRYPTO=gnutls +endif ifdef TLS_FUNCS OBJS += ../src/crypto/tls_gnutls.o LIBS += -lgnutls -lgpg-error endif -OBJS += ../src/crypto/crypto_gnutls.o -HOBJS += ../src/crypto/crypto_gnutls.o +OBJS += ../src/crypto/crypto_$(CONFIG_CRYPTO).o +HOBJS += ../src/crypto/crypto_$(CONFIG_CRYPTO).o ifdef NEED_FIPS186_2_PRF OBJS += ../src/crypto/fips_prf_internal.o SHA1OBJS += ../src/crypto/sha1-internal.o endif +ifeq ($(CONFIG_CRYPTO), gnutls) LIBS += -lgcrypt LIBS_h += -lgcrypt -CONFIG_INTERNAL_SHA256=y +LIBS_n += -lgcrypt CONFIG_INTERNAL_RC4=y CONFIG_INTERNAL_DH_GROUP5=y endif +ifeq ($(CONFIG_CRYPTO), nettle) +LIBS += -lnettle -lgmp +LIBS_p += -lnettle -lgmp +CONFIG_INTERNAL_RC4=y +CONFIG_INTERNAL_DH_GROUP5=y +endif +endif ifeq ($(CONFIG_TLS), internal) ifndef CONFIG_CRYPTO @@ -720,6 +808,47 @@ CONFIG_INTERNAL_RC4=y endif endif +ifeq ($(CONFIG_TLS), linux) +OBJS += ../src/crypto/crypto_linux.o +ifdef TLS_FUNCS +OBJS += ../src/crypto/crypto_internal-rsa.o +OBJS += ../src/crypto/tls_internal.o +OBJS += ../src/tls/tlsv1_common.o +OBJS += ../src/tls/tlsv1_record.o +OBJS += ../src/tls/tlsv1_cred.o +OBJS += ../src/tls/tlsv1_server.o +OBJS += ../src/tls/tlsv1_server_write.o +OBJS += ../src/tls/tlsv1_server_read.o +OBJS += ../src/tls/asn1.o +OBJS += ../src/tls/rsa.o +OBJS += ../src/tls/x509v3.o +OBJS += ../src/tls/pkcs1.o +OBJS += ../src/tls/pkcs5.o +OBJS += ../src/tls/pkcs8.o +NEED_SHA256=y +NEED_BASE64=y +NEED_TLS_PRF=y +ifdef CONFIG_TLSV12 +NEED_TLS_PRF_SHA256=y +endif +NEED_MODEXP=y +NEED_CIPHER=y +CFLAGS += -DCONFIG_TLS_INTERNAL +CFLAGS += -DCONFIG_TLS_INTERNAL_SERVER +endif +ifdef NEED_MODEXP +OBJS += ../src/crypto/crypto_internal-modexp.o +OBJS += ../src/tls/bignum.o +CFLAGS += -DCONFIG_INTERNAL_LIBTOMMATH +CFLAGS += -DLTM_FAST +endif +CONFIG_INTERNAL_DH_GROUP5=y +ifdef NEED_FIPS186_2_PRF +OBJS += ../src/crypto/fips_prf_internal.o +OBJS += ../src/crypto/sha1-internal.o +endif +endif + ifeq ($(CONFIG_TLS), none) ifdef TLS_FUNCS OBJS += ../src/crypto/tls_none.o @@ -750,12 +879,20 @@ AESOBJS += ../src/crypto/aes-internal.o ../src/crypto/ endif ifneq ($(CONFIG_TLS), openssl) +ifneq ($(CONFIG_TLS), wolfssl) AESOBJS += ../src/crypto/aes-wrap.o endif +endif ifdef NEED_AES_EAX AESOBJS += ../src/crypto/aes-eax.o NEED_AES_CTR=y +NEED_AES_OMAC1=y endif +ifdef NEED_AES_SIV +AESOBJS += ../src/crypto/aes-siv.o +NEED_AES_CTR=y +NEED_AES_OMAC1=y +endif ifdef NEED_AES_CTR AESOBJS += ../src/crypto/aes-ctr.o endif @@ -763,20 +900,32 @@ ifdef NEED_AES_ENCBLOCK AESOBJS += ../src/crypto/aes-encblock.o endif ifdef NEED_AES_OMAC1 +ifneq ($(CONFIG_TLS), linux) +ifneq ($(CONFIG_TLS), wolfssl) AESOBJS += ../src/crypto/aes-omac1.o endif +endif +endif ifdef NEED_AES_UNWRAP ifneq ($(CONFIG_TLS), openssl) +ifneq ($(CONFIG_TLS), linux) +ifneq ($(CONFIG_TLS), wolfssl) NEED_AES_DEC=y AESOBJS += ../src/crypto/aes-unwrap.o endif endif +endif +endif ifdef NEED_AES_CBC NEED_AES_DEC=y ifneq ($(CONFIG_TLS), openssl) +ifneq ($(CONFIG_TLS), linux) +ifneq ($(CONFIG_TLS), wolfssl) AESOBJS += ../src/crypto/aes-cbc.o endif endif +endif +endif ifdef NEED_AES_DEC ifdef CONFIG_INTERNAL_AES AESOBJS += ../src/crypto/aes-internal-dec.o @@ -788,8 +937,14 @@ endif ifdef NEED_SHA1 ifneq ($(CONFIG_TLS), openssl) +ifneq ($(CONFIG_TLS), linux) +ifneq ($(CONFIG_TLS), gnutls) +ifneq ($(CONFIG_TLS), wolfssl) SHA1OBJS += ../src/crypto/sha1.o endif +endif +endif +endif SHA1OBJS += ../src/crypto/sha1-prf.o ifdef CONFIG_INTERNAL_SHA1 SHA1OBJS += ../src/crypto/sha1-internal.o @@ -798,8 +953,10 @@ SHA1OBJS += ../src/crypto/fips_prf_internal.o endif endif ifneq ($(CONFIG_TLS), openssl) +ifneq ($(CONFIG_TLS), wolfssl) SHA1OBJS += ../src/crypto/sha1-pbkdf2.o endif +endif ifdef NEED_T_PRF SHA1OBJS += ../src/crypto/sha1-tprf.o endif @@ -813,8 +970,14 @@ OBJS += $(SHA1OBJS) endif ifneq ($(CONFIG_TLS), openssl) +ifneq ($(CONFIG_TLS), linux) +ifneq ($(CONFIG_TLS), gnutls) +ifneq ($(CONFIG_TLS), wolfssl) OBJS += ../src/crypto/md5.o endif +endif +endif +endif ifdef NEED_MD5 ifdef CONFIG_INTERNAL_MD5 @@ -830,6 +993,7 @@ endif endif ifdef NEED_DES +CFLAGS += -DCONFIG_DES ifdef CONFIG_INTERNAL_DES OBJS += ../src/crypto/des-internal.o endif @@ -850,8 +1014,14 @@ endif ifdef NEED_SHA256 CFLAGS += -DCONFIG_SHA256 ifneq ($(CONFIG_TLS), openssl) +ifneq ($(CONFIG_TLS), linux) +ifneq ($(CONFIG_TLS), gnutls) +ifneq ($(CONFIG_TLS), wolfssl) OBJS += ../src/crypto/sha256.o endif +endif +endif +endif OBJS += ../src/crypto/sha256-prf.o ifdef CONFIG_INTERNAL_SHA256 OBJS += ../src/crypto/sha256-internal.o @@ -862,11 +1032,39 @@ endif ifdef NEED_HMAC_SHA256_KDF OBJS += ../src/crypto/sha256-kdf.o endif +ifdef NEED_HMAC_SHA384_KDF +OBJS += ../src/crypto/sha384-kdf.o endif +ifdef NEED_HMAC_SHA512_KDF +OBJS += ../src/crypto/sha512-kdf.o +endif +endif ifdef NEED_SHA384 CFLAGS += -DCONFIG_SHA384 +ifneq ($(CONFIG_TLS), openssl) +ifneq ($(CONFIG_TLS), linux) +ifneq ($(CONFIG_TLS), gnutls) +ifneq ($(CONFIG_TLS), wolfssl) +OBJS += ../src/crypto/sha384.o +endif +endif +endif +endif OBJS += ../src/crypto/sha384-prf.o endif +ifdef NEED_SHA512 +CFLAGS += -DCONFIG_SHA512 +ifneq ($(CONFIG_TLS), openssl) +ifneq ($(CONFIG_TLS), linux) +ifneq ($(CONFIG_TLS), gnutls) +ifneq ($(CONFIG_TLS), wolfssl) +OBJS += ../src/crypto/sha512.o +endif +endif +endif +endif +OBJS += ../src/crypto/sha512-prf.o +endif ifdef CONFIG_INTERNAL_SHA384 CFLAGS += -DCONFIG_INTERNAL_SHA384 @@ -902,9 +1100,13 @@ HOBJS += ../src/crypto/random.o HOBJS += ../src/utils/eloop.o HOBJS += $(SHA1OBJS) ifneq ($(CONFIG_TLS), openssl) +ifneq ($(CONFIG_TLS), linux) +ifneq ($(CONFIG_TLS), wolfssl) HOBJS += ../src/crypto/md5.o endif endif +endif +endif ifdef CONFIG_RADIUS_SERVER CFLAGS += -DRADIUS_SERVER @@ -923,6 +1125,11 @@ ifdef NEED_BASE64 OBJS += ../src/utils/base64.o endif +ifdef NEED_JSON +OBJS += ../src/utils/json.o +CFLAGS += -DCONFIG_JSON +endif + ifdef NEED_AP_MLME OBJS += ../src/ap/wmm.o OBJS += ../src/ap/ap_list.o @@ -952,6 +1159,10 @@ endif ifdef CONFIG_INTERWORKING CFLAGS += -DCONFIG_INTERWORKING +NEED_GAS=y +endif + +ifdef NEED_GAS OBJS += ../src/common/gas.o OBJS += ../src/ap/gas_serv.o endif @@ -983,6 +1194,10 @@ ifdef CONFIG_NO_STDOUT_DEBUG CFLAGS += -DCONFIG_NO_STDOUT_DEBUG endif +ifdef CONFIG_DEBUG_SYSLOG +CFLAGS += -DCONFIG_DEBUG_SYSLOG +endif + ifdef CONFIG_DEBUG_LINUX_TRACING CFLAGS += -DCONFIG_DEBUG_LINUX_TRACING endif @@ -1082,22 +1297,23 @@ endif ifdef CONFIG_INTERNAL_MD5 NOBJS += ../src/crypto/md5-internal.o endif -NOBJS += ../src/crypto/crypto_openssl.o ../src/utils/os_$(CONFIG_OS).o +NOBJS += ../src/crypto/crypto_$(CONFIG_CRYPTO).o +NOBJS += ../src/utils/os_$(CONFIG_OS).o NOBJS += ../src/utils/wpa_debug.o NOBJS += ../src/utils/wpabuf.o ifdef CONFIG_WPA_TRACE NOBJS += ../src/utils/trace.o LIBS_n += -lbfd endif -ifdef TLS_FUNCS -LIBS_n += -lcrypto -endif HOBJS += hlr_auc_gw.o ../src/utils/common.o ../src/utils/wpa_debug.o ../src/utils/os_$(CONFIG_OS).o ../src/utils/wpabuf.o ../src/crypto/milenage.o HOBJS += ../src/crypto/aes-encblock.o ifdef CONFIG_INTERNAL_AES HOBJS += ../src/crypto/aes-internal.o HOBJS += ../src/crypto/aes-internal-enc.o +endif +ifeq ($(CONFIG_TLS), linux) +HOBJS += ../src/crypto/crypto_linux.o endif nt_password_hash: $(NOBJS) Modified: vendor/wpa/dist/hostapd/README ============================================================================== --- vendor/wpa/dist/hostapd/README Thu Dec 6 04:36:02 2018 (r341617) +++ vendor/wpa/dist/hostapd/README Thu Dec 6 05:04:28 2018 (r341618) @@ -2,7 +2,7 @@ hostapd - user space IEEE 802.11 AP and IEEE 802.1X/WP Authenticator and RADIUS authentication server ================================================================ -Copyright (c) 2002-2016, Jouni Malinen and contributors +Copyright (c) 2002-2018, Jouni Malinen and contributors All Rights Reserved. This program is licensed under the BSD license (the one with @@ -70,7 +70,7 @@ Requirements Current hardware/software requirements: - drivers: Host AP driver for Prism2/2.5/3. - (http://hostap.epitest.fi/) + (http://w1.fi/hostap-driver.html) Please note that station firmware version needs to be 1.7.0 or newer to work in WPA mode. @@ -81,8 +81,7 @@ Current hardware/software requirements: Any wired Ethernet driver for wired IEEE 802.1X authentication (experimental code) - FreeBSD -current (with some kernel mods that have not yet been - committed when hostapd v0.3.0 was released) + FreeBSD -current BSD net80211 layer (e.g., Atheros driver) @@ -186,24 +185,14 @@ Authenticator and RADIUS encapsulation between the Aut the Authentication Server. Other than this, the functionality is similar to the case with the co-located Authentication Server. -Authentication Server and Supplicant ------------------------------------- +Authentication Server +--------------------- Any RADIUS server supporting EAP should be usable as an IEEE 802.1X Authentication Server with hostapd Authenticator. FreeRADIUS (http://www.freeradius.org/) has been successfully tested with hostapd -Authenticator and both Xsupplicant (http://www.open1x.org) and Windows -XP Supplicants. EAP/TLS was used with Xsupplicant and -EAP/MD5-Challenge with Windows XP. +Authenticator. -http://www.missl.cs.umd.edu/wireless/eaptls/ has useful information -about using EAP/TLS with FreeRADIUS and Xsupplicant (just replace -Cisco access point with Host AP driver, hostapd daemon, and a Prism2 -card ;-). http://www.freeradius.org/doc/EAP-MD5.html has information -about using EAP/MD5 with FreeRADIUS, including instructions for WinXP -configuration. http://www.denobula.com/EAPTLS.pdf has a HOWTO on -EAP/TLS use with WinXP Supplicant. - Automatic WEP key configuration ------------------------------- @@ -243,16 +232,15 @@ networks that require some kind of security. Task grou of IEEE 802.11 working group (http://www.ieee802.org/11/) has worked to address the flaws of the base standard and has in practice completed its work in May 2004. The IEEE 802.11i amendment to the IEEE -802.11 standard was approved in June 2004 and this amendment is likely -to be published in July 2004. +802.11 standard was approved in June 2004 and this amendment was +published in July 2004. Wi-Fi Alliance (http://www.wi-fi.org/) used a draft version of the IEEE 802.11i work (draft 3.0) to define a subset of the security enhancements that can be implemented with existing wlan hardware. This is called Wi-Fi Protected Access (WPA). This has now become a mandatory component of interoperability testing and certification done -by Wi-Fi Alliance. Wi-Fi provides information about WPA at its web -site (http://www.wi-fi.org/OpenSection/protected_access.asp). +by Wi-Fi Alliance. IEEE 802.11 standard defined wired equivalent privacy (WEP) algorithm for protecting wireless networks. WEP uses RC4 with 40-bit keys, Modified: vendor/wpa/dist/hostapd/android.config ============================================================================== --- vendor/wpa/dist/hostapd/android.config Thu Dec 6 04:36:02 2018 (r341617) +++ vendor/wpa/dist/hostapd/android.config Thu Dec 6 05:04:28 2018 (r341618) @@ -44,9 +44,6 @@ CONFIG_DRIVER_NL80211_QCA=y # WPA2/IEEE 802.11i RSN pre-authentication #CONFIG_RSN_PREAUTH=y -# PeerKey handshake for Station to Station Link (IEEE 802.11e DLS) -#CONFIG_PEERKEY=y - # IEEE 802.11w (management frame protection) # This version is an experimental implementation based on IEEE 802.11w/D1.0 # draft and is subject to change since the standard has not yet been finalized. @@ -199,3 +196,17 @@ CONFIG_AP=y # These extentions facilitate efficient use of multiple frequency bands # available to the AP and the devices that may associate with it. #CONFIG_MBO=y + +# Include internal line edit mode in hostapd_cli. +CONFIG_WPA_CLI_EDIT=y + +# Opportunistic Wireless Encryption (OWE) +# Experimental implementation of draft-harkins-owe-07.txt +#CONFIG_OWE=y + +# Wpa_supplicant's random pool is not necessary on Android. Randomness is +# already provided by the entropymixer service which ensures sufficient +# entropy is maintained across reboots. Commit b410eb1913 'Initialize +# /dev/urandom earlier in boot' seeds /dev/urandom with that entropy before +# either wpa_supplicant or hostapd are run. +CONFIG_NO_RANDOM_POOL=y Modified: vendor/wpa/dist/hostapd/config_file.c ============================================================================== --- vendor/wpa/dist/hostapd/config_file.c Thu Dec 6 04:36:02 2018 (r341617) +++ vendor/wpa/dist/hostapd/config_file.c Thu Dec 6 05:04:28 2018 (r341618) @@ -1,6 +1,6 @@ /* * hostapd / Configuration file parser - * Copyright (c) 2003-2015, Jouni Malinen + * Copyright (c) 2003-2018, Jouni Malinen * *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Dec 6 05:06:15 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 854A6130EEB4; Thu, 6 Dec 2018 05:06:15 +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 272B47DA53; Thu, 6 Dec 2018 05:06:15 +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 E26EE1EF1B; Thu, 6 Dec 2018 05:06:14 +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 wB656E0U065620; Thu, 6 Dec 2018 05:06:14 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB656EcF065619; Thu, 6 Dec 2018 05:06:14 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201812060506.wB656EcF065619@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 05:06:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r341619 - vendor/wpa/2.7 X-SVN-Group: vendor X-SVN-Commit-Author: cy X-SVN-Commit-Paths: vendor/wpa/2.7 X-SVN-Commit-Revision: 341619 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 272B47DA53 X-Spamd-Result: default: False [-0.30 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.47)[-0.467,0]; NEURAL_SPAM_SHORT(0.27)[0.274,0]; NEURAL_HAM_LONG(-0.11)[-0.112,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Dec 2018 05:06:15 -0000 Author: cy Date: Thu Dec 6 05:06:14 2018 New Revision: 341619 URL: https://svnweb.freebsd.org/changeset/base/341619 Log: Tag wpa_supplicant/hostapd 2.7. Added: vendor/wpa/2.7/ - copied from r341618, vendor/wpa/dist/ From owner-svn-src-all@freebsd.org Thu Dec 6 04:36:03 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Dec 6 06:18:22 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Dec 6 06:19:12 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6761E1313E3C for ; Thu, 6 Dec 2018 06:19:12 +0000 (UTC) (envelope-from bounce+0c72f6.b1b642-svn-src-all=freebsd.org@home.dimapanov.com) Received: from mail2.static.mailgun.info (mail2.static.mailgun.info [104.130.122.2]) (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 B4A16807B4 for ; Thu, 6 Dec 2018 06:19:11 +0000 (UTC) (envelope-from bounce+0c72f6.b1b642-svn-src-all=freebsd.org@home.dimapanov.com) DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=home.dimapanov.com; q=dns/txt; s=smtp; t=1544077151; h=Content-Transfer-Encoding: Content-Type: In-Reply-To: MIME-Version: Date: Message-ID: From: References: Cc: To: Subject: Reply-To: Sender; bh=+G04V5T6nko9O/GU676q4Gpbl5S0jkG3f2q1T5InomY=; b=KuAUnwzpFMi17T85JuXyVBzoW63hxi+lmG4oUqmlQ2nBqJy16qOaF+KAoOsAZR5A73HwtNQE fLc4XFbgpjBsePAuJCcK28Q9voBambHMyx36NfwTxpnelFUA6xC8Nxob2U8yrZG4jQM97JW2 aANOBhLgNfPaI2iHVHxuK0VuLH0= X-Mailgun-Sending-Ip: 104.130.122.2 X-Mailgun-Sid: WyIzNTBlNSIsICJzdm4tc3JjLWFsbEBmcmVlYnNkLm9yZyIsICJiMWI2NDIiXQ== Sender: fluffy=freebsd.org@home.dimapanov.com Received: from iMac-Fluffy.local (Unknown [172.111.245.169]) by mxa.mailgun.org with ESMTP id 5c08ba9c.7f6c6edf23e8-smtp-out-n01; Thu, 06 Dec 2018 05:58:52 -0000 (UTC) Reply-To: fluffy@FreeBSD.org Subject: Re: svn commit: r341266 - in releng/12.0: . sys/modules/iavf To: Marius Strobl Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org References: <201811292159.wATLx9Bb099604@repo.freebsd.org> From: Dima Panov Message-ID: <31493546-f2a6-8ad4-5c6e-5e8d835debeb@FreeBSD.org> Date: Thu, 6 Dec 2018 15:58:44 +1000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 PostboxApp/6.1.6 MIME-Version: 1.0 In-Reply-To: <201811292159.wATLx9Bb099604@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: ru Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: B4A16807B4 X-Spamd-Result: default: False [-0.41 / 15.00]; HAS_REPLYTO(0.00)[fluffy@FreeBSD.org]; MX_INVALID(0.50)[cached]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:104.130.122.0/23]; REPLYTO_ADDR_EQ_FROM(0.00)[]; DKIM_TRACE(0.00)[home.dimapanov.com:+]; NEURAL_HAM_SHORT(-0.60)[-0.604,0]; FORGED_SENDER(0.30)[fluffy@FreeBSD.org,bounce@home.dimapanov.com]; RCVD_TLS_LAST(0.00)[]; IP_SCORE(-0.61)[ipnet: 104.130.120.0/22(0.48), asn: 27357(-3.46), country: US(-0.09)]; ASN(0.00)[asn:27357, ipnet:104.130.120.0/22, country:US]; MID_RHS_MATCH_FROM(0.00)[]; TAGGED_FROM(0.00)[0c72f6.b1b642-svn-src-all=freebsd.org]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; R_DKIM_ALLOW(-0.20)[home.dimapanov.com]; FROM_NEQ_ENVFROM(0.00)[fluffy@FreeBSD.org,bounce@home.dimapanov.com]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; NEURAL_HAM_LONG(-1.00)[-0.997,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[FreeBSD.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2.122.130.104.list.dnswl.org : 127.0.15.0]; FORGED_MUA_MOZILLA_MAIL_MSGID_UNKNOWN(2.50)[]; RCVD_COUNT_TWO(0.00)[2] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Dec 2018 06:19:12 -0000 Hello! Marius Strobl wrote on 30/11/2018 07:59: > Author: marius > Date: Thu Nov 29 21:59:09 2018 > New Revision: 341266 > URL: https://svnweb.freebsd.org/changeset/base/341266 > > Log: > MFC: r341016, MF12: r341261 > > - Add a belated UPDATING entry for the ixlv(4) -> iavf(4) rename in r339338. > - Likewise, add ixlv.4.gz to OLD_FILES, > - and link if_ixlv.ko to if_iavf.ko in order to aid a bit in the transition. > [cut] > > Modified: releng/12.0/sys/modules/iavf/Makefile > ============================================================================== > --- releng/12.0/sys/modules/iavf/Makefile Thu Nov 29 21:20:53 2018 (r341265) > +++ releng/12.0/sys/modules/iavf/Makefile Thu Nov 29 21:59:09 2018 (r341266) > @@ -15,4 +15,6 @@ SRCS += i40e_common.c i40e_nvm.c i40e_adminq.c > # Enable asserts and other debugging facilities > # CFLAGS += -DINVARIANTS -DINVARIANTS_SUPPORT -DWITNESS > > +LINKS= ${KMODDIR}/${KMOD}.ko ${KMODDIR}/if_ixlv.ko > + > .include And this broke poudriere jail upgrade due to missed kernel modules for build purpose # poudriere jail -u -j fbsd12-test -t 12.0-RC3 [skip] /usr/src/usr.sbin/newsyslog/newsyslog.c To install the downloaded upgrades, run "/usr/sbin/freebsd-update.fixed install". Installing updates...ln: ///boot/kernel/if_iavf.ko: No such file or directory chflags: ///boot/kernel/if_ixlv.ko: No such file or directory [00:20:27] Error: Fail to upgrade system # -- Dima Panov (fluffy@FreeBSD.org) (X11, KDE, Office)@FreeBSD team Facebook: http://www.facebook.com/fluffy.khv twitter: fluffy_khv | skype: dima.panov | telegram: @dima_panov IRC: fluffy@EFNet, fluffykhv@FreeNode From owner-svn-src-all@freebsd.org Thu Dec 6 08:27:31 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6059F13230BE; Thu, 6 Dec 2018 08:27:31 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F3C548588F; Thu, 6 Dec 2018 08:27:30 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B3CA320FE5; Thu, 6 Dec 2018 08:27:30 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB68RUFM068508; Thu, 6 Dec 2018 08:27:30 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB68RUwJ068507; Thu, 6 Dec 2018 08:27:30 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201812060827.wB68RUwJ068507@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Thu, 6 Dec 2018 08:27:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341621 - stable/12/usr.sbin/nfsd X-SVN-Group: stable-12 X-SVN-Commit-Author: bapt X-SVN-Commit-Paths: stable/12/usr.sbin/nfsd X-SVN-Commit-Revision: 341621 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: F3C548588F X-Spamd-Result: default: False [-0.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.46)[-0.456,0]; NEURAL_HAM_SHORT(-0.41)[-0.414,0]; NEURAL_HAM_LONG(-0.07)[-0.070,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Dec 2018 08:27:31 -0000 Author: bapt Date: Thu Dec 6 08:27:30 2018 New Revision: 341621 URL: https://svnweb.freebsd.org/changeset/base/341621 Log: MFC r340111: nfsd: Factorize code Factorize code by using struct sockaddr_storage to handle both ipv6 and ipv4 Discussed with: rmacklem Reviewed by: manu Sponsored by: Gandi.net Differential Revision: https://reviews.freebsd.org/D13223 Modified: stable/12/usr.sbin/nfsd/nfsd.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/nfsd/nfsd.c ============================================================================== --- stable/12/usr.sbin/nfsd/nfsd.c Thu Dec 6 06:18:21 2018 (r341620) +++ stable/12/usr.sbin/nfsd/nfsd.c Thu Dec 6 08:27:30 2018 (r341621) @@ -160,10 +160,8 @@ main(int argc, char **argv) struct addrinfo *ai_udp, *ai_tcp, *ai_udp6, *ai_tcp6, hints; struct netconfig *nconf_udp, *nconf_tcp, *nconf_udp6, *nconf_tcp6; struct netbuf nb_udp, nb_tcp, nb_udp6, nb_tcp6; - struct sockaddr_in inetpeer; - struct sockaddr_in6 inet6peer; + struct sockaddr_storage peer; fd_set ready, sockbits; - fd_set v4bits, v6bits; int ch, connect_type_cnt, i, maxsock, msgsock; socklen_t len; int on = 1, unregister, reregister, sock; @@ -480,8 +478,6 @@ main(int argc, char **argv) } (void)signal(SIGUSR1, cleanup); - FD_ZERO(&v4bits); - FD_ZERO(&v6bits); FD_ZERO(&sockbits); rpcbregcnt = 0; @@ -663,7 +659,6 @@ main(int argc, char **argv) } freeaddrinfo(ai_tcp); FD_SET(tcpsock, &sockbits); - FD_SET(tcpsock, &v4bits); maxsock = tcpsock; connect_type_cnt++; } @@ -742,7 +737,6 @@ main(int argc, char **argv) } freeaddrinfo(ai_tcp6); FD_SET(tcp6sock, &sockbits); - FD_SET(tcp6sock, &v6bits); if (maxsock < tcp6sock) maxsock = tcp6sock; connect_type_cnt++; @@ -816,52 +810,25 @@ main(int argc, char **argv) } for (tcpsock = 0; tcpsock <= maxsock; tcpsock++) { if (FD_ISSET(tcpsock, &ready)) { - if (FD_ISSET(tcpsock, &v4bits)) { - len = sizeof(inetpeer); - if ((msgsock = accept(tcpsock, - (struct sockaddr *)&inetpeer, &len)) < 0) { - error = errno; - syslog(LOG_ERR, "accept failed: %m"); - if (error == ECONNABORTED || - error == EINTR) - continue; - nfsd_exit(1); - } - memset(inetpeer.sin_zero, 0, - sizeof(inetpeer.sin_zero)); - if (setsockopt(msgsock, SOL_SOCKET, - SO_KEEPALIVE, (char *)&on, sizeof(on)) < 0) - syslog(LOG_ERR, - "setsockopt SO_KEEPALIVE: %m"); - addsockargs.sock = msgsock; - addsockargs.name = (caddr_t)&inetpeer; - addsockargs.namelen = len; - nfssvc(nfssvc_addsock, &addsockargs); - (void)close(msgsock); - } else if (FD_ISSET(tcpsock, &v6bits)) { - len = sizeof(inet6peer); - if ((msgsock = accept(tcpsock, - (struct sockaddr *)&inet6peer, - &len)) < 0) { - error = errno; - syslog(LOG_ERR, - "accept failed: %m"); - if (error == ECONNABORTED || - error == EINTR) - continue; - nfsd_exit(1); - } - if (setsockopt(msgsock, SOL_SOCKET, - SO_KEEPALIVE, (char *)&on, - sizeof(on)) < 0) - syslog(LOG_ERR, "setsockopt " - "SO_KEEPALIVE: %m"); - addsockargs.sock = msgsock; - addsockargs.name = (caddr_t)&inet6peer; - addsockargs.namelen = len; - nfssvc(nfssvc_addsock, &addsockargs); - (void)close(msgsock); + len = sizeof(peer); + if ((msgsock = accept(tcpsock, + (struct sockaddr *)&peer, &len)) < 0) { + error = errno; + syslog(LOG_ERR, "accept failed: %m"); + if (error == ECONNABORTED || + error == EINTR) + continue; + nfsd_exit(1); } + if (setsockopt(msgsock, SOL_SOCKET, + SO_KEEPALIVE, (char *)&on, sizeof(on)) < 0) + syslog(LOG_ERR, + "setsockopt SO_KEEPALIVE: %m"); + addsockargs.sock = msgsock; + addsockargs.name = (caddr_t)&peer; + addsockargs.namelen = len; + nfssvc(nfssvc_addsock, &addsockargs); + (void)close(msgsock); } } } From owner-svn-src-all@freebsd.org Thu Dec 6 08:27:57 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A88511323104; Thu, 6 Dec 2018 08:27:57 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4EC37859A4; Thu, 6 Dec 2018 08:27:57 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2F4D220FE6; Thu, 6 Dec 2018 08:27:57 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB68RuG0068567; Thu, 6 Dec 2018 08:27:56 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB68RuQp068566; Thu, 6 Dec 2018 08:27:56 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201812060827.wB68RuQp068566@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Thu, 6 Dec 2018 08:27:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r341622 - stable/11/usr.sbin/nfsd X-SVN-Group: stable-11 X-SVN-Commit-Author: bapt X-SVN-Commit-Paths: stable/11/usr.sbin/nfsd X-SVN-Commit-Revision: 341622 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4EC37859A4 X-Spamd-Result: default: False [-0.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.46)[-0.456,0]; NEURAL_HAM_SHORT(-0.41)[-0.414,0]; NEURAL_HAM_LONG(-0.07)[-0.070,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Dec 2018 08:27:57 -0000 Author: bapt Date: Thu Dec 6 08:27:56 2018 New Revision: 341622 URL: https://svnweb.freebsd.org/changeset/base/341622 Log: MFC r340111: nfsd: Factorize code Factorize code by using struct sockaddr_storage to handle both ipv6 and ipv4 Discussed with: rmacklem Reviewed by: manu Sponsored by: Gandi.net Differential Revision: https://reviews.freebsd.org/D13223 Modified: stable/11/usr.sbin/nfsd/nfsd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/nfsd/nfsd.c ============================================================================== --- stable/11/usr.sbin/nfsd/nfsd.c Thu Dec 6 08:27:30 2018 (r341621) +++ stable/11/usr.sbin/nfsd/nfsd.c Thu Dec 6 08:27:56 2018 (r341622) @@ -149,10 +149,8 @@ main(int argc, char **argv) struct addrinfo *ai_udp, *ai_tcp, *ai_udp6, *ai_tcp6, hints; struct netconfig *nconf_udp, *nconf_tcp, *nconf_udp6, *nconf_tcp6; struct netbuf nb_udp, nb_tcp, nb_udp6, nb_tcp6; - struct sockaddr_in inetpeer; - struct sockaddr_in6 inet6peer; + struct sockaddr_storage peer; fd_set ready, sockbits; - fd_set v4bits, v6bits; int ch, connect_type_cnt, i, maxsock, msgsock; socklen_t len; int on = 1, unregister, reregister, sock; @@ -450,8 +448,6 @@ main(int argc, char **argv) } (void)signal(SIGUSR1, cleanup); - FD_ZERO(&v4bits); - FD_ZERO(&v6bits); FD_ZERO(&sockbits); rpcbregcnt = 0; @@ -633,7 +629,6 @@ main(int argc, char **argv) } freeaddrinfo(ai_tcp); FD_SET(tcpsock, &sockbits); - FD_SET(tcpsock, &v4bits); maxsock = tcpsock; connect_type_cnt++; } @@ -712,7 +707,6 @@ main(int argc, char **argv) } freeaddrinfo(ai_tcp6); FD_SET(tcp6sock, &sockbits); - FD_SET(tcp6sock, &v6bits); if (maxsock < tcp6sock) maxsock = tcp6sock; connect_type_cnt++; @@ -786,52 +780,25 @@ main(int argc, char **argv) } for (tcpsock = 0; tcpsock <= maxsock; tcpsock++) { if (FD_ISSET(tcpsock, &ready)) { - if (FD_ISSET(tcpsock, &v4bits)) { - len = sizeof(inetpeer); - if ((msgsock = accept(tcpsock, - (struct sockaddr *)&inetpeer, &len)) < 0) { - error = errno; - syslog(LOG_ERR, "accept failed: %m"); - if (error == ECONNABORTED || - error == EINTR) - continue; - nfsd_exit(1); - } - memset(inetpeer.sin_zero, 0, - sizeof(inetpeer.sin_zero)); - if (setsockopt(msgsock, SOL_SOCKET, - SO_KEEPALIVE, (char *)&on, sizeof(on)) < 0) - syslog(LOG_ERR, - "setsockopt SO_KEEPALIVE: %m"); - addsockargs.sock = msgsock; - addsockargs.name = (caddr_t)&inetpeer; - addsockargs.namelen = len; - nfssvc(nfssvc_addsock, &addsockargs); - (void)close(msgsock); - } else if (FD_ISSET(tcpsock, &v6bits)) { - len = sizeof(inet6peer); - if ((msgsock = accept(tcpsock, - (struct sockaddr *)&inet6peer, - &len)) < 0) { - error = errno; - syslog(LOG_ERR, - "accept failed: %m"); - if (error == ECONNABORTED || - error == EINTR) - continue; - nfsd_exit(1); - } - if (setsockopt(msgsock, SOL_SOCKET, - SO_KEEPALIVE, (char *)&on, - sizeof(on)) < 0) - syslog(LOG_ERR, "setsockopt " - "SO_KEEPALIVE: %m"); - addsockargs.sock = msgsock; - addsockargs.name = (caddr_t)&inet6peer; - addsockargs.namelen = len; - nfssvc(nfssvc_addsock, &addsockargs); - (void)close(msgsock); + len = sizeof(peer); + if ((msgsock = accept(tcpsock, + (struct sockaddr *)&peer, &len)) < 0) { + error = errno; + syslog(LOG_ERR, "accept failed: %m"); + if (error == ECONNABORTED || + error == EINTR) + continue; + nfsd_exit(1); } + if (setsockopt(msgsock, SOL_SOCKET, + SO_KEEPALIVE, (char *)&on, sizeof(on)) < 0) + syslog(LOG_ERR, + "setsockopt SO_KEEPALIVE: %m"); + addsockargs.sock = msgsock; + addsockargs.name = (caddr_t)&peer; + addsockargs.namelen = len; + nfssvc(nfssvc_addsock, &addsockargs); + (void)close(msgsock); } } } From owner-svn-src-all@freebsd.org Thu Dec 6 08:29:14 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Dec 6 09:22:36 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Dec 6 09:45:26 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Dec 6 09:47:25 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C270A1325B62; Thu, 6 Dec 2018 09:47:24 +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 58AD78957A; Thu, 6 Dec 2018 09:47:24 +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 3967121D0E; Thu, 6 Dec 2018 09:47:24 +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 wB69lOsP009722; Thu, 6 Dec 2018 09:47:24 GMT (envelope-from yuripv@FreeBSD.org) Received: (from yuripv@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB69lO3r009721; Thu, 6 Dec 2018 09:47:24 GMT (envelope-from yuripv@FreeBSD.org) Message-Id: <201812060947.wB69lO3r009721@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 09:47:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341625 - in stable/12: share/colldef share/ctypedef share/monetdef share/numericdef tools/tools/locale tools/tools/locale/etc tools/tools/locale/etc/final-maps X-SVN-Group: stable-12 X-SVN-Commit-Author: yuripv X-SVN-Commit-Paths: in stable/12: share/colldef share/ctypedef share/monetdef share/numericdef tools/tools/locale tools/tools/locale/etc tools/tools/locale/etc/final-maps X-SVN-Commit-Revision: 341625 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 58AD78957A X-Spamd-Result: default: False [-0.66 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.39)[-0.385,0]; NEURAL_SPAM_LONG(0.02)[0.020,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_SHORT(-0.29)[-0.291,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Dec 2018 09:47:25 -0000 Author: yuripv Date: Thu Dec 6 09:47:23 2018 New Revision: 341625 URL: https://svnweb.freebsd.org/changeset/base/341625 Log: MFC r340104: Update to CLDR 34 and UNICODE 11. Discussed with: bapt Added: stable/12/share/monetdef/fr_FR.UTF-8.src - copied unchanged from r340104, head/share/monetdef/fr_FR.UTF-8.src stable/12/share/monetdef/it_IT.ISO8859-15.src - copied unchanged from r340104, head/share/monetdef/it_IT.ISO8859-15.src stable/12/share/monetdef/it_IT.UTF-8.src - copied unchanged from r340104, head/share/monetdef/it_IT.UTF-8.src stable/12/share/monetdef/nl_BE.ISO8859-1.src - copied unchanged from r340104, head/share/monetdef/nl_BE.ISO8859-1.src stable/12/share/numericdef/fr_FR.UTF-8.src - copied unchanged from r340104, head/share/numericdef/fr_FR.UTF-8.src Deleted: stable/12/share/monetdef/de_AT.ISO8859-1.src stable/12/share/monetdef/de_AT.ISO8859-15.src stable/12/share/monetdef/de_AT.UTF-8.src Modified: stable/12/share/colldef/af_ZA.UTF-8.src stable/12/share/colldef/am_ET.UTF-8.src stable/12/share/colldef/ar_SA.UTF-8.src stable/12/share/colldef/be_BY.UTF-8.src stable/12/share/colldef/ca_AD.UTF-8.src stable/12/share/colldef/cs_CZ.ISO8859-2.src stable/12/share/colldef/cs_CZ.UTF-8.src stable/12/share/colldef/da_DK.ISO8859-1.src stable/12/share/colldef/da_DK.ISO8859-15.src stable/12/share/colldef/da_DK.UTF-8.src stable/12/share/colldef/el_GR.UTF-8.src stable/12/share/colldef/en_US.UTF-8.src stable/12/share/colldef/es_MX.UTF-8.src stable/12/share/colldef/et_EE.UTF-8.src stable/12/share/colldef/fi_FI.UTF-8.src stable/12/share/colldef/fr_CA.UTF-8.src stable/12/share/colldef/he_IL.UTF-8.src stable/12/share/colldef/hi_IN.UTF-8.src stable/12/share/colldef/hr_HR.ISO8859-2.src stable/12/share/colldef/hu_HU.ISO8859-2.src stable/12/share/colldef/hu_HU.UTF-8.src stable/12/share/colldef/hy_AM.UTF-8.src stable/12/share/colldef/is_IS.UTF-8.src stable/12/share/colldef/ja_JP.UTF-8.src stable/12/share/colldef/ja_JP.eucJP.src stable/12/share/colldef/kk_KZ.UTF-8.src stable/12/share/colldef/ko_KR.UTF-8.src stable/12/share/colldef/lt_LT.UTF-8.src stable/12/share/colldef/lv_LV.UTF-8.src stable/12/share/colldef/nb_NO.ISO8859-1.src stable/12/share/colldef/nb_NO.ISO8859-15.src stable/12/share/colldef/nn_NO.ISO8859-1.src stable/12/share/colldef/nn_NO.ISO8859-15.src stable/12/share/colldef/nn_NO.UTF-8.src stable/12/share/colldef/pl_PL.UTF-8.src stable/12/share/colldef/ro_RO.UTF-8.src stable/12/share/colldef/ru_RU.UTF-8.src stable/12/share/colldef/se_NO.UTF-8.src stable/12/share/colldef/sk_SK.ISO8859-2.src stable/12/share/colldef/sk_SK.UTF-8.src stable/12/share/colldef/sl_SI.UTF-8.src stable/12/share/colldef/sr_RS.ISO8859-2.src stable/12/share/colldef/sr_RS.ISO8859-5.src stable/12/share/colldef/sr_RS.UTF-8.src stable/12/share/colldef/sr_RS.UTF-8@latin.src stable/12/share/colldef/sv_SE.UTF-8.src stable/12/share/colldef/tr_TR.UTF-8.src stable/12/share/colldef/uk_UA.UTF-8.src stable/12/share/colldef/zh_CN.GB18030.src stable/12/share/colldef/zh_CN.GB2312.src stable/12/share/colldef/zh_CN.GBK.src stable/12/share/colldef/zh_CN.UTF-8.src stable/12/share/colldef/zh_CN.eucCN.src stable/12/share/colldef/zh_TW.Big5.src stable/12/share/colldef/zh_TW.UTF-8.src stable/12/share/ctypedef/Makefile stable/12/share/ctypedef/ca_IT.ISO8859-1.src stable/12/share/ctypedef/en_US.ISO8859-1.src stable/12/share/ctypedef/hi_IN.ISCII-DEV.src stable/12/share/ctypedef/hy_AM.ARMSCII-8.src stable/12/share/ctypedef/ja_JP.eucJP.src stable/12/share/ctypedef/zh_CN.eucCN.src stable/12/share/monetdef/Makefile stable/12/share/monetdef/fr_CH.UTF-8.src stable/12/share/monetdef/hy_AM.ARMSCII-8.src stable/12/share/monetdef/hy_AM.UTF-8.src stable/12/share/monetdef/mn_MN.UTF-8.src stable/12/share/monetdef/nl_BE.ISO8859-15.src stable/12/share/monetdef/nl_BE.UTF-8.src stable/12/share/numericdef/Makefile stable/12/tools/tools/locale/Makefile stable/12/tools/tools/locale/etc/charmaps.xml stable/12/tools/tools/locale/etc/final-maps/map.UTF-8 Directory Properties: stable/12/ (props changed) Modified: stable/12/share/colldef/af_ZA.UTF-8.src ============================================================================== --- stable/12/share/colldef/af_ZA.UTF-8.src Thu Dec 6 09:45:25 2018 (r341624) +++ stable/12/share/colldef/af_ZA.UTF-8.src Thu Dec 6 09:47:23 2018 (r341625) @@ -60,6 +60,7 @@ collating-symbol collating-symbol collating-symbol collating-symbol +collating-symbol collating-symbol collating-symbol collating-symbol @@ -70,431 +71,433 @@ collating-symbol collating-symbol collating-symbol collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol collating-symbol collating-symbol -collating-symbol -collating-symbol +collating-symbol collating-symbol collating-symbol -collating-symbol -collating-symbol -collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol collating-symbol collating-symbol collating-symbol collating-symbol collating-symbol collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol order_start forward;forward;forward;forward @@ -550,6 +553,7 @@ order_start forward;forward;forward;forward + @@ -560,431 +564,433 @@ order_start forward;forward;forward;forward - - - - + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - + - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Dec 6 09:51:52 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A5E951325D57; Thu, 6 Dec 2018 09:51:52 +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 4C9E089938; Thu, 6 Dec 2018 09:51:52 +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 2F2C621D79; Thu, 6 Dec 2018 09:51:52 +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 wB69pqg7013673; Thu, 6 Dec 2018 09:51:52 GMT (envelope-from yuripv@FreeBSD.org) Received: (from yuripv@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB69pqLq013672; Thu, 6 Dec 2018 09:51:52 GMT (envelope-from yuripv@FreeBSD.org) Message-Id: <201812060951.wB69pqLq013672@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 09:51:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341626 - stable/12/usr.bin/man X-SVN-Group: stable-12 X-SVN-Commit-Author: yuripv X-SVN-Commit-Paths: stable/12/usr.bin/man X-SVN-Commit-Revision: 341626 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4C9E089938 X-Spamd-Result: default: False [-0.90 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.48)[-0.477,0]; NEURAL_HAM_SHORT(-0.33)[-0.326,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.10)[-0.099,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Dec 2018 09:51:52 -0000 Author: yuripv Date: Thu Dec 6 09:51:51 2018 New Revision: 341626 URL: https://svnweb.freebsd.org/changeset/base/341626 Log: MFC r340128: Teach man(1) about C.UTF-8. While here, use LANG as the proper source to select man pages language/encoding, falling back to LC_CTYPE. Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D17835 Modified: stable/12/usr.bin/man/man.sh Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.bin/man/man.sh ============================================================================== --- stable/12/usr.bin/man/man.sh Thu Dec 6 09:47:23 2018 (r341625) +++ stable/12/usr.bin/man/man.sh Thu Dec 6 09:51:51 2018 (r341626) @@ -662,6 +662,7 @@ man_setup_width() { # Setup necessary locale variables. man_setup_locale() { local lang_cc + local locstr locpaths='.' man_charset='US-ASCII' @@ -670,18 +671,25 @@ man_setup_locale() { if [ -n "$oflag" ]; then decho 'Using non-localized manpages' else - # Use the locale tool to give us the proper LC_CTYPE + # Use the locale tool to give us proper locale information eval $( $LOCALE ) - case "$LC_CTYPE" in + if [ -n "$LANG" ]; then + locstr=$LANG + else + locstr=$LC_CTYPE + fi + + case "$locstr" in C) ;; + C.UTF-8) ;; POSIX) ;; [a-z][a-z]_[A-Z][A-Z]\.*) - lang_cc="${LC_CTYPE%.*}" - man_lang="${LC_CTYPE%_*}" + lang_cc="${locstr%.*}" + man_lang="${locstr%_*}" man_country="${lang_cc#*_}" - man_charset="${LC_CTYPE#*.}" - locpaths="$LC_CTYPE" + man_charset="${locstr#*.}" + locpaths="$locstr" locpaths="$locpaths:$man_lang.$man_charset" if [ "$man_lang" != "en" ]; then locpaths="$locpaths:en.$man_charset" From owner-svn-src-all@freebsd.org Thu Dec 6 10:41:24 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C720F1326F99; Thu, 6 Dec 2018 10:41:23 +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 796A28AFBC; Thu, 6 Dec 2018 10:41:23 +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 5A3E52266D; Thu, 6 Dec 2018 10:41:23 +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 wB6AfNEo036823; Thu, 6 Dec 2018 10:41:23 GMT (envelope-from yuripv@FreeBSD.org) Received: (from yuripv@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB6AfMVn036819; Thu, 6 Dec 2018 10:41:22 GMT (envelope-from yuripv@FreeBSD.org) Message-Id: <201812061041.wB6AfMVn036819@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 10:41:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341627 - in stable/12: lib/libc/locale share/ctypedef tools/tools/locale tools/tools/locale/tools X-SVN-Group: stable-12 X-SVN-Commit-Author: yuripv X-SVN-Commit-Paths: in stable/12: lib/libc/locale share/ctypedef tools/tools/locale tools/tools/locale/tools X-SVN-Commit-Revision: 341627 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 796A28AFBC X-Spamd-Result: default: False [-0.92 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.39)[-0.385,0]; NEURAL_SPAM_LONG(0.02)[0.020,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_SHORT(-0.55)[-0.552,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Dec 2018 10:41:24 -0000 Author: yuripv Date: Thu Dec 6 10:41:22 2018 New Revision: 341627 URL: https://svnweb.freebsd.org/changeset/base/341627 Log: MFC r340144: Add hybrid C.UTF-8 locale being identical to default C locale except that it uses the same ctype maps and functions as other UTF-8 locales. Reviewed by: bapt, cem, eadler Differential Revision: https://reviews.freebsd.org/D17833 Added: stable/12/share/ctypedef/C.UTF-8.src - copied unchanged from r340144, head/share/ctypedef/C.UTF-8.src Deleted: stable/12/share/ctypedef/en_US.UTF-8.src Modified: stable/12/lib/libc/locale/collate.c stable/12/lib/libc/locale/ldpart.c stable/12/share/ctypedef/Makefile stable/12/tools/tools/locale/Makefile stable/12/tools/tools/locale/tools/cldr2def.pl Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libc/locale/collate.c ============================================================================== --- stable/12/lib/libc/locale/collate.c Thu Dec 6 09:51:51 2018 (r341626) +++ stable/12/lib/libc/locale/collate.c Thu Dec 6 10:41:22 2018 (r341627) @@ -84,7 +84,8 @@ destruct_collate(void *t) void * __collate_load(const char *encoding, __unused locale_t unused) { - if (strcmp(encoding, "C") == 0 || strcmp(encoding, "POSIX") == 0) { + if (strcmp(encoding, "C") == 0 || strcmp(encoding, "POSIX") == 0 || + strncmp(encoding, "C.", 2) == 0) { return &__xlocale_C_collate; } struct xlocale_collate *table = calloc(sizeof(struct xlocale_collate), 1); @@ -122,7 +123,8 @@ __collate_load_tables_l(const char *encoding, struct x table->__collate_load_error = 1; /* 'encoding' must be already checked. */ - if (strcmp(encoding, "C") == 0 || strcmp(encoding, "POSIX") == 0) { + if (strcmp(encoding, "C") == 0 || strcmp(encoding, "POSIX") == 0 || + strncmp(encoding, "C.", 2) == 0) { return (_LDP_CACHE); } Modified: stable/12/lib/libc/locale/ldpart.c ============================================================================== --- stable/12/lib/libc/locale/ldpart.c Thu Dec 6 09:51:51 2018 (r341626) +++ stable/12/lib/libc/locale/ldpart.c Thu Dec 6 10:41:22 2018 (r341627) @@ -63,7 +63,8 @@ __part_load_locale(const char *name, size_t namesize, bufsize; /* 'name' must be already checked. */ - if (strcmp(name, "C") == 0 || strcmp(name, "POSIX") == 0) { + if (strcmp(name, "C") == 0 || strcmp(name, "POSIX") == 0 || + strncmp(name, "C.", 2) == 0) { *using_locale = 0; return (_LDP_CACHE); } Copied: stable/12/share/ctypedef/C.UTF-8.src (from r340144, head/share/ctypedef/C.UTF-8.src) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/share/ctypedef/C.UTF-8.src Thu Dec 6 10:41:22 2018 (r341627, copy of r340144, head/share/ctypedef/C.UTF-8.src) @@ -0,0 +1,6372 @@ +# Warning: Do not edit. This file is automatically generated from the +# tools in /usr/src/tools/tools/locale. The data is obtained from the +# CLDR project, obtained from http://cldr.unicode.org/ +# ----------------------------------------------------------------------------- + +comment_char * +escape_char / + +LC_CTYPE + +********************************************************************** +* 0x0000 - 0x007F Basic Latin +* 0x0080 - 0x00FF Latin-1 Supplement +* 0x0100 - 0x017F Latin Extended-A +* 0x0180 - 0x024F Latin Extended-B +* 0x0250 - 0x02AF IPA Extensions +* 0x1D00 - 0x1D7F Phonetic Extensions +* 0x1D80 - 0x1DBF Phonetic Extensions Supplement +* 0x1E00 - 0x1EFF Latin Extended Additional +* 0x2150 - 0x218F Number Forms (partial - Roman Numerals) +* 0x2C60 - 0x2C7F Latin Extended-C +* 0xA720 - 0xA7FF Latin Extended-D +* 0xAB30 - 0xAB6F Latin Extended-E +* 0xFB00 - 0xFF4F Alphabetic Presentation Forms (partial) +* 0xFF00 - 0xFFEF Halfwidth and Fullwidth Forms (partial) +********************************************************************** +upper ;...;;/ + ;...;;/ + ;...;;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;...;;/ + ;...;;/ + ;/ + ;/ + ;...;;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;...;;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;...;;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;...;;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;...;;/ + ;/ + ;/ + ;...;;/ + ;/ + ;/ + ;/ + ;...;;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;...;;/ + ;...;;/ + ;/ + ;...; +lower ;...;;/ + ;/ + ;/ + ;...;;/ + ;...;;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;...;;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;...;;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;...;;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;...;;/ + ;...;;/ + ;...;;/ + ;...;;/ + ;...;;/ + ;...;;/ + ;...;;/ + ;...;;/ + ;...;;/ + ;...;;/ + ;...;;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;...;;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;...;;/ + ;/ + ;...;;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;...;;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;...;;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;...;;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;...;;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;...;;/ + ;...;;/ + ;...;;/ + ;...;;/ + ;...;;/ + ;...; +alpha ;/ + ;...;;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;...;;/ + ;...;;/ + ;/ + ;/ + ;...; +space ;...;;/ + +cntrl ;...;;/ + +graph ;...;;/ + ;/ + ;/ + ;...;;/ + ;...;;/ + ;...;;/ + ;...;;/ + ;...;;/ + ;...;;/ + ;...;;/ + ;...;;/ + ;...;;/ + ;...;;/ + ;...;;/ + ;...;;/ + ;...;;/ + ;...;;/ + ;...;;/ + ;...;;/ + ;...;;/ + ;...;;/ + ;...;;/ + ;...;;/ + ;...;;/ + ;...;;/ + ;/ + ;/ + ;...;;/ + ;/ + ;/ + ;/ + ;/ + ;...;;/ + ;...;;/ + ;...;;/ + ;...;;/ + ;...;;/ + ;...;;/ + ;...;;/ + ;...;;/ + ;...;;/ + ;...;;/ + ;...;;/ + ;...;;/ + ;...;;/ + ;...;;/ + ;...; +punct ;...;;/ + ;...;;/ + ;...;;/ + ;/ + ;/ + ;/ + ;/ + ;...;;/ + ;/ + ;/ + +digit ;...; +xdigit ;...;;/ + ;...;;/ + ;...; +blank ;/ + +toupper (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (

,

);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ + (,);/ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Dec 6 10:48:48 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EE3361327294; Thu, 6 Dec 2018 10:48:47 +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 9E6958B2E1; Thu, 6 Dec 2018 10:48:47 +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 7F5EB226CC; Thu, 6 Dec 2018 10:48:47 +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 wB6Aml5T040412; Thu, 6 Dec 2018 10:48:47 GMT (envelope-from yuripv@FreeBSD.org) Received: (from yuripv@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB6Amkj8040387; Thu, 6 Dec 2018 10:48:46 GMT (envelope-from yuripv@FreeBSD.org) Message-Id: <201812061048.wB6Amkj8040387@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 10:48:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341628 - in stable/12/tools/tools/locale: . etc tools X-SVN-Group: stable-12 X-SVN-Commit-Author: yuripv X-SVN-Commit-Paths: in stable/12/tools/tools/locale: . etc tools X-SVN-Commit-Revision: 341628 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9E6958B2E1 X-Spamd-Result: default: False [-1.02 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.43)[-0.433,0]; NEURAL_HAM_SHORT(-0.54)[-0.542,0]; NEURAL_HAM_LONG(-0.04)[-0.040,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Dec 2018 10:48:48 -0000 Author: yuripv Date: Thu Dec 6 10:48:46 2018 New Revision: 341628 URL: https://svnweb.freebsd.org/changeset/base/341628 Log: MFC r340204: Cleanup locale tools: - Simplify the source dir specification, and update README appropriately - Drop the LC (doonly) processing, it's broken, and even if fixed, not really useful - Don't remove the target directories while installing new data as it removes Makefile.depend which we don't manage; only rm the files we are going to add/replace/delete instead - Restrict adding bsd.endian.mk to colldef and ctypedef Makefiles, it's not needed in other (text-only) categories - GC unused scripts; they don't seem to be particularly helpful standalone as well Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D17858 Deleted: stable/12/tools/tools/locale/etc/unicode.conf stable/12/tools/tools/locale/tools/UTF82encoding.pl stable/12/tools/tools/locale/tools/changeoffset.pl stable/12/tools/tools/locale/tools/unicode2src.pl stable/12/tools/tools/locale/tools/whatis.pl Modified: stable/12/tools/tools/locale/Makefile stable/12/tools/tools/locale/README stable/12/tools/tools/locale/tools/cldr2def.pl stable/12/tools/tools/locale/tools/finalize stable/12/tools/tools/locale/tools/utf8-rollup.pl Directory Properties: stable/12/ (props changed) Modified: stable/12/tools/tools/locale/Makefile ============================================================================== --- stable/12/tools/tools/locale/Makefile Thu Dec 6 10:41:22 2018 (r341627) +++ stable/12/tools/tools/locale/Makefile Thu Dec 6 10:48:46 2018 (r341628) @@ -10,13 +10,10 @@ .OBJDIR: . -.if !defined(CLDRDIR) -CLDRDIR!= grep ^cldr etc/unicode.conf | cut -f 2 -d " " +.if !defined(UNIDIR) +.error UNIDIR is not set .endif -.if !defined(UNIDATADIR) -UNIDATADIR!= grep ^unidata etc/unicode.conf | cut -f 2 -d " " -.endif -PASSON= CLDRDIR="${CLDRDIR}" UNIDATADIR="${UNIDATADIR}" +PASSON= UNIDIR="${UNIDIR}" ETCDIR= ${.CURDIR}/etc @@ -49,12 +46,8 @@ COLLATIONS_SPECIAL_ENV+= ${area}.${enc} .endfor PASSON+= COLLATIONS_SPECIAL="${COLLATIONS_SPECIAL_ENV}" -.if defined(LC) -LC:= --lc=${LC} -.endif - all: - cp ${ETCDIR}/common.UTF-8.src ${CLDRDIR}/posix/xx_Comm_C.UTF-8.src + cp ${ETCDIR}/common.UTF-8.src ${UNIDIR}/posix/xx_Comm_C.UTF-8.src .for t in ${TYPES} . if ${KNOWN:M${t}} test -d ${t} || mkdir ${t} @@ -69,8 +62,9 @@ install: install-${t} install-${t}: . if ${KNOWN:M${t}} rm -rf ${.CURDIR}/${t}.draft - rm -rf ${.CURDIR}/../../../share/${t} - mv ${.CURDIR}/${t} ${.CURDIR}/../../../share/${t} + rm -f ${.CURDIR}/../../../share/${t}/Makefile + rm -f ${.CURDIR}/../../../share/${t}/*.src + mv ${.CURDIR}/${t}/* ${.CURDIR}/../../../share/${t}/ . endif .endfor @@ -86,10 +80,9 @@ post-install: gen-${t}: mkdir -p ${t} ${t}.draft perl -I tools tools/cldr2def.pl \ - --cldr=$$(realpath ${CLDRDIR}) \ - --unidata=$$(realpath ${UNIDATADIR}) \ + --unidir=$$(realpath ${UNIDIR}) \ --etc=$$(realpath ${ETCDIR}) \ - --type=${t} ${LC} + --type=${t} build-${t}: gen-${t} env ${PASSON} tools/finalize ${t} @@ -101,15 +94,16 @@ build-colldef: static-colldef static-colldef: .for area enc in ${COLLATION_SPECIAL} - awk -f tools/extract-colldef.awk ${CLDRDIR}/posix/${area}.${enc}.src > colldef.draft/${area}.${enc}.src + awk -f tools/extract-colldef.awk ${UNIDIR}/posix/${area}.${enc}.src > \ + colldef.draft/${area}.${enc}.src .endfor transfer-rollup: - cp ${ETCDIR}/common.UTF-8.src ${CLDRDIR}/posix/xx_Comm_C.UTF-8.src + cp ${ETCDIR}/common.UTF-8.src ${UNIDIR}/posix/xx_Comm_C.UTF-8.src rollup: perl -I tools tools/utf8-rollup.pl \ - --cldr=$$(realpath ${CLDRDIR}) \ + --unidir=$$(realpath ${UNIDIR}) \ --etc=$$(realpath ${ETCDIR}) clean: @@ -159,33 +153,33 @@ ENCODINGS= Big5 \ POSIX: -.if exists (${CLDRDIR}/tools/java/cldr.jar) - mkdir -p ${CLDRDIR}/posix +.if exists (${UNIDIR}/tools/java/cldr.jar) + mkdir -p ${UNIDIR}/posix . for area in ${BASE_LOCALES_OF_INTEREST} -. if !exists(${CLDRDIR}/posix/${area}.UTF-8.src) - java -DCLDR_DIR=${CLDRDIR:Q} -jar ${CLDRDIR}/tools/java/cldr.jar \ +. if !exists(${UNIDIR}/posix/${area}.UTF-8.src) + java -DCLDR_DIR=${UNIDIR:Q} -jar ${UNIDIR}/tools/java/cldr.jar \ org.unicode.cldr.posix.GeneratePOSIX \ - -d ${CLDRDIR}/posix -m ${area} -c UTF-8 + -d ${UNIDIR}/posix -m ${area} -c UTF-8 . endif . endfor . for area encoding in ${COLLATION_SPECIAL} -. if !exists(${CLDRDIR}/posix/${area}.${encoding}.src) - java -DCLDR_DIR=${CLDRDIR:Q} -jar ${CLDRDIR}/tools/java/cldr.jar \ +. if !exists(${UNIDIR}/posix/${area}.${encoding}.src) + java -DCLDR_DIR=${UNIDIR:Q} -jar ${UNIDIR}/tools/java/cldr.jar \ org.unicode.cldr.posix.GeneratePOSIX \ - -d ${CLDRDIR}/posix -m ${area} -c ${encoding} + -d ${UNIDIR}/posix -m ${area} -c ${encoding} . endif . endfor . for enc in ${ENCODINGS} -. if !exists(${CLDRDIR}/posix/${enc}.cm) - java -DCLDR_DIR=${CLDRDIR:Q} -jar ${CLDRDIR}/tools/java/cldr.jar \ +. if !exists(${UNIDIR}/posix/${enc}.cm) + java -DCLDR_DIR=${UNIDIR:Q} -jar ${UNIDIR}/tools/java/cldr.jar \ org.unicode.cldr.posix.GenerateCharmap \ - -d ${CLDRDIR}/posix -c ${enc} + -d ${UNIDIR}/posix -c ${enc} . endif . endfor .else @echo "Please install CLDR toolset for the desired release" - @echo "It should go at ${CLDRDIR}/tools" + @echo "It should go at ${UNIDIR}/tools" .endif clean-POSIX: - rm -f ${CLDRDIR}/posix/* + rm -f ${UNIDIR}/posix/* Modified: stable/12/tools/tools/locale/README ============================================================================== --- stable/12/tools/tools/locale/README Thu Dec 6 10:41:22 2018 (r341627) +++ stable/12/tools/tools/locale/README Thu Dec 6 10:48:46 2018 (r341628) @@ -9,30 +9,23 @@ Tools needed: devel/p5-Tie-IxHash textproc/p5-XML-Parser -Fetch CLDR data from: http://unicode.org/Public/cldr/. You need all of the +1. Fetch CLDR data from: http://unicode.org/Public/cldr/. You need all of the core.zip, keyboards.zip, and tools.zip. - -Extract: - mkdir -p ~/unicode/cldr/v33.0 - cd ~/unicode/cldr/v33.0 - unzip ~/core.zip ~/keyboards.zip ~/tools.zip - -Fetch unidata (UCD.zip) from http://www.unicode.org/Public/zipped/latest. - -Extract: - mkdir -p ~/unicode/UNIDATA/11.0.0 - cd ~/unicode/UNIDATA/11.0.0 +2. Fetch unidata (UCD.zip) from http://www.unicode.org/Public/zipped/latest. +3. Extract: + mkdir -p ~/unicode + cd ~/unicode + unzip ~/core.zip + unzip ~/keyboards.zip + unzip ~/tools.zip unzip ~/UCD.zip - -Either modify tools/tools/locales/etc/unicode.conf or export variables: - CLDRDIR=~/unicode/cldr/v33.0; export CLDRDIR - UNIDATADIR=~/unicode/UNIDATA/9.0.0; export UNIDATADIR - -Build the CLDR tools: - cd $CLDRDIR/tools/java +4. Export variable: + UNIDIR=~/unicode; export UNIDIR +5. Build the CLDR tools: + cd $UNIDIR/tools/java ant jar - -Run: +6. Build POSIX data files from CLDR data: make POSIX +7. Build and install new locale data: make make install Modified: stable/12/tools/tools/locale/tools/cldr2def.pl ============================================================================== --- stable/12/tools/tools/locale/tools/cldr2def.pl Thu Dec 6 10:41:22 2018 (r341627) +++ stable/12/tools/tools/locale/tools/cldr2def.pl Thu Dec 6 10:48:46 2018 (r341628) @@ -6,32 +6,27 @@ use File::Copy; use XML::Parser; use Tie::IxHash; use Text::Iconv; -use Data::Dumper; +#use Data::Dumper; use Getopt::Long; use Digest::SHA qw(sha1_hex); require "charmaps.pm"; if ($#ARGV < 2) { - print "Usage: $0 --cldr= --unidata= --etc= --type= [--lc=]\n"; + print "Usage: $0 --unidir= --etc= --type=\n"; exit(1); } my $DEFENCODING = "UTF-8"; -my @filter = (); -my $CLDRDIR = undef; -my $UNIDATADIR = undef; +my $UNIDIR = undef; my $ETCDIR = undef; my $TYPE = undef; -my $doonly = undef; my $result = GetOptions ( - "cldr=s" => \$CLDRDIR, - "unidata=s" => \$UNIDATADIR, + "unidir=s" => \$UNIDIR, "etc=s" => \$ETCDIR, "type=s" => \$TYPE, - "lc=s" => \$doonly ); my %convertors = (); @@ -47,8 +42,8 @@ get_languages(); my %utf8map = (); my %utf8aliases = (); -get_unidata($UNIDATADIR); -get_utf8map("$CLDRDIR/posix/$DEFENCODING.cm"); +get_unidata($UNIDIR); +get_utf8map("$UNIDIR/posix/$DEFENCODING.cm"); get_encodings("$ETCDIR/charmaps"); my %keys = (); @@ -397,22 +392,6 @@ sub get_languages { %translations = %{$data{T}}; %alternativemonths = %{$data{AM}}; %encodings = %{$data{E}}; - - return if (!defined $doonly); - - my @a = split(/_/, $doonly); - if ($#a == 1) { - $filter[0] = $a[0]; - $filter[1] = "x"; - $filter[2] = $a[1]; - } elsif ($#a == 2) { - $filter[0] = $a[0]; - $filter[1] = $a[1]; - $filter[2] = $a[2]; - } - - print Dumper(@filter); - return; } sub transform_ctypes { @@ -422,8 +401,6 @@ sub transform_ctypes { foreach my $l (sort keys(%languages)) { foreach my $f (sort keys(%{$languages{$l}})) { foreach my $c (sort keys(%{$languages{$l}{$f}{data}})) { - next if ($#filter == 2 && ($filter[0] ne $l - || $filter[1] ne $f || $filter[2] ne $c)); next if (defined $languages{$l}{$f}{definitions} && $languages{$l}{$f}{definitions} !~ /$TYPE/); $languages{$l}{$f}{data}{$c}{$DEFENCODING} = 0; # unread @@ -432,7 +409,7 @@ sub transform_ctypes { $file .= "_" . $c if ($c ne "x"); my $actfile = $file; - my $filename = "$CLDRDIR/posix/xx_Comm_C.UTF-8.src"; + my $filename = "$UNIDIR/posix/xx_Comm_C.UTF-8.src"; if (! -f $filename) { print STDERR "Cannot open $filename\n"; next; @@ -455,7 +432,7 @@ sub transform_ctypes { close(FOUT); foreach my $enc (sort keys(%{$languages{$l}{$f}{data}{$c}})) { next if ($enc eq $DEFENCODING); - $filename = "$CLDRDIR/posix/$file.$DEFENCODING.src"; + $filename = "$UNIDIR/posix/$file.$DEFENCODING.src"; if (! -f $filename) { print STDERR "Cannot open $filename\n"; next; @@ -494,8 +471,6 @@ sub transform_collation { foreach my $l (sort keys(%languages)) { foreach my $f (sort keys(%{$languages{$l}})) { foreach my $c (sort keys(%{$languages{$l}{$f}{data}})) { - next if ($#filter == 2 && ($filter[0] ne $l - || $filter[1] ne $f || $filter[2] ne $c)); next if (defined $languages{$l}{$f}{definitions} && $languages{$l}{$f}{definitions} !~ /$TYPE/); $languages{$l}{$f}{data}{$c}{$DEFENCODING} = 0; # unread @@ -505,15 +480,15 @@ sub transform_collation { $file .= $c; my $actfile = $file; - my $filename = "$CLDRDIR/posix/$file.$DEFENCODING.src"; + my $filename = "$UNIDIR/posix/$file.$DEFENCODING.src"; $filename = "$ETCDIR/$file.$DEFENCODING.src" if (! -f $filename); if (! -f $filename && defined $languages{$l}{$f}{fallback}) { $file = $languages{$l}{$f}{fallback}; - $filename = "$CLDRDIR/posix/$file.$DEFENCODING.src"; + $filename = "$UNIDIR/posix/$file.$DEFENCODING.src"; } - $filename = "$CLDRDIR/posix/$file.$DEFENCODING.src" + $filename = "$UNIDIR/posix/$file.$DEFENCODING.src" if (! -f $filename); if (! -f $filename) { print STDERR @@ -564,8 +539,6 @@ sub get_fields { foreach my $l (sort keys(%languages)) { foreach my $f (sort keys(%{$languages{$l}})) { foreach my $c (sort keys(%{$languages{$l}{$f}{data}})) { - next if ($#filter == 2 && ($filter[0] ne $l - || $filter[1] ne $f || $filter[2] ne $c)); next if (defined $languages{$l}{$f}{definitions} && $languages{$l}{$f}{definitions} !~ /$TYPE/); @@ -575,15 +548,15 @@ sub get_fields { $file .= $f . "_" if ($f ne "x"); $file .= $c; - my $filename = "$CLDRDIR/posix/$file.$DEFENCODING.src"; + my $filename = "$UNIDIR/posix/$file.$DEFENCODING.src"; $filename = "$ETCDIR/$file.$DEFENCODING.src" if (! -f $filename); if (! -f $filename && defined $languages{$l}{$f}{fallback}) { $file = $languages{$l}{$f}{fallback}; - $filename = "$CLDRDIR/posix/$file.$DEFENCODING.src"; + $filename = "$UNIDIR/posix/$file.$DEFENCODING.src"; } - $filename = "$CLDRDIR/posix/$file.$DEFENCODING.src" + $filename = "$UNIDIR/posix/$file.$DEFENCODING.src" if (! -f $filename); if (! -f $filename) { print STDERR @@ -703,8 +676,6 @@ sub print_fields { foreach my $l (sort keys(%languages)) { foreach my $f (sort keys(%{$languages{$l}})) { foreach my $c (sort keys(%{$languages{$l}{$f}{data}})) { - next if ($#filter == 2 && ($filter[0] ne $l - || $filter[1] ne $f || $filter[2] ne $c)); next if (defined $languages{$l}{$f}{definitions} && $languages{$l}{$f}{definitions} !~ /$TYPE/); foreach my $enc (sort keys(%{$languages{$l}{$f}{data}{$c}})) { @@ -851,7 +822,6 @@ EOF } sub make_makefile { - return if ($#filter > -1); print "Creating Makefile for $TYPE\n"; my $SRCOUT; my $SRCOUT2; @@ -913,8 +883,16 @@ LOCALEDIR= \${SHAREDIR}/locale FILESNAME= $FILESNAMES{$TYPE} .SUFFIXES: .src .${SRCOUT2} ${MAPLOC} +EOF + + if ($TYPE eq "colldef" || $TYPE eq "ctypedef") { + print FOUT < +EOF + } + + print FOUT < ${TEMP3} rm -f ${TEMP2} /usr/bin/sed -E -e 's/[ ]+/ /g' \ - ${CLDRDIR}/posix/UTF-8.cm \ + ${UNIDIR}/posix/UTF-8.cm \ > ${base}/../etc/final-maps/map.UTF-8 /usr/bin/sed -E -e 's/[ ]+/ /g' \ - ${CLDRDIR}/posix/eucCN.cm \ + ${UNIDIR}/posix/eucCN.cm \ > ${base}/../etc/final-maps/map.eucCN /usr/bin/sed -E -e 's/[ ]+/ /g' \ - ${CLDRDIR}/posix/eucCN.cm \ + ${UNIDIR}/posix/eucCN.cm \ > ${base}/../etc/final-maps/map.GB2312 CHARMAPS="ARMSCII-8 Big5 CP1131 CP1251 \ CP866 GBK ISCII-DEV ISO8859-1 \ Modified: stable/12/tools/tools/locale/tools/utf8-rollup.pl ============================================================================== --- stable/12/tools/tools/locale/tools/utf8-rollup.pl Thu Dec 6 10:41:22 2018 (r341627) +++ stable/12/tools/tools/locale/tools/utf8-rollup.pl Thu Dec 6 10:48:46 2018 (r341628) @@ -1,4 +1,5 @@ #!/usr/local/bin/perl -wC +# $FreeBSD$ use strict; #use File::Copy; @@ -11,15 +12,15 @@ use Getopt::Long; if ($#ARGV != 1) { - print "Usage: $0 --cldr= --etc=\n"; + print "Usage: $0 --unidir= --etc=\n"; exit(1); } -my $CLDRDIR = undef; +my $UNIDIR = undef; my $ETCDIR = undef; my $result = GetOptions ( - "cldr=s" => \$CLDRDIR, + "unidir=s" => \$UNIDIR, "etc=s" => \$ETCDIR, ); @@ -118,7 +119,7 @@ my $outfilename = "$ETCDIR/common.UTF-8.src"; my $manual_file = "$ETCDIR/manual-input.UTF-8"; my $stars = "**********************************************************************\n"; -get_utf8map("$CLDRDIR/posix/UTF-8.cm"); +get_utf8map("$UNIDIR/posix/UTF-8.cm"); generate_header (); generate_sections (); generate_footer (); @@ -252,7 +253,7 @@ sub compress_ctype { my @lines = initialize_lines ($territory); - my $filename = "$CLDRDIR/posix/$territory.UTF-8.src"; + my $filename = "$UNIDIR/posix/$territory.UTF-8.src"; if (! -f $filename) { print STDERR "Cannot open $filename\n"; return; From owner-svn-src-all@freebsd.org Thu Dec 6 10:53:13 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D0A5613275B0; Thu, 6 Dec 2018 10:53:12 +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 80E698B8F5; Thu, 6 Dec 2018 10:53:12 +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 61ABF2287E; Thu, 6 Dec 2018 10:53:12 +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 wB6ArCKw045635; Thu, 6 Dec 2018 10:53:12 GMT (envelope-from yuripv@FreeBSD.org) Received: (from yuripv@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB6ArCvU045632; Thu, 6 Dec 2018 10:53:12 GMT (envelope-from yuripv@FreeBSD.org) Message-Id: <201812061053.wB6ArCvU045632@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 10:53:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341629 - in stable/12: contrib/netbsd-tests/lib/libc/locale share/ctypedef tools/tools/locale tools/tools/locale/etc tools/tools/locale/tools X-SVN-Group: stable-12 X-SVN-Commit-Author: yuripv X-SVN-Commit-Paths: in stable/12: contrib/netbsd-tests/lib/libc/locale share/ctypedef tools/tools/locale tools/tools/locale/etc tools/tools/locale/tools X-SVN-Commit-Revision: 341629 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 80E698B8F5 X-Spamd-Result: default: False [-0.79 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.39)[-0.385,0]; NEURAL_SPAM_LONG(0.02)[0.020,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_SHORT(-0.43)[-0.429,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Dec 2018 10:53:13 -0000 Author: yuripv Date: Thu Dec 6 10:53:11 2018 New Revision: 341629 URL: https://svnweb.freebsd.org/changeset/base/341629 Log: MFC r340491, r340492: Use UnicodeData.txt to create UTF-8 ctype map. This should provide more complete coverage of currently defined Unicode characters as compared to manually assembled one we use currently. Comparison of original and new UTF-8 ctype maps by character class: TYPE ORIG NEW alnum 94229 126029 alpha 93557 125419 blank 4 2 cntrl 73 137685 digit 469 622 graph 109615 137203 lower 1478 2145 print 109641 137222 punct 3428 797 rune 110481 274907 space 33 24 upper 983 1781 xdigit 469 622 Large number of added cntrl definitions is due to the fact that private-use planes are currently defined as such, this can change in the future. Discussed with: bapt Differential revision: https://reviews.freebsd.org/D17842 Deleted: stable/12/tools/tools/locale/etc/common.UTF-8.src stable/12/tools/tools/locale/etc/manual-input.UTF-8 Modified: stable/12/contrib/netbsd-tests/lib/libc/locale/t_mbstowcs.c stable/12/share/ctypedef/C.UTF-8.src stable/12/tools/tools/locale/Makefile stable/12/tools/tools/locale/tools/utf8-rollup.pl Directory Properties: stable/12/ (props changed) Modified: stable/12/contrib/netbsd-tests/lib/libc/locale/t_mbstowcs.c ============================================================================== --- stable/12/contrib/netbsd-tests/lib/libc/locale/t_mbstowcs.c Thu Dec 6 10:48:46 2018 (r341628) +++ stable/12/contrib/netbsd-tests/lib/libc/locale/t_mbstowcs.c Thu Dec 6 10:53:11 2018 (r341629) @@ -88,7 +88,7 @@ static struct test { 0xFFFF, 0x5D, 0x5B, 0x10000, 0x10FFFF, 0x5D, 0x0A }, #ifdef __FreeBSD__ - { 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, + { 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, #else { 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, #endif Modified: stable/12/share/ctypedef/C.UTF-8.src ============================================================================== --- stable/12/share/ctypedef/C.UTF-8.src Thu Dec 6 10:48:46 2018 (r341628) +++ stable/12/share/ctypedef/C.UTF-8.src Thu Dec 6 10:53:11 2018 (r341629) @@ -7,386 +7,27606 @@ comment_char * escape_char / LC_CTYPE - -********************************************************************** -* 0x0000 - 0x007F Basic Latin -* 0x0080 - 0x00FF Latin-1 Supplement -* 0x0100 - 0x017F Latin Extended-A -* 0x0180 - 0x024F Latin Extended-B -* 0x0250 - 0x02AF IPA Extensions -* 0x1D00 - 0x1D7F Phonetic Extensions -* 0x1D80 - 0x1DBF Phonetic Extensions Supplement -* 0x1E00 - 0x1EFF Latin Extended Additional -* 0x2150 - 0x218F Number Forms (partial - Roman Numerals) -* 0x2C60 - 0x2C7F Latin Extended-C -* 0xA720 - 0xA7FF Latin Extended-D -* 0xAB30 - 0xAB6F Latin Extended-E -* 0xFB00 - 0xFF4F Alphabetic Presentation Forms (partial) -* 0xFF00 - 0xFFEF Halfwidth and Fullwidth Forms (partial) -********************************************************************** -upper ;...;;/ - ;...;;/ - ;...;;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;...;;/ - ;...;;/ - ;/ - ;/ - ;...;;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;...;;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;...;;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;...;;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;...;;/ - ;/ - ;/ - ;...;;/ - ;/ - ;/ - ;/ - ;...;;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;...;;/ - ;...;;/ - ;/ - ;...; -lower ;...;;/ - ;/ +alpha ;/ ;/ - ;...;;/ - ;...;;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Dec 6 11:49:54 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 19DAD1329015; Thu, 6 Dec 2018 11:49:54 +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 B41648D625; Thu, 6 Dec 2018 11:49:53 +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 95858230D9; Thu, 6 Dec 2018 11:49:53 +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 wB6Bnr8Y074996; Thu, 6 Dec 2018 11:49:53 GMT (envelope-from yuripv@FreeBSD.org) Received: (from yuripv@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB6BnqDW074992; Thu, 6 Dec 2018 11:49:52 GMT (envelope-from yuripv@FreeBSD.org) Message-Id: <201812061149.wB6BnqDW074992@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 11:49:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r341630 - in stable/11: share/ctypedef tools/tools/locale tools/tools/locale/etc X-SVN-Group: stable-11 X-SVN-Commit-Author: yuripv X-SVN-Commit-Paths: in stable/11: share/ctypedef tools/tools/locale tools/tools/locale/etc X-SVN-Commit-Revision: 341630 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B41648D625 X-Spamd-Result: default: False [-1.13 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.46)[-0.456,0]; NEURAL_HAM_SHORT(-0.61)[-0.609,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.07)[-0.070,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Dec 2018 11:49:54 -0000 Author: yuripv Date: Thu Dec 6 11:49:52 2018 New Revision: 341630 URL: https://svnweb.freebsd.org/changeset/base/341630 Log: MFC r339311, r339313: Restore some of the ctype definitions reported in the PR from pre-CLDR data, namely 0xE000-0xF8FF private use area, and 0xFF00-0xFFF half- and fullwidth punctuation. While here, update tools/tools/locale/README based on my experience rebuilding the locale data. PR: 225692 Reviewed by: bapt, cem (previous version) Differential Revision: https://reviews.freebsd.org/D17471 Modified: stable/11/share/ctypedef/en_US.UTF-8.src stable/11/tools/tools/locale/README stable/11/tools/tools/locale/etc/common.UTF-8.src stable/11/tools/tools/locale/etc/manual-input.UTF-8 (contents, props changed) Directory Properties: stable/11/ (props changed) Modified: stable/11/share/ctypedef/en_US.UTF-8.src ============================================================================== --- stable/11/share/ctypedef/en_US.UTF-8.src Thu Dec 6 10:53:11 2018 (r341629) +++ stable/11/share/ctypedef/en_US.UTF-8.src Thu Dec 6 11:49:52 2018 (r341630) @@ -6241,6 +6241,12 @@ graph ;...;;...; ********************************************************************** +* 0xE000 - 0xF8FF Private Use Area (from pre-CLDR data) +********************************************************************** + +graph ;...; + +********************************************************************** * 0xFB50 - 0xFDFF Arabic Presentation Forms (differential) ********************************************************************** @@ -6277,6 +6283,17 @@ punct ;...; ********************************************************************** blank + +********************************************************************** +* 0xFF00 - 0xFFFF Half- and Fullwidth Punctuation (from pre-CLDR data) +********************************************************************** + +punct ;...;;/ + ;...;;/ + ;...;;/ + ;...;;/ + ;...;;/ + ;...; ********************************************************************** * 0x10300 - 0x1032F Old Italic Modified: stable/11/tools/tools/locale/README ============================================================================== --- stable/11/tools/tools/locale/README Thu Dec 6 10:53:11 2018 (r341629) +++ stable/11/tools/tools/locale/README Thu Dec 6 11:49:52 2018 (r341630) @@ -2,17 +2,37 @@ To generate the locales: -Tools needed: java, perl and devel/p5-Tie-IxHash +Tools needed: + java (openjdk >= 8) + perl + converters/p5-Text-Iconv + devel/p5-Tie-IxHash + textproc/p5-XML-Parser -fetch cldr data from: http://cldr.unicode.org -extract in a directory ~/unicode/cldr/v27.0.1 for example -fetch unidata from http://www.unicode.org/Public/zipped/ (latest version) -extract in a directory ~/unicode/UNIDATA/8.0.0 for example +Fetch CLDR data from: http://unicode.org/Public/cldr/. You need all of the +core.zip, keyboards.zip, and tools.zip. -either modify tools/tools/locales/etc/unicode.conf or export variables: -CLDRDIR="~/unicode/cldr/v27.0.1" -UNIDATADIR="~/unicode/UNIDATA/8.0.0" +Extract: + mkdir -p ~/unicode/cldr/v33.0 + cd ~/unicode/cldr/v33.0 + unzip ~/core.zip ~/keyboards.zip ~/tools.zip -run: -make POSIX -make install +Fetch unidata (UCD.zip) from http://www.unicode.org/Public/zipped/latest. + +Extract: + mkdir -p ~/unicode/UNIDATA/11.0.0 + cd ~/unicode/UNIDATA/11.0.0 + unzip ~/UCD.zip + +Either modify tools/tools/locales/etc/unicode.conf or export variables: + CLDRDIR=~/unicode/cldr/v33.0; export CLDRDIR + UNIDATADIR=~/unicode/UNIDATA/9.0.0; export UNIDATADIR + +Build the CLDR tools: + cd $CLDRDIR/tools/java + ant jar + +Run: + make POSIX + make + make install Modified: stable/11/tools/tools/locale/etc/common.UTF-8.src ============================================================================== --- stable/11/tools/tools/locale/etc/common.UTF-8.src Thu Dec 6 10:53:11 2018 (r341629) +++ stable/11/tools/tools/locale/etc/common.UTF-8.src Thu Dec 6 11:49:52 2018 (r341630) @@ -6241,6 +6241,12 @@ graph ;...;;...; ********************************************************************** +* 0xE000 - 0xF8FF Private Use Area (from pre-CLDR data) +********************************************************************** + +graph ;...; + +********************************************************************** * 0xFB50 - 0xFDFF Arabic Presentation Forms (differential) ********************************************************************** @@ -6277,6 +6283,17 @@ punct ;...; ********************************************************************** blank + +********************************************************************** +* 0xFF00 - 0xFFFF Half- and Fullwidth Punctuation (from pre-CLDR data) +********************************************************************** + +punct ;...;;/ + ;...;;/ + ;...;;/ + ;...;;/ + ;...;;/ + ;...; ********************************************************************** * 0x10300 - 0x1032F Old Italic Modified: stable/11/tools/tools/locale/etc/manual-input.UTF-8 ============================================================================== --- stable/11/tools/tools/locale/etc/manual-input.UTF-8 Thu Dec 6 10:53:11 2018 (r341629) +++ stable/11/tools/tools/locale/etc/manual-input.UTF-8 Thu Dec 6 11:49:52 2018 (r341630) @@ -877,6 +877,12 @@ graph ;...;;...; ********************************************************************** +* 0xE000 - 0xF8FF Private Use Area (from pre-CLDR data) +********************************************************************** + +graph ;...; + +********************************************************************** * 0xFB50 - 0xFDFF Arabic Presentation Forms (differential) ********************************************************************** @@ -913,6 +919,17 @@ punct ;...; ********************************************************************** blank + +********************************************************************** +* 0xFF00 - 0xFFFF Half- and Fullwidth Punctuation (from pre-CLDR data) +********************************************************************** + +punct ;...;;/ + ;...;;/ + ;...;;/ + ;...;;/ + ;...;;/ + ;...; ********************************************************************** * 0x10300 - 0x1032F Old Italic From owner-svn-src-all@freebsd.org Thu Dec 6 11:52:08 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CBB1C1329369; Thu, 6 Dec 2018 11:52:08 +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 737828DAB6; Thu, 6 Dec 2018 11:52:08 +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 55BE023249; Thu, 6 Dec 2018 11:52:08 +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 wB6Bq8iV077397; Thu, 6 Dec 2018 11:52:08 GMT (envelope-from yuripv@FreeBSD.org) Received: (from yuripv@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB6Bq8fu077396; Thu, 6 Dec 2018 11:52:08 GMT (envelope-from yuripv@FreeBSD.org) Message-Id: <201812061152.wB6Bq8fu077396@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 11:52:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r341631 - stable/11/usr.bin/localedef X-SVN-Group: stable-11 X-SVN-Commit-Author: yuripv X-SVN-Commit-Paths: stable/11/usr.bin/localedef X-SVN-Commit-Revision: 341631 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 737828DAB6 X-Spamd-Result: default: False [-1.18 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.48)[-0.477,0]; NEURAL_HAM_SHORT(-0.60)[-0.599,0]; NEURAL_HAM_LONG(-0.10)[-0.099,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Dec 2018 11:52:09 -0000 Author: yuripv Date: Thu Dec 6 11:52:07 2018 New Revision: 341631 URL: https://svnweb.freebsd.org/changeset/base/341631 Log: MFC r339827: localedef: define characters in "space" class also as "print", except for the known conflicts ("control" characters can't be "print"able). POSIX doesn't explicitly forbid this, and actually includes character in "print". PR: 225692 Reviewed by: bapt, cem (previous version), pfg (previous version) Differential Revision: https://reviews.freebsd.org/D17467 Modified: stable/11/usr.bin/localedef/ctype.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/localedef/ctype.c ============================================================================== --- stable/11/usr.bin/localedef/ctype.c Thu Dec 6 11:49:52 2018 (r341630) +++ stable/11/usr.bin/localedef/ctype.c Thu Dec 6 11:52:07 2018 (r341631) @@ -120,7 +120,13 @@ add_ctype_impl(ctype_node_t *ctn) ctn->ctype |= (_ISDIGIT | _ISGRAPH | _ISPRINT | _ISXDIGIT | _E4); break; case T_ISSPACE: - ctn->ctype |= _ISSPACE; + /* + * This can be troublesome as , , + * , , and are defined both + * as space and cntrl, and POSIX doesn't allow cntrl/print + * combination. We will take care of this in dump_ctype(). + */ + ctn->ctype |= (_ISSPACE | _ISPRINT); break; case T_ISCNTRL: ctn->ctype |= _ISCNTRL; @@ -372,9 +378,15 @@ dump_ctype(void) ctn->ctype |= _ISPRINT; /* - * Finally, POSIX requires that certain combinations - * are invalid. We don't flag this as a fatal error, - * but we will warn about. + * POSIX requires that certain combinations are invalid. + * Try fixing the cases we know about (see add_ctype_impl()). + */ + if ((ctn->ctype & (_ISSPACE|_ISCNTRL)) == (_ISSPACE|_ISCNTRL)) + ctn->ctype &= ~_ISPRINT; + + /* + * Finally, don't flag remaining cases as a fatal error, + * and just warn about them. */ if ((ctn->ctype & _ISALPHA) && (ctn->ctype & (_ISPUNCT|_ISDIGIT))) From owner-svn-src-all@freebsd.org Thu Dec 6 12:34:35 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Dec 6 13:32:52 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 948B2132D66C; Thu, 6 Dec 2018 13:32: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 3730C6B8F2; Thu, 6 Dec 2018 13:32: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 182F52435D; Thu, 6 Dec 2018 13:32: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 wB6DWppe031485; Thu, 6 Dec 2018 13:32:51 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB6DWphp031484; Thu, 6 Dec 2018 13:32:51 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201812061332.wB6DWphp031484@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 13:32:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r341633 - stable/10/sys/security/audit X-SVN-Group: stable-10 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/10/sys/security/audit X-SVN-Commit-Revision: 341633 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3730C6B8F2 X-Spamd-Result: default: False [-1.81 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.87)[-0.866,0]; NEURAL_HAM_SHORT(-0.84)[-0.844,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.10)[-0.099,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Dec 2018 13:32:52 -0000 Author: avg Date: Thu Dec 6 13:32:51 2018 New Revision: 341633 URL: https://svnweb.freebsd.org/changeset/base/341633 Log: MFC r336641: fix incorrect operator in the AUDITPIPE_SET_QLIMIT bounds check PR: 229983 Modified: stable/10/sys/security/audit/audit_pipe.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/security/audit/audit_pipe.c ============================================================================== --- stable/10/sys/security/audit/audit_pipe.c Thu Dec 6 12:34:34 2018 (r341632) +++ stable/10/sys/security/audit/audit_pipe.c Thu Dec 6 13:32:51 2018 (r341633) @@ -800,7 +800,7 @@ audit_pipe_ioctl(struct cdev *dev, u_long cmd, caddr_t case AUDITPIPE_SET_QLIMIT: /* Lockless integer write. */ - if (*(u_int *)data >= AUDIT_PIPE_QLIMIT_MIN || + if (*(u_int *)data >= AUDIT_PIPE_QLIMIT_MIN && *(u_int *)data <= AUDIT_PIPE_QLIMIT_MAX) { ap->ap_qlimit = *(u_int *)data; error = 0; From owner-svn-src-all@freebsd.org Thu Dec 6 13:46:19 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Dec 6 13:52:03 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Dec 6 15:28:10 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A85F81331CA0; Thu, 6 Dec 2018 15:28:10 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F0147110B; Thu, 6 Dec 2018 15:28:10 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 318C2255C6; Thu, 6 Dec 2018 15:28:10 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB6FSA8L089721; Thu, 6 Dec 2018 15:28:10 GMT (envelope-from erj@FreeBSD.org) Received: (from erj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB6FS9II089719; Thu, 6 Dec 2018 15:28:09 GMT (envelope-from erj@FreeBSD.org) Message-Id: <201812061528.wB6FS9II089719@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erj set sender to erj@FreeBSD.org using -f From: Eric Joyner Date: Thu, 6 Dec 2018 15:28:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341636 - stable/12/sys/dev/ixl X-SVN-Group: stable-12 X-SVN-Commit-Author: erj X-SVN-Commit-Paths: stable/12/sys/dev/ixl X-SVN-Commit-Revision: 341636 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4F0147110B X-Spamd-Result: default: False [-1.92 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.87)[-0.866,0]; NEURAL_HAM_LONG(-0.10)[-0.099,0]; NEURAL_HAM_SHORT(-0.95)[-0.953,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Dec 2018 15:28:10 -0000 Author: erj Date: Thu Dec 6 15:28:09 2018 New Revision: 341636 URL: https://svnweb.freebsd.org/changeset/base/341636 Log: MFC r340010 ixl/iavf(4): Update remaining references of "num_queues" to "num_rx_queues" Modified: stable/12/sys/dev/ixl/iavf_vc.c stable/12/sys/dev/ixl/if_iavf.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ixl/iavf_vc.c ============================================================================== --- stable/12/sys/dev/ixl/iavf_vc.c Thu Dec 6 13:52:02 2018 (r341635) +++ stable/12/sys/dev/ixl/iavf_vc.c Thu Dec 6 15:28:09 2018 (r341636) @@ -720,10 +720,6 @@ iavf_update_stats_counters(struct iavf_sc *sc, struct uint64_t tx_discards; tx_discards = es->tx_discards; -#if 0 - for (int i = 0; i < vsi->num_queues; i++) - tx_discards += sc->vsi.queues[i].txr.br->br_drops; -#endif /* Update ifnet stats */ IXL_SET_IPACKETS(vsi, es->rx_unicast + @@ -826,7 +822,7 @@ iavf_config_rss_lut(struct iavf_sc *sc) /* * Fetch the RSS bucket id for the given indirection entry. * Cap it at the number of configured buckets (which is - * num_queues.) + * num_rx_queues.) */ que_id = rss_get_indirection_to_bucket(i); que_id = que_id % sc->vsi.num_rx_queues; Modified: stable/12/sys/dev/ixl/if_iavf.c ============================================================================== --- stable/12/sys/dev/ixl/if_iavf.c Thu Dec 6 13:52:02 2018 (r341635) +++ stable/12/sys/dev/ixl/if_iavf.c Thu Dec 6 15:28:09 2018 (r341636) @@ -1947,10 +1947,10 @@ iavf_config_rss_reg(struct iavf_sc *sc) /* * Fetch the RSS bucket id for the given indirection entry. * Cap it at the number of configured buckets (which is - * num_queues.) + * num_rx_queues.) */ que_id = rss_get_indirection_to_bucket(i); - que_id = que_id % vsi->num_queues; + que_id = que_id % vsi->num_rx_queues; #else que_id = j; #endif From owner-svn-src-all@freebsd.org Thu Dec 6 16:10:40 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A8401133395C; Thu, 6 Dec 2018 16:10:40 +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 4E68E73215; Thu, 6 Dec 2018 16:10:40 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 30BAE25D32; Thu, 6 Dec 2018 16:10:40 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB6GAehM010605; Thu, 6 Dec 2018 16:10:40 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB6GAeso010604; Thu, 6 Dec 2018 16:10:40 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201812061610.wB6GAeso010604@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 16:10:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341637 - stable/12 X-SVN-Group: stable-12 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/12 X-SVN-Commit-Revision: 341637 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4E68E73215 X-Spamd-Result: default: False [-1.91 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.87)[-0.866,0]; NEURAL_HAM_SHORT(-0.94)[-0.943,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.10)[-0.099,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Dec 2018 16:10:40 -0000 Author: emaste Date: Thu Dec 6 16:10:39 2018 New Revision: 341637 URL: https://svnweb.freebsd.org/changeset/base/341637 Log: MFC r340986: UPDATING: add note for ld.bfd removal r340984 in HEAD, MFC in r341239 Modified: stable/12/UPDATING Directory Properties: stable/12/ (props changed) Modified: stable/12/UPDATING ============================================================================== --- stable/12/UPDATING Thu Dec 6 15:28:09 2018 (r341636) +++ stable/12/UPDATING Thu Dec 6 16:10:39 2018 (r341637) @@ -16,6 +16,12 @@ from older versions of FreeBSD, try WITHOUT_CLANG and the tip of head, and then rebuild without this option. The bootstrap process from older version of current across the gcc/clang cutover is a bit fragile. +20181129: + On amd64, arm64 and armv7 (architectures that install LLVM's ld.lld + linker as /usr/bin/ld) GNU ld is no longer installed as ld.bfd, as + it produces broken binaries when ifuncs are in use. Users needing + GNU ld should install the binutils port or package. + 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 From owner-svn-src-all@freebsd.org Thu Dec 6 17:25:16 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7FBAB130C44E; Thu, 6 Dec 2018 17:25:16 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "alchemy.franken.de", Issuer "alchemy.franken.de" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 8806A76711; Thu, 6 Dec 2018 17:25:14 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.15.2/8.15.2/ALCHEMY.FRANKEN.DE) with ESMTPS id wB6HP64t015300 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 6 Dec 2018 18:25:06 +0100 (CET) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.15.2/8.15.2/Submit) id wB6HP6KH015299; Thu, 6 Dec 2018 18:25:06 +0100 (CET) (envelope-from marius) Date: Thu, 6 Dec 2018 18:25:06 +0100 From: Marius Strobl To: Dima Panov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: Re: svn commit: r341266 - in releng/12.0: . sys/modules/iavf Message-ID: <20181206172506.GU93591@alchemy.franken.de> References: <201811292159.wATLx9Bb099604@repo.freebsd.org> <31493546-f2a6-8ad4-5c6e-5e8d835debeb@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <31493546-f2a6-8ad4-5c6e-5e8d835debeb@FreeBSD.org> User-Agent: Mutt/1.9.2 (2017-12-15) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (alchemy.franken.de [0.0.0.0]); Thu, 06 Dec 2018 18:25:06 +0100 (CET) X-Rspamd-Queue-Id: 8806A76711 X-Spamd-Result: default: False [-4.57 / 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]; 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]; AUTH_NA(1.00)[]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; IP_SCORE(-2.77)[ip: (-9.53), ipnet: 194.94.0.0/15(-4.18), asn: 680(-0.11), country: DE(-0.01)]; MX_GOOD(-0.01)[alchemy.franken.de,hub-r.franken.de,rachael.franken.de]; NEURAL_HAM_SHORT(-1.00)[-0.996,0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[marius@freebsd.org,marius@alchemy.franken.de]; R_DKIM_NA(0.00)[]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:680, ipnet:194.94.0.0/15, country:DE]; FROM_NEQ_ENVFROM(0.00)[marius@freebsd.org,marius@alchemy.franken.de] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Dec 2018 17:25:16 -0000 On Thu, Dec 06, 2018 at 03:58:44PM +1000, Dima Panov wrote: > Hello! > > Marius Strobl wrote on 30/11/2018 07:59: > > Author: marius > > Date: Thu Nov 29 21:59:09 2018 > > New Revision: 341266 > > URL: https://svnweb.freebsd.org/changeset/base/341266 > > > > Log: > > MFC: r341016, MF12: r341261 > > > > - Add a belated UPDATING entry for the ixlv(4) -> iavf(4) rename in r339338. > > - Likewise, add ixlv.4.gz to OLD_FILES, > > - and link if_ixlv.ko to if_iavf.ko in order to aid a bit in the transition. > > > [cut] > > > > Modified: releng/12.0/sys/modules/iavf/Makefile > > ============================================================================== > > --- releng/12.0/sys/modules/iavf/Makefile Thu Nov 29 21:20:53 2018 (r341265) > > +++ releng/12.0/sys/modules/iavf/Makefile Thu Nov 29 21:59:09 2018 (r341266) > > @@ -15,4 +15,6 @@ SRCS += i40e_common.c i40e_nvm.c i40e_adminq.c > > # Enable asserts and other debugging facilities > > # CFLAGS += -DINVARIANTS -DINVARIANTS_SUPPORT -DWITNESS > > > > +LINKS= ${KMODDIR}/${KMOD}.ko ${KMODDIR}/if_ixlv.ko > > + > > .include > > > And this broke poudriere jail upgrade due to missed kernel modules for > build purpose > > # poudriere jail -u -j fbsd12-test -t 12.0-RC3 > [skip] > /usr/src/usr.sbin/newsyslog/newsyslog.c > To install the downloaded upgrades, run "/usr/sbin/freebsd-update.fixed > install". > Installing updates...ln: ///boot/kernel/if_iavf.ko: No such file or > directory > chflags: ///boot/kernel/if_ixlv.ko: No such file or directory > [00:20:27] Error: Fail to upgrade system > # Hrm, apparently this doesn't trip up with a native, i. e. non-poudriere, environment and I'd assume that the linking of if_igb.ko to if_em.ko that sys/modules/em/Makefile does ever since r324500 isn't causing problems with poudriere either. What are poudriere and the "fixed" version of freebsd-update(8) doing differently than native counterparts and what do you mean by "missed kernel modules for build purpose"? Marius From owner-svn-src-all@freebsd.org Thu Dec 6 17:29:38 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Dec 6 17:30:07 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DA51D130C572; Thu, 6 Dec 2018 17:30:06 +0000 (UTC) (envelope-from gjb@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 80A9276A36; Thu, 6 Dec 2018 17:30:06 +0000 (UTC) (envelope-from gjb@freebsd.org) Received: from FreeBSD.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by freefall.freebsd.org (Postfix) with ESMTPS id F034EF321; Thu, 6 Dec 2018 17:30:05 +0000 (UTC) (envelope-from gjb@freebsd.org) Date: Thu, 6 Dec 2018 17:30:03 +0000 From: Glen Barber To: Marius Strobl Cc: Dima Panov , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: Re: svn commit: r341266 - in releng/12.0: . sys/modules/iavf Message-ID: <20181206173003.GE29692@FreeBSD.org> References: <201811292159.wATLx9Bb099604@repo.freebsd.org> <31493546-f2a6-8ad4-5c6e-5e8d835debeb@FreeBSD.org> <20181206172506.GU93591@alchemy.franken.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="n+lFg1Zro7sl44OB" Content-Disposition: inline In-Reply-To: <20181206172506.GU93591@alchemy.franken.de> User-Agent: Mutt/1.10.1 (2018-07-13) X-Rspamd-Queue-Id: 80A9276A36 X-Spamd-Result: default: False [-2.50 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.94)[-0.936,0]; NEURAL_HAM_LONG(-0.61)[-0.609,0]; NEURAL_HAM_SHORT(-0.96)[-0.957,0]; ASN(0.00)[asn:11403, ipnet:96.47.64.0/20, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Dec 2018 17:30:07 -0000 --n+lFg1Zro7sl44OB Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Dec 06, 2018 at 06:25:06PM +0100, Marius Strobl wrote: > On Thu, Dec 06, 2018 at 03:58:44PM +1000, Dima Panov wrote: > > Hello! > >=20 > > Marius Strobl wrote on 30/11/2018 07:59: > > > Author: marius > > > Date: Thu Nov 29 21:59:09 2018 > > > New Revision: 341266 > > > URL: https://svnweb.freebsd.org/changeset/base/341266 > > >=20 > > > Log: > > > MFC: r341016, MF12: r341261 > > > =20 > > > - Add a belated UPDATING entry for the ixlv(4) -> iavf(4) rename i= n r339338. > > > - Likewise, add ixlv.4.gz to OLD_FILES, > > > - and link if_ixlv.ko to if_iavf.ko in order to aid a bit in the t= ransition. > > > =20 > > [cut] > > >=20 > > > Modified: releng/12.0/sys/modules/iavf/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 > > > --- releng/12.0/sys/modules/iavf/Makefile Thu Nov 29 21:20:53 2018 (r= 341265) > > > +++ releng/12.0/sys/modules/iavf/Makefile Thu Nov 29 21:59:09 2018 (r= 341266) > > > @@ -15,4 +15,6 @@ SRCS +=3D i40e_common.c i40e_nvm.c i40e_adminq.c > > > # Enable asserts and other debugging facilities > > > # CFLAGS +=3D -DINVARIANTS -DINVARIANTS_SUPPORT -DWITNESS > > > =20 > > > +LINKS=3D ${KMODDIR}/${KMOD}.ko ${KMODDIR}/if_ixlv.ko > > > + > > > .include > >=20 > >=20 > > And this broke poudriere jail upgrade due to missed kernel modules for= =20 > > build purpose > >=20 > > # poudriere jail -u -j fbsd12-test -t 12.0-RC3 > > [skip] > > /usr/src/usr.sbin/newsyslog/newsyslog.c > > To install the downloaded upgrades, run "/usr/sbin/freebsd-update.fixed= =20 > > install". > > Installing updates...ln: ///boot/kernel/if_iavf.ko: No such file or=20 > > directory > > chflags: ///boot/kernel/if_ixlv.ko: No such file or directory > > [00:20:27] Error: Fail to upgrade system > > # >=20 > Hrm, apparently this doesn't trip up with a native, i. e. non-poudriere, > environment and I'd assume that the linking of if_igb.ko to if_em.ko that > sys/modules/em/Makefile does ever since r324500 isn't causing problems > with poudriere either. What are poudriere and the "fixed" version of > freebsd-update(8) doing differently than native counterparts and what do > you mean by "missed kernel modules for build purpose"? >=20 FWIW, I did not see this in all of my freebsd-update(8) tests. Glen --n+lFg1Zro7sl44OB Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEjRJAPC5sqwhs9k2jAxRYpUeP4pMFAlwJXJsACgkQAxRYpUeP 4pOYdg//aDdoyYeJgzdnB26Oqmi39lSvSxq1bYWYaWpcFGA1zHJ/VtG0We4eW90s 7pZQVHpJAzk3Ym9jF89OIAB4UaxroYUP/uFRBSaOVg6/qKRb5IdJjVXMbQxFfa5y Tm4fmbevn8cA7o30o7GucbaiYwNkjTOv2vEkQ9O3RrqGAu7cKTxxdScA+eRH+sU7 XKqrbLs6g98uyOe24qWDANyJpWYMWutyGhaoiGnk19VacLUublBsJ9Yu6BwT1I7E FFk9ARPF01+nYLZO4q/MQdMJ7xGYJCyhEPUYqsX3LK0fnp2yirivEsnXyspHhcv/ +5V2FJebhlI9NPqxHwOgM31SipzI8SZKyeZpjK4Uv/Z89Ow3pbUM5tgaCaK4fqxh BTP//r39ZevLdn0Qlt1IClLjk9SjU4Y8RiXNzyNIvCRce7b5YYOBIh3LrvQBKBxM CzZMO10hANCoOa0H1La6GvFINQoLld3X8tWK2HYVRodfLzh/KqZSOsJ2HPvJID6T 2oJ1KrSg0xGz/rlDvNPb35OBxZlceanFZwePQxuhdCflO68Bv2OKzBVNi+1r+Bns pChrECYNHHG3vz2ur8HC3g9AyHW9/bYyYTxfwluIWkTua7nRYNQNtpbKCBgOA30T tAyWsMeQAr+bSTp5RZm92FPEVg7rcpWSqWaF5wajXnW7y0REVYg= =9DJV -----END PGP SIGNATURE----- --n+lFg1Zro7sl44OB-- From owner-svn-src-all@freebsd.org Thu Dec 6 18:03:19 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Dec 6 18:12:51 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Dec 6 18:21:49 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Dec 6 18:39:50 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EDEE6130E899 for ; Thu, 6 Dec 2018 18:39:49 +0000 (UTC) (envelope-from bounce+0c72f6.b1b642-svn-src-all=freebsd.org@home.dimapanov.com) Received: from mail2.static.mailgun.info (mail2.static.mailgun.info [104.130.122.2]) (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 66A7779D7E for ; Thu, 6 Dec 2018 18:39:38 +0000 (UTC) (envelope-from bounce+0c72f6.b1b642-svn-src-all=freebsd.org@home.dimapanov.com) DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=home.dimapanov.com; q=dns/txt; s=smtp; t=1544121578; h=Content-Transfer-Encoding: Content-Type: In-Reply-To: MIME-Version: Date: Message-ID: From: References: Cc: To: Subject: Reply-To: Sender; bh=ujF98rQczjE375DTHm02+Mw2fYYUyFrQzEO02IsMr4s=; b=TaPKk2RiP6KOBd9GX4bIZwnQBvR8k6BDUVMQSP9usuyWq/VrPE+YZ5Hc75f9jG4by29urEEu Jp9HnDOdJWQt5ESNL2dLuOwydM7MZmieOzLpPsrxY/nOYhXgrEj0dWfmCzLpH1bkYoBGZ6vC AAv7pH73zkL1vA2+N6oA+mN7DjI= X-Mailgun-Sending-Ip: 104.130.122.2 X-Mailgun-Sid: WyIzNTBlNSIsICJzdm4tc3JjLWFsbEBmcmVlYnNkLm9yZyIsICJiMWI2NDIiXQ== Sender: fluffy=freebsd.org@home.dimapanov.com Received: from iMac-Fluffy.local (Unknown [172.111.245.169]) by mxa.mailgun.org with ESMTP id 5c096cea.7fc010d590a0-smtp-out-n03; Thu, 06 Dec 2018 18:39:38 -0000 (UTC) Reply-To: fluffy@FreeBSD.org Subject: Re: svn commit: r341266 - in releng/12.0: . sys/modules/iavf To: Marius Strobl Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org References: <201811292159.wATLx9Bb099604@repo.freebsd.org> <31493546-f2a6-8ad4-5c6e-5e8d835debeb@FreeBSD.org> <20181206172506.GU93591@alchemy.franken.de> From: Dima Panov Message-ID: <8cdcbd76-64c0-4bb5-e37c-2102d5a70a7c@FreeBSD.org> Date: Fri, 7 Dec 2018 04:39:33 +1000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 PostboxApp/6.1.6 MIME-Version: 1.0 In-Reply-To: <20181206172506.GU93591@alchemy.franken.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: ru Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 66A7779D7E X-Spamd-Result: default: False [3.47 / 15.00]; HAS_REPLYTO(0.00)[fluffy@FreeBSD.org]; MX_INVALID(0.50)[greylisted]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:104.130.122.0/23]; REPLYTO_ADDR_EQ_FROM(0.00)[]; DKIM_TRACE(0.00)[home.dimapanov.com:+]; NEURAL_HAM_SHORT(-0.75)[-0.754,0]; FORGED_SENDER(0.30)[fluffy@FreeBSD.org,bounce@home.dimapanov.com]; RCVD_TLS_LAST(0.00)[]; IP_SCORE(-0.59)[ipnet: 104.130.120.0/22(0.56), asn: 27357(-3.41), country: US(-0.09)]; ASN(0.00)[asn:27357, ipnet:104.130.120.0/22, country:US]; MID_RHS_MATCH_FROM(0.00)[]; TAGGED_FROM(0.00)[0c72f6.b1b642-svn-src-all=freebsd.org]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.86)[-0.856,0]; R_DKIM_ALLOW(-0.20)[home.dimapanov.com]; FROM_NEQ_ENVFROM(0.00)[fluffy@FreeBSD.org,bounce@home.dimapanov.com]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; NEURAL_HAM_LONG(-0.63)[-0.633,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[FreeBSD.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MX_MISSING(3.50)[requested record is not found]; RCVD_IN_DNSWL_NONE(0.00)[2.122.130.104.list.dnswl.org : 127.0.15.0]; FORGED_MUA_MOZILLA_MAIL_MSGID_UNKNOWN(2.50)[]; RCVD_COUNT_TWO(0.00)[2]; GREYLIST(0.00)[pass,meta] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Dec 2018 18:39:50 -0000 Hello! Marius Strobl wrote on 07/12/2018 03:25: > On Thu, Dec 06, 2018 at 03:58:44PM +1000, Dima Panov wrote: >> Hello! >> >> Marius Strobl wrote on 30/11/2018 07:59: >>> Author: marius >>> Date: Thu Nov 29 21:59:09 2018 >>> New Revision: 341266 >>> URL: https://svnweb.freebsd.org/changeset/base/341266 >>> >>> Log: >>> MFC: r341016, MF12: r341261 >>> >>> - Add a belated UPDATING entry for the ixlv(4) -> iavf(4) rename in r339338. >>> - Likewise, add ixlv.4.gz to OLD_FILES, >>> - and link if_ixlv.ko to if_iavf.ko in order to aid a bit in the transition. >>> >> [cut] >>> >>> Modified: releng/12.0/sys/modules/iavf/Makefile >>> ============================================================================== >>> --- releng/12.0/sys/modules/iavf/Makefile Thu Nov 29 21:20:53 2018 (r341265) >>> +++ releng/12.0/sys/modules/iavf/Makefile Thu Nov 29 21:59:09 2018 (r341266) >>> @@ -15,4 +15,6 @@ SRCS += i40e_common.c i40e_nvm.c i40e_adminq.c >>> # Enable asserts and other debugging facilities >>> # CFLAGS += -DINVARIANTS -DINVARIANTS_SUPPORT -DWITNESS >>> >>> +LINKS= ${KMODDIR}/${KMOD}.ko ${KMODDIR}/if_ixlv.ko >>> + >>> .include >> >> >> And this broke poudriere jail upgrade due to missed kernel modules for >> build purpose >> >> # poudriere jail -u -j fbsd12-test -t 12.0-RC3 >> [skip] >> /usr/src/usr.sbin/newsyslog/newsyslog.c >> To install the downloaded upgrades, run "/usr/sbin/freebsd-update.fixed >> install". >> Installing updates...ln: ///boot/kernel/if_iavf.ko: No such file or >> directory >> chflags: ///boot/kernel/if_ixlv.ko: No such file or directory >> [00:20:27] Error: Fail to upgrade system >> # > > Hrm, apparently this doesn't trip up with a native, i. e. non-poudriere, > environment and I'd assume that the linking of if_igb.ko to if_em.ko that > sys/modules/em/Makefile does ever since r324500 isn't causing problems > with poudriere either. What are poudriere and the "fixed" version of > freebsd-update(8) doing differently than native counterparts and what do > you mean by "missed kernel modules for build purpose"? > Poudriere not install kernel/modules package into jails, only base|lib|src, so whole '${jail}/boot/kernel' directory is missing, but freebsd-update(8) unconditionaly try to link on modules. Package building procedure is not demanding on binary kernel and modules -- Dima Panov (fluffy@FreeBSD.org) (X11, KDE, Office)@FreeBSD team Facebook: http://www.facebook.com/fluffy.khv twitter: fluffy_khv | skype: dima.panov | telegram: @dima_panov IRC: fluffy@EFNet, fluffykhv@FreeNode From owner-svn-src-all@freebsd.org Thu Dec 6 18:58:55 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Dec 6 18:59:34 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Dec 6 19:08:04 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B6D40130F874; Thu, 6 Dec 2018 19:08:04 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "alchemy.franken.de", Issuer "alchemy.franken.de" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id D447F7B224; Thu, 6 Dec 2018 19:08:03 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.15.2/8.15.2/ALCHEMY.FRANKEN.DE) with ESMTPS id wB6J82TJ016239 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 6 Dec 2018 20:08:02 +0100 (CET) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.15.2/8.15.2/Submit) id wB6J82MY016238; Thu, 6 Dec 2018 20:08:02 +0100 (CET) (envelope-from marius) Date: Thu, 6 Dec 2018 20:08:02 +0100 From: Marius Strobl To: Glen Barber Cc: Dima Panov , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: Re: svn commit: r341266 - in releng/12.0: . sys/modules/iavf Message-ID: <20181206190802.GV93591@alchemy.franken.de> References: <201811292159.wATLx9Bb099604@repo.freebsd.org> <31493546-f2a6-8ad4-5c6e-5e8d835debeb@FreeBSD.org> <20181206172506.GU93591@alchemy.franken.de> <20181206173003.GE29692@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181206173003.GE29692@FreeBSD.org> User-Agent: Mutt/1.9.2 (2017-12-15) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (alchemy.franken.de [0.0.0.0]); Thu, 06 Dec 2018 20:08:02 +0100 (CET) X-Rspamd-Queue-Id: D447F7B224 X-Spamd-Result: default: False [-4.50 / 15.00]; TO_DN_SOME(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[3]; MX_GOOD(-0.01)[cached: alchemy.franken.de]; NEURAL_HAM_SHORT(-0.98)[-0.985,0]; FORGED_SENDER(0.30)[marius@freebsd.org,marius@alchemy.franken.de]; R_DKIM_NA(0.00)[]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:680, ipnet:194.94.0.0/15, country:DE]; FROM_NEQ_ENVFROM(0.00)[marius@freebsd.org,marius@alchemy.franken.de]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; FROM_HAS_DN(0.00)[]; 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]; AUTH_NA(1.00)[]; IP_SCORE(-2.71)[ip: (-9.35), ipnet: 194.94.0.0/15(-4.08), asn: 680(-0.11), country: DE(-0.01)]; R_SPF_NA(0.00)[] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Dec 2018 19:08:04 -0000 On Thu, Dec 06, 2018 at 05:30:03PM +0000, Glen Barber wrote: > On Thu, Dec 06, 2018 at 06:25:06PM +0100, Marius Strobl wrote: > > On Thu, Dec 06, 2018 at 03:58:44PM +1000, Dima Panov wrote: > > > Hello! > > > > > > Marius Strobl wrote on 30/11/2018 07:59: > > > > Author: marius > > > > Date: Thu Nov 29 21:59:09 2018 > > > > New Revision: 341266 > > > > URL: https://svnweb.freebsd.org/changeset/base/341266 > > > > > > > > Log: > > > > MFC: r341016, MF12: r341261 > > > > > > > > - Add a belated UPDATING entry for the ixlv(4) -> iavf(4) rename in r339338. > > > > - Likewise, add ixlv.4.gz to OLD_FILES, > > > > - and link if_ixlv.ko to if_iavf.ko in order to aid a bit in the transition. > > > > > > > [cut] > > > > > > > > Modified: releng/12.0/sys/modules/iavf/Makefile > > > > ============================================================================== > > > > --- releng/12.0/sys/modules/iavf/Makefile Thu Nov 29 21:20:53 2018 (r341265) > > > > +++ releng/12.0/sys/modules/iavf/Makefile Thu Nov 29 21:59:09 2018 (r341266) > > > > @@ -15,4 +15,6 @@ SRCS += i40e_common.c i40e_nvm.c i40e_adminq.c > > > > # Enable asserts and other debugging facilities > > > > # CFLAGS += -DINVARIANTS -DINVARIANTS_SUPPORT -DWITNESS > > > > > > > > +LINKS= ${KMODDIR}/${KMOD}.ko ${KMODDIR}/if_ixlv.ko > > > > + > > > > .include > > > > > > > > > And this broke poudriere jail upgrade due to missed kernel modules for > > > build purpose > > > > > > # poudriere jail -u -j fbsd12-test -t 12.0-RC3 > > > [skip] > > > /usr/src/usr.sbin/newsyslog/newsyslog.c > > > To install the downloaded upgrades, run "/usr/sbin/freebsd-update.fixed > > > install". > > > Installing updates...ln: ///boot/kernel/if_iavf.ko: No such file or > > > directory > > > chflags: ///boot/kernel/if_ixlv.ko: No such file or directory > > > [00:20:27] Error: Fail to upgrade system > > > # > > > > Hrm, apparently this doesn't trip up with a native, i. e. non-poudriere, > > environment and I'd assume that the linking of if_igb.ko to if_em.ko that > > sys/modules/em/Makefile does ever since r324500 isn't causing problems > > with poudriere either. What are poudriere and the "fixed" version of > > freebsd-update(8) doing differently than native counterparts and what do > > you mean by "missed kernel modules for build purpose"? > > > > FWIW, I did not see this in all of my freebsd-update(8) tests. So could it be that a subset of the mirrors carries a corrupt index of 12.0-RC3? Otherwise I don't see how only some freebsd-update(8) runs to 12.0-RC3 fail or how the problem should be specific to if_ixlv.ko so far. Marius From owner-svn-src-all@freebsd.org Thu Dec 6 19:08:53 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Dec 6 19:18:52 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CB2AB130FDAA; Thu, 6 Dec 2018 19:18:52 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6DD977B9B1; Thu, 6 Dec 2018 19:18:52 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4F02327F34; Thu, 6 Dec 2018 19:18:52 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB6JIqhP010553; Thu, 6 Dec 2018 19:18:52 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB6JIq8P010552; Thu, 6 Dec 2018 19:18:52 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201812061918.wB6JIq8P010552@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 6 Dec 2018 19:18:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r341644 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 341644 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6DD977B9B1 X-Spamd-Result: default: False [-1.90 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.87)[-0.868,0]; NEURAL_HAM_LONG(-0.07)[-0.070,0]; NEURAL_HAM_SHORT(-0.96)[-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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Dec 2018 19:18:53 -0000 Author: kevans Date: Thu Dec 6 19:18:51 2018 New Revision: 341644 URL: https://svnweb.freebsd.org/changeset/base/341644 Log: Fix kenv handling in stable/11 following r337333 The aforementioned commit merged revised static_env/static_hint handling to allow static_env and loader env to coexist with the variable loader_env.disabled=0. init_static_kenv had been rewritten slighly in an attempt to maintain historical behavior: the static environment and loader environment are mutually exclusive, unless the latter disables the former. The rewritten version botched this by only setting up the loader environment if the static environment was empty or if the loader environment was specifically enabled. It was never given a chance to disable the static environment, so the default behavior was broken unless the loader environment was specifically enabled by the static environment. Rewrite this again to do the right thing: - Setup the static environment and check loader_env.disabled; if it's explicitly enabled, we're done. - Check static_{env,hints}.disabled and "empty out" the respective environments as needed - Finally, check: if the static environment is not empty and we've not explicitly re-enabled the static environment with loader_env.disabled=0, we tear the loader environment (which was setup to 'keep things simple') down again. Future commits to head (and subsequently MFC'd) will likely zero these environments out if they're disabled since this normally happens when they're merged into the dynamic environment. This is a direct commit to stable/11 because this particular bug does not apply to head. Fixes: r337333 Reported by: bde Modified: stable/11/sys/kern/kern_environment.c Modified: stable/11/sys/kern/kern_environment.c ============================================================================== --- stable/11/sys/kern/kern_environment.c Thu Dec 6 18:59:33 2018 (r341643) +++ stable/11/sys/kern/kern_environment.c Thu Dec 6 19:18:51 2018 (r341644) @@ -245,7 +245,7 @@ done: void init_static_kenv(char *buf, size_t len) { - char *eval; + char *eval, *loader_eval; KASSERT(!dynamic_kenv, ("kenv: dynamic_kenv already initialized")); /* @@ -264,21 +264,43 @@ init_static_kenv(char *buf, size_t len) * * As a warning, the static environment may not be disabled in any way * if the static environment has disabled the loader environment. + * + * We're setting up the static environment early here because it will + * either be used or empty. */ kern_envp = static_env; - eval = kern_getenv("loader_env.disabled"); - if (*kern_envp == '\0' || (eval != NULL && strcmp(eval, "0") == 0)) { - md_envp = buf; - md_env_len = len; - md_env_pos = 0; + loader_eval = kern_getenv("loader_env.disabled"); + if (loader_eval != NULL && strcmp(loader_eval, "1") == 0) + /* Bail out early, the loader environment is disabled. */ + return; - eval = kern_getenv("static_env.disabled"); - if (eval != NULL && strcmp(eval, "1") == 0) - *kern_envp = '\0'; - } + /* + * Next, the loader env is checked for the status of the static env. We + * are allowing static_env and static_hints to disable themselves here for + * the sake of simplicity. + */ + md_envp = buf; + md_env_len = len; + md_env_pos = 0; + + eval = kern_getenv("static_env.disabled"); + if (eval != NULL && strcmp(eval, "1") == 0) + *static_env = '\0'; + eval = kern_getenv("static_hints.disabled"); if (eval != NULL && strcmp(eval, "1") == 0) *static_hints = '\0'; + + /* + * Now we see if we need to tear the loader environment back down due + * to the presence of a non-empty static environment and lack of request + * to keep it enabled. + */ + if (*static_env != '\0' && + (loader_eval == NULL || strcmp(loader_eval, "0") != 0)) { + md_envp = NULL; + md_env_len = 0; + } } static void From owner-svn-src-all@freebsd.org Thu Dec 6 19:20:01 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Dec 6 19:27:16 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Dec 6 19:49:09 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Dec 6 20:03:08 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Dec 6 20:04:02 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Dec 6 20:15:56 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Dec 6 20:28:10 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Dec 6 20:56:24 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Dec 6 21:27:36 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Dec 6 21:33:09 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Dec 6 21:52:41 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Dec 6 22:35:08 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Dec 6 22:58:58 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Dec 6 22:58:29 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Dec 6 22:59:22 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Dec 6 22:59:11 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Dec 6 22:58:45 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Dec 6 23:29:09 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Dec 6 23:25:06 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 32D2B1318AFE 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 0E3796A28E 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 v13so2126251wrw.5 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=Yux5T9XgFbI7aHGM70aZWRMigRb7srBpAgZCkDwbHMDl0D0vE84F8o3ImyfLgqaOLU rUOtABiHE/W/obDCDYp30sB6+OU7QfHEcoTfPXSbsT08O5OsyW156kb8K8DoXb3b/dHa jkswmXv/7R4E6ewLk7sy8ADDOC8aHoeQhe3eRLco3qJgUBmW0OgwYteEgBpEUtvS+hJh gRlRQ//gYR12QtA/ngunRU7yru6iWvD/Q6Q+NjO4fDUVQ0CSnLbkhmrKTGlzMOc0DBJ+ eFBJEYjyEtXapNa4VX80WYeXw9WEKRvauNUNew0/8trxm5vZkg1t1lPnkF5R8vieV/lk ocTg== X-Gm-Message-State: AA+aEWb13k7BwewM7WSHebglEdIvNJbOuvuJcnyN2SGyjAS+80iwisJv ktBMlUBs6RtqPaDkGq+KrTXNXbmVevIj/o3McZ+iRg== 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: 0E3796A28E 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-all@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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Dec 6 23:28:56 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Dec 6 23:40:57 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Dec 6 23:23:39 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Dec 6 23:42:55 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 50D33131AD34 for ; Thu, 6 Dec 2018 23:42:55 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x82f.google.com (mail-qt1-x82f.google.com [IPv6:2607:f8b0:4864:20::82f]) (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 A51746B9B6 for ; Thu, 6 Dec 2018 23:42:54 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x82f.google.com with SMTP id v11so2631357qtc.2 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=FRFX2R4lVLuPrlIIJyCAFGHMp7OAV/0093ytU3vXGT9PUgN5O/O4gmtiAv3XvTAaXZ Rq8NqhtXmMEpaBkbhYN9AZWAcvEGsx2jxN9goJEbotf4mg9XgmdgPbmVV5cNKBLL9ATt VjhRM5o25wQxzwLj40dINHOWti4unGyhCxnVhfi3NYj7fk9oyu2f7YpDIIJvlglD8ibm sHpTwST8s25aFbEbkErgiTWddB+Axc4wICGq9ab9y1rvjH1xFKbGtzgxByA0Ddlt448T zYu29NKx2l8d+wbE6/hkNZ4tONCTUCHMYFbW47LxQWUMJyBq9HzI6XF03yYyHpGDtW0B Ylyw== X-Gm-Message-State: AA+aEWZuQbVDPkT8G/CKDj1vIiKALAG2K+8KmY5KMYsljp1i5nmQxssT dk6hPJ3ehsiZ4T6VM9Ln8EMyNKByPMoG8v7qYcRwrQ== 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: A51746B9B6 X-Spamd-Result: default: False [-5.06 / 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-all@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)[f.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.965,0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_LAST(0.00)[]; IP_SCORE(-2.09)[ip: (-7.51), 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Fri Dec 7 00:00:14 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 291E2131BBAF; Fri, 7 Dec 2018 00:00:14 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BCA5E6C76C; Fri, 7 Dec 2018 00:00:13 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9D7513008; Fri, 7 Dec 2018 00:00:13 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB700DXP057842; Fri, 7 Dec 2018 00:00:13 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB700D6Z057839; Fri, 7 Dec 2018 00:00:13 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201812070000.wB700D6Z057839@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 7 Dec 2018 00:00:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r341666 - in releng/12.0: . lib/csu/common sys/conf X-SVN-Group: releng X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: in releng/12.0: . lib/csu/common sys/conf X-SVN-Commit-Revision: 341666 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: BCA5E6C76C 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Dec 2018 00:00:14 -0000 Author: gjb Date: Fri Dec 7 00:00:12 2018 New Revision: 341666 URL: https://svnweb.freebsd.org/changeset/base/341666 Log: - Switch releng/12.0 from RC3 to RELEASE. - Add the anticipated 12.0-RELEASE date to UPDATING. - Set a static __FreeBSD_version. - This one goes to 12. Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: releng/12.0/UPDATING releng/12.0/lib/csu/common/crtbrand.c releng/12.0/sys/conf/newvers.sh Modified: releng/12.0/UPDATING ============================================================================== --- releng/12.0/UPDATING Thu Dec 6 23:55:39 2018 (r341665) +++ releng/12.0/UPDATING Fri Dec 7 00:00:12 2018 (r341666) @@ -16,6 +16,9 @@ from older versions of FreeBSD, try WITHOUT_CLANG and the tip of head, and then rebuild without this option. The bootstrap process from older version of current across the gcc/clang cutover is a bit fragile. +20181211: + 12.0-RELEASE. + 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 Modified: releng/12.0/lib/csu/common/crtbrand.c ============================================================================== --- releng/12.0/lib/csu/common/crtbrand.c Thu Dec 6 23:55:39 2018 (r341665) +++ releng/12.0/lib/csu/common/crtbrand.c Fri Dec 7 00:00:12 2018 (r341666) @@ -65,5 +65,5 @@ static const struct { .descsz = sizeof(int32_t), .type = NT_FREEBSD_ABI_TAG, .name = NOTE_FREEBSD_VENDOR, - .desc = __FreeBSD_version + .desc = 1200086 }; Modified: releng/12.0/sys/conf/newvers.sh ============================================================================== --- releng/12.0/sys/conf/newvers.sh Thu Dec 6 23:55:39 2018 (r341665) +++ releng/12.0/sys/conf/newvers.sh Fri Dec 7 00:00:12 2018 (r341666) @@ -46,7 +46,7 @@ TYPE="FreeBSD" REVISION="12.0" -BRANCH="RC3" +BRANCH="RELEASE" if [ -n "${BRANCH_OVERRIDE}" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-svn-src-all@freebsd.org Thu Dec 6 23:39:55 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 86B82131A987 for ; Thu, 6 Dec 2018 23:39:55 +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 A69C36B2C9 for ; Thu, 6 Dec 2018 23:39:54 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x82d.google.com with SMTP id d19so2585617qtq.9 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=qpNz4Wecz1PehJGFoBhVZ7twdaLkkuJjm3qCKhno3vfFgjAhqaj6u0CTRWYyhycq1O w6NsqUrbGhUBkrsXAbppLzVmQHwGoeO1t0k9Pe4n19w5dzSuYB0uWN1qTd7e0fJNZXLN cN9Y0ajndPO9UWwTmFAvb3Og0BLDSYJFwjlBPwBxBCUQv/n7MYSp8v3C8p4lsBoeWB8f 3k9Um4cFHIM1z7P5lGUmFLyt7NTytpgMQHI6tHDODNslE5hVJY2nOOAqV5CTDseRxPiR ENiNoXmiNfIUEE5IfS3iDbfkWLyoSvoU+F+y6CCJrHErJgV0aUWqpgLTtlsJ1t590+Hp 5sEA== X-Gm-Message-State: AA+aEWaAlLgHqMmGdBtfZDNe3rYeK9K4N1WVojxcEXQPYEo4hQccgUem /pkVls3a1CE3uSpHEBuRpHr36pos8KncsToY0pLAJg== 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: A69C36B2C9 X-Spamd-Result: default: False [-3.42 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.99)[-0.990,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-0.99)[-0.995,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-all@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)[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.84)[-0.836,0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_LAST(0.00)[]; IP_SCORE(-0.59)[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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Thu Dec 6 23:55:41 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-all@freebsd.org Fri Dec 7 00:06:37 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Dec 7 00:27:40 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Dec 7 00:33:03 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D99001322DBC; Fri, 7 Dec 2018 00:33: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 7ED726EA9A; Fri, 7 Dec 2018 00:33:03 +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 5FDA23A6C; Fri, 7 Dec 2018 00:33:03 +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 wB70X34X078716; Fri, 7 Dec 2018 00:33:03 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB70X3JS078715; Fri, 7 Dec 2018 00:33:03 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201812070033.wB70X3JS078715@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 00:33:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341668 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 341668 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7ED726EA9A X-Spamd-Result: default: False [-1.92 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.87)[-0.866,0]; NEURAL_HAM_SHORT(-0.96)[-0.956,0]; NEURAL_HAM_LONG(-0.10)[-0.099,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Dec 2018 00:33:04 -0000 Author: kib Date: Fri Dec 7 00:33:02 2018 New Revision: 341668 URL: https://svnweb.freebsd.org/changeset/base/341668 Log: MFC r340862: Trivial reduction of the code duplication, reuse the return FALSE code. Modified: stable/12/sys/kern/imgact_elf.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/imgact_elf.c ============================================================================== --- stable/12/sys/kern/imgact_elf.c Fri Dec 7 00:27:38 2018 (r341667) +++ stable/12/sys/kern/imgact_elf.c Fri Dec 7 00:33:02 2018 (r341668) @@ -2363,8 +2363,7 @@ __elfN(parse_notes)(struct image_params *imgp, Elf_Bra curthread->td_ucred, NOCRED, NULL, curthread); if (error != 0) { uprintf("i/o error PT_NOTE\n"); - res = FALSE; - goto ret; + goto retf; } note = note0 = (const Elf_Note *)buf; note_end = (const Elf_Note *)(buf + pnote->p_filesz); @@ -2378,8 +2377,7 @@ __elfN(parse_notes)(struct image_params *imgp, Elf_Bra for (i = 0; i < 100 && note >= note0 && note < note_end; i++) { if (!aligned(note, Elf32_Addr) || (const char *)note_end - (const char *)note < sizeof(Elf_Note)) { - res = FALSE; - goto ret; + goto retf; } if (note->n_namesz != checknote->hdr.n_namesz || note->n_descsz != checknote->hdr.n_descsz || @@ -2407,6 +2405,7 @@ nextnote: roundup2(note->n_namesz, ELF_NOTE_ROUNDSIZE) + roundup2(note->n_descsz, ELF_NOTE_ROUNDSIZE)); } +retf: res = FALSE; ret: free(buf, M_TEMP); From owner-svn-src-all@freebsd.org Fri Dec 7 00:35:57 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5C4BB1322E76; Fri, 7 Dec 2018 00:35:57 +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 039466EC07; Fri, 7 Dec 2018 00:35:57 +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 D8B7D3A8D; Fri, 7 Dec 2018 00:35: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 wB70ZuJ5078881; Fri, 7 Dec 2018 00:35:56 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB70ZuhR078880; Fri, 7 Dec 2018 00:35:56 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201812070035.wB70ZuhR078880@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 00:35:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341669 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 341669 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 039466EC07 X-Spamd-Result: default: False [-1.90 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.87)[-0.868,0]; NEURAL_HAM_LONG(-0.07)[-0.070,0]; NEURAL_HAM_SHORT(-0.96)[-0.958,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Dec 2018 00:35:57 -0000 Author: kib Date: Fri Dec 7 00:35:56 2018 New Revision: 341669 URL: https://svnweb.freebsd.org/changeset/base/341669 Log: MFC r340863: Generalize ELF parse_notes(). Modified: stable/12/sys/kern/imgact_elf.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/imgact_elf.c ============================================================================== --- stable/12/sys/kern/imgact_elf.c Fri Dec 7 00:33:02 2018 (r341668) +++ stable/12/sys/kern/imgact_elf.c Fri Dec 7 00:35:56 2018 (r341669) @@ -2340,8 +2340,9 @@ __elfN(note_procstat_auxv)(void *arg, struct sbuf *sb, } static boolean_t -__elfN(parse_notes)(struct image_params *imgp, Elf_Brandnote *checknote, - int32_t *osrel, const Elf_Phdr *pnote) +__elfN(parse_notes)(struct image_params *imgp, Elf_Note *checknote, + const char *note_vendor, const Elf_Phdr *pnote, + boolean_t (*cb)(const Elf_Note *, void *, boolean_t *), void *cb_arg) { const Elf_Note *note, *note0, *note_end; const char *note_name; @@ -2379,27 +2380,18 @@ __elfN(parse_notes)(struct image_params *imgp, Elf_Bra (const char *)note < sizeof(Elf_Note)) { goto retf; } - if (note->n_namesz != checknote->hdr.n_namesz || - note->n_descsz != checknote->hdr.n_descsz || - note->n_type != checknote->hdr.n_type) + if (note->n_namesz != checknote->n_namesz || + note->n_descsz != checknote->n_descsz || + note->n_type != checknote->n_type) goto nextnote; note_name = (const char *)(note + 1); - if (note_name + checknote->hdr.n_namesz >= - (const char *)note_end || strncmp(checknote->vendor, - note_name, checknote->hdr.n_namesz) != 0) + if (note_name + checknote->n_namesz >= + (const char *)note_end || strncmp(note_vendor, + note_name, checknote->n_namesz) != 0) goto nextnote; - /* - * Fetch the osreldate for binary - * from the ELF OSABI-note if necessary. - */ - if ((checknote->flags & BN_TRANSLATE_OSREL) != 0 && - checknote->trans_osrel != NULL) { - res = checknote->trans_osrel(note, osrel); + if (cb(note, cb_arg, &res)) goto ret; - } - res = TRUE; - goto ret; nextnote: note = (const Elf_Note *)((const char *)(note + 1) + roundup2(note->n_namesz, ELF_NOTE_ROUNDSIZE) + @@ -2412,26 +2404,54 @@ ret: return (res); } +struct brandnote_cb_arg { + Elf_Brandnote *brandnote; + int32_t *osrel; +}; + +static boolean_t +brandnote_cb(const Elf_Note *note, void *arg0, boolean_t *res) +{ + struct brandnote_cb_arg *arg; + + arg = arg0; + + /* + * Fetch the osreldate for binary from the ELF OSABI-note if + * necessary. + */ + *res = (arg->brandnote->flags & BN_TRANSLATE_OSREL) != 0 && + arg->brandnote->trans_osrel != NULL ? + arg->brandnote->trans_osrel(note, arg->osrel) : TRUE; + + return (TRUE); +} + /* * Try to find the appropriate ABI-note section for checknote, * fetch the osreldate for binary from the ELF OSABI-note. Only the * first page of the image is searched, the same as for headers. */ static boolean_t -__elfN(check_note)(struct image_params *imgp, Elf_Brandnote *checknote, +__elfN(check_note)(struct image_params *imgp, Elf_Brandnote *brandnote, int32_t *osrel) { const Elf_Phdr *phdr; const Elf_Ehdr *hdr; + struct brandnote_cb_arg b_arg; int i; hdr = (const Elf_Ehdr *)imgp->image_header; phdr = (const Elf_Phdr *)(imgp->image_header + hdr->e_phoff); + b_arg.brandnote = brandnote; + b_arg.osrel = osrel; for (i = 0; i < hdr->e_phnum; i++) { - if (phdr[i].p_type == PT_NOTE && - __elfN(parse_notes)(imgp, checknote, osrel, &phdr[i])) + if (phdr[i].p_type == PT_NOTE && __elfN(parse_notes)(imgp, + &brandnote->hdr, brandnote->vendor, &phdr[i], brandnote_cb, + &b_arg)) { return (TRUE); + } } return (FALSE); From owner-svn-src-all@freebsd.org Fri Dec 7 00:38:22 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 71B431322FC4; Fri, 7 Dec 2018 00:38:22 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 19C4C6EDE8; Fri, 7 Dec 2018 00:38:22 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EEF153A9C; Fri, 7 Dec 2018 00:38:21 +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 wB70cLhA079033; Fri, 7 Dec 2018 00:38:21 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB70cLZD079032; Fri, 7 Dec 2018 00:38:21 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201812070038.wB70cLZD079032@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 00:38:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r341670 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 341670 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 19C4C6EDE8 X-Spamd-Result: default: False [-1.92 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.87)[-0.866,0]; NEURAL_HAM_SHORT(-0.96)[-0.956,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.10)[-0.099,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Dec 2018 00:38:22 -0000 Author: kib Date: Fri Dec 7 00:38:21 2018 New Revision: 341670 URL: https://svnweb.freebsd.org/changeset/base/341670 Log: MFC r340862: Trivial reduction of the code duplication, reuse the return FALSE code. Modified: stable/11/sys/kern/imgact_elf.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/imgact_elf.c ============================================================================== --- stable/11/sys/kern/imgact_elf.c Fri Dec 7 00:35:56 2018 (r341669) +++ stable/11/sys/kern/imgact_elf.c Fri Dec 7 00:38:21 2018 (r341670) @@ -2348,8 +2348,7 @@ __elfN(parse_notes)(struct image_params *imgp, Elf_Bra curthread->td_ucred, NOCRED, NULL, curthread); if (error != 0) { uprintf("i/o error PT_NOTE\n"); - res = FALSE; - goto ret; + goto retf; } note = note0 = (const Elf_Note *)buf; note_end = (const Elf_Note *)(buf + pnote->p_filesz); @@ -2363,8 +2362,7 @@ __elfN(parse_notes)(struct image_params *imgp, Elf_Bra for (i = 0; i < 100 && note >= note0 && note < note_end; i++) { if (!aligned(note, Elf32_Addr) || (const char *)note_end - (const char *)note < sizeof(Elf_Note)) { - res = FALSE; - goto ret; + goto retf; } if (note->n_namesz != checknote->hdr.n_namesz || note->n_descsz != checknote->hdr.n_descsz || @@ -2392,6 +2390,7 @@ nextnote: roundup2(note->n_namesz, ELF_NOTE_ROUNDSIZE) + roundup2(note->n_descsz, ELF_NOTE_ROUNDSIZE)); } +retf: res = FALSE; ret: free(buf, M_TEMP); From owner-svn-src-all@freebsd.org Fri Dec 7 00:39:36 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E4311132308F; Fri, 7 Dec 2018 00:39:35 +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 745E16EF4D; Fri, 7 Dec 2018 00:39:35 +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 555F63AA1; Fri, 7 Dec 2018 00:39:35 +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 wB70dZNN079136; Fri, 7 Dec 2018 00:39:35 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB70dZuY079135; Fri, 7 Dec 2018 00:39:35 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201812070039.wB70dZuY079135@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 00:39:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r341671 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 341671 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 745E16EF4D X-Spamd-Result: default: False [-1.90 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.87)[-0.868,0]; NEURAL_HAM_SHORT(-0.96)[-0.958,0]; NEURAL_HAM_LONG(-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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Dec 2018 00:39:36 -0000 Author: kib Date: Fri Dec 7 00:39:34 2018 New Revision: 341671 URL: https://svnweb.freebsd.org/changeset/base/341671 Log: MFC r340863: Generalize ELF parse_notes(). Modified: stable/11/sys/kern/imgact_elf.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/imgact_elf.c ============================================================================== --- stable/11/sys/kern/imgact_elf.c Fri Dec 7 00:38:21 2018 (r341670) +++ stable/11/sys/kern/imgact_elf.c Fri Dec 7 00:39:34 2018 (r341671) @@ -2325,8 +2325,9 @@ __elfN(note_procstat_auxv)(void *arg, struct sbuf *sb, } static boolean_t -__elfN(parse_notes)(struct image_params *imgp, Elf_Brandnote *checknote, - int32_t *osrel, const Elf_Phdr *pnote) +__elfN(parse_notes)(struct image_params *imgp, Elf_Note *checknote, + const char *note_vendor, const Elf_Phdr *pnote, + boolean_t (*cb)(const Elf_Note *, void *, boolean_t *), void *cb_arg) { const Elf_Note *note, *note0, *note_end; const char *note_name; @@ -2364,27 +2365,18 @@ __elfN(parse_notes)(struct image_params *imgp, Elf_Bra (const char *)note < sizeof(Elf_Note)) { goto retf; } - if (note->n_namesz != checknote->hdr.n_namesz || - note->n_descsz != checknote->hdr.n_descsz || - note->n_type != checknote->hdr.n_type) + if (note->n_namesz != checknote->n_namesz || + note->n_descsz != checknote->n_descsz || + note->n_type != checknote->n_type) goto nextnote; note_name = (const char *)(note + 1); - if (note_name + checknote->hdr.n_namesz >= - (const char *)note_end || strncmp(checknote->vendor, - note_name, checknote->hdr.n_namesz) != 0) + if (note_name + checknote->n_namesz >= + (const char *)note_end || strncmp(note_vendor, + note_name, checknote->n_namesz) != 0) goto nextnote; - /* - * Fetch the osreldate for binary - * from the ELF OSABI-note if necessary. - */ - if ((checknote->flags & BN_TRANSLATE_OSREL) != 0 && - checknote->trans_osrel != NULL) { - res = checknote->trans_osrel(note, osrel); + if (cb(note, cb_arg, &res)) goto ret; - } - res = TRUE; - goto ret; nextnote: note = (const Elf_Note *)((const char *)(note + 1) + roundup2(note->n_namesz, ELF_NOTE_ROUNDSIZE) + @@ -2397,26 +2389,54 @@ ret: return (res); } +struct brandnote_cb_arg { + Elf_Brandnote *brandnote; + int32_t *osrel; +}; + +static boolean_t +brandnote_cb(const Elf_Note *note, void *arg0, boolean_t *res) +{ + struct brandnote_cb_arg *arg; + + arg = arg0; + + /* + * Fetch the osreldate for binary from the ELF OSABI-note if + * necessary. + */ + *res = (arg->brandnote->flags & BN_TRANSLATE_OSREL) != 0 && + arg->brandnote->trans_osrel != NULL ? + arg->brandnote->trans_osrel(note, arg->osrel) : TRUE; + + return (TRUE); +} + /* * Try to find the appropriate ABI-note section for checknote, * fetch the osreldate for binary from the ELF OSABI-note. Only the * first page of the image is searched, the same as for headers. */ static boolean_t -__elfN(check_note)(struct image_params *imgp, Elf_Brandnote *checknote, +__elfN(check_note)(struct image_params *imgp, Elf_Brandnote *brandnote, int32_t *osrel) { const Elf_Phdr *phdr; const Elf_Ehdr *hdr; + struct brandnote_cb_arg b_arg; int i; hdr = (const Elf_Ehdr *)imgp->image_header; phdr = (const Elf_Phdr *)(imgp->image_header + hdr->e_phoff); + b_arg.brandnote = brandnote; + b_arg.osrel = osrel; for (i = 0; i < hdr->e_phnum; i++) { - if (phdr[i].p_type == PT_NOTE && - __elfN(parse_notes)(imgp, checknote, osrel, &phdr[i])) + if (phdr[i].p_type == PT_NOTE && __elfN(parse_notes)(imgp, + &brandnote->hdr, brandnote->vendor, &phdr[i], brandnote_cb, + &b_arg)) { return (TRUE); + } } return (FALSE); From owner-svn-src-all@freebsd.org Fri Dec 7 00:47:07 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Dec 7 00:50:04 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5860E132351C; Fri, 7 Dec 2018 00:50:04 +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 EC3206F72C; Fri, 7 Dec 2018 00:50:03 +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 CD5023C5C; Fri, 7 Dec 2018 00:50:03 +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 wB70o3Gn084378; Fri, 7 Dec 2018 00:50:03 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB70o3CE084376; Fri, 7 Dec 2018 00:50:03 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201812070050.wB70o3CE084376@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 00:50:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341673 - in stable/12/sys: kern sys X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/12/sys: kern sys X-SVN-Commit-Revision: 341673 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: EC3206F72C X-Spamd-Result: default: False [-1.92 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.87)[-0.866,0]; NEURAL_HAM_LONG(-0.10)[-0.099,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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Dec 2018 00:50:04 -0000 Author: kib Date: Fri Dec 7 00:50:02 2018 New Revision: 341673 URL: https://svnweb.freebsd.org/changeset/base/341673 Log: MFC r340860: Provide storage for the process feature control flags in struct proc. Modified: stable/12/sys/kern/kern_exec.c stable/12/sys/kern/kern_fork.c stable/12/sys/sys/proc.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_exec.c ============================================================================== --- stable/12/sys/kern/kern_exec.c Fri Dec 7 00:47:05 2018 (r341672) +++ stable/12/sys/kern/kern_exec.c Fri Dec 7 00:50:02 2018 (r341673) @@ -488,6 +488,7 @@ interpret: goto exec_fail_dealloc; imgp->proc->p_osrel = 0; + imgp->proc->p_fctl0 = 0; /* * Implement image setuid/setgid. Modified: stable/12/sys/kern/kern_fork.c ============================================================================== --- stable/12/sys/kern/kern_fork.c Fri Dec 7 00:47:05 2018 (r341672) +++ stable/12/sys/kern/kern_fork.c Fri Dec 7 00:50:02 2018 (r341673) @@ -415,6 +415,7 @@ do_fork(struct thread *td, struct fork_req *fr, struct bcopy(&p1->p_startcopy, &p2->p_startcopy, __rangeof(struct proc, p_startcopy, p_endcopy)); + p2->p_fctl0 = p1->p_fctl0; pargs_hold(p2->p_args); PROC_UNLOCK(p1); Modified: stable/12/sys/sys/proc.h ============================================================================== --- stable/12/sys/sys/proc.h Fri Dec 7 00:47:05 2018 (r341672) +++ stable/12/sys/sys/proc.h Fri Dec 7 00:50:02 2018 (r341673) @@ -681,6 +681,7 @@ struct proc { */ LIST_ENTRY(proc) p_orphan; /* (e) List of orphan processes. */ LIST_HEAD(, proc) p_orphans; /* (e) Pointer to list of orphans. */ + uint32_t p_fctl0; /* (x) ABI feature control, ELF note */ }; #define p_session p_pgrp->pg_session From owner-svn-src-all@freebsd.org Fri Dec 7 02:44:06 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Dec 7 03:13:37 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Dec 7 03:30:15 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1237D132749A for ; Fri, 7 Dec 2018 03:30:15 +0000 (UTC) (envelope-from bounce+0c72f6.b1b642-svn-src-all=freebsd.org@home.dimapanov.com) Received: from mail2.static.mailgun.info (mail2.static.mailgun.info [104.130.122.2]) (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 71F0B74395 for ; Fri, 7 Dec 2018 03:30:03 +0000 (UTC) (envelope-from bounce+0c72f6.b1b642-svn-src-all=freebsd.org@home.dimapanov.com) DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=home.dimapanov.com; q=dns/txt; s=smtp; t=1544153403; h=Content-Transfer-Encoding: Content-Type: In-Reply-To: MIME-Version: Date: Message-ID: From: References: Cc: To: Subject: Reply-To: Sender; bh=8eJ+9OmIpNqlo9FkIw1T/zMZVwhp0JYHewgr0DNPBfU=; b=cIIiWz24Ua030KO948jToURnswNIaRZcpBQGLDV8LTNOeza7U1ubGPPX/UIa+zBJu1bMy32K 9D1f87Lfa0Bf8latiCsw0sy6hopX5jfu4yoJxKtEnGuP5UYR7/EsmIIsobw7ZxtHUCJ3sNRe y2lNTd0PIdHDR2GMwyr7lr9qxBM= X-Mailgun-Sending-Ip: 104.130.122.2 X-Mailgun-Sid: WyIzNTBlNSIsICJzdm4tc3JjLWFsbEBmcmVlYnNkLm9yZyIsICJiMWI2NDIiXQ== Sender: fluffy=freebsd.org@home.dimapanov.com Received: from iMac-Fluffy.local (Unknown [172.111.245.169]) by mxa.mailgun.org with ESMTP id 5c09e93a.7fc012af3378-smtp-out-n03; Fri, 07 Dec 2018 03:30:02 -0000 (UTC) Reply-To: fluffy@FreeBSD.org Subject: Re: svn commit: r341266 - in releng/12.0: . sys/modules/iavf To: Marius Strobl Cc: Glen Barber , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org References: <201811292159.wATLx9Bb099604@repo.freebsd.org> <31493546-f2a6-8ad4-5c6e-5e8d835debeb@FreeBSD.org> <20181206172506.GU93591@alchemy.franken.de> <20181206173003.GE29692@FreeBSD.org> <20181206190802.GV93591@alchemy.franken.de> From: Dima Panov Message-ID: Date: Fri, 7 Dec 2018 13:29:57 +1000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 PostboxApp/6.1.6 MIME-Version: 1.0 In-Reply-To: <20181206190802.GV93591@alchemy.franken.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: ru Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 71F0B74395 X-Spamd-Result: default: False [3.96 / 15.00]; HAS_REPLYTO(0.00)[fluffy@FreeBSD.org]; MX_INVALID(0.50)[greylisted]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:104.130.122.0/23]; REPLYTO_ADDR_EQ_FROM(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; DKIM_TRACE(0.00)[home.dimapanov.com:+]; NEURAL_HAM_SHORT(-0.65)[-0.649,0]; FORGED_SENDER(0.30)[fluffy@FreeBSD.org,bounce@home.dimapanov.com]; RCVD_TLS_LAST(0.00)[]; IP_SCORE(-0.57)[ipnet: 104.130.120.0/22(0.65), asn: 27357(-3.40), country: US(-0.09)]; ASN(0.00)[asn:27357, ipnet:104.130.120.0/22, country:US]; MID_RHS_MATCH_FROM(0.00)[]; TAGGED_FROM(0.00)[0c72f6.b1b642-svn-src-all=freebsd.org]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.52)[-0.525,0]; R_DKIM_ALLOW(-0.20)[home.dimapanov.com]; FROM_NEQ_ENVFROM(0.00)[fluffy@FreeBSD.org,bounce@home.dimapanov.com]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-0.60)[-0.601,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[FreeBSD.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MX_MISSING(3.50)[requested record is not found]; RCVD_IN_DNSWL_NONE(0.00)[2.122.130.104.list.dnswl.org : 127.0.15.0]; FORGED_MUA_MOZILLA_MAIL_MSGID_UNKNOWN(2.50)[]; RCVD_COUNT_TWO(0.00)[2]; GREYLIST(0.00)[pass,meta] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Dec 2018 03:30:15 -0000 Hello! Marius Strobl wrote on 07/12/2018 05:08: > On Thu, Dec 06, 2018 at 05:30:03PM +0000, Glen Barber wrote: >> On Thu, Dec 06, 2018 at 06:25:06PM +0100, Marius Strobl wrote: >>> On Thu, Dec 06, 2018 at 03:58:44PM +1000, Dima Panov wrote: >>>> Hello! >>>> >>>> Marius Strobl wrote on 30/11/2018 07:59: >>>>> Author: marius >>>>> Date: Thu Nov 29 21:59:09 2018 >>>>> New Revision: 341266 >>>>> URL: https://svnweb.freebsd.org/changeset/base/341266 >>>>> >>>>> Log: >>>>> MFC: r341016, MF12: r341261 >>>>> >>>>> - Add a belated UPDATING entry for the ixlv(4) -> iavf(4) rename in r339338. >>>>> - Likewise, add ixlv.4.gz to OLD_FILES, >>>>> - and link if_ixlv.ko to if_iavf.ko in order to aid a bit in the transition. >>>>> >>>> [cut] >>>>> >>>>> Modified: releng/12.0/sys/modules/iavf/Makefile >>>>> ============================================================================== >>>>> --- releng/12.0/sys/modules/iavf/Makefile Thu Nov 29 21:20:53 2018 (r341265) >>>>> +++ releng/12.0/sys/modules/iavf/Makefile Thu Nov 29 21:59:09 2018 (r341266) >>>>> @@ -15,4 +15,6 @@ SRCS += i40e_common.c i40e_nvm.c i40e_adminq.c >>>>> # Enable asserts and other debugging facilities >>>>> # CFLAGS += -DINVARIANTS -DINVARIANTS_SUPPORT -DWITNESS >>>>> >>>>> +LINKS= ${KMODDIR}/${KMOD}.ko ${KMODDIR}/if_ixlv.ko >>>>> + >>>>> .include >>>> >>>> >>>> And this broke poudriere jail upgrade due to missed kernel modules for >>>> build purpose >>>> >>>> # poudriere jail -u -j fbsd12-test -t 12.0-RC3 >>>> [skip] >>>> /usr/src/usr.sbin/newsyslog/newsyslog.c >>>> To install the downloaded upgrades, run "/usr/sbin/freebsd-update.fixed >>>> install". >>>> Installing updates...ln: ///boot/kernel/if_iavf.ko: No such file or >>>> directory >>>> chflags: ///boot/kernel/if_ixlv.ko: No such file or directory >>>> [00:20:27] Error: Fail to upgrade system >>>> # >>> >>> Hrm, apparently this doesn't trip up with a native, i. e. non-poudriere, >>> environment and I'd assume that the linking of if_igb.ko to if_em.ko that >>> sys/modules/em/Makefile does ever since r324500 isn't causing problems >>> with poudriere either. What are poudriere and the "fixed" version of >>> freebsd-update(8) doing differently than native counterparts and what do >>> you mean by "missed kernel modules for build purpose"? >>> >> >> FWIW, I did not see this in all of my freebsd-update(8) tests. > > So could it be that a subset of the mirrors carries a corrupt index > of 12.0-RC3? Otherwise I don't see how only some freebsd-update(8) > runs to 12.0-RC3 fail or how the problem should be specific to > if_ixlv.ko so far. > No, mirrors are fine. Bug is repeatable on 4 different machines with poudrire during jails -RC2 => -RC3 binary upgrade. On a host installation upgrade is always fine — /bot/kernel/* is always present on live systems. Upgrade error caused by absent kernel and modules in poudriere jail installations. -- Dima Panov (fluffy@FreeBSD.org) (X11, KDE, Office)@FreeBSD team Facebook: http://www.facebook.com/fluffy.khv twitter: fluffy_khv | skype: dima.panov | telegram: @dima_panov IRC: fluffy@EFNet, fluffykhv@FreeNode From owner-svn-src-all@freebsd.org Fri Dec 7 03:43:35 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DED801327A66; Fri, 7 Dec 2018 03:43:35 +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 809C174C30; Fri, 7 Dec 2018 03:43:35 +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 5F6D15ACA; Fri, 7 Dec 2018 03:43:35 +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 wB73hZtx076346; Fri, 7 Dec 2018 03:43:35 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB73hZkj076345; Fri, 7 Dec 2018 03:43:35 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201812070343.wB73hZkj076345@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Fri, 7 Dec 2018 03:43:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341676 - stable/12/share/man/man5 X-SVN-Group: stable-12 X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: stable/12/share/man/man5 X-SVN-Commit-Revision: 341676 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 809C174C30 X-Spamd-Result: default: False [-2.06 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.988,0]; NEURAL_HAM_SHORT(-0.97)[-0.973,0]; NEURAL_HAM_LONG(-0.10)[-0.099,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Dec 2018 03:43:36 -0000 Author: pfg Date: Fri Dec 7 03:43:34 2018 New Revision: 341676 URL: https://svnweb.freebsd.org/changeset/base/341676 Log: MFC r341505: ext2fs.5: basic updates. Starting with FreeBSD 12 we fully support writing ext4 filesystems. Mention some features that we don't support while here. Modified: stable/12/share/man/man5/ext2fs.5 Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man5/ext2fs.5 ============================================================================== --- stable/12/share/man/man5/ext2fs.5 Fri Dec 7 03:13:36 2018 (r341675) +++ stable/12/share/man/man5/ext2fs.5 Fri Dec 7 03:43:34 2018 (r341676) @@ -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-all@freebsd.org Fri Dec 7 09:39:39 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 107D513319E8; Fri, 7 Dec 2018 09:39:39 +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 AC5F28107F; Fri, 7 Dec 2018 09:39:38 +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 73BE7114DB; Fri, 7 Dec 2018 09:39:38 +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 wB79dcpx060019; Fri, 7 Dec 2018 09:39:38 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB79dcKM060018; Fri, 7 Dec 2018 09:39:38 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201812070939.wB79dcKM060018@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Fri, 7 Dec 2018 09:39:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r341678 - stable/11/sys/net X-SVN-Group: stable-11 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: stable/11/sys/net X-SVN-Commit-Revision: 341678 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: AC5F28107F X-Spamd-Result: default: False [-2.03 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.989,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.07)[-0.070,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Dec 2018 09:39:39 -0000 Author: ae Date: Fri Dec 7 09:39:37 2018 New Revision: 341678 URL: https://svnweb.freebsd.org/changeset/base/341678 Log: MFC r341008: Fix possible panic during ifnet detach in rtsock. The panic can happen, when some application does dump of routing table using sysctl interface. To prevent this, set IFF_DYING flag in if_detach_internal() function, when ifnet under lock is removed from the chain. In sysctl_rtsock() take IFNET_RLOCK_NOSLEEP() to prevent ifnet detach during routes enumeration. In case, if some interface was detached in the time before we take the lock, add the check, that ifnet is not DYING. This prevents access to memory that could be freed after ifnet is unlinked. Differential Revision: https://reviews.freebsd.org/D18338 Modified: stable/11/sys/net/if.c stable/11/sys/net/rtsock.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net/if.c ============================================================================== --- stable/11/sys/net/if.c Fri Dec 7 09:38:25 2018 (r341677) +++ stable/11/sys/net/if.c Fri Dec 7 09:39:37 2018 (r341678) @@ -1031,6 +1031,8 @@ if_detach_internal(struct ifnet *ifp, int vmove, struc TAILQ_FOREACH(iter, &V_ifnet, if_link) if (iter == ifp) { TAILQ_REMOVE(&V_ifnet, ifp, if_link); + if (!vmove) + ifp->if_flags |= IFF_DYING; found = 1; break; } Modified: stable/11/sys/net/rtsock.c ============================================================================== --- stable/11/sys/net/rtsock.c Fri Dec 7 09:38:25 2018 (r341677) +++ stable/11/sys/net/rtsock.c Fri Dec 7 09:39:37 2018 (r341678) @@ -1548,6 +1548,8 @@ sysctl_dumpentry(struct radix_node *rn, void *vw) struct rt_addrinfo info; struct sockaddr_storage ss; + IFNET_RLOCK_NOSLEEP_ASSERT(); + if (w->w_op == NET_RT_FLAGS && !(rt->rt_flags & w->w_arg)) return 0; if ((rt->rt_flags & RTF_HOST) == 0 @@ -1560,7 +1562,7 @@ sysctl_dumpentry(struct radix_node *rn, void *vw) info.rti_info[RTAX_NETMASK] = rtsock_fix_netmask(rt_key(rt), rt_mask(rt), &ss); info.rti_info[RTAX_GENMASK] = 0; - if (rt->rt_ifp) { + if (rt->rt_ifp && !(rt->rt_ifp->if_flags & IFF_DYING)) { info.rti_info[RTAX_IFP] = rt->rt_ifp->if_addr->ifa_addr; info.rti_info[RTAX_IFA] = rt->rt_ifa->ifa_addr; if (rt->rt_ifp->if_flags & IFF_POINTOPOINT) @@ -1925,8 +1927,10 @@ sysctl_rtsock(SYSCTL_HANDLER_ARGS) rnh = rt_tables_get_rnh(fib, i); if (rnh != NULL) { RIB_RLOCK(rnh); + IFNET_RLOCK_NOSLEEP(); error = rnh->rnh_walktree(&rnh->head, sysctl_dumpentry, &w); + IFNET_RUNLOCK_NOSLEEP(); RIB_RUNLOCK(rnh); } else if (af != 0) error = EAFNOSUPPORT; From owner-svn-src-all@freebsd.org Fri Dec 7 09:38:26 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 43CD313318AC; Fri, 7 Dec 2018 09:38:26 +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 DFD6280E93; Fri, 7 Dec 2018 09:38:25 +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 B9B4E114D3; Fri, 7 Dec 2018 09:38:25 +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 wB79cPEf059890; Fri, 7 Dec 2018 09:38:25 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB79cPrE059888; Fri, 7 Dec 2018 09:38:25 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201812070938.wB79cPrE059888@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Fri, 7 Dec 2018 09:38:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341677 - stable/12/sys/net X-SVN-Group: stable-12 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: stable/12/sys/net X-SVN-Commit-Revision: 341677 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: DFD6280E93 X-Spamd-Result: default: False [-2.03 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.989,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.07)[-0.070,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Dec 2018 09:38:26 -0000 Author: ae Date: Fri Dec 7 09:38:25 2018 New Revision: 341677 URL: https://svnweb.freebsd.org/changeset/base/341677 Log: MFC r341008: Fix possible panic during ifnet detach in rtsock. The panic can happen, when some application does dump of routing table using sysctl interface. To prevent this, set IFF_DYING flag in if_detach_internal() function, when ifnet under lock is removed from the chain. In sysctl_rtsock() take IFNET_RLOCK_NOSLEEP() to prevent ifnet detach during routes enumeration. In case, if some interface was detached in the time before we take the lock, add the check, that ifnet is not DYING. This prevents access to memory that could be freed after ifnet is unlinked. Differential Revision: https://reviews.freebsd.org/D18338 MFC r341334: Adapt the fix in r341008 to correctly work with EBR. IFNET_RLOCK_NOSLEEP() is epoch_enter_preempt() in FreeBSD 12+. Holding it in sysctl_rtsock() doesn't protect us from ifnet unlinking, because unlinking occurs with IFNET_WLOCK(), that is rw_wlock+sx_xlock, and it doesn check that concurrent code is running in epoch section. But while we are in epoch section, we should be able to do access to ifnet's fields, even it was unlinked. Thus do not change if_addr and if_hw_addr fields in ifnet_detach_internal() to NULL, since rtsock code can do access to these fields and this is allowed while it is running in epoch section. This should fix the race, when ifnet_detach_internal() unlinks ifnet after we checked it for IFF_DYING in sysctl_dumpentry. Move free(ifp->if_hw_addr) into ifnet_free_internal(). Also remove the NULL check for ifp->if_description, since free(9) can correctly handle NULL pointer. Modified: stable/12/sys/net/if.c stable/12/sys/net/rtsock.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/net/if.c ============================================================================== --- stable/12/sys/net/if.c Fri Dec 7 03:43:34 2018 (r341676) +++ stable/12/sys/net/if.c Fri Dec 7 09:38:25 2018 (r341677) @@ -597,8 +597,6 @@ if_free_internal(struct ifnet *ifp) #ifdef MAC mac_ifnet_destroy(ifp); #endif /* MAC */ - if (ifp->if_description != NULL) - free(ifp->if_description, M_IFDESCR); IF_AFDATA_DESTROY(ifp); IF_ADDR_LOCK_DESTROY(ifp); ifq_delete(&ifp->if_snd); @@ -606,6 +604,8 @@ if_free_internal(struct ifnet *ifp) for (int i = 0; i < IFCOUNTERS; i++) counter_u64_free(ifp->if_counters[i]); + free(ifp->if_description, M_IFDESCR); + free(ifp->if_hw_addr, M_IFADDR); free(ifp, M_IFNET); } @@ -1068,6 +1068,8 @@ if_detach_internal(struct ifnet *ifp, int vmove, struc CK_STAILQ_FOREACH(iter, &V_ifnet, if_link) if (iter == ifp) { CK_STAILQ_REMOVE(&V_ifnet, ifp, ifnet, if_link); + if (!vmove) + ifp->if_flags |= IFF_DYING; found = 1; break; } @@ -1182,14 +1184,8 @@ if_detach_internal(struct ifnet *ifp, int vmove, struc if_dead(ifp); /* - * Remove link ifaddr pointer and maybe decrement if_index. * Clean up all addresses. */ - free(ifp->if_hw_addr, M_IFADDR); - ifp->if_hw_addr = NULL; - ifp->if_addr = NULL; - - /* We can now free link ifaddr. */ IF_ADDR_WLOCK(ifp); if (!CK_STAILQ_EMPTY(&ifp->if_addrhead)) { ifa = CK_STAILQ_FIRST(&ifp->if_addrhead); Modified: stable/12/sys/net/rtsock.c ============================================================================== --- stable/12/sys/net/rtsock.c Fri Dec 7 03:43:34 2018 (r341676) +++ stable/12/sys/net/rtsock.c Fri Dec 7 09:38:25 2018 (r341677) @@ -1559,6 +1559,8 @@ sysctl_dumpentry(struct radix_node *rn, void *vw) struct rt_addrinfo info; struct sockaddr_storage ss; + IFNET_RLOCK_NOSLEEP_ASSERT(); + if (w->w_op == NET_RT_FLAGS && !(rt->rt_flags & w->w_arg)) return 0; if ((rt->rt_flags & RTF_HOST) == 0 @@ -1571,7 +1573,7 @@ sysctl_dumpentry(struct radix_node *rn, void *vw) info.rti_info[RTAX_NETMASK] = rtsock_fix_netmask(rt_key(rt), rt_mask(rt), &ss); info.rti_info[RTAX_GENMASK] = 0; - if (rt->rt_ifp) { + if (rt->rt_ifp && !(rt->rt_ifp->if_flags & IFF_DYING)) { info.rti_info[RTAX_IFP] = rt->rt_ifp->if_addr->ifa_addr; info.rti_info[RTAX_IFA] = rt->rt_ifa->ifa_addr; if (rt->rt_ifp->if_flags & IFF_POINTOPOINT) @@ -1934,8 +1936,10 @@ sysctl_rtsock(SYSCTL_HANDLER_ARGS) rnh = rt_tables_get_rnh(fib, i); if (rnh != NULL) { RIB_RLOCK(rnh); + IFNET_RLOCK_NOSLEEP(); error = rnh->rnh_walktree(&rnh->head, sysctl_dumpentry, &w); + IFNET_RUNLOCK_NOSLEEP(); RIB_RUNLOCK(rnh); } else if (af != 0) error = EAFNOSUPPORT; From owner-svn-src-all@freebsd.org Fri Dec 7 11:10:28 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Dec 7 11:47:43 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Dec 7 12:02:32 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Dec 7 12:05:12 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Dec 7 12:06:04 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Dec 7 12:22:33 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Dec 7 12:32:26 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Dec 7 13:53:30 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 78E9A130E78C; Fri, 7 Dec 2018 13:53:30 +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 1F4F18C300; Fri, 7 Dec 2018 13:53:30 +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 003EF13F9C; Fri, 7 Dec 2018 13:53:30 +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 wB7DrTDW094450; Fri, 7 Dec 2018 13:53:29 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB7DrTAS094448; Fri, 7 Dec 2018 13:53:29 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201812071353.wB7DrTAS094448@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 13:53:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341686 - in stable/12: contrib/elftoolchain/readelf sys/sys X-SVN-Group: stable-12 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in stable/12: contrib/elftoolchain/readelf sys/sys X-SVN-Commit-Revision: 341686 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1F4F18C300 X-Spamd-Result: default: False [-2.93 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.988,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.99)[-0.990,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Dec 2018 13:53:30 -0000 Author: emaste Date: Fri Dec 7 13:53:29 2018 New Revision: 341686 URL: https://svnweb.freebsd.org/changeset/base/341686 Log: MFC r340076: Define NT_FREEBSD_FEATURE_CTL ELF note type This ELF note will be used to allow binaries to opt out of, or in to, upcoming vulnerability mitigation and other features. Modified: stable/12/contrib/elftoolchain/readelf/readelf.c stable/12/sys/sys/elf_common.h Directory Properties: stable/12/ (props changed) Modified: stable/12/contrib/elftoolchain/readelf/readelf.c ============================================================================== --- stable/12/contrib/elftoolchain/readelf/readelf.c Fri Dec 7 12:32:25 2018 (r341685) +++ stable/12/contrib/elftoolchain/readelf/readelf.c Fri Dec 7 13:53:29 2018 (r341686) @@ -1121,6 +1121,7 @@ note_type_freebsd(unsigned int nt) case 1: return "NT_FREEBSD_ABI_TAG"; case 2: return "NT_FREEBSD_NOINIT_TAG"; case 3: return "NT_FREEBSD_ARCH_TAG"; + case 4: return "NT_FREEBSD_FEATURE_CTL"; default: return (note_type_unknown(nt)); } } Modified: stable/12/sys/sys/elf_common.h ============================================================================== --- stable/12/sys/sys/elf_common.h Fri Dec 7 12:32:25 2018 (r341685) +++ stable/12/sys/sys/elf_common.h Fri Dec 7 13:53:29 2018 (r341686) @@ -759,6 +759,7 @@ typedef struct { #define NT_FREEBSD_ABI_TAG 1 #define NT_FREEBSD_NOINIT_TAG 2 #define NT_FREEBSD_ARCH_TAG 3 +#define NT_FREEBSD_FEATURE_CTL 4 /* Values for n_type. Used in core files. */ #define NT_PRSTATUS 1 /* Process status. */ From owner-svn-src-all@freebsd.org Fri Dec 7 14:25:47 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B3166130F0CC; Fri, 7 Dec 2018 14:25:47 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5830C8D0F1; Fri, 7 Dec 2018 14:25:47 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3933A14474; Fri, 7 Dec 2018 14:25:47 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB7EPlOF009895; Fri, 7 Dec 2018 14:25:47 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB7EPk2I009893; Fri, 7 Dec 2018 14:25:46 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201812071425.wB7EPk2I009893@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 14:25:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341687 - stable/12/libexec/rtld-elf X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/libexec/rtld-elf X-SVN-Commit-Revision: 341687 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5830C8D0F1 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.971,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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Dec 2018 14:25:48 -0000 Author: kib Date: Fri Dec 7 14:25:46 2018 New Revision: 341687 URL: https://svnweb.freebsd.org/changeset/base/341687 Log: MFC r340858: rtld: parse FreeBSD Feature Control note on the object load. Modified: stable/12/libexec/rtld-elf/rtld.c stable/12/libexec/rtld-elf/rtld.h Directory Properties: stable/12/ (props changed) Modified: stable/12/libexec/rtld-elf/rtld.c ============================================================================== --- stable/12/libexec/rtld-elf/rtld.c Fri Dec 7 13:53:29 2018 (r341686) +++ stable/12/libexec/rtld-elf/rtld.c Fri Dec 7 14:25:46 2018 (r341687) @@ -1453,6 +1453,7 @@ digest_notes(Obj_Entry *obj, Elf_Addr note_start, Elf_ note->n_descsz != sizeof(int32_t)) continue; if (note->n_type != NT_FREEBSD_ABI_TAG && + note->n_type != NT_FREEBSD_FEATURE_CTL && note->n_type != NT_FREEBSD_NOINIT_TAG) continue; note_name = (const char *)(note + 1); @@ -1466,6 +1467,13 @@ digest_notes(Obj_Entry *obj, Elf_Addr note_start, Elf_ p += roundup2(note->n_namesz, sizeof(Elf32_Addr)); obj->osrel = *(const int32_t *)(p); dbg("note osrel %d", obj->osrel); + break; + case NT_FREEBSD_FEATURE_CTL: + /* FreeBSD ABI feature control note */ + p = (uintptr_t)(note + 1); + p += roundup2(note->n_namesz, sizeof(Elf32_Addr)); + obj->fctl0 = *(const uint32_t *)(p); + dbg("note fctl0 %#x", obj->fctl0); break; case NT_FREEBSD_NOINIT_TAG: /* FreeBSD 'crt does not call init' note */ Modified: stable/12/libexec/rtld-elf/rtld.h ============================================================================== --- stable/12/libexec/rtld-elf/rtld.h Fri Dec 7 13:53:29 2018 (r341686) +++ stable/12/libexec/rtld-elf/rtld.h Fri Dec 7 14:25:46 2018 (r341687) @@ -236,6 +236,7 @@ typedef struct Struct_Obj_Entry { int fini_array_num; /* Number of entries in fini_array */ int32_t osrel; /* OSREL note value */ + uint32_t fctl0; /* FEATURE_CONTROL note desc[0] value */ bool mainprog : 1; /* True if this is the main program */ bool rtld : 1; /* True if this is the dynamic linker */ From owner-svn-src-all@freebsd.org Fri Dec 7 14:45:29 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 097A7130F983; Fri, 7 Dec 2018 14:45:29 +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 A2D5A8DD7D; Fri, 7 Dec 2018 14:45:28 +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 84E7B147B4; Fri, 7 Dec 2018 14:45:28 +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 wB7EjSvm020417; Fri, 7 Dec 2018 14:45:28 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB7EjSY2020416; Fri, 7 Dec 2018 14:45:28 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201812071445.wB7EjSY2020416@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 14:45:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341688 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 341688 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A2D5A8DD7D 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_SHORT(-0.97)[-0.973,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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Dec 2018 14:45:29 -0000 Author: kib Date: Fri Dec 7 14:45:28 2018 New Revision: 341688 URL: https://svnweb.freebsd.org/changeset/base/341688 Log: MFC r340864: Parse FreeBSD Feature Control note on the ELF image activation. Modified: stable/12/sys/kern/imgact_elf.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/imgact_elf.c ============================================================================== --- stable/12/sys/kern/imgact_elf.c Fri Dec 7 14:25:46 2018 (r341687) +++ stable/12/sys/kern/imgact_elf.c Fri Dec 7 14:45:28 2018 (r341688) @@ -88,7 +88,7 @@ __FBSDID("$FreeBSD$"); static int __elfN(check_header)(const Elf_Ehdr *hdr); static Elf_Brandinfo *__elfN(get_brandinfo)(struct image_params *imgp, - const char *interp, int interp_name_len, int32_t *osrel); + const char *interp, int interp_name_len, int32_t *osrel, uint32_t *fctl0); static int __elfN(load_file)(struct proc *p, const char *file, u_long *addr, u_long *entry, size_t pagesize); static int __elfN(load_section)(struct image_params *imgp, vm_ooffset_t offset, @@ -99,7 +99,7 @@ static bool __elfN(freebsd_trans_osrel)(const Elf_Note int32_t *osrel); static bool kfreebsd_trans_osrel(const Elf_Note *note, int32_t *osrel); static boolean_t __elfN(check_note)(struct image_params *imgp, - Elf_Brandnote *checknote, int32_t *osrel); + Elf_Brandnote *checknote, int32_t *osrel, uint32_t *fctl0); static vm_prot_t __elfN(trans_prot)(Elf_Word); static Elf_Word __elfN(untrans_prot)(vm_prot_t); @@ -255,7 +255,7 @@ __elfN(brand_inuse)(Elf_Brandinfo *entry) static Elf_Brandinfo * __elfN(get_brandinfo)(struct image_params *imgp, const char *interp, - int interp_name_len, int32_t *osrel) + int interp_name_len, int32_t *osrel, uint32_t *fctl0) { const Elf_Ehdr *hdr = (const Elf_Ehdr *)imgp->image_header; Elf_Brandinfo *bi, *bi_m; @@ -279,7 +279,8 @@ __elfN(get_brandinfo)(struct image_params *imgp, const continue; if (hdr->e_machine == bi->machine && (bi->flags & (BI_BRAND_NOTE|BI_BRAND_NOTE_MANDATORY)) != 0) { - ret = __elfN(check_note)(imgp, bi->brand_note, osrel); + ret = __elfN(check_note)(imgp, bi->brand_note, osrel, + fctl0); /* Give brand a chance to veto check_note's guess */ if (ret && bi->header_supported) ret = bi->header_supported(imgp); @@ -788,6 +789,7 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i vm_prot_t prot; u_long text_size, data_size, total_size, text_addr, data_addr; u_long seg_size, seg_addr, addr, baddr, et_dyn_addr, entry, proghdr; + uint32_t fctl0; int32_t osrel; int error, i, n, interp_name_len, have_interp; @@ -823,6 +825,7 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i n = error = 0; baddr = 0; osrel = 0; + fctl0 = 0; text_size = data_size = total_size = text_addr = data_addr = 0; entry = proghdr = 0; interp_name_len = 0; @@ -888,7 +891,7 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i } brand_info = __elfN(get_brandinfo)(imgp, interp, interp_name_len, - &osrel); + &osrel, &fctl0); if (brand_info == NULL) { uprintf("ELF binary type \"%u\" not known.\n", hdr->e_ident[EI_OSABI]); @@ -1091,6 +1094,7 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i imgp->interpreted = 0; imgp->reloc_base = addr; imgp->proc->p_osrel = osrel; + imgp->proc->p_fctl0 = fctl0; imgp->proc->p_elf_machine = hdr->e_machine; imgp->proc->p_elf_flags = hdr->e_flags; @@ -2427,29 +2431,64 @@ brandnote_cb(const Elf_Note *note, void *arg0, boolean return (TRUE); } +static Elf_Note fctl_note = { + .n_namesz = sizeof(FREEBSD_ABI_VENDOR), + .n_descsz = sizeof(uint32_t), + .n_type = NT_FREEBSD_FEATURE_CTL, +}; + +struct fctl_cb_arg { + uint32_t *fctl0; +}; + +static boolean_t +note_fctl_cb(const Elf_Note *note, void *arg0, boolean_t *res) +{ + struct fctl_cb_arg *arg; + const Elf32_Word *desc; + uintptr_t p; + + arg = arg0; + p = (uintptr_t)(note + 1); + p += roundup2(note->n_namesz, ELF_NOTE_ROUNDSIZE); + desc = (const Elf32_Word *)p; + *arg->fctl0 = desc[0]; + return (TRUE); +} + /* - * Try to find the appropriate ABI-note section for checknote, - * fetch the osreldate for binary from the ELF OSABI-note. Only the - * first page of the image is searched, the same as for headers. + * Try to find the appropriate ABI-note section for checknote, fetch + * the osreldate and feature control flags for binary from the ELF + * OSABI-note. Only the first page of the image is searched, the same + * as for headers. */ static boolean_t __elfN(check_note)(struct image_params *imgp, Elf_Brandnote *brandnote, - int32_t *osrel) + int32_t *osrel, uint32_t *fctl0) { const Elf_Phdr *phdr; const Elf_Ehdr *hdr; struct brandnote_cb_arg b_arg; - int i; + struct fctl_cb_arg f_arg; + int i, j; hdr = (const Elf_Ehdr *)imgp->image_header; phdr = (const Elf_Phdr *)(imgp->image_header + hdr->e_phoff); b_arg.brandnote = brandnote; b_arg.osrel = osrel; + f_arg.fctl0 = fctl0; for (i = 0; i < hdr->e_phnum; i++) { if (phdr[i].p_type == PT_NOTE && __elfN(parse_notes)(imgp, &brandnote->hdr, brandnote->vendor, &phdr[i], brandnote_cb, &b_arg)) { + for (j = 0; j < hdr->e_phnum; j++) { + if (phdr[j].p_type == PT_NOTE && + __elfN(parse_notes)(imgp, &fctl_note, + FREEBSD_ABI_VENDOR, &phdr[j], + note_fctl_cb, &f_arg)) + break; + } return (TRUE); } } From owner-svn-src-all@freebsd.org Fri Dec 7 15:17:31 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Dec 7 15:19:03 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Dec 7 15:48:43 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0F2EB1311416; Fri, 7 Dec 2018 15:48:43 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A448969D89; Fri, 7 Dec 2018 15:48:42 +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 807DE151AD; Fri, 7 Dec 2018 15:48:42 +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 wB7Fmg9G051455; Fri, 7 Dec 2018 15:48:42 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB7FmgmK051454; Fri, 7 Dec 2018 15:48:42 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201812071548.wB7FmgmK051454@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:48:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341691 - stable/12/usr.bin/top X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/usr.bin/top X-SVN-Commit-Revision: 341691 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A448969D89 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.960,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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Dec 2018 15:48:43 -0000 Author: markj Date: Fri Dec 7 15:48:42 2018 New Revision: 341691 URL: https://svnweb.freebsd.org/changeset/base/341691 Log: MFC r341346: Add missing display messages when toggling modes. PR: 233667 Modified: stable/12/usr.bin/top/top.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.bin/top/top.c ============================================================================== --- stable/12/usr.bin/top/top.c Fri Dec 7 15:19:00 2018 (r341690) +++ stable/12/usr.bin/top/top.c Fri Dec 7 15:48:42 2018 (r341691) @@ -985,6 +985,9 @@ restart: break; case CMD_viewtog: displaymode = displaymode == DISP_IO ? DISP_CPU : DISP_IO; + new_message(MT_standout | MT_delayed, + " Displaying %s statistics.", + displaymode == DISP_IO ? "IO" : "CPU"); header_text = format_header(uname_field); display_header(true); d_header = i_header; @@ -992,9 +995,15 @@ restart: break; case CMD_viewsys: ps.system = !ps.system; + new_message(MT_standout | MT_delayed, + " %sisplaying system processes.", + ps.system ? "D" : "Not d"); break; case CMD_showargs: fmt_flags ^= FMT_SHOWARGS; + new_message(MT_standout | MT_delayed, + " %sisplaying process arguments.", + fmt_flags & FMT_SHOWARGS ? "D" : "Not d"); break; case CMD_order: new_message(MT_standout, From owner-svn-src-all@freebsd.org Fri Dec 7 15:52:51 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Dec 7 15:55:25 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Dec 7 15:56:41 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Dec 7 16:01:52 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Dec 7 16:05:40 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Dec 7 16:10:14 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Dec 7 16:11:46 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Dec 7 16:22:55 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Dec 7 16:33:42 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 18CF91312F02 for ; Fri, 7 Dec 2018 16:33:42 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x82a.google.com (mail-qt1-x82a.google.com [IPv6:2607:f8b0:4864:20::82a]) (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 5D1D96CA71 for ; Fri, 7 Dec 2018 16:33:41 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x82a.google.com with SMTP id n32so5074669qte.11 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=sPsqqr2AO8xh8g4zWXFE/pbzZNM469X73W1lgQPLbVlEwqDyvxib3o/IfbUDM4aCd1 9e0gMbeK/dSw0xPmwLoD7rhKshL1gqwJfNRX9B53A4pQa5dmzH57KCYdG1aov6c1bguL SLE7unM20pEgKMy1i+3s/2V0OmXMHytUcqiRdu3/b89O8picWWRJ+6tIYJKdW9BtiJ0R FH96PsWaFKnT91SV6I8NSUZItuPdpF8QNXz5yqCVrA7BcCu53eMy3chXEkvoU9miB07F QftB/DSo032WQsPgLrNe3XVLcRZn1GDAx5MfU0USiMYX/gFWGyUiQdvuXRyZpGxxJpVw 4/Zw== X-Gm-Message-State: AA+aEWZWUX2O05S97dVj2AfMpB3HZ4qykoG9TOgyzokHqsVwAskvOb++ Dx9K29X1hN07O/9gPhIhI3Kz4fkWCrvKClH0DARqYA== 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: 5D1D96CA71 X-Spamd-Result: default: False [-4.80 / 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)[-0.999,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-all@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; 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)[a.2.8.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_SHORT(-0.97)[-0.973,0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_LAST(0.00)[]; IP_SCORE(-1.82)[ip: (-6.18), 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Dec 7 16:44:53 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Dec 7 16:47:36 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Dec 7 16:51:39 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Dec 7 16:52:53 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Dec 7 17:21:13 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Dec 7 17:21:38 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Dec 7 17:48:09 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Dec 7 18:04:55 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Dec 7 18:10:15 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DEBA71315631 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 53F9470C2A for ; Fri, 7 Dec 2018 18:10:14 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1544206206; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=gAy3QsSyeFHI/arBwX6jMe5JlJOXmRMUtel7c27apGQX+39SU2Ru2pXP0EXtGutpKU00r2YlnAbii oSAzbXq+yoP1ujY2w+Zj2NbC/2YDqM72VqYeX8Gg1Gxpu2vySusLec2iGKFENtGUu/QuoqDMGBwCjf eDxI3H+F3jWICt5hcddM6CV7/WPokdxblvOWI+72iBdcpuzZd9q3+FVPkLEipWmyE2dzcJSzZQP35D ABYfOi9cxO2ke6a+GO7+PiTHGAsq6/dkFT42YnWl7ZFZqpz2d5mQShnTUq8BjVr+eizKgeNwYBdcMh KmDYWk9LP2NGGnOPsGfVOCvr/to3JgQ== 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: 53F9470C2A 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Dec 7 18:28:57 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Dec 7 19:00:18 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Dec 7 19:10:52 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Dec 7 19:34:58 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Dec 7 20:30:02 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Dec 7 20:55:31 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Dec 7 21:40:36 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 55B35131BC1F; Fri, 7 Dec 2018 21:40:36 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F192578825; Fri, 7 Dec 2018 21:40:35 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B894F18BA2; Fri, 7 Dec 2018 21:40:35 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB7LeZjT033511; Fri, 7 Dec 2018 21:40:35 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB7LeZ8Z033510; Fri, 7 Dec 2018 21:40:35 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201812072140.wB7LeZ8Z033510@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 7 Dec 2018 21:40:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-release@freebsd.org Subject: svn commit: r341707 - release/12.0.0 X-SVN-Group: release X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: release/12.0.0 X-SVN-Commit-Revision: 341707 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: F192578825 X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.987,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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Dec 2018 21:40:36 -0000 Author: gjb Date: Fri Dec 7 21:40:35 2018 New Revision: 341707 URL: https://svnweb.freebsd.org/changeset/base/341707 Log: Tag releng/12.0@r341666 as release/12.0.0 (12.0-RELEASE). Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Added: release/12.0.0/ - copied from r341666, releng/12.0/ From owner-svn-src-all@freebsd.org Fri Dec 7 21:42:43 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6C094132153D; Fri, 7 Dec 2018 21:42:43 +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 2B8C079236; Fri, 7 Dec 2018 21:42:43 +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 0D70718D2D; Fri, 7 Dec 2018 21:42:43 +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 wB7LggfG038054; Fri, 7 Dec 2018 21:42:42 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB7LggpG038053; Fri, 7 Dec 2018 21:42:42 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201812072142.wB7LggpG038053@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Fri, 7 Dec 2018 21:42:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r341708 - in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-10 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 341708 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2B8C079236 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_LONG(-0.99)[-0.990,0]; NEURAL_HAM_SHORT(-0.98)[-0.975,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Dec 2018 21:42:43 -0000 Author: cy Date: Fri Dec 7 21:42:41 2018 New Revision: 341708 URL: https://svnweb.freebsd.org/changeset/base/341708 Log: MFC r341280: Clean up a rather useless conditional structure member definition. Modified: stable/10/sys/contrib/ipfilter/netinet/ip_fil.h Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/contrib/ipfilter/netinet/ip_fil.h stable/12/sys/contrib/ipfilter/netinet/ip_fil.h Directory Properties: stable/11/ (props changed) stable/12/ (props changed) Modified: stable/10/sys/contrib/ipfilter/netinet/ip_fil.h ============================================================================== --- stable/10/sys/contrib/ipfilter/netinet/ip_fil.h Fri Dec 7 21:40:35 2018 (r341707) +++ stable/10/sys/contrib/ipfilter/netinet/ip_fil.h Fri Dec 7 21:42:41 2018 (r341708) @@ -1026,11 +1026,7 @@ typedef struct iplog { #define IPLOG_SIZE sizeof(iplog_t) typedef struct ipflog { -#if (defined(NetBSD) && (NetBSD <= 1991011) && (NetBSD >= 199603)) || \ - (defined(OpenBSD) && (OpenBSD >= 199603)) -#else - u_int fl_unit; -#endif + u_int fl_unit; u_32_t fl_rule; u_32_t fl_flags; u_32_t fl_lflags; From owner-svn-src-all@freebsd.org Fri Dec 7 21:42:43 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0FE1B132152F; Fri, 7 Dec 2018 21:42:43 +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 CF67079234; Fri, 7 Dec 2018 21:42:42 +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 B220018D2C; Fri, 7 Dec 2018 21:42:42 +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 wB7LggC9038048; Fri, 7 Dec 2018 21:42:42 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB7LggAZ038047; Fri, 7 Dec 2018 21:42:42 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201812072142.wB7LggAZ038047@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Fri, 7 Dec 2018 21:42:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341708 - in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 341708 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: CF67079234 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.98)[-0.975,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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Dec 2018 21:42:43 -0000 Author: cy Date: Fri Dec 7 21:42:41 2018 New Revision: 341708 URL: https://svnweb.freebsd.org/changeset/base/341708 Log: MFC r341280: Clean up a rather useless conditional structure member definition. Modified: stable/12/sys/contrib/ipfilter/netinet/ip_fil.h Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/contrib/ipfilter/netinet/ip_fil.h stable/11/sys/contrib/ipfilter/netinet/ip_fil.h Directory Properties: stable/10/ (props changed) stable/11/ (props changed) Modified: stable/12/sys/contrib/ipfilter/netinet/ip_fil.h ============================================================================== --- stable/12/sys/contrib/ipfilter/netinet/ip_fil.h Fri Dec 7 21:40:35 2018 (r341707) +++ stable/12/sys/contrib/ipfilter/netinet/ip_fil.h Fri Dec 7 21:42:41 2018 (r341708) @@ -1026,11 +1026,7 @@ typedef struct iplog { #define IPLOG_SIZE sizeof(iplog_t) typedef struct ipflog { -#if (defined(NetBSD) && (NetBSD <= 1991011) && (NetBSD >= 199603)) || \ - (defined(OpenBSD) && (OpenBSD >= 199603)) -#else - u_int fl_unit; -#endif + u_int fl_unit; u_32_t fl_rule; u_32_t fl_flags; u_32_t fl_lflags; From owner-svn-src-all@freebsd.org Fri Dec 7 21:42:42 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D946C132152E; Fri, 7 Dec 2018 21:42:42 +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 7D06979232; Fri, 7 Dec 2018 21:42:42 +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 5F3D318D2B; Fri, 7 Dec 2018 21:42:42 +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 wB7Lgggj038042; Fri, 7 Dec 2018 21:42:42 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB7LggaA038041; Fri, 7 Dec 2018 21:42:42 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201812072142.wB7LggaA038041@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Fri, 7 Dec 2018 21:42:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r341708 - in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 341708 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7D06979232 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_LONG(-0.99)[-0.990,0]; NEURAL_HAM_SHORT(-0.98)[-0.975,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Dec 2018 21:42:43 -0000 Author: cy Date: Fri Dec 7 21:42:41 2018 New Revision: 341708 URL: https://svnweb.freebsd.org/changeset/base/341708 Log: MFC r341280: Clean up a rather useless conditional structure member definition. Modified: stable/11/sys/contrib/ipfilter/netinet/ip_fil.h Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/contrib/ipfilter/netinet/ip_fil.h stable/12/sys/contrib/ipfilter/netinet/ip_fil.h Directory Properties: stable/10/ (props changed) stable/12/ (props changed) Modified: stable/11/sys/contrib/ipfilter/netinet/ip_fil.h ============================================================================== --- stable/11/sys/contrib/ipfilter/netinet/ip_fil.h Fri Dec 7 21:40:35 2018 (r341707) +++ stable/11/sys/contrib/ipfilter/netinet/ip_fil.h Fri Dec 7 21:42:41 2018 (r341708) @@ -1026,11 +1026,7 @@ typedef struct iplog { #define IPLOG_SIZE sizeof(iplog_t) typedef struct ipflog { -#if (defined(NetBSD) && (NetBSD <= 1991011) && (NetBSD >= 199603)) || \ - (defined(OpenBSD) && (OpenBSD >= 199603)) -#else - u_int fl_unit; -#endif + u_int fl_unit; u_32_t fl_rule; u_32_t fl_flags; u_32_t fl_lflags; From owner-svn-src-all@freebsd.org Fri Dec 7 21:57:40 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Dec 7 21:58:09 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Dec 7 23:05:13 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Dec 7 23:07:53 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Dec 7 23:11:23 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Dec 7 23:13:38 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Fri Dec 7 23:31:11 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-all@freebsd.org Sat Dec 8 00:28:29 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BD0DA13266E8; Sat, 8 Dec 2018 00:28:28 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 60E277FECF; Sat, 8 Dec 2018 00:28:28 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 41DCC1A75F; Sat, 8 Dec 2018 00:28:28 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB80SSQk020985; Sat, 8 Dec 2018 00:28:28 GMT (envelope-from eugen@FreeBSD.org) Received: (from eugen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB80SSJM020984; Sat, 8 Dec 2018 00:28:28 GMT (envelope-from eugen@FreeBSD.org) Message-Id: <201812080028.wB80SSJM020984@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eugen set sender to eugen@FreeBSD.org using -f From: Eugene Grosbein Date: Sat, 8 Dec 2018 00:28:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341713 - stable/12/sbin/ping X-SVN-Group: stable-12 X-SVN-Commit-Author: eugen X-SVN-Commit-Paths: stable/12/sbin/ping X-SVN-Commit-Revision: 341713 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 60E277FECF 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.962,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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Dec 2018 00:28:29 -0000 Author: eugen Date: Sat Dec 8 00:28:27 2018 New Revision: 341713 URL: https://svnweb.freebsd.org/changeset/base/341713 Log: MFC r340245: ping(8): improve diagnostics in case of wrong arguments. For example, in case of super-user: $ sudo ping -s -64 127.0.0.1 PING 127.0.0.1 (127.0.0.1): -64 data bytes ping: sendto: Invalid argument For unprivileged user: $ ping -s -64 127.0.0.1 ping: packet size too large: 18446744073709551552 > 56: Operation not permitted Fix this by switching from strtoul() to strtol() for integer arguments and adding explicit checks for negative values. Modified: stable/12/sbin/ping/ping.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/ping/ping.c ============================================================================== --- stable/12/sbin/ping/ping.c Fri Dec 7 23:07:51 2018 (r341712) +++ stable/12/sbin/ping/ping.c Sat Dec 8 00:28:27 2018 (r341713) @@ -242,7 +242,8 @@ main(int argc, char *const *argv) #endif struct sockaddr_in *to; double t; - u_long alarmtimeout, ultmp; + u_long alarmtimeout; + long ltmp; int almost_done, ch, df, hold, i, icmp_len, mib[4], preload; int ssend_errno, srecv_errno, tos, ttl; char ctrl[CMSG_SPACE(sizeof(struct timeval))]; @@ -311,12 +312,12 @@ main(int argc, char *const *argv) options |= F_AUDIBLE; break; case 'c': - ultmp = strtoul(optarg, &ep, 0); - if (*ep || ep == optarg || ultmp > LONG_MAX || !ultmp) + ltmp = strtol(optarg, &ep, 0); + if (*ep || ep == optarg || ltmp > LONG_MAX || ltmp <=0) errx(EX_USAGE, "invalid count of packets to transmit: `%s'", optarg); - npackets = ultmp; + npackets = ltmp; break; case 'D': options |= F_HDRINCL; @@ -334,46 +335,46 @@ main(int argc, char *const *argv) setbuf(stdout, (char *)NULL); break; case 'G': /* Maximum packet size for ping sweep */ - ultmp = strtoul(optarg, &ep, 0); - if (*ep || ep == optarg) + ltmp = strtol(optarg, &ep, 0); + if (*ep || ep == optarg || ltmp <= 0) errx(EX_USAGE, "invalid packet size: `%s'", optarg); - if (uid != 0 && ultmp > DEFDATALEN) { + if (uid != 0 && ltmp > DEFDATALEN) { errno = EPERM; err(EX_NOPERM, - "packet size too large: %lu > %u", - ultmp, DEFDATALEN); + "packet size too large: %ld > %u", + ltmp, DEFDATALEN); } options |= F_SWEEP; - sweepmax = ultmp; + sweepmax = ltmp; break; case 'g': /* Minimum packet size for ping sweep */ - ultmp = strtoul(optarg, &ep, 0); - if (*ep || ep == optarg) + ltmp = strtol(optarg, &ep, 0); + if (*ep || ep == optarg || ltmp <= 0) errx(EX_USAGE, "invalid packet size: `%s'", optarg); - if (uid != 0 && ultmp > DEFDATALEN) { + if (uid != 0 && ltmp > DEFDATALEN) { errno = EPERM; err(EX_NOPERM, - "packet size too large: %lu > %u", - ultmp, DEFDATALEN); + "packet size too large: %ld > %u", + ltmp, DEFDATALEN); } options |= F_SWEEP; - sweepmin = ultmp; + sweepmin = ltmp; break; case 'h': /* Packet size increment for ping sweep */ - ultmp = strtoul(optarg, &ep, 0); - if (*ep || ep == optarg || ultmp < 1) + ltmp = strtol(optarg, &ep, 0); + if (*ep || ep == optarg || ltmp < 1) errx(EX_USAGE, "invalid increment size: `%s'", optarg); - if (uid != 0 && ultmp > DEFDATALEN) { + if (uid != 0 && ltmp > DEFDATALEN) { errno = EPERM; err(EX_NOPERM, - "packet size too large: %lu > %u", - ultmp, DEFDATALEN); + "packet size too large: %ld > %u", + ltmp, DEFDATALEN); } options |= F_SWEEP; - sweepincr = ultmp; + sweepincr = ltmp; break; case 'I': /* multicast interface */ if (inet_aton(optarg, &ifaddr) == 0) @@ -399,15 +400,15 @@ main(int argc, char *const *argv) loop = 0; break; case 'l': - ultmp = strtoul(optarg, &ep, 0); - if (*ep || ep == optarg || ultmp > INT_MAX) + ltmp = strtol(optarg, &ep, 0); + if (*ep || ep == optarg || ltmp > INT_MAX || ltmp < 0) errx(EX_USAGE, "invalid preload value: `%s'", optarg); if (uid) { errno = EPERM; err(EX_NOPERM, "-l flag"); } - preload = ultmp; + preload = ltmp; break; case 'M': switch(optarg[0]) { @@ -425,10 +426,10 @@ main(int argc, char *const *argv) } break; case 'm': /* TTL */ - ultmp = strtoul(optarg, &ep, 0); - if (*ep || ep == optarg || ultmp > MAXTTL) + ltmp = strtol(optarg, &ep, 0); + if (*ep || ep == optarg || ltmp > MAXTTL || ltmp < 0) errx(EX_USAGE, "invalid TTL: `%s'", optarg); - ttl = ultmp; + ttl = ltmp; options |= F_TTL; break; case 'n': @@ -470,24 +471,24 @@ main(int argc, char *const *argv) source = optarg; break; case 's': /* size of packet to send */ - ultmp = strtoul(optarg, &ep, 0); - if (*ep || ep == optarg) + ltmp = strtol(optarg, &ep, 0); + if (*ep || ep == optarg || ltmp < 0) errx(EX_USAGE, "invalid packet size: `%s'", optarg); - if (uid != 0 && ultmp > DEFDATALEN) { + if (uid != 0 && ltmp > DEFDATALEN) { errno = EPERM; err(EX_NOPERM, - "packet size too large: %lu > %u", - ultmp, DEFDATALEN); + "packet size too large: %ld > %u", + ltmp, DEFDATALEN); } - datalen = ultmp; + datalen = ltmp; break; case 'T': /* multicast TTL */ - ultmp = strtoul(optarg, &ep, 0); - if (*ep || ep == optarg || ultmp > MAXTTL) + ltmp = strtol(optarg, &ep, 0); + if (*ep || ep == optarg || ltmp > MAXTTL || ltmp < 0) errx(EX_USAGE, "invalid multicast TTL: `%s'", optarg); - mttl = ultmp; + mttl = ltmp; options |= F_MTTL; break; case 't': @@ -513,10 +514,10 @@ main(int argc, char *const *argv) break; case 'z': options |= F_HDRINCL; - ultmp = strtoul(optarg, &ep, 0); - if (*ep || ep == optarg || ultmp > MAXTOS) + ltmp = strtol(optarg, &ep, 0); + if (*ep || ep == optarg || ltmp > MAXTOS || ltmp < 0) errx(EX_USAGE, "invalid TOS: `%s'", optarg); - tos = ultmp; + tos = ltmp; break; default: usage(); From owner-svn-src-all@freebsd.org Sat Dec 8 00:33:21 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D18E1326A66; Sat, 8 Dec 2018 00:33:21 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 11553803E7; Sat, 8 Dec 2018 00:33:21 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E67EB1A906; Sat, 8 Dec 2018 00:33:20 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB80XKNV025895; Sat, 8 Dec 2018 00:33:20 GMT (envelope-from eugen@FreeBSD.org) Received: (from eugen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB80XKmk025894; Sat, 8 Dec 2018 00:33:20 GMT (envelope-from eugen@FreeBSD.org) Message-Id: <201812080033.wB80XKmk025894@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eugen set sender to eugen@FreeBSD.org using -f From: Eugene Grosbein Date: Sat, 8 Dec 2018 00:33:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r341714 - stable/11/sbin/ping X-SVN-Group: stable-11 X-SVN-Commit-Author: eugen X-SVN-Commit-Paths: stable/11/sbin/ping X-SVN-Commit-Revision: 341714 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 11553803E7 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.962,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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Dec 2018 00:33:21 -0000 Author: eugen Date: Sat Dec 8 00:33:20 2018 New Revision: 341714 URL: https://svnweb.freebsd.org/changeset/base/341714 Log: MFC r340245: ping(8): improve diagnostics in case of wrong arguments. For example, in case of super-user: $ sudo ping -s -64 127.0.0.1 PING 127.0.0.1 (127.0.0.1): -64 data bytes ping: sendto: Invalid argument For unprivileged user: $ ping -s -64 127.0.0.1 ping: packet size too large: 18446744073709551552 > 56: Operation not permitted Fix this by switching from strtoul() to strtol() for integer arguments and adding explicit checks for negative values. Modified: stable/11/sbin/ping/ping.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/ping/ping.c ============================================================================== --- stable/11/sbin/ping/ping.c Sat Dec 8 00:28:27 2018 (r341713) +++ stable/11/sbin/ping/ping.c Sat Dec 8 00:33:20 2018 (r341714) @@ -246,7 +246,8 @@ main(int argc, char *const *argv) #endif struct sockaddr_in *to; double t; - u_long alarmtimeout, ultmp; + u_long alarmtimeout; + long ltmp; int almost_done, ch, df, hold, i, icmp_len, mib[4], preload; int ssend_errno, srecv_errno, tos, ttl; char ctrl[CMSG_SPACE(sizeof(struct timeval))]; @@ -315,12 +316,12 @@ main(int argc, char *const *argv) options |= F_AUDIBLE; break; case 'c': - ultmp = strtoul(optarg, &ep, 0); - if (*ep || ep == optarg || ultmp > LONG_MAX || !ultmp) + ltmp = strtol(optarg, &ep, 0); + if (*ep || ep == optarg || ltmp > LONG_MAX || ltmp <=0) errx(EX_USAGE, "invalid count of packets to transmit: `%s'", optarg); - npackets = ultmp; + npackets = ltmp; break; case 'D': options |= F_HDRINCL; @@ -338,46 +339,46 @@ main(int argc, char *const *argv) setbuf(stdout, (char *)NULL); break; case 'G': /* Maximum packet size for ping sweep */ - ultmp = strtoul(optarg, &ep, 0); - if (*ep || ep == optarg) + ltmp = strtol(optarg, &ep, 0); + if (*ep || ep == optarg || ltmp <= 0) errx(EX_USAGE, "invalid packet size: `%s'", optarg); - if (uid != 0 && ultmp > DEFDATALEN) { + if (uid != 0 && ltmp > DEFDATALEN) { errno = EPERM; err(EX_NOPERM, - "packet size too large: %lu > %u", - ultmp, DEFDATALEN); + "packet size too large: %ld > %u", + ltmp, DEFDATALEN); } options |= F_SWEEP; - sweepmax = ultmp; + sweepmax = ltmp; break; case 'g': /* Minimum packet size for ping sweep */ - ultmp = strtoul(optarg, &ep, 0); - if (*ep || ep == optarg) + ltmp = strtol(optarg, &ep, 0); + if (*ep || ep == optarg || ltmp <= 0) errx(EX_USAGE, "invalid packet size: `%s'", optarg); - if (uid != 0 && ultmp > DEFDATALEN) { + if (uid != 0 && ltmp > DEFDATALEN) { errno = EPERM; err(EX_NOPERM, - "packet size too large: %lu > %u", - ultmp, DEFDATALEN); + "packet size too large: %ld > %u", + ltmp, DEFDATALEN); } options |= F_SWEEP; - sweepmin = ultmp; + sweepmin = ltmp; break; case 'h': /* Packet size increment for ping sweep */ - ultmp = strtoul(optarg, &ep, 0); - if (*ep || ep == optarg || ultmp < 1) + ltmp = strtol(optarg, &ep, 0); + if (*ep || ep == optarg || ltmp < 1) errx(EX_USAGE, "invalid increment size: `%s'", optarg); - if (uid != 0 && ultmp > DEFDATALEN) { + if (uid != 0 && ltmp > DEFDATALEN) { errno = EPERM; err(EX_NOPERM, - "packet size too large: %lu > %u", - ultmp, DEFDATALEN); + "packet size too large: %ld > %u", + ltmp, DEFDATALEN); } options |= F_SWEEP; - sweepincr = ultmp; + sweepincr = ltmp; break; case 'I': /* multicast interface */ if (inet_aton(optarg, &ifaddr) == 0) @@ -403,15 +404,15 @@ main(int argc, char *const *argv) loop = 0; break; case 'l': - ultmp = strtoul(optarg, &ep, 0); - if (*ep || ep == optarg || ultmp > INT_MAX) + ltmp = strtol(optarg, &ep, 0); + if (*ep || ep == optarg || ltmp > INT_MAX || ltmp < 0) errx(EX_USAGE, "invalid preload value: `%s'", optarg); if (uid) { errno = EPERM; err(EX_NOPERM, "-l flag"); } - preload = ultmp; + preload = ltmp; break; case 'M': switch(optarg[0]) { @@ -429,10 +430,10 @@ main(int argc, char *const *argv) } break; case 'm': /* TTL */ - ultmp = strtoul(optarg, &ep, 0); - if (*ep || ep == optarg || ultmp > MAXTTL) + ltmp = strtol(optarg, &ep, 0); + if (*ep || ep == optarg || ltmp > MAXTTL || ltmp < 0) errx(EX_USAGE, "invalid TTL: `%s'", optarg); - ttl = ultmp; + ttl = ltmp; options |= F_TTL; break; case 'n': @@ -474,24 +475,24 @@ main(int argc, char *const *argv) source = optarg; break; case 's': /* size of packet to send */ - ultmp = strtoul(optarg, &ep, 0); - if (*ep || ep == optarg) + ltmp = strtol(optarg, &ep, 0); + if (*ep || ep == optarg || ltmp < 0) errx(EX_USAGE, "invalid packet size: `%s'", optarg); - if (uid != 0 && ultmp > DEFDATALEN) { + if (uid != 0 && ltmp > DEFDATALEN) { errno = EPERM; err(EX_NOPERM, - "packet size too large: %lu > %u", - ultmp, DEFDATALEN); + "packet size too large: %ld > %u", + ltmp, DEFDATALEN); } - datalen = ultmp; + datalen = ltmp; break; case 'T': /* multicast TTL */ - ultmp = strtoul(optarg, &ep, 0); - if (*ep || ep == optarg || ultmp > MAXTTL) + ltmp = strtol(optarg, &ep, 0); + if (*ep || ep == optarg || ltmp > MAXTTL || ltmp < 0) errx(EX_USAGE, "invalid multicast TTL: `%s'", optarg); - mttl = ultmp; + mttl = ltmp; options |= F_MTTL; break; case 't': @@ -517,10 +518,10 @@ main(int argc, char *const *argv) break; case 'z': options |= F_HDRINCL; - ultmp = strtoul(optarg, &ep, 0); - if (*ep || ep == optarg || ultmp > MAXTOS) + ltmp = strtol(optarg, &ep, 0); + if (*ep || ep == optarg || ltmp > MAXTOS || ltmp < 0) errx(EX_USAGE, "invalid TOS: `%s'", optarg); - tos = ultmp; + tos = ltmp; break; default: usage(); From owner-svn-src-all@freebsd.org Sat Dec 8 00:44:45 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5AB8713270A0; Sat, 8 Dec 2018 00:44:45 +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 E7D6280DFD; Sat, 8 Dec 2018 00:44:44 +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 C51C21AA9B; Sat, 8 Dec 2018 00:44:44 +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 wB80iiuE031363; Sat, 8 Dec 2018 00:44:44 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB80ii65031362; Sat, 8 Dec 2018 00:44:44 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201812080044.wB80ii65031362@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 00:44:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341715 - in stable/12/sys: arm/arm i386/i386 X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/12/sys: arm/arm i386/i386 X-SVN-Commit-Revision: 341715 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E7D6280DFD X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.996,0]; NEURAL_HAM_SHORT(-0.96)[-0.960,0]; NEURAL_HAM_LONG(-0.99)[-0.990,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Dec 2018 00:44:45 -0000 Author: kib Date: Sat Dec 8 00:44:44 2018 New Revision: 341715 URL: https://svnweb.freebsd.org/changeset/base/341715 Log: MFC r341374: Correct the tunable name in the message. PR: 231577 Modified: stable/12/sys/arm/arm/pmap-v6.c stable/12/sys/i386/i386/pmap.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm/arm/pmap-v6.c ============================================================================== --- stable/12/sys/arm/arm/pmap-v6.c Sat Dec 8 00:33:20 2018 (r341714) +++ stable/12/sys/arm/arm/pmap-v6.c Sat Dec 8 00:44:44 2018 (r341715) @@ -3037,7 +3037,7 @@ get_pv_entry(pmap_t pmap, boolean_t try) if (ratecheck(&lastprint, &printinterval)) printf("Approaching the limit on PV entries, consider " "increasing either the vm.pmap.shpgperproc or the " - "vm.pmap.pv_entry_max tunable.\n"); + "vm.pmap.pv_entries tunable.\n"); retry: pc = TAILQ_FIRST(&pmap->pm_pvchunk); if (pc != NULL) { Modified: stable/12/sys/i386/i386/pmap.c ============================================================================== --- stable/12/sys/i386/i386/pmap.c Sat Dec 8 00:33:20 2018 (r341714) +++ stable/12/sys/i386/i386/pmap.c Sat Dec 8 00:44:44 2018 (r341715) @@ -2568,7 +2568,7 @@ get_pv_entry(pmap_t pmap, boolean_t try) if (ratecheck(&lastprint, &printinterval)) printf("Approaching the limit on PV entries, consider " "increasing either the vm.pmap.shpgperproc or the " - "vm.pmap.pv_entry_max tunable.\n"); + "vm.pmap.pv_entries tunable.\n"); retry: pc = TAILQ_FIRST(&pmap->pm_pvchunk); if (pc != NULL) { From owner-svn-src-all@freebsd.org Sat Dec 8 00:46:06 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 02A6E13271FE; Sat, 8 Dec 2018 00:46: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 9EE8E81028; Sat, 8 Dec 2018 00:46: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 806E61AA9D; Sat, 8 Dec 2018 00:46: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 wB80k5cv031500; Sat, 8 Dec 2018 00:46:05 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB80k5AB031499; Sat, 8 Dec 2018 00:46:05 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201812080046.wB80k5AB031499@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 00:46:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341716 - stable/12/sys/vm X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/vm X-SVN-Commit-Revision: 341716 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9EE8E81028 X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.996,0]; NEURAL_HAM_SHORT(-0.96)[-0.960,0]; NEURAL_HAM_LONG(-0.99)[-0.990,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Dec 2018 00:46:06 -0000 Author: kib Date: Sat Dec 8 00:46:05 2018 New Revision: 341716 URL: https://svnweb.freebsd.org/changeset/base/341716 Log: MFC r341375: Allow to create swap zone larger than v_page_count / 2. Modified: stable/12/sys/vm/swap_pager.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/vm/swap_pager.c ============================================================================== --- stable/12/sys/vm/swap_pager.c Sat Dec 8 00:44:44 2018 (r341715) +++ stable/12/sys/vm/swap_pager.c Sat Dec 8 00:46:05 2018 (r341716) @@ -547,12 +547,12 @@ swap_pager_swap_init(void) mtx_unlock(&pbuf_mtx); /* - * Initialize our zone, guessing on the number we need based - * on the number of pages in the system. + * Initialize our zone, taking the user's requested size or + * estimating the number we need based on the number of pages + * in the system. */ - n = vm_cnt.v_page_count / 2; - if (maxswzone && n > maxswzone / sizeof(struct swblk)) - n = maxswzone / sizeof(struct swblk); + n = maxswzone != 0 ? maxswzone / sizeof(struct swblk) : + vm_cnt.v_page_count / 2; swpctrie_zone = uma_zcreate("swpctrie", pctrie_node_size(), NULL, NULL, pctrie_zone_init, NULL, UMA_ALIGN_PTR, UMA_ZONE_VM); if (swpctrie_zone == NULL) @@ -580,7 +580,7 @@ swap_pager_swap_init(void) n = uma_zone_get_max(swblk_zone); if (n < n2) - printf("Swap blk zone entries reduced from %lu to %lu.\n", + printf("Swap blk zone entries changed from %lu to %lu.\n", n2, n); swap_maxpages = n * SWAP_META_PAGES; swzone = n * sizeof(struct swblk); From owner-svn-src-all@freebsd.org Sat Dec 8 00:47:24 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 31B38132737A; Sat, 8 Dec 2018 00:47:24 +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 B85FE811EF; Sat, 8 Dec 2018 00:47:23 +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 9AF311AA9E; Sat, 8 Dec 2018 00:47:23 +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 wB80lNKP031605; Sat, 8 Dec 2018 00:47:23 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB80lNxl031603; Sat, 8 Dec 2018 00:47:23 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201812080047.wB80lNxl031603@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 00:47:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r341717 - in stable/11/sys: arm/arm i386/i386 X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/11/sys: arm/arm i386/i386 X-SVN-Commit-Revision: 341717 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B85FE811EF X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.996,0]; NEURAL_HAM_SHORT(-0.96)[-0.960,0]; NEURAL_HAM_LONG(-0.99)[-0.990,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Dec 2018 00:47:24 -0000 Author: kib Date: Sat Dec 8 00:47:22 2018 New Revision: 341717 URL: https://svnweb.freebsd.org/changeset/base/341717 Log: MFC r341374: Correct the tunable name in the message. PR: 231577 Modified: stable/11/sys/arm/arm/pmap-v6.c stable/11/sys/i386/i386/pmap.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/arm/pmap-v6.c ============================================================================== --- stable/11/sys/arm/arm/pmap-v6.c Sat Dec 8 00:46:05 2018 (r341716) +++ stable/11/sys/arm/arm/pmap-v6.c Sat Dec 8 00:47:22 2018 (r341717) @@ -3028,7 +3028,7 @@ get_pv_entry(pmap_t pmap, boolean_t try) if (ratecheck(&lastprint, &printinterval)) printf("Approaching the limit on PV entries, consider " "increasing either the vm.pmap.shpgperproc or the " - "vm.pmap.pv_entry_max tunable.\n"); + "vm.pmap.pv_entries tunable.\n"); retry: pc = TAILQ_FIRST(&pmap->pm_pvchunk); if (pc != NULL) { Modified: stable/11/sys/i386/i386/pmap.c ============================================================================== --- stable/11/sys/i386/i386/pmap.c Sat Dec 8 00:46:05 2018 (r341716) +++ stable/11/sys/i386/i386/pmap.c Sat Dec 8 00:47:22 2018 (r341717) @@ -2414,7 +2414,7 @@ get_pv_entry(pmap_t pmap, boolean_t try) if (ratecheck(&lastprint, &printinterval)) printf("Approaching the limit on PV entries, consider " "increasing either the vm.pmap.shpgperproc or the " - "vm.pmap.pv_entry_max tunable.\n"); + "vm.pmap.pv_entries tunable.\n"); retry: pc = TAILQ_FIRST(&pmap->pm_pvchunk); if (pc != NULL) { From owner-svn-src-all@freebsd.org Sat Dec 8 00:48:12 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 99CD11327488; Sat, 8 Dec 2018 00:48:12 +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 40F0E8141F; Sat, 8 Dec 2018 00:48:12 +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 1928A1AAA1; Sat, 8 Dec 2018 00:48:11 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB80mAN3031837; Sat, 8 Dec 2018 00:48:10 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB80mAi7031836; Sat, 8 Dec 2018 00:48:10 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201812080048.wB80mAi7031836@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 00:48:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r341718 - stable/11/sys/vm X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/vm X-SVN-Commit-Revision: 341718 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 40F0E8141F X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.996,0]; NEURAL_HAM_SHORT(-0.96)[-0.960,0]; NEURAL_HAM_LONG(-0.99)[-0.990,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Dec 2018 00:48:12 -0000 Author: kib Date: Sat Dec 8 00:48:10 2018 New Revision: 341718 URL: https://svnweb.freebsd.org/changeset/base/341718 Log: MFC r341375: Allow to create swap zone larger than v_page_count / 2. Modified: stable/11/sys/vm/swap_pager.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/swap_pager.c ============================================================================== --- stable/11/sys/vm/swap_pager.c Sat Dec 8 00:47:22 2018 (r341717) +++ stable/11/sys/vm/swap_pager.c Sat Dec 8 00:48:10 2018 (r341718) @@ -514,12 +514,12 @@ swap_pager_swap_init(void) mtx_unlock(&pbuf_mtx); /* - * Initialize our zone, guessing on the number we need based - * on the number of pages in the system. + * Initialize our zone, taking the user's requested size or + * estimating the number we need based on the number of pages + * in the system. */ - n = vm_cnt.v_page_count / 2; - if (maxswzone && n > maxswzone / sizeof(struct swblk)) - n = maxswzone / sizeof(struct swblk); + n = maxswzone != 0 ? maxswzone / sizeof(struct swblk) : + vm_cnt.v_page_count / 2; swpctrie_zone = uma_zcreate("swpctrie", pctrie_node_size(), NULL, NULL, pctrie_zone_init, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE | UMA_ZONE_VM); @@ -549,7 +549,7 @@ swap_pager_swap_init(void) n = uma_zone_get_max(swblk_zone); if (n < n2) - printf("Swap blk zone entries reduced from %lu to %lu.\n", + printf("Swap blk zone entries changed from %lu to %lu.\n", n2, n); swap_maxpages = n * SWAP_META_PAGES; swzone = n * sizeof(struct swblk); From owner-svn-src-all@freebsd.org Sat Dec 8 03:49:49 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-all@freebsd.org Sat Dec 8 06:34:14 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-all@freebsd.org Sat Dec 8 04:53:10 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-all@freebsd.org Sat Dec 8 06:30:42 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-all@freebsd.org Sat Dec 8 06:31:44 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-all@freebsd.org Sat Dec 8 10:22:13 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-all@freebsd.org Sat Dec 8 11:38:40 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-all@freebsd.org Sat Dec 8 12:52:10 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-all@freebsd.org Sat Dec 8 12:49:21 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-all@freebsd.org Sat Dec 8 14:04:58 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-all@freebsd.org Sat Dec 8 14:32:21 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 50CB9131864F; Sat, 8 Dec 2018 14:32:21 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E2C7180745; Sat, 8 Dec 2018 14:32:20 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4B6542367D; Sat, 8 Dec 2018 14:32:20 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB8EWKPS060582; Sat, 8 Dec 2018 14:32:20 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB8EWKhm060581; Sat, 8 Dec 2018 14:32:20 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201812081432.wB8EWKhm060581@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 8 Dec 2018 14:32:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r341736 - vendor/lldb/lldb-release_70-r348686 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/lldb/lldb-release_70-r348686 X-SVN-Commit-Revision: 341736 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E2C7180745 X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.996,0]; NEURAL_HAM_SHORT(-0.96)[-0.961,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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Dec 2018 14:32:21 -0000 Author: dim Date: Sat Dec 8 14:32:19 2018 New Revision: 341736 URL: https://svnweb.freebsd.org/changeset/base/341736 Log: Tag lldb release_70 branch r348686. Added: vendor/lldb/lldb-release_70-r348686/ - copied from r341735, vendor/lldb/dist-release_70/ From owner-svn-src-all@freebsd.org Sat Dec 8 14:32:14 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 109E01318507; Sat, 8 Dec 2018 14:32:14 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AC3DB806C9; Sat, 8 Dec 2018 14:32:13 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BF1362366B; Sat, 8 Dec 2018 14:32:07 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB8EW7Of060390; Sat, 8 Dec 2018 14:32:07 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB8EW7p3060389; Sat, 8 Dec 2018 14:32:07 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201812081432.wB8EW7p3060389@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 8 Dec 2018 14:32:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r341732 - vendor/compiler-rt/compiler-rt-release_70-r348686 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/compiler-rt/compiler-rt-release_70-r348686 X-SVN-Commit-Revision: 341732 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: AC3DB806C9 X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.996,0]; NEURAL_HAM_SHORT(-0.96)[-0.961,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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Dec 2018 14:32:14 -0000 Author: dim Date: Sat Dec 8 14:32:07 2018 New Revision: 341732 URL: https://svnweb.freebsd.org/changeset/base/341732 Log: Tag compiler-rt release_70 branch r348686. Added: vendor/compiler-rt/compiler-rt-release_70-r348686/ - copied from r341731, vendor/compiler-rt/dist-release_70/ From owner-svn-src-all@freebsd.org Sat Dec 8 14:32:19 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 30A001318517; Sat, 8 Dec 2018 14:32:19 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1C58180707; Sat, 8 Dec 2018 14:32:16 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 811C723675; Sat, 8 Dec 2018 14:32:13 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB8EWD45060487; Sat, 8 Dec 2018 14:32:13 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB8EWDxN060486; Sat, 8 Dec 2018 14:32:13 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201812081432.wB8EWDxN060486@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 8 Dec 2018 14:32:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r341734 - vendor/libc++/libc++-release_70-r348686 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/libc++/libc++-release_70-r348686 X-SVN-Commit-Revision: 341734 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1C58180707 X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.996,0]; NEURAL_HAM_SHORT(-0.96)[-0.961,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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Dec 2018 14:32:19 -0000 Author: dim Date: Sat Dec 8 14:32:13 2018 New Revision: 341734 URL: https://svnweb.freebsd.org/changeset/base/341734 Log: Tag libc++ release_70 branch r348686. Added: vendor/libc++/libc++-release_70-r348686/ - copied from r341733, vendor/libc++/dist-release_70/ From owner-svn-src-all@freebsd.org Sat Dec 8 14:32:13 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AC8C41318504; Sat, 8 Dec 2018 14:32:13 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 50ED5806C0; Sat, 8 Dec 2018 14:32:13 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 03DA82366A; Sat, 8 Dec 2018 14:32:05 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB8EW46g060342; Sat, 8 Dec 2018 14:32:04 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB8EW4l5060341; Sat, 8 Dec 2018 14:32:04 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201812081432.wB8EW4l5060341@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 8 Dec 2018 14:32:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r341731 - vendor/clang/clang-release_70-r348686 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/clang/clang-release_70-r348686 X-SVN-Commit-Revision: 341731 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 50ED5806C0 X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.996,0]; NEURAL_HAM_SHORT(-0.96)[-0.961,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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Dec 2018 14:32:13 -0000 Author: dim Date: Sat Dec 8 14:32:04 2018 New Revision: 341731 URL: https://svnweb.freebsd.org/changeset/base/341731 Log: Tag clang release_70 branch r348686. Added: vendor/clang/clang-release_70-r348686/ - copied from r341730, vendor/clang/dist-release_70/ From owner-svn-src-all@freebsd.org Sat Dec 8 14:32:19 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 79F66131851E; Sat, 8 Dec 2018 14:32:19 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AC52E80711; Sat, 8 Dec 2018 14:32:16 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7252F23678; Sat, 8 Dec 2018 14:32:16 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB8EWG0Y060533; Sat, 8 Dec 2018 14:32:16 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB8EWGlb060532; Sat, 8 Dec 2018 14:32:16 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201812081432.wB8EWGlb060532@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 8 Dec 2018 14:32:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r341735 - vendor/lld/lld-release_70-r348686 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/lld/lld-release_70-r348686 X-SVN-Commit-Revision: 341735 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: AC52E80711 X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.996,0]; NEURAL_HAM_SHORT(-0.96)[-0.961,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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Dec 2018 14:32:19 -0000 Author: dim Date: Sat Dec 8 14:32:16 2018 New Revision: 341735 URL: https://svnweb.freebsd.org/changeset/base/341735 Log: Tag lld release_70 branch r348686. Added: vendor/lld/lld-release_70-r348686/ - copied from r341734, vendor/lld/dist-release_70/ From owner-svn-src-all@freebsd.org Sat Dec 8 14:31:56 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0E20213184F3; Sat, 8 Dec 2018 14:31:56 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AA337803F2; Sat, 8 Dec 2018 14:31:55 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7161E23562; Sat, 8 Dec 2018 14:31:55 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB8EVtIU060228; Sat, 8 Dec 2018 14:31:55 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB8EVtTo060227; Sat, 8 Dec 2018 14:31:55 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201812081431.wB8EVtTo060227@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 8 Dec 2018 14:31:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r341729 - vendor/llvm/llvm-release_70-r348686 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/llvm/llvm-release_70-r348686 X-SVN-Commit-Revision: 341729 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: AA337803F2 X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.996,0]; NEURAL_HAM_SHORT(-0.96)[-0.961,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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Dec 2018 14:31:56 -0000 Author: dim Date: Sat Dec 8 14:31:55 2018 New Revision: 341729 URL: https://svnweb.freebsd.org/changeset/base/341729 Log: Tag llvm release_70 branch r348686. Added: vendor/llvm/llvm-release_70-r348686/ - copied from r341728, vendor/llvm/dist-release_70/ From owner-svn-src-all@freebsd.org Sat Dec 8 14:31:53 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3368513184EA; Sat, 8 Dec 2018 14:31:53 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D4629803E8; Sat, 8 Dec 2018 14:31:52 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9A9F22355B; Sat, 8 Dec 2018 14:31:52 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB8EVqEs060181; Sat, 8 Dec 2018 14:31:52 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB8EVn8x060167; Sat, 8 Dec 2018 14:31:49 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201812081431.wB8EVn8x060167@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 8 Dec 2018 14:31:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r341728 - in vendor/llvm/dist-release_70: include/llvm/DebugInfo/PDB/Native include/llvm/ExecutionEngine/Orc include/llvm/ProfileData/Coverage lib/Analysis lib/ExecutionEngine/RuntimeDy... X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in vendor/llvm/dist-release_70: include/llvm/DebugInfo/PDB/Native include/llvm/ExecutionEngine/Orc include/llvm/ProfileData/Coverage lib/Analysis lib/ExecutionEngine/RuntimeDyld lib/Target/AArch64 lib... X-SVN-Commit-Revision: 341728 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D4629803E8 X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.972,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.99)[-0.993,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Dec 2018 14:31:53 -0000 Author: dim Date: Sat Dec 8 14:31:49 2018 New Revision: 341728 URL: https://svnweb.freebsd.org/changeset/base/341728 Log: Vendor import of llvm release_70 branch r348686: https://llvm.org/svn/llvm-project/llvm/branches/release_70@348686 Modified: vendor/llvm/dist-release_70/include/llvm/DebugInfo/PDB/Native/GlobalsStream.h vendor/llvm/dist-release_70/include/llvm/DebugInfo/PDB/Native/ModuleDebugStream.h vendor/llvm/dist-release_70/include/llvm/ExecutionEngine/Orc/Core.h vendor/llvm/dist-release_70/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h vendor/llvm/dist-release_70/include/llvm/ProfileData/Coverage/CoverageMapping.h vendor/llvm/dist-release_70/lib/Analysis/MemorySSA.cpp vendor/llvm/dist-release_70/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp vendor/llvm/dist-release_70/lib/Target/AArch64/AArch64ISelLowering.cpp vendor/llvm/dist-release_70/lib/Target/AMDGPU/AMDGPULibFunc.cpp vendor/llvm/dist-release_70/lib/Transforms/InstCombine/InstCombineCompares.cpp vendor/llvm/dist-release_70/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp vendor/llvm/dist-release_70/test/CodeGen/AArch64/arm64-ccmp.ll vendor/llvm/dist-release_70/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-sge-to-icmp-sle.ll vendor/llvm/dist-release_70/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-slt-to-icmp-sgt.ll Modified: vendor/llvm/dist-release_70/include/llvm/DebugInfo/PDB/Native/GlobalsStream.h ============================================================================== --- vendor/llvm/dist-release_70/include/llvm/DebugInfo/PDB/Native/GlobalsStream.h Sat Dec 8 14:04:57 2018 (r341727) +++ vendor/llvm/dist-release_70/include/llvm/DebugInfo/PDB/Native/GlobalsStream.h Sat Dec 8 14:31:49 2018 (r341728) @@ -30,8 +30,6 @@ class GSIHashIterator GSIHashIterator, FixedStreamArrayIterator, std::random_access_iterator_tag, const uint32_t> { public: - GSIHashIterator() = default; - template GSIHashIterator(T &&v) : GSIHashIterator::iterator_adaptor_base(std::forward(v)) {} Modified: vendor/llvm/dist-release_70/include/llvm/DebugInfo/PDB/Native/ModuleDebugStream.h ============================================================================== --- vendor/llvm/dist-release_70/include/llvm/DebugInfo/PDB/Native/ModuleDebugStream.h Sat Dec 8 14:04:57 2018 (r341727) +++ vendor/llvm/dist-release_70/include/llvm/DebugInfo/PDB/Native/ModuleDebugStream.h Sat Dec 8 14:31:49 2018 (r341728) @@ -49,7 +49,7 @@ class ModuleDebugStreamRef { (public) BinarySubstreamRef getC13LinesSubstream() const; BinarySubstreamRef getGlobalRefsSubstream() const; - ModuleDebugStreamRef &operator=(ModuleDebugStreamRef &&Other) = default; + ModuleDebugStreamRef &operator=(ModuleDebugStreamRef &&Other) = delete; iterator_range subsections() const; codeview::DebugSubsectionArray getSubsectionsArray() const { Modified: vendor/llvm/dist-release_70/include/llvm/ExecutionEngine/Orc/Core.h ============================================================================== --- vendor/llvm/dist-release_70/include/llvm/ExecutionEngine/Orc/Core.h Sat Dec 8 14:04:57 2018 (r341727) +++ vendor/llvm/dist-release_70/include/llvm/ExecutionEngine/Orc/Core.h Sat Dec 8 14:31:49 2018 (r341728) @@ -126,7 +126,7 @@ class MaterializationResponsibility { public: MaterializationResponsibility(MaterializationResponsibility &&) = default; MaterializationResponsibility & - operator=(MaterializationResponsibility &&) = default; + operator=(MaterializationResponsibility &&) = delete; /// Destruct a MaterializationResponsibility instance. In debug mode /// this asserts that all symbols being tracked have been either Modified: vendor/llvm/dist-release_70/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h ============================================================================== --- vendor/llvm/dist-release_70/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h Sat Dec 8 14:04:57 2018 (r341727) +++ vendor/llvm/dist-release_70/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h Sat Dec 8 14:31:49 2018 (r341728) @@ -70,8 +70,7 @@ class OrcRemoteTargetClient (public) RemoteRTDyldMemoryManager & operator=(const RemoteRTDyldMemoryManager &) = delete; RemoteRTDyldMemoryManager(RemoteRTDyldMemoryManager &&) = default; - RemoteRTDyldMemoryManager & - operator=(RemoteRTDyldMemoryManager &&) = default; + RemoteRTDyldMemoryManager &operator=(RemoteRTDyldMemoryManager &&) = delete; uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment, unsigned SectionID, Modified: vendor/llvm/dist-release_70/include/llvm/ProfileData/Coverage/CoverageMapping.h ============================================================================== --- vendor/llvm/dist-release_70/include/llvm/ProfileData/Coverage/CoverageMapping.h Sat Dec 8 14:04:57 2018 (r341727) +++ vendor/llvm/dist-release_70/include/llvm/ProfileData/Coverage/CoverageMapping.h Sat Dec 8 14:31:49 2018 (r341728) @@ -641,8 +641,6 @@ class LineCoverageIterator (public) this->operator++(); } - LineCoverageIterator &operator=(const LineCoverageIterator &R) = default; - bool operator==(const LineCoverageIterator &R) const { return &CD == &R.CD && Next == R.Next && Ended == R.Ended; } Modified: vendor/llvm/dist-release_70/lib/Analysis/MemorySSA.cpp ============================================================================== --- vendor/llvm/dist-release_70/lib/Analysis/MemorySSA.cpp Sat Dec 8 14:04:57 2018 (r341727) +++ vendor/llvm/dist-release_70/lib/Analysis/MemorySSA.cpp Sat Dec 8 14:31:49 2018 (r341728) @@ -119,7 +119,6 @@ class MemoryLocOrCall { public: bool IsCall = false; - MemoryLocOrCall() = default; MemoryLocOrCall(MemoryUseOrDef *MUD) : MemoryLocOrCall(MUD->getMemoryInst()) {} MemoryLocOrCall(const MemoryUseOrDef *MUD) Modified: vendor/llvm/dist-release_70/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp ============================================================================== --- vendor/llvm/dist-release_70/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp Sat Dec 8 14:04:57 2018 (r341727) +++ vendor/llvm/dist-release_70/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp Sat Dec 8 14:31:49 2018 (r341728) @@ -275,7 +275,7 @@ RuntimeDyldImpl::loadObjectImpl(const object::ObjectFi uint64_t Size = I->getCommonSize(); if (!CommonAlign) CommonAlign = Align; - CommonSize += alignTo(CommonSize, Align) + Size; + CommonSize = alignTo(CommonSize, Align) + Size; CommonSymbolsToAllocate.push_back(*I); } } else Modified: vendor/llvm/dist-release_70/lib/Target/AArch64/AArch64ISelLowering.cpp ============================================================================== --- vendor/llvm/dist-release_70/lib/Target/AArch64/AArch64ISelLowering.cpp Sat Dec 8 14:04:57 2018 (r341727) +++ vendor/llvm/dist-release_70/lib/Target/AArch64/AArch64ISelLowering.cpp Sat Dec 8 14:31:49 2018 (r341728) @@ -1515,39 +1515,50 @@ static SDValue emitComparison(SDValue LHS, SDValue RHS /// The CCMP/CCMN/FCCMP/FCCMPE instructions allow the conditional execution of /// a comparison. They set the NZCV flags to a predefined value if their /// predicate is false. This allows to express arbitrary conjunctions, for -/// example "cmp 0 (and (setCA (cmp A)) (setCB (cmp B))))" +/// example "cmp 0 (and (setCA (cmp A)) (setCB (cmp B)))" /// expressed as: /// cmp A /// ccmp B, inv(CB), CA /// check for CB flags /// -/// In general we can create code for arbitrary "... (and (and A B) C)" -/// sequences. We can also implement some "or" expressions, because "(or A B)" -/// is equivalent to "not (and (not A) (not B))" and we can implement some -/// negation operations: -/// We can negate the results of a single comparison by inverting the flags -/// used when the predicate fails and inverting the flags tested in the next -/// instruction; We can also negate the results of the whole previous -/// conditional compare sequence by inverting the flags tested in the next -/// instruction. However there is no way to negate the result of a partial -/// sequence. +/// This naturally lets us implement chains of AND operations with SETCC +/// operands. And we can even implement some other situations by transforming +/// them: +/// - We can implement (NEG SETCC) i.e. negating a single comparison by +/// negating the flags used in a CCMP/FCCMP operations. +/// - We can negate the result of a whole chain of CMP/CCMP/FCCMP operations +/// by negating the flags we test for afterwards. i.e. +/// NEG (CMP CCMP CCCMP ...) can be implemented. +/// - Note that we can only ever negate all previously processed results. +/// What we can not implement by flipping the flags to test is a negation +/// of two sub-trees (because the negation affects all sub-trees emitted so +/// far, so the 2nd sub-tree we emit would also affect the first). +/// With those tools we can implement some OR operations: +/// - (OR (SETCC A) (SETCC B)) can be implemented via: +/// NEG (AND (NEG (SETCC A)) (NEG (SETCC B))) +/// - After transforming OR to NEG/AND combinations we may be able to use NEG +/// elimination rules from earlier to implement the whole thing as a +/// CCMP/FCCMP chain. /// -/// Therefore on encountering an "or" expression we can negate the subtree on -/// one side and have to be able to push the negate to the leafs of the subtree -/// on the other side (see also the comments in code). As complete example: -/// "or (or (setCA (cmp A)) (setCB (cmp B))) -/// (and (setCC (cmp C)) (setCD (cmp D)))" -/// is transformed to -/// "not (and (not (and (setCC (cmp C)) (setCC (cmp D)))) -/// (and (not (setCA (cmp A)) (not (setCB (cmp B))))))" -/// and implemented as: +/// As complete example: +/// or (or (setCA (cmp A)) (setCB (cmp B))) +/// (and (setCC (cmp C)) (setCD (cmp D)))" +/// can be reassociated to: +/// or (and (setCC (cmp C)) setCD (cmp D)) +// (or (setCA (cmp A)) (setCB (cmp B))) +/// can be transformed to: +/// not (and (not (and (setCC (cmp C)) (setCD (cmp D)))) +/// (and (not (setCA (cmp A)) (not (setCB (cmp B))))))" +/// which can be implemented as: /// cmp C /// ccmp D, inv(CD), CC /// ccmp A, CA, inv(CD) /// ccmp B, CB, inv(CA) /// check for CB flags -/// A counterexample is "or (and A B) (and C D)" which cannot be implemented -/// by conditional compare sequences. +/// +/// A counterexample is "or (and A B) (and C D)" which translates to +/// not (and (not (and (not A) (not B))) (not (and (not C) (not D)))), we +/// can only implement 1 of the inner (not) operations, but not both! /// @{ /// Create a conditional comparison; Use CCMP, CCMN or FCCMP as appropriate. @@ -1585,14 +1596,23 @@ static SDValue emitConditionalComparison(SDValue LHS, return DAG.getNode(Opcode, DL, MVT_CC, LHS, RHS, NZCVOp, Condition, CCOp); } -/// Returns true if @p Val is a tree of AND/OR/SETCC operations. -/// CanPushNegate is set to true if we can push a negate operation through -/// the tree in a was that we are left with AND operations and negate operations -/// at the leafs only. i.e. "not (or (or x y) z)" can be changed to -/// "and (and (not x) (not y)) (not z)"; "not (or (and x y) z)" cannot be -/// brought into such a form. -static bool isConjunctionDisjunctionTree(const SDValue Val, bool &CanNegate, - unsigned Depth = 0) { +/// Returns true if @p Val is a tree of AND/OR/SETCC operations that can be +/// expressed as a conjunction. See \ref AArch64CCMP. +/// \param CanNegate Set to true if we can negate the whole sub-tree just by +/// changing the conditions on the SETCC tests. +/// (this means we can call emitConjunctionRec() with +/// Negate==true on this sub-tree) +/// \param MustBeFirst Set to true if this subtree needs to be negated and we +/// cannot do the negation naturally. We are required to +/// emit the subtree first in this case. +/// \param WillNegate Is true if are called when the result of this +/// subexpression must be negated. This happens when the +/// outer expression is an OR. We can use this fact to know +/// that we have a double negation (or (or ...) ...) that +/// can be implemented for free. +static bool canEmitConjunction(const SDValue Val, bool &CanNegate, + bool &MustBeFirst, bool WillNegate, + unsigned Depth = 0) { if (!Val.hasOneUse()) return false; unsigned Opcode = Val->getOpcode(); @@ -1600,39 +1620,44 @@ static bool isConjunctionDisjunctionTree(const SDValue if (Val->getOperand(0).getValueType() == MVT::f128) return false; CanNegate = true; + MustBeFirst = false; return true; } // Protect against exponential runtime and stack overflow. if (Depth > 6) return false; if (Opcode == ISD::AND || Opcode == ISD::OR) { + bool IsOR = Opcode == ISD::OR; SDValue O0 = Val->getOperand(0); SDValue O1 = Val->getOperand(1); bool CanNegateL; - if (!isConjunctionDisjunctionTree(O0, CanNegateL, Depth+1)) + bool MustBeFirstL; + if (!canEmitConjunction(O0, CanNegateL, MustBeFirstL, IsOR, Depth+1)) return false; bool CanNegateR; - if (!isConjunctionDisjunctionTree(O1, CanNegateR, Depth+1)) + bool MustBeFirstR; + if (!canEmitConjunction(O1, CanNegateR, MustBeFirstR, IsOR, Depth+1)) return false; - if (Opcode == ISD::OR) { - // For an OR expression we need to be able to negate at least one side or - // we cannot do the transformation at all. + if (MustBeFirstL && MustBeFirstR) + return false; + + if (IsOR) { + // For an OR expression we need to be able to naturally negate at least + // one side or we cannot do the transformation at all. if (!CanNegateL && !CanNegateR) return false; - // We can however change a (not (or x y)) to (and (not x) (not y)) if we - // can negate the x and y subtrees. - CanNegate = CanNegateL && CanNegateR; + // If we the result of the OR will be negated and we can naturally negate + // the leafs, then this sub-tree as a whole negates naturally. + CanNegate = WillNegate && CanNegateL && CanNegateR; + // If we cannot naturally negate the whole sub-tree, then this must be + // emitted first. + MustBeFirst = !CanNegate; } else { - // If the operands are OR expressions then we finally need to negate their - // outputs, we can only do that for the operand with emitted last by - // negating OutCC, not for both operands. - bool NeedsNegOutL = O0->getOpcode() == ISD::OR; - bool NeedsNegOutR = O1->getOpcode() == ISD::OR; - if (NeedsNegOutL && NeedsNegOutR) - return false; - // We cannot negate an AND operation (it would become an OR), + assert(Opcode == ISD::AND && "Must be OR or AND"); + // We cannot naturally negate an AND operation. CanNegate = false; + MustBeFirst = MustBeFirstL || MustBeFirstR; } return true; } @@ -1645,11 +1670,9 @@ static bool isConjunctionDisjunctionTree(const SDValue /// and conditional compare operations. @returns an NZCV flags producing node /// and sets @p OutCC to the flags that should be tested or returns SDValue() if /// transformation was not possible. -/// On recursive invocations @p PushNegate may be set to true to have negation -/// effects pushed to the tree leafs; @p Predicate is an NZCV flag predicate -/// for the comparisons in the current subtree; @p Depth limits the search -/// depth to avoid stack overflow. -static SDValue emitConjunctionDisjunctionTreeRec(SelectionDAG &DAG, SDValue Val, +/// \p Negate is true if we want this sub-tree being negated just by changing +/// SETCC conditions. +static SDValue emitConjunctionRec(SelectionDAG &DAG, SDValue Val, AArch64CC::CondCode &OutCC, bool Negate, SDValue CCOp, AArch64CC::CondCode Predicate) { // We're at a tree leaf, produce a conditional comparison operation. @@ -1690,76 +1713,85 @@ static SDValue emitConjunctionDisjunctionTreeRec(Selec return emitConditionalComparison(LHS, RHS, CC, CCOp, Predicate, OutCC, DL, DAG); } - assert((Opcode == ISD::AND || (Opcode == ISD::OR && Val->hasOneUse())) && - "Valid conjunction/disjunction tree"); + assert(Val->hasOneUse() && "Valid conjunction/disjunction tree"); - // Check if both sides can be transformed. + bool IsOR = Opcode == ISD::OR; + SDValue LHS = Val->getOperand(0); + bool CanNegateL; + bool MustBeFirstL; + bool ValidL = canEmitConjunction(LHS, CanNegateL, MustBeFirstL, IsOR); + assert(ValidL && "Valid conjunction/disjunction tree"); + (void)ValidL; + SDValue RHS = Val->getOperand(1); + bool CanNegateR; + bool MustBeFirstR; + bool ValidR = canEmitConjunction(RHS, CanNegateR, MustBeFirstR, IsOR); + assert(ValidR && "Valid conjunction/disjunction tree"); + (void)ValidR; - // In case of an OR we need to negate our operands and the result. - // (A v B) <=> not(not(A) ^ not(B)) - bool NegateOpsAndResult = Opcode == ISD::OR; - // We can negate the results of all previous operations by inverting the - // predicate flags giving us a free negation for one side. The other side - // must be negatable by itself. - if (NegateOpsAndResult) { - // See which side we can negate. - bool CanNegateL; - bool isValidL = isConjunctionDisjunctionTree(LHS, CanNegateL); - assert(isValidL && "Valid conjunction/disjunction tree"); - (void)isValidL; + // Swap sub-tree that must come first to the right side. + if (MustBeFirstL) { + assert(!MustBeFirstR && "Valid conjunction/disjunction tree"); + std::swap(LHS, RHS); + std::swap(CanNegateL, CanNegateR); + std::swap(MustBeFirstL, MustBeFirstR); + } -#ifndef NDEBUG - bool CanNegateR; - bool isValidR = isConjunctionDisjunctionTree(RHS, CanNegateR); - assert(isValidR && "Valid conjunction/disjunction tree"); - assert((CanNegateL || CanNegateR) && "Valid conjunction/disjunction tree"); -#endif - - // Order the side which we cannot negate to RHS so we can emit it first. - if (!CanNegateL) + bool NegateR; + bool NegateAfterR; + bool NegateL; + bool NegateAfterAll; + if (Opcode == ISD::OR) { + // Swap the sub-tree that we can negate naturally to the left. + if (!CanNegateL) { + assert(CanNegateR && "at least one side must be negatable"); + assert(!MustBeFirstR && "invalid conjunction/disjunction tree"); + assert(!Negate); std::swap(LHS, RHS); + NegateR = false; + NegateAfterR = true; + } else { + // Negate the left sub-tree if possible, otherwise negate the result. + NegateR = CanNegateR; + NegateAfterR = !CanNegateR; + } + NegateL = true; + NegateAfterAll = !Negate; } else { - bool NeedsNegOutL = LHS->getOpcode() == ISD::OR; - assert((!NeedsNegOutL || RHS->getOpcode() != ISD::OR) && - "Valid conjunction/disjunction tree"); - // Order the side where we need to negate the output flags to RHS so it - // gets emitted first. - if (NeedsNegOutL) - std::swap(LHS, RHS); + assert(Opcode == ISD::AND && "Valid conjunction/disjunction tree"); + assert(!Negate && "Valid conjunction/disjunction tree"); + + NegateL = false; + NegateR = false; + NegateAfterR = false; + NegateAfterAll = false; } - // Emit RHS. If we want to negate the tree we only need to push a negate - // through if we are already in a PushNegate case, otherwise we can negate - // the "flags to test" afterwards. + // Emit sub-trees. AArch64CC::CondCode RHSCC; - SDValue CmpR = emitConjunctionDisjunctionTreeRec(DAG, RHS, RHSCC, Negate, - CCOp, Predicate); - if (NegateOpsAndResult && !Negate) + SDValue CmpR = emitConjunctionRec(DAG, RHS, RHSCC, NegateR, CCOp, Predicate); + if (NegateAfterR) RHSCC = AArch64CC::getInvertedCondCode(RHSCC); - // Emit LHS. We may need to negate it. - SDValue CmpL = emitConjunctionDisjunctionTreeRec(DAG, LHS, OutCC, - NegateOpsAndResult, CmpR, - RHSCC); - // If we transformed an OR to and AND then we have to negate the result - // (or absorb the Negate parameter). - if (NegateOpsAndResult && !Negate) + SDValue CmpL = emitConjunctionRec(DAG, LHS, OutCC, NegateL, CmpR, RHSCC); + if (NegateAfterAll) OutCC = AArch64CC::getInvertedCondCode(OutCC); return CmpL; } -/// Emit conjunction or disjunction tree with the CMP/FCMP followed by a chain -/// of CCMP/CFCMP ops. See @ref AArch64CCMP. -/// \see emitConjunctionDisjunctionTreeRec(). -static SDValue emitConjunctionDisjunctionTree(SelectionDAG &DAG, SDValue Val, - AArch64CC::CondCode &OutCC) { - bool CanNegate; - if (!isConjunctionDisjunctionTree(Val, CanNegate)) +/// Emit expression as a conjunction (a series of CCMP/CFCMP ops). +/// In some cases this is even possible with OR operations in the expression. +/// See \ref AArch64CCMP. +/// \see emitConjunctionRec(). +static SDValue emitConjunction(SelectionDAG &DAG, SDValue Val, + AArch64CC::CondCode &OutCC) { + bool DummyCanNegate; + bool DummyMustBeFirst; + if (!canEmitConjunction(Val, DummyCanNegate, DummyMustBeFirst, false)) return SDValue(); - return emitConjunctionDisjunctionTreeRec(DAG, Val, OutCC, false, SDValue(), - AArch64CC::AL); + return emitConjunctionRec(DAG, Val, OutCC, false, SDValue(), AArch64CC::AL); } /// @} @@ -1859,7 +1891,7 @@ static SDValue getAArch64Cmp(SDValue LHS, SDValue RHS, } if (!Cmp && (RHSC->isNullValue() || RHSC->isOne())) { - if ((Cmp = emitConjunctionDisjunctionTree(DAG, LHS, AArch64CC))) { + if ((Cmp = emitConjunction(DAG, LHS, AArch64CC))) { if ((CC == ISD::SETNE) ^ RHSC->isNullValue()) AArch64CC = AArch64CC::getInvertedCondCode(AArch64CC); } Modified: vendor/llvm/dist-release_70/lib/Target/AMDGPU/AMDGPULibFunc.cpp ============================================================================== --- vendor/llvm/dist-release_70/lib/Target/AMDGPU/AMDGPULibFunc.cpp Sat Dec 8 14:04:57 2018 (r341727) +++ vendor/llvm/dist-release_70/lib/Target/AMDGPU/AMDGPULibFunc.cpp Sat Dec 8 14:31:49 2018 (r341728) @@ -90,7 +90,6 @@ class UnmangledFuncInfo { public: using ID = AMDGPULibFunc::EFuncId; - UnmangledFuncInfo() = default; UnmangledFuncInfo(StringRef _Name, unsigned _NumArgs) : Name(_Name), NumArgs(_NumArgs) {} // Get index to Table by function name. Modified: vendor/llvm/dist-release_70/lib/Transforms/InstCombine/InstCombineCompares.cpp ============================================================================== --- vendor/llvm/dist-release_70/lib/Transforms/InstCombine/InstCombineCompares.cpp Sat Dec 8 14:04:57 2018 (r341727) +++ vendor/llvm/dist-release_70/lib/Transforms/InstCombine/InstCombineCompares.cpp Sat Dec 8 14:31:49 2018 (r341728) @@ -2924,12 +2924,20 @@ static Value *foldICmpWithLowBitMaskedVal(ICmpInst &I, // x & (-1 >> y) s>= x -> x s<= (-1 >> y) if (X != I.getOperand(1)) // X must be on RHS of comparison! return nullptr; // Ignore the other case. + if (!match(M, m_Constant())) // Can not do this fold with non-constant. + return nullptr; + if (!match(M, m_NonNegative())) // Must not have any -1 vector elements. + return nullptr; DstPred = ICmpInst::Predicate::ICMP_SLE; break; case ICmpInst::Predicate::ICMP_SLT: // x & (-1 >> y) s< x -> x s> (-1 >> y) if (X != I.getOperand(1)) // X must be on RHS of comparison! return nullptr; // Ignore the other case. + if (!match(M, m_Constant())) // Can not do this fold with non-constant. + return nullptr; + if (!match(M, m_NonNegative())) // Must not have any -1 vector elements. + return nullptr; DstPred = ICmpInst::Predicate::ICMP_SGT; break; case ICmpInst::Predicate::ICMP_SLE: Modified: vendor/llvm/dist-release_70/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp ============================================================================== --- vendor/llvm/dist-release_70/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp Sat Dec 8 14:04:57 2018 (r341727) +++ vendor/llvm/dist-release_70/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp Sat Dec 8 14:31:49 2018 (r341728) @@ -231,17 +231,17 @@ struct TransformedFunction { TransformedFunction& operator=(TransformedFunction&&) = default; /// Type of the function before the transformation. - FunctionType* const OriginalType; + FunctionType *OriginalType; /// Type of the function after the transformation. - FunctionType* const TransformedType; + FunctionType *TransformedType; /// Transforming a function may change the position of arguments. This /// member records the mapping from each argument's old position to its new /// position. Argument positions are zero-indexed. If the transformation /// from F to F' made the first argument of F into the third argument of F', /// then ArgumentIndexMapping[0] will equal 2. - const std::vector ArgumentIndexMapping; + std::vector ArgumentIndexMapping; }; /// Given function attributes from a call site for the original function, Modified: vendor/llvm/dist-release_70/test/CodeGen/AArch64/arm64-ccmp.ll ============================================================================== --- vendor/llvm/dist-release_70/test/CodeGen/AArch64/arm64-ccmp.ll Sat Dec 8 14:04:57 2018 (r341727) +++ vendor/llvm/dist-release_70/test/CodeGen/AArch64/arm64-ccmp.ll Sat Dec 8 14:31:49 2018 (r341728) @@ -526,8 +526,8 @@ define i32 @select_or_olt_one(double %v0, double %v1, ; CHECK-LABEL: select_or_one_olt: ; CHECK-LABEL: ; %bb.0: ; CHECK-NEXT: fcmp d0, d1 -; CHECK-NEXT: fccmp d0, d1, #1, ne -; CHECK-NEXT: fccmp d2, d3, #8, vs +; CHECK-NEXT: fccmp d0, d1, #8, le +; CHECK-NEXT: fccmp d2, d3, #8, pl ; CHECK-NEXT: csel w0, w0, w1, mi ; CHECK-NEXT: ret define i32 @select_or_one_olt(double %v0, double %v1, double %v2, double %v3, i32 %a, i32 %b) #0 { @@ -556,8 +556,8 @@ define i32 @select_or_olt_ueq(double %v0, double %v1, ; CHECK-LABEL: select_or_ueq_olt: ; CHECK-LABEL: ; %bb.0: ; CHECK-NEXT: fcmp d0, d1 -; CHECK-NEXT: fccmp d0, d1, #8, le -; CHECK-NEXT: fccmp d2, d3, #8, mi +; CHECK-NEXT: fccmp d0, d1, #1, ne +; CHECK-NEXT: fccmp d2, d3, #8, vc ; CHECK-NEXT: csel w0, w0, w1, mi ; CHECK-NEXT: ret define i32 @select_or_ueq_olt(double %v0, double %v1, double %v2, double %v3, i32 %a, i32 %b) #0 { @@ -653,6 +653,70 @@ define i32 @f128_select_and_olt_oge(fp128 %v0, fp128 % %c1 = fcmp oge fp128 %v2, %v3 %cr = and i1 %c1, %c0 %sel = select i1 %cr, i32 %a, i32 %b + ret i32 %sel +} + +; This testcase resembles the core problem of http://llvm.org/PR39550 +; (an OR operation is 2 levels deep but needs to be implemented first) +; CHECK-LABEL: deep_or +; CHECK: cmp w2, #20 +; CHECK-NEXT: ccmp w2, #15, #4, ne +; CHECK-NEXT: ccmp w1, #0, #4, eq +; CHECK-NEXT: ccmp w0, #0, #4, ne +; CHECK-NEXT: csel w0, w4, w5, ne +; CHECK-NEXT: ret +define i32 @deep_or(i32 %a0, i32 %a1, i32 %a2, i32 %a3, i32 %x, i32 %y) { + %c0 = icmp ne i32 %a0, 0 + %c1 = icmp ne i32 %a1, 0 + %c2 = icmp eq i32 %a2, 15 + %c3 = icmp eq i32 %a2, 20 + + %or = or i1 %c2, %c3 + %and0 = and i1 %or, %c1 + %and1 = and i1 %and0, %c0 + %sel = select i1 %and1, i32 %x, i32 %y + ret i32 %sel +} + +; Variation of deep_or, we still need to implement the OR first though. +; CHECK-LABEL: deep_or1 +; CHECK: cmp w2, #20 +; CHECK-NEXT: ccmp w2, #15, #4, ne +; CHECK-NEXT: ccmp w0, #0, #4, eq +; CHECK-NEXT: ccmp w1, #0, #4, ne +; CHECK-NEXT: csel w0, w4, w5, ne +; CHECK-NEXT: ret +define i32 @deep_or1(i32 %a0, i32 %a1, i32 %a2, i32 %a3, i32 %x, i32 %y) { + %c0 = icmp ne i32 %a0, 0 + %c1 = icmp ne i32 %a1, 0 + %c2 = icmp eq i32 %a2, 15 + %c3 = icmp eq i32 %a2, 20 + + %or = or i1 %c2, %c3 + %and0 = and i1 %c0, %or + %and1 = and i1 %and0, %c1 + %sel = select i1 %and1, i32 %x, i32 %y + ret i32 %sel +} + +; Variation of deep_or, we still need to implement the OR first though. +; CHECK-LABEL: deep_or2 +; CHECK: cmp w2, #20 +; CHECK-NEXT: ccmp w2, #15, #4, ne +; CHECK-NEXT: ccmp w1, #0, #4, eq +; CHECK-NEXT: ccmp w0, #0, #4, ne +; CHECK-NEXT: csel w0, w4, w5, ne +; CHECK-NEXT: ret +define i32 @deep_or2(i32 %a0, i32 %a1, i32 %a2, i32 %a3, i32 %x, i32 %y) { + %c0 = icmp ne i32 %a0, 0 + %c1 = icmp ne i32 %a1, 0 + %c2 = icmp eq i32 %a2, 15 + %c3 = icmp eq i32 %a2, 20 + + %or = or i1 %c2, %c3 + %and0 = and i1 %c0, %c1 + %and1 = and i1 %and0, %or + %sel = select i1 %and1, i32 %x, i32 %y ret i32 %sel } Modified: vendor/llvm/dist-release_70/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-sge-to-icmp-sle.ll ============================================================================== --- vendor/llvm/dist-release_70/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-sge-to-icmp-sle.ll Sat Dec 8 14:04:57 2018 (r341727) +++ vendor/llvm/dist-release_70/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-sge-to-icmp-sle.ll Sat Dec 8 14:31:49 2018 (r341728) @@ -23,18 +23,6 @@ define i1 @p0(i8 %x) { ret i1 %ret } -define i1 @pv(i8 %x, i8 %y) { -; CHECK-LABEL: @pv( -; CHECK-NEXT: [[TMP0:%.*]] = lshr i8 -1, [[Y:%.*]] -; CHECK-NEXT: [[TMP1:%.*]] = icmp sge i8 [[TMP0]], [[X:%.*]] -; CHECK-NEXT: ret i1 [[TMP1]] -; - %tmp0 = lshr i8 -1, %y - %tmp1 = and i8 %tmp0, %x - %ret = icmp sge i8 %tmp1, %x - ret i1 %ret -} - ; ============================================================================ ; ; Vector tests ; ============================================================================ ; @@ -120,8 +108,9 @@ define i1 @cv0(i8 %y) { ; CHECK-LABEL: @cv0( ; CHECK-NEXT: [[X:%.*]] = call i8 @gen8() ; CHECK-NEXT: [[TMP0:%.*]] = lshr i8 -1, [[Y:%.*]] -; CHECK-NEXT: [[TMP1:%.*]] = icmp sle i8 [[X]], [[TMP0]] -; CHECK-NEXT: ret i1 [[TMP1]] +; CHECK-NEXT: [[TMP1:%.*]] = and i8 [[X]], [[TMP0]] +; CHECK-NEXT: [[RET:%.*]] = icmp sge i8 [[TMP1]], [[X]] +; CHECK-NEXT: ret i1 [[RET]] ; %x = call i8 @gen8() %tmp0 = lshr i8 -1, %y @@ -195,4 +184,43 @@ define <2 x i1> @n2(<2 x i8> %x) { %tmp0 = and <2 x i8> %x, ; only the first one is valid. %ret = icmp sge <2 x i8> %tmp0, %x ret <2 x i1> %ret +} + +; ============================================================================ ; +; Potential miscompiles. +; ============================================================================ ; + +define i1 @nv(i8 %x, i8 %y) { +; CHECK-LABEL: @nv( +; CHECK-NEXT: [[TMP0:%.*]] = lshr i8 -1, [[Y:%.*]] +; CHECK-NEXT: [[TMP1:%.*]] = and i8 [[TMP0]], [[X:%.*]] +; CHECK-NEXT: [[RET:%.*]] = icmp sge i8 [[TMP1]], [[X]] +; CHECK-NEXT: ret i1 [[RET]] +; + %tmp0 = lshr i8 -1, %y + %tmp1 = and i8 %tmp0, %x + %ret = icmp sge i8 %tmp1, %x + ret i1 %ret +} + +define <2 x i1> @n3_vec(<2 x i8> %x) { +; CHECK-LABEL: @n3_vec( +; CHECK-NEXT: [[TMP0:%.*]] = and <2 x i8> [[X:%.*]], +; CHECK-NEXT: [[RET:%.*]] = icmp sge <2 x i8> [[TMP0]], [[X]] +; CHECK-NEXT: ret <2 x i1> [[RET]] +; + %tmp0 = and <2 x i8> %x, + %ret = icmp sge <2 x i8> %tmp0, %x + ret <2 x i1> %ret +} + +define <3 x i1> @n4_vec(<3 x i8> %x) { +; CHECK-LABEL: @n4_vec( +; CHECK-NEXT: [[TMP0:%.*]] = and <3 x i8> [[X:%.*]], +; CHECK-NEXT: [[RET:%.*]] = icmp sge <3 x i8> [[TMP0]], [[X]] +; CHECK-NEXT: ret <3 x i1> [[RET]] +; + %tmp0 = and <3 x i8> %x, + %ret = icmp sge <3 x i8> %tmp0, %x + ret <3 x i1> %ret } Modified: vendor/llvm/dist-release_70/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-slt-to-icmp-sgt.ll ============================================================================== --- vendor/llvm/dist-release_70/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-slt-to-icmp-sgt.ll Sat Dec 8 14:04:57 2018 (r341727) +++ vendor/llvm/dist-release_70/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-slt-to-icmp-sgt.ll Sat Dec 8 14:31:49 2018 (r341728) @@ -23,18 +23,6 @@ define i1 @p0(i8 %x) { ret i1 %ret } -define i1 @pv(i8 %x, i8 %y) { -; CHECK-LABEL: @pv( -; CHECK-NEXT: [[TMP0:%.*]] = lshr i8 -1, [[Y:%.*]] -; CHECK-NEXT: [[TMP1:%.*]] = icmp slt i8 [[TMP0]], [[X:%.*]] -; CHECK-NEXT: ret i1 [[TMP1]] -; - %tmp0 = lshr i8 -1, %y - %tmp1 = and i8 %tmp0, %x - %ret = icmp slt i8 %tmp1, %x - ret i1 %ret -} - ; ============================================================================ ; ; Vector tests ; ============================================================================ ; @@ -120,8 +108,9 @@ define i1 @cv0(i8 %y) { ; CHECK-LABEL: @cv0( ; CHECK-NEXT: [[X:%.*]] = call i8 @gen8() ; CHECK-NEXT: [[TMP0:%.*]] = lshr i8 -1, [[Y:%.*]] -; CHECK-NEXT: [[TMP1:%.*]] = icmp sgt i8 [[X]], [[TMP0]] -; CHECK-NEXT: ret i1 [[TMP1]] +; CHECK-NEXT: [[TMP1:%.*]] = and i8 [[X]], [[TMP0]] +; CHECK-NEXT: [[RET:%.*]] = icmp slt i8 [[TMP1]], [[X]] +; CHECK-NEXT: ret i1 [[RET]] ; %x = call i8 @gen8() %tmp0 = lshr i8 -1, %y @@ -195,4 +184,43 @@ define <2 x i1> @n2(<2 x i8> %x) { %tmp0 = and <2 x i8> %x, ; only the first one is valid. %ret = icmp slt <2 x i8> %tmp0, %x ret <2 x i1> %ret +} + +; ============================================================================ ; +; Potential miscompiles. +; ============================================================================ ; + +define i1 @nv(i8 %x, i8 %y) { +; CHECK-LABEL: @nv( +; CHECK-NEXT: [[TMP0:%.*]] = lshr i8 -1, [[Y:%.*]] +; CHECK-NEXT: [[TMP1:%.*]] = and i8 [[TMP0]], [[X:%.*]] +; CHECK-NEXT: [[RET:%.*]] = icmp slt i8 [[TMP1]], [[X]] +; CHECK-NEXT: ret i1 [[RET]] +; + %tmp0 = lshr i8 -1, %y + %tmp1 = and i8 %tmp0, %x + %ret = icmp slt i8 %tmp1, %x + ret i1 %ret +} + +define <2 x i1> @n3(<2 x i8> %x) { +; CHECK-LABEL: @n3( +; CHECK-NEXT: [[TMP0:%.*]] = and <2 x i8> [[X:%.*]], +; CHECK-NEXT: [[RET:%.*]] = icmp slt <2 x i8> [[TMP0]], [[X]] +; CHECK-NEXT: ret <2 x i1> [[RET]] +; + %tmp0 = and <2 x i8> %x, + %ret = icmp slt <2 x i8> %tmp0, %x + ret <2 x i1> %ret +} + +define <3 x i1> @n4(<3 x i8> %x) { +; CHECK-LABEL: @n4( +; CHECK-NEXT: [[TMP0:%.*]] = and <3 x i8> [[X:%.*]], +; CHECK-NEXT: [[RET:%.*]] = icmp slt <3 x i8> [[TMP0]], [[X]] +; CHECK-NEXT: ret <3 x i1> [[RET]] +; + %tmp0 = and <3 x i8> %x, + %ret = icmp slt <3 x i8> %tmp0, %x + ret <3 x i1> %ret } From owner-svn-src-all@freebsd.org Sat Dec 8 14:32:11 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 94E0213184FE; Sat, 8 Dec 2018 14:32:11 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3FD8780686; Sat, 8 Dec 2018 14:32:11 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 06AA723570; Sat, 8 Dec 2018 14:32:02 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB8EW22l060295; Sat, 8 Dec 2018 14:32:02 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB8EVxuo060276; Sat, 8 Dec 2018 14:31:59 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201812081431.wB8EVxuo060276@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 8 Dec 2018 14:31:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r341730 - in vendor/clang/dist-release_70: include/clang/AST include/clang/Basic lib/AST lib/CodeGen lib/Driver/ToolChains lib/StaticAnalyzer/Core test/Analysis test/CodeGen test/CodeGe... X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in vendor/clang/dist-release_70: include/clang/AST include/clang/Basic lib/AST lib/CodeGen lib/Driver/ToolChains lib/StaticAnalyzer/Core test/Analysis test/CodeGen test/CodeGenCXX test/Driver X-SVN-Commit-Revision: 341730 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3FD8780686 X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.972,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-0.99)[-0.993,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Dec 2018 14:32:12 -0000 Author: dim Date: Sat Dec 8 14:31:58 2018 New Revision: 341730 URL: https://svnweb.freebsd.org/changeset/base/341730 Log: Vendor import of clang release_70 branch r348686: https://llvm.org/svn/llvm-project/cfe/branches/release_70@348686 Added: vendor/clang/dist-release_70/test/CodeGenCXX/attr-cpuspecific.cpp (contents, props changed) vendor/clang/dist-release_70/test/CodeGenCXX/visibility-inlines-hidden-staticvar.cpp (contents, props changed) Modified: vendor/clang/dist-release_70/include/clang/AST/DeclBase.h vendor/clang/dist-release_70/include/clang/Basic/Attr.td vendor/clang/dist-release_70/lib/AST/ASTContext.cpp vendor/clang/dist-release_70/lib/AST/Decl.cpp vendor/clang/dist-release_70/lib/CodeGen/CodeGenFunction.cpp vendor/clang/dist-release_70/lib/CodeGen/CodeGenFunction.h vendor/clang/dist-release_70/lib/CodeGen/CodeGenModule.cpp vendor/clang/dist-release_70/lib/Driver/ToolChains/OpenBSD.cpp vendor/clang/dist-release_70/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp vendor/clang/dist-release_70/test/Analysis/svalbuilder-rearrange-comparisons.c vendor/clang/dist-release_70/test/CodeGen/attr-cpuspecific.c vendor/clang/dist-release_70/test/CodeGenCXX/attr-target-mv-member-funcs.cpp vendor/clang/dist-release_70/test/Driver/openbsd.c Modified: vendor/clang/dist-release_70/include/clang/AST/DeclBase.h ============================================================================== --- vendor/clang/dist-release_70/include/clang/AST/DeclBase.h Sat Dec 8 14:31:55 2018 (r341729) +++ vendor/clang/dist-release_70/include/clang/AST/DeclBase.h Sat Dec 8 14:31:58 2018 (r341730) @@ -1216,7 +1216,6 @@ class DeclContextLookupResult { (public) value_type SingleElement; public: - iterator() = default; explicit iterator(pointer Pos, value_type Single = nullptr) : IteratorBase(Pos), SingleElement(Single) {} Modified: vendor/clang/dist-release_70/include/clang/Basic/Attr.td ============================================================================== --- vendor/clang/dist-release_70/include/clang/Basic/Attr.td Sat Dec 8 14:31:55 2018 (r341729) +++ vendor/clang/dist-release_70/include/clang/Basic/Attr.td Sat Dec 8 14:31:58 2018 (r341730) @@ -1953,6 +1953,39 @@ def Target : InheritableAttr { return parse(getFeaturesStr()); } + StringRef getArchitecture() const { + StringRef Features = getFeaturesStr(); + if (Features == "default") return {}; + + SmallVector AttrFeatures; + Features.split(AttrFeatures, ","); + + for (auto &Feature : AttrFeatures) { + Feature = Feature.trim(); + if (Feature.startswith("arch=")) + return Feature.drop_front(sizeof("arch=") - 1); + } + return ""; + } + + // Gets the list of features as simple string-refs with no +/- or 'no-'. + // Only adds the items to 'Out' that are additions. + void getAddedFeatures(llvm::SmallVectorImpl &Out) const { + StringRef Features = getFeaturesStr(); + if (Features == "default") return; + + SmallVector AttrFeatures; + Features.split(AttrFeatures, ","); + + for (auto &Feature : AttrFeatures) { + Feature = Feature.trim(); + + if (!Feature.startswith("no-") && !Feature.startswith("arch=") && + !Feature.startswith("fpmath=") && !Feature.startswith("tune=")) + Out.push_back(Feature); + } + } + template ParsedTargetAttr parse(Compare cmp) const { ParsedTargetAttr Attrs = parse(); Modified: vendor/clang/dist-release_70/lib/AST/ASTContext.cpp ============================================================================== --- vendor/clang/dist-release_70/lib/AST/ASTContext.cpp Sat Dec 8 14:31:55 2018 (r341729) +++ vendor/clang/dist-release_70/lib/AST/ASTContext.cpp Sat Dec 8 14:31:58 2018 (r341730) @@ -9734,6 +9734,10 @@ bool ASTContext::DeclMustBeEmitted(const Decl *D) { return true; if (const auto *FD = dyn_cast(D)) { + // Multiversioned functions always have to be emitted, because they are used + // by the resolver. + if (FD->isMultiVersion()) + return true; // Forward declarations aren't required. if (!FD->doesThisDeclarationHaveABody()) return FD->doesDeclarationForceExternallyVisibleDefinition(); Modified: vendor/clang/dist-release_70/lib/AST/Decl.cpp ============================================================================== --- vendor/clang/dist-release_70/lib/AST/Decl.cpp Sat Dec 8 14:31:55 2018 (r341729) +++ vendor/clang/dist-release_70/lib/AST/Decl.cpp Sat Dec 8 14:31:58 2018 (r341730) @@ -725,7 +725,7 @@ LinkageComputer::getLVForNamespaceScopeDecl(const Name // If we're paying attention to global visibility, apply // -finline-visibility-hidden if this is an inline method. if (useInlineVisibilityHidden(D)) - LV.mergeVisibility(HiddenVisibility, true); + LV.mergeVisibility(HiddenVisibility, /*visibilityExplicit=*/false); } } @@ -915,7 +915,7 @@ LinkageComputer::getLVForClassMember(const NamedDecl * // Note that we do this before merging information about // the class visibility. if (!LV.isVisibilityExplicit() && useInlineVisibilityHidden(D)) - LV.mergeVisibility(HiddenVisibility, true); + LV.mergeVisibility(HiddenVisibility, /*visibilityExplicit=*/false); } // If this class member has an explicit visibility attribute, the only @@ -1262,7 +1262,27 @@ LinkageInfo LinkageComputer::getLVForLocalDecl(const N !isTemplateInstantiation(FD->getTemplateSpecializationKind())) return LinkageInfo::none(); + // If a function is hidden by -fvisibility-inlines-hidden option and + // is not explicitly attributed as a hidden function, + // we should not make static local variables in the function hidden. LV = getLVForDecl(FD, computation); + if (isa(D) && useInlineVisibilityHidden(FD) && + !LV.isVisibilityExplicit()) { + assert(cast(D)->isStaticLocal()); + // If this was an implicitly hidden inline method, check again for + // explicit visibility on the parent class, and use that for static locals + // if present. + if (const auto *MD = dyn_cast(FD)) + LV = getLVForDecl(MD->getParent(), computation); + if (!LV.isVisibilityExplicit()) { + Visibility globalVisibility = + computation.isValueVisibility() + ? Context.getLangOpts().getValueVisibilityMode() + : Context.getLangOpts().getTypeVisibilityMode(); + return LinkageInfo(VisibleNoLinkage, globalVisibility, + /*visibilityExplicit=*/false); + } + } } if (!isExternallyVisible(LV.getLinkage())) return LinkageInfo::none(); Modified: vendor/clang/dist-release_70/lib/CodeGen/CodeGenFunction.cpp ============================================================================== --- vendor/clang/dist-release_70/lib/CodeGen/CodeGenFunction.cpp Sat Dec 8 14:31:55 2018 (r341729) +++ vendor/clang/dist-release_70/lib/CodeGen/CodeGenFunction.cpp Sat Dec 8 14:31:58 2018 (r341730) @@ -2359,91 +2359,53 @@ void CodeGenFunction::EmitSanitizerStatReport(llvm::Sa CGM.getSanStats().create(IRB, SSK); } -llvm::Value *CodeGenFunction::FormResolverCondition( - const TargetMultiVersionResolverOption &RO) { - llvm::Value *TrueCondition = nullptr; - if (!RO.ParsedAttribute.Architecture.empty()) - TrueCondition = EmitX86CpuIs(RO.ParsedAttribute.Architecture); +llvm::Value * +CodeGenFunction::FormResolverCondition(const MultiVersionResolverOption &RO) { + llvm::Value *Condition = nullptr; - if (!RO.ParsedAttribute.Features.empty()) { - SmallVector FeatureList; - llvm::for_each(RO.ParsedAttribute.Features, - [&FeatureList](const std::string &Feature) { - FeatureList.push_back(StringRef{Feature}.substr(1)); - }); - llvm::Value *FeatureCmp = EmitX86CpuSupports(FeatureList); - TrueCondition = TrueCondition ? Builder.CreateAnd(TrueCondition, FeatureCmp) - : FeatureCmp; - } - return TrueCondition; -} + if (!RO.Conditions.Architecture.empty()) + Condition = EmitX86CpuIs(RO.Conditions.Architecture); -void CodeGenFunction::EmitTargetMultiVersionResolver( - llvm::Function *Resolver, - ArrayRef Options) { - assert((getContext().getTargetInfo().getTriple().getArch() == - llvm::Triple::x86 || - getContext().getTargetInfo().getTriple().getArch() == - llvm::Triple::x86_64) && - "Only implemented for x86 targets"); - - // Main function's basic block. - llvm::BasicBlock *CurBlock = createBasicBlock("entry", Resolver); - Builder.SetInsertPoint(CurBlock); - EmitX86CpuInit(); - - llvm::Function *DefaultFunc = nullptr; - for (const TargetMultiVersionResolverOption &RO : Options) { - Builder.SetInsertPoint(CurBlock); - llvm::Value *TrueCondition = FormResolverCondition(RO); - - if (!TrueCondition) { - DefaultFunc = RO.Function; - } else { - llvm::BasicBlock *RetBlock = createBasicBlock("ro_ret", Resolver); - llvm::IRBuilder<> RetBuilder(RetBlock); - RetBuilder.CreateRet(RO.Function); - CurBlock = createBasicBlock("ro_else", Resolver); - Builder.CreateCondBr(TrueCondition, RetBlock, CurBlock); - } + if (!RO.Conditions.Features.empty()) { + llvm::Value *FeatureCond = EmitX86CpuSupports(RO.Conditions.Features); + Condition = + Condition ? Builder.CreateAnd(Condition, FeatureCond) : FeatureCond; } - - assert(DefaultFunc && "No default version?"); - // Emit return from the 'else-ist' block. - Builder.SetInsertPoint(CurBlock); - Builder.CreateRet(DefaultFunc); + return Condition; } -void CodeGenFunction::EmitCPUDispatchMultiVersionResolver( - llvm::Function *Resolver, - ArrayRef Options) { +void CodeGenFunction::EmitMultiVersionResolver( + llvm::Function *Resolver, ArrayRef Options) { assert((getContext().getTargetInfo().getTriple().getArch() == llvm::Triple::x86 || getContext().getTargetInfo().getTriple().getArch() == llvm::Triple::x86_64) && "Only implemented for x86 targets"); - // Main function's basic block. llvm::BasicBlock *CurBlock = createBasicBlock("resolver_entry", Resolver); Builder.SetInsertPoint(CurBlock); EmitX86CpuInit(); - for (const CPUDispatchMultiVersionResolverOption &RO : Options) { + for (const MultiVersionResolverOption &RO : Options) { Builder.SetInsertPoint(CurBlock); + llvm::Value *Condition = FormResolverCondition(RO); - // "generic" case should catch-all. - if (RO.FeatureMask == 0) { + // The 'default' or 'generic' case. + if (!Condition) { + assert(&RO == Options.end() - 1 && + "Default or Generic case must be last"); Builder.CreateRet(RO.Function); return; } + llvm::BasicBlock *RetBlock = createBasicBlock("resolver_return", Resolver); llvm::IRBuilder<> RetBuilder(RetBlock); RetBuilder.CreateRet(RO.Function); CurBlock = createBasicBlock("resolver_else", Resolver); - llvm::Value *TrueCondition = EmitX86CpuSupports(RO.FeatureMask); - Builder.CreateCondBr(TrueCondition, RetBlock, CurBlock); + Builder.CreateCondBr(Condition, RetBlock, CurBlock); } + // If no generic/default, emit an unreachable. Builder.SetInsertPoint(CurBlock); llvm::CallInst *TrapCall = EmitTrapCall(llvm::Intrinsic::trap); TrapCall->setDoesNotReturn(); Modified: vendor/clang/dist-release_70/lib/CodeGen/CodeGenFunction.h ============================================================================== --- vendor/clang/dist-release_70/lib/CodeGen/CodeGenFunction.h Sat Dec 8 14:31:55 2018 (r341729) +++ vendor/clang/dist-release_70/lib/CodeGen/CodeGenFunction.h Sat Dec 8 14:31:58 2018 (r341730) @@ -4247,31 +4247,27 @@ class CodeGenFunction : public CodeGenTypeCache { (pub void EmitSanitizerStatReport(llvm::SanitizerStatKind SSK); - struct TargetMultiVersionResolverOption { + struct MultiVersionResolverOption { llvm::Function *Function; - TargetAttr::ParsedTargetAttr ParsedAttribute; - unsigned Priority; - TargetMultiVersionResolverOption( - const TargetInfo &TargInfo, llvm::Function *F, - const clang::TargetAttr::ParsedTargetAttr &PT) - : Function(F), ParsedAttribute(PT), Priority(0u) { - for (StringRef Feat : PT.Features) - Priority = std::max(Priority, - TargInfo.multiVersionSortPriority(Feat.substr(1))); + struct Conds { + StringRef Architecture; + llvm::SmallVector Features; - if (!PT.Architecture.empty()) - Priority = std::max(Priority, - TargInfo.multiVersionSortPriority(PT.Architecture)); - } + Conds(StringRef Arch, ArrayRef Feats) + : Architecture(Arch), Features(Feats.begin(), Feats.end()) {} + } Conditions; - bool operator>(const TargetMultiVersionResolverOption &Other) const { - return Priority > Other.Priority; - } + MultiVersionResolverOption(llvm::Function *F, StringRef Arch, + ArrayRef Feats) + : Function(F), Conditions(Arch, Feats) {} }; - void EmitTargetMultiVersionResolver( - llvm::Function *Resolver, - ArrayRef Options); + // Emits the body of a multiversion function's resolver. Assumes that the + // options are already sorted in the proper order, with the 'default' option + // last (if it exists). + void EmitMultiVersionResolver(llvm::Function *Resolver, + ArrayRef Options); + struct CPUDispatchMultiVersionResolverOption { llvm::Function *Function; // Note: EmitX86CPUSupports only has 32 bits available, so we store the mask @@ -4306,8 +4302,7 @@ class CodeGenFunction : public CodeGenTypeCache { (pub llvm::Value *EmitX86CpuSupports(ArrayRef FeatureStrs); llvm::Value *EmitX86CpuSupports(uint32_t Mask); llvm::Value *EmitX86CpuInit(); - llvm::Value * - FormResolverCondition(const TargetMultiVersionResolverOption &RO); + llvm::Value *FormResolverCondition(const MultiVersionResolverOption &RO); }; inline DominatingLLVMValue::saved_type Modified: vendor/clang/dist-release_70/lib/CodeGen/CodeGenModule.cpp ============================================================================== --- vendor/clang/dist-release_70/lib/CodeGen/CodeGenModule.cpp Sat Dec 8 14:31:55 2018 (r341729) +++ vendor/clang/dist-release_70/lib/CodeGen/CodeGenModule.cpp Sat Dec 8 14:31:58 2018 (r341730) @@ -2399,9 +2399,22 @@ void CodeGenModule::EmitGlobalDefinition(GlobalDecl GD static void ReplaceUsesOfNonProtoTypeWithRealFunction(llvm::GlobalValue *Old, llvm::Function *NewFn); +static unsigned +TargetMVPriority(const TargetInfo &TI, + const CodeGenFunction::MultiVersionResolverOption &RO) { + unsigned Priority = 0; + for (StringRef Feat : RO.Conditions.Features) + Priority = std::max(Priority, TI.multiVersionSortPriority(Feat)); + + if (!RO.Conditions.Architecture.empty()) + Priority = std::max( + Priority, TI.multiVersionSortPriority(RO.Conditions.Architecture)); + return Priority; +} + void CodeGenModule::emitMultiVersionFunctions() { for (GlobalDecl GD : MultiVersionFuncs) { - SmallVector Options; + SmallVector Options; const FunctionDecl *FD = cast(GD.getDecl()); getContext().forEachMultiversionedFunctionVersion( FD, [this, &GD, &Options](const FunctionDecl *CurFD) { @@ -2422,8 +2435,13 @@ void CodeGenModule::emitMultiVersionFunctions() { } assert(Func && "This should have just been created"); } - Options.emplace_back(getTarget(), cast(Func), - CurFD->getAttr()->parse()); + + const auto *TA = CurFD->getAttr(); + llvm::SmallVector Feats; + TA->getAddedFeatures(Feats); + + Options.emplace_back(cast(Func), + TA->getArchitecture(), Feats); }); llvm::Function *ResolverFunc = cast( @@ -2431,11 +2449,16 @@ void CodeGenModule::emitMultiVersionFunctions() { if (supportsCOMDAT()) ResolverFunc->setComdat( getModule().getOrInsertComdat(ResolverFunc->getName())); + + const TargetInfo &TI = getTarget(); std::stable_sort( Options.begin(), Options.end(), - std::greater()); + [&TI](const CodeGenFunction::MultiVersionResolverOption &LHS, + const CodeGenFunction::MultiVersionResolverOption &RHS) { + return TargetMVPriority(TI, LHS) > TargetMVPriority(TI, RHS); + }); CodeGenFunction CGF(*this); - CGF.EmitTargetMultiVersionResolver(ResolverFunc, Options); + CGF.EmitMultiVersionResolver(ResolverFunc, Options); } } @@ -2444,8 +2467,14 @@ void CodeGenModule::emitCPUDispatchDefinition(GlobalDe assert(FD && "Not a FunctionDecl?"); const auto *DD = FD->getAttr(); assert(DD && "Not a cpu_dispatch Function?"); - llvm::Type *DeclTy = getTypes().ConvertTypeForMem(FD->getType()); + QualType CanonTy = Context.getCanonicalType(FD->getType()); + llvm::Type *DeclTy = getTypes().ConvertFunctionType(CanonTy, FD); + if (const auto *CXXFD = dyn_cast(FD)) { + const CGFunctionInfo &FInfo = getTypes().arrangeCXXMethodDeclaration(CXXFD); + DeclTy = getTypes().GetFunctionType(FInfo); + } + StringRef ResolverName = getMangledName(GD); llvm::Type *ResolverType = llvm::FunctionType::get( llvm::PointerType::get(DeclTy, @@ -2455,15 +2484,14 @@ void CodeGenModule::emitCPUDispatchDefinition(GlobalDe GetOrCreateLLVMFunction(ResolverName, ResolverType, GlobalDecl{}, /*ForVTable=*/false)); - SmallVector - Options; + SmallVector Options; const TargetInfo &Target = getTarget(); for (const IdentifierInfo *II : DD->cpus()) { // Get the name of the target function so we can look it up/create it. std::string MangledName = getMangledNameImpl(*this, GD, FD, true) + getCPUSpecificMangling(*this, II->getName()); llvm::Constant *Func = GetOrCreateLLVMFunction( - MangledName, DeclTy, GD, /*ForVTable=*/false, /*DontDefer=*/false, + MangledName, DeclTy, GD, /*ForVTable=*/false, /*DontDefer=*/true, /*IsThunk=*/false, llvm::AttributeList(), ForDefinition); llvm::SmallVector Features; Target.getCPUSpecificCPUDispatchFeatures(II->getName(), Features); @@ -2473,15 +2501,34 @@ void CodeGenModule::emitCPUDispatchDefinition(GlobalDe Features.begin(), Features.end(), [&Target](StringRef Feat) { return !Target.validateCpuSupports(Feat); }), Features.end()); - Options.emplace_back(cast(Func), - CodeGenFunction::GetX86CpuSupportsMask(Features)); + Options.emplace_back(cast(Func), StringRef{}, Features); } llvm::sort( Options.begin(), Options.end(), - std::greater()); + [](const CodeGenFunction::MultiVersionResolverOption &LHS, + const CodeGenFunction::MultiVersionResolverOption &RHS) { + return CodeGenFunction::GetX86CpuSupportsMask(LHS.Conditions.Features) > + CodeGenFunction::GetX86CpuSupportsMask(RHS.Conditions.Features); + }); + + // If the list contains multiple 'default' versions, such as when it contains + // 'pentium' and 'generic', don't emit the call to the generic one (since we + // always run on at least a 'pentium'). We do this by deleting the 'least + // advanced' (read, lowest mangling letter). + while (Options.size() > 1 && + CodeGenFunction::GetX86CpuSupportsMask( + (Options.end() - 2)->Conditions.Features) == 0) { + StringRef LHSName = (Options.end() - 2)->Function->getName(); + StringRef RHSName = (Options.end() - 1)->Function->getName(); + if (LHSName.compare(RHSName) < 0) + Options.erase(Options.end() - 2); + else + Options.erase(Options.end() - 1); + } + CodeGenFunction CGF(*this); - CGF.EmitCPUDispatchMultiVersionResolver(ResolverFunc, Options); + CGF.EmitMultiVersionResolver(ResolverFunc, Options); } /// If an ifunc for the specified mangled name is not in the module, create and Modified: vendor/clang/dist-release_70/lib/Driver/ToolChains/OpenBSD.cpp ============================================================================== --- vendor/clang/dist-release_70/lib/Driver/ToolChains/OpenBSD.cpp Sat Dec 8 14:31:55 2018 (r341729) +++ vendor/clang/dist-release_70/lib/Driver/ToolChains/OpenBSD.cpp Sat Dec 8 14:31:58 2018 (r341730) @@ -138,7 +138,7 @@ void openbsd::Linker::ConstructJob(Compilation &C, con if (Args.hasArg(options::OPT_pie)) CmdArgs.push_back("-pie"); - if (Args.hasArg(options::OPT_nopie)) + if (Args.hasArg(options::OPT_nopie) || Args.hasArg(options::OPT_pg)) CmdArgs.push_back("-nopie"); if (Output.isFilename()) { Modified: vendor/clang/dist-release_70/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp ============================================================================== --- vendor/clang/dist-release_70/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp Sat Dec 8 14:31:55 2018 (r341729) +++ vendor/clang/dist-release_70/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp Sat Dec 8 14:31:58 2018 (r341730) @@ -475,15 +475,16 @@ static Optional tryRearrange(ProgramStateRef S SingleTy = ResultTy; if (LSym->getType() != SingleTy) return None; - // Substracting unsigned integers is a nightmare. - if (!SingleTy->isSignedIntegerOrEnumerationType()) - return None; } else { // Don't rearrange other operations. return None; } assert(!SingleTy.isNull() && "We should have figured out the type by now!"); + + // Rearrange signed symbolic expressions only + if (!SingleTy->isSignedIntegerOrEnumerationType()) + return None; SymbolRef RSym = Rhs.getAsSymbol(); if (!RSym || RSym->getType() != SingleTy) Modified: vendor/clang/dist-release_70/test/Analysis/svalbuilder-rearrange-comparisons.c ============================================================================== --- vendor/clang/dist-release_70/test/Analysis/svalbuilder-rearrange-comparisons.c Sat Dec 8 14:31:55 2018 (r341729) +++ vendor/clang/dist-release_70/test/Analysis/svalbuilder-rearrange-comparisons.c Sat Dec 8 14:31:58 2018 (r341730) @@ -934,3 +934,17 @@ int mixed_integer_types(int x, int y) { short a = x - 1U; return a - y; } + +unsigned gu(); +unsigned fu() { + unsigned x = gu(); + // Assert that no overflows occur in this test file. + // Assuming that concrete integers are also within that range. + assert(x <= ((unsigned)UINT_MAX / 4)); + return x; +} + +void unsigned_concrete_int_no_crash() { + unsigned x = fu() + 1U, y = fu() + 1U; + clang_analyzer_dump(x == y); // expected-warning {{((conj_$2{unsigned int}) + 1U) == ((conj_$7{unsigned int}) + 1U)}} +} Modified: vendor/clang/dist-release_70/test/CodeGen/attr-cpuspecific.c ============================================================================== --- vendor/clang/dist-release_70/test/CodeGen/attr-cpuspecific.c Sat Dec 8 14:31:55 2018 (r341729) +++ vendor/clang/dist-release_70/test/CodeGen/attr-cpuspecific.c Sat Dec 8 14:31:58 2018 (r341730) @@ -96,6 +96,15 @@ void HasGeneric(void); // CHECK: ret void ()* @HasGeneric.A // CHECK-NOT: call void @llvm.trap +__attribute__((cpu_dispatch(atom, generic, pentium))) +int GenericAndPentium(int i, double d); +// CHECK: define i32 (i32, double)* @GenericAndPentium.resolver() +// CHECK: call void @__cpu_indicator_init +// CHECK: ret i32 (i32, double)* @GenericAndPentium.O +// CHECK: ret i32 (i32, double)* @GenericAndPentium.B +// CHECK-NOT: ret i32 (i32, double)* @GenericAndPentium.A +// CHECK-NOT: call void @llvm.trap + // CHECK: attributes #[[S]] = {{.*}}"target-features"="+avx,+cmov,+f16c,+mmx,+popcnt,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87,+xsave" // CHECK: attributes #[[K]] = {{.*}}"target-features"="+adx,+avx,+avx2,+avx512cd,+avx512er,+avx512f,+avx512pf,+bmi,+cmov,+f16c,+fma,+lzcnt,+mmx,+movbe,+popcnt,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87,+xsave" // CHECK: attributes #[[O]] = {{.*}}"target-features"="+cmov,+mmx,+movbe,+sse,+sse2,+sse3,+ssse3,+x87" Added: vendor/clang/dist-release_70/test/CodeGenCXX/attr-cpuspecific.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/clang/dist-release_70/test/CodeGenCXX/attr-cpuspecific.cpp Sat Dec 8 14:31:58 2018 (r341730) @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK,LINUX + +struct S { + __attribute__((cpu_specific(atom))) + void Func(){} + __attribute__((cpu_dispatch(ivybridge,atom))) + void Func(){} +}; + +void foo() { + S s; + s.Func(); +} + +// LINUX: define linkonce_odr void @_ZN1S4FuncEv.O +// LINUX: define void (%struct.S*)* @_ZN1S4FuncEv.resolver +// LINUX: ret void (%struct.S*)* @_ZN1S4FuncEv.S +// LINUX: ret void (%struct.S*)* @_ZN1S4FuncEv.O Modified: vendor/clang/dist-release_70/test/CodeGenCXX/attr-target-mv-member-funcs.cpp ============================================================================== --- vendor/clang/dist-release_70/test/CodeGenCXX/attr-target-mv-member-funcs.cpp Sat Dec 8 14:31:55 2018 (r341729) +++ vendor/clang/dist-release_70/test/CodeGenCXX/attr-target-mv-member-funcs.cpp Sat Dec 8 14:31:58 2018 (r341730) @@ -72,6 +72,15 @@ int templ_use() { // CHECK: @_ZN5templIiE3fooEi.ifunc = ifunc i32 (%struct.templ*, i32), i32 (%struct.templ*, i32)* ()* @_ZN5templIiE3fooEi.resolver // CHECK: @_ZN5templIdE3fooEi.ifunc = ifunc i32 (%struct.templ.0*, i32), i32 (%struct.templ.0*, i32)* ()* @_ZN5templIdE3fooEi.resolver +// CHECK: define linkonce_odr i32 @_ZN1S3fooEi.sse4.2(%struct.S* %this, i32) +// CHECK: ret i32 0 + +// CHECK: define linkonce_odr i32 @_ZN1S3fooEi.arch_ivybridge(%struct.S* %this, i32) +// CHECK: ret i32 1 + +// CHECK: define linkonce_odr i32 @_ZN1S3fooEi(%struct.S* %this, i32) +// CHECK: ret i32 2 + // CHECK: define i32 @_Z3barv() // CHECK: %s = alloca %struct.S, align 1 // CHECK: %s2 = alloca %struct.S, align 1 @@ -123,23 +132,14 @@ int templ_use() { // CHECK: ret i32 (%struct.templ.0*, i32)* @_ZN5templIdE3fooEi.sse4.2 // CHECK: ret i32 (%struct.templ.0*, i32)* @_ZN5templIdE3fooEi -// CHECK: define linkonce_odr i32 @_ZN1S3fooEi.sse4.2(%struct.S* %this, i32) -// CHECK: ret i32 0 - -// CHECK: declare i32 @_ZN1S3fooEi.arch_sandybridge(%struct.S*, i32) - -// CHECK: define linkonce_odr i32 @_ZN1S3fooEi.arch_ivybridge(%struct.S* %this, i32) -// CHECK: ret i32 1 - -// CHECK: define linkonce_odr i32 @_ZN1S3fooEi(%struct.S* %this, i32) -// CHECK: ret i32 2 - // CHECK: define linkonce_odr i32 @_ZN5templIiE3fooEi.sse4.2 -// CHECK: declare i32 @_ZN5templIiE3fooEi.arch_sandybridge // CHECK: define linkonce_odr i32 @_ZN5templIiE3fooEi.arch_ivybridge // CHECK: define linkonce_odr i32 @_ZN5templIiE3fooEi // CHECK: define linkonce_odr i32 @_ZN5templIdE3fooEi.sse4.2 -// CHECK: declare i32 @_ZN5templIdE3fooEi.arch_sandybridge // CHECK: define linkonce_odr i32 @_ZN5templIdE3fooEi.arch_ivybridge // CHECK: define linkonce_odr i32 @_ZN5templIdE3fooEi +// +// CHECK: declare i32 @_ZN1S3fooEi.arch_sandybridge(%struct.S*, i32) +// CHECK: declare i32 @_ZN5templIiE3fooEi.arch_sandybridge +// CHECK: declare i32 @_ZN5templIdE3fooEi.arch_sandybridge Added: vendor/clang/dist-release_70/test/CodeGenCXX/visibility-inlines-hidden-staticvar.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/clang/dist-release_70/test/CodeGenCXX/visibility-inlines-hidden-staticvar.cpp Sat Dec 8 14:31:58 2018 (r341730) @@ -0,0 +1,111 @@ +// RUN: %clang_cc1 -triple i386-unknown-unknown -std=c++11 -fvisibility-inlines-hidden -emit-llvm -o - %s -O2 -disable-llvm-passes | FileCheck %s +// RUN: %clang_cc1 -triple i386-unknown-unknown -std=c++11 -emit-llvm -o - %s -O2 -disable-llvm-passes | FileCheck -check-prefixes=CHECK-NO-VIH %s +// RUN: %clang_cc1 -triple i386-unknown-unknown -std=c++11 -fvisibility hidden -fvisibility-inlines-hidden -emit-llvm -o - %s -O2 -disable-llvm-passes | FileCheck %s --check-prefix=CHECK-VIS-HIDDEN +// RUN: %clang_cc1 -triple i386-unknown-unknown -std=c++11 -fvisibility protected -fvisibility-inlines-hidden -emit-llvm -o - %s -O2 -disable-llvm-passes | FileCheck %s --check-prefix=CHECK-VIS-PROTECTED + +// When a function is hidden due to -fvisibility-inlines-hidden option, static local variables of the function should not be hidden by the option. + +// CHECK-DAG: @_ZZ4funcvE3var = internal global i32 0 +// CHECK-DAG: @_ZZ11hidden_funcvE3var = internal global i32 0 +// CHECK-DAG: @_ZZ12default_funcvE3var = internal global i32 0 +// CHECK-DAG: @_ZZ11inline_funcvE3var = linkonce_odr global i32 0, comdat +// CHECK-DAG: @_ZZ18inline_hidden_funcvE3var = linkonce_odr hidden global i32 0, comdat +// CHECK-DAG: @_ZZ19inline_default_funcvE3var = linkonce_odr global i32 0, comdat +// CHECK-DAG: @_ZZN13ExportedClass10inl_methodEvE3var = linkonce_odr global i32 0, comdat, align 4 +// CHECK-DAG: define i32 @_Z4funcv() +// CHECK-DAG: define hidden i32 @_Z11hidden_funcv() +// CHECK-DAG: define i32 @_Z12default_funcv() +// CHECK-DAG: define linkonce_odr hidden i32 @_Z11inline_funcv() +// CHECK-DAG: define linkonce_odr hidden i32 @_Z18inline_hidden_funcv() +// CHECK-DAG: define linkonce_odr i32 @_Z19inline_default_funcv() +// CHECK-DAG: define linkonce_odr hidden i32 @_ZN13ExportedClass10inl_methodEv({{.*}}) +// CHECK-DAG: define i32 @_ZN13ExportedClass10ext_methodEv({{.*}}) + +// CHECK-NO-VIH-DAG: @_ZZ4funcvE3var = internal global i32 0 +// CHECK-NO-VIH-DAG: @_ZZ11hidden_funcvE3var = internal global i32 0 +// CHECK-NO-VIH-DAG: @_ZZ12default_funcvE3var = internal global i32 0 +// CHECK-NO-VIH-DAG: @_ZZ11inline_funcvE3var = linkonce_odr global i32 0, comdat +// CHECK-NO-VIH-DAG: @_ZZ18inline_hidden_funcvE3var = linkonce_odr hidden global i32 0, comdat +// CHECK-NO-VIH-DAG: @_ZZ19inline_default_funcvE3var = linkonce_odr global i32 0, comdat +// CHECK-NO-VIH-DAG: @_ZZN13ExportedClass10inl_methodEvE3var = linkonce_odr global i32 0, comdat, align 4 +// CHECK-NO-VIH-DAG: define i32 @_Z4funcv() +// CHECK-NO-VIH-DAG: define hidden i32 @_Z11hidden_funcv() +// CHECK-NO-VIH-DAG: define i32 @_Z12default_funcv() +// CHECK-NO-VIH-DAG: define linkonce_odr i32 @_Z11inline_funcv() +// CHECK-NO-VIH-DAG: define linkonce_odr hidden i32 @_Z18inline_hidden_funcv() +// CHECK-NO-VIH-DAG: define linkonce_odr i32 @_Z19inline_default_funcv() +// CHECK-NO-VIH-DAG: define linkonce_odr i32 @_ZN13ExportedClass10inl_methodEv({{.*}}) +// CHECK-NO-VIH-DAG: define i32 @_ZN13ExportedClass10ext_methodEv({{.*}}) + +// CHECK-VIS-HIDDEN-DAG: @_ZZ4funcvE3var = internal global i32 0 +// CHECK-VIS-HIDDEN-DAG: @_ZZ11hidden_funcvE3var = internal global i32 0 +// CHECK-VIS-HIDDEN-DAG: @_ZZ12default_funcvE3var = internal global i32 0 +// CHECK-VIS-HIDDEN-DAG: @_ZZ11inline_funcvE3var = linkonce_odr hidden global i32 0, comdat +// CHECK-VIS-HIDDEN-DAG: @_ZZ18inline_hidden_funcvE3var = linkonce_odr hidden global i32 0, comdat +// CHECK-VIS-HIDDEN-DAG: @_ZZ19inline_default_funcvE3var = linkonce_odr global i32 0, comdat +// CHECK-VIS-HIDDEN-DAG: @_ZZN13ExportedClass10inl_methodEvE3var = linkonce_odr global i32 0, comdat, align 4 +// CHECK-VIS-HIDDEN-DAG: define hidden i32 @_Z4funcv() +// CHECK-VIS-HIDDEN-DAG: define hidden i32 @_Z11hidden_funcv() +// CHECK-VIS-HIDDEN-DAG: define i32 @_Z12default_funcv() +// CHECK-VIS-HIDDEN-DAG: define linkonce_odr hidden i32 @_Z11inline_funcv() +// CHECK-VIS-HIDDEN-DAG: define linkonce_odr hidden i32 @_Z18inline_hidden_funcv() +// CHECK-VIS-HIDDEN-DAG: define linkonce_odr i32 @_Z19inline_default_funcv() +// CHECK-VIS-HIDDEN-DAG: define linkonce_odr hidden i32 @_ZN13ExportedClass10inl_methodEv({{.*}}) +// CHECK-VIS-HIDDEN-DAG: define i32 @_ZN13ExportedClass10ext_methodEv({{.*}}) + +// CHECK-VIS-PROTECTED-DAG: @_ZZ4funcvE3var = internal global i32 0 +// CHECK-VIS-PROTECTED-DAG: @_ZZ11hidden_funcvE3var = internal global i32 0 +// CHECK-VIS-PROTECTED-DAG: @_ZZ12default_funcvE3var = internal global i32 0 +// CHECK-VIS-PROTECTED-DAG: @_ZZ11inline_funcvE3var = linkonce_odr protected global i32 0, comdat +// CHECK-VIS-PROTECTED-DAG: @_ZZ18inline_hidden_funcvE3var = linkonce_odr hidden global i32 0, comdat +// CHECK-VIS-PROTECTED-DAG: @_ZZ19inline_default_funcvE3var = linkonce_odr global i32 0, comdat +// CHECK-VIS-PROTECTED-DAG: @_ZZN13ExportedClass10inl_methodEvE3var = linkonce_odr global i32 0, comdat, align 4 +// CHECK-VIS-PROTECTED-DAG: define protected i32 @_Z4funcv() +// CHECK-VIS-PROTECTED-DAG: define hidden i32 @_Z11hidden_funcv() +// CHECK-VIS-PROTECTED-DAG: define i32 @_Z12default_funcv() +// CHECK-VIS-PROTECTED-DAG: define linkonce_odr hidden i32 @_Z11inline_funcv() +// CHECK-VIS-PROTECTED-DAG: define linkonce_odr hidden i32 @_Z18inline_hidden_funcv() +// CHECK-VIS-PROTECTED-DAG: define linkonce_odr i32 @_Z19inline_default_funcv() +// CHECK-VIS-PROTECTED-DAG: define linkonce_odr hidden i32 @_ZN13ExportedClass10inl_methodEv({{.*}}) +// CHECK-VIS-PROTECTED-DAG: define i32 @_ZN13ExportedClass10ext_methodEv({{.*}}) + +int func(void) { + static int var = 0; + return var++; +} +inline int inline_func(void) { + static int var = 0; + return var++; +} +int __attribute__((visibility("hidden"))) hidden_func(void) { + static int var = 0; + return var++; +} +inline int __attribute__((visibility("hidden"))) inline_hidden_func(void) { + static int var = 0; + return var++; +} +int __attribute__((visibility("default"))) default_func(void) { + static int var = 0; + return var++; +} +inline int __attribute__((visibility("default"))) inline_default_func(void) { + static int var = 0; + return var++; +} +struct __attribute__((visibility("default"))) ExportedClass { + int inl_method() { + static int var = 0; + return var++; + } + int ext_method(); +}; +int ExportedClass::ext_method() { return inl_method(); } +void bar(void) { + func(); + inline_func(); + hidden_func(); + inline_hidden_func(); + default_func(); + inline_default_func(); +} Modified: vendor/clang/dist-release_70/test/Driver/openbsd.c ============================================================================== --- vendor/clang/dist-release_70/test/Driver/openbsd.c Sat Dec 8 14:31:55 2018 (r341729) +++ vendor/clang/dist-release_70/test/Driver/openbsd.c Sat Dec 8 14:31:58 2018 (r341730) @@ -12,7 +12,7 @@ // RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -pg -pthread %s -### 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-PG %s // CHECK-PG: clang{{.*}}" "-cc1" "-triple" "i686-pc-openbsd" -// CHECK-PG: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-o" "a.out" "{{.*}}gcrt0.o" "{{.*}}crtbegin.o" "{{.*}}.o" "-lgcc" "-lpthread_p" "-lc_p" "-lgcc" "{{.*}}crtend.o" +// CHECK-PG: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-nopie" "-o" "a.out" "{{.*}}gcrt0.o" "{{.*}}crtbegin.o" "{{.*}}.o" "-lgcc" "-lpthread_p" "-lc_p" "-lgcc" "{{.*}}crtend.o" // Check CPU type for MIPS64 // RUN: %clang -target mips64-unknown-openbsd -### -c %s 2>&1 \ From owner-svn-src-all@freebsd.org Sat Dec 8 14:32:19 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1888D1318516; Sat, 8 Dec 2018 14:32:19 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BCF1C806F9; Sat, 8 Dec 2018 14:32:15 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A7C5D23671; Sat, 8 Dec 2018 14:32:10 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB8EWAxo060438; Sat, 8 Dec 2018 14:32:10 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB8EWAso060436; Sat, 8 Dec 2018 14:32:10 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201812081432.wB8EWAso060436@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 8 Dec 2018 14:32:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r341733 - in vendor/libc++/dist-release_70: cmake/Modules src/filesystem X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in vendor/libc++/dist-release_70: cmake/Modules src/filesystem X-SVN-Commit-Revision: 341733 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: BCF1C806F9 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]; 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Dec 2018 14:32:19 -0000 Author: dim Date: Sat Dec 8 14:32:10 2018 New Revision: 341733 URL: https://svnweb.freebsd.org/changeset/base/341733 Log: Vendor import of libc++ release_70 branch r348686: https://llvm.org/svn/llvm-project/libcxx/branches/release_70@348686 Modified: vendor/libc++/dist-release_70/cmake/Modules/HandleLibCXXABI.cmake vendor/libc++/dist-release_70/src/filesystem/operations.cpp Modified: vendor/libc++/dist-release_70/cmake/Modules/HandleLibCXXABI.cmake ============================================================================== --- vendor/libc++/dist-release_70/cmake/Modules/HandleLibCXXABI.cmake Sat Dec 8 14:32:07 2018 (r341732) +++ vendor/libc++/dist-release_70/cmake/Modules/HandleLibCXXABI.cmake Sat Dec 8 14:32:10 2018 (r341733) @@ -41,7 +41,7 @@ macro(setup_abi_lib abidefines abilib abifiles abidirs get_filename_component(ifile ${fpath} NAME) set(src ${incpath}/${fpath}) - set(dst ${LIBCXX_BINARY_INCLUDE_DIR}/${dstdir}/${fpath}) + set(dst ${LIBCXX_BINARY_INCLUDE_DIR}/${dstdir}/${ifile}) add_custom_command(OUTPUT ${dst} DEPENDS ${src} COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst} Modified: vendor/libc++/dist-release_70/src/filesystem/operations.cpp ============================================================================== --- vendor/libc++/dist-release_70/src/filesystem/operations.cpp Sat Dec 8 14:32:07 2018 (r341732) +++ vendor/libc++/dist-release_70/src/filesystem/operations.cpp Sat Dec 8 14:32:10 2018 (r341733) @@ -352,7 +352,6 @@ struct FileDescriptor { ~FileDescriptor() { close(); } - FileDescriptor() = default; FileDescriptor(FileDescriptor const&) = delete; FileDescriptor& operator=(FileDescriptor const&) = delete; From owner-svn-src-all@freebsd.org Sat Dec 8 14:54:34 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 58AE2131A6DE; Sat, 8 Dec 2018 14:54:34 +0000 (UTC) (envelope-from karels@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EFE3C81BAA; Sat, 8 Dec 2018 14:54:33 +0000 (UTC) (envelope-from karels@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CB761239E3; Sat, 8 Dec 2018 14:54:33 +0000 (UTC) (envelope-from karels@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB8EsXhN071342; Sat, 8 Dec 2018 14:54:33 GMT (envelope-from karels@FreeBSD.org) Received: (from karels@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB8EsXSX071340; Sat, 8 Dec 2018 14:54:33 GMT (envelope-from karels@FreeBSD.org) Message-Id: <201812081454.wB8EsXSX071340@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: karels set sender to karels@FreeBSD.org using -f From: Mike Karels Date: Sat, 8 Dec 2018 14:54:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341737 - stable/12/sys/net/altq X-SVN-Group: stable-12 X-SVN-Commit-Author: karels X-SVN-Commit-Paths: stable/12/sys/net/altq X-SVN-Commit-Revision: 341737 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: EFE3C81BAA 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Dec 2018 14:54:34 -0000 Author: karels Date: Sat Dec 8 14:54:33 2018 New Revision: 341737 URL: https://svnweb.freebsd.org/changeset/base/341737 Log: MFC r340474: Fix flags collision causing inability to enable CBQ in ALTQ The CBQ BORROW flag conflicts with the RMCF_CODEL flag; the two sets of definitions actually define the same things. The symptom is that a kernel with CBQ support and not CODEL fails to load a QoS policy with the obscure error "pfctl: DIOCADDALTQ: Cannot allocate memory." If ALTQ_DEBUG is enabled, the error becomes a little clearer: "rmc_newclass: CODEL not configured for CBQ!" is printed by the kernel. There really shouldn't be two sets of macros that have to be defined consistently, but the include structure isn't right for exporting CBQ flags to altq_rmclass.h. Re-align the definitions, and add CTASSERTs in the kernel to ensure that the definitions are consistent. PR: 215716 Reviewed by: pkelsey Sponsored by: Forcepoint LLC Differential Revision: https://reviews.freebsd.org/D17758 Modified: stable/12/sys/net/altq/altq_cbq.h stable/12/sys/net/altq/altq_rmclass.h Modified: stable/12/sys/net/altq/altq_cbq.h ============================================================================== --- stable/12/sys/net/altq/altq_cbq.h Sat Dec 8 14:32:19 2018 (r341736) +++ stable/12/sys/net/altq/altq_cbq.h Sat Dec 8 14:54:33 2018 (r341737) @@ -46,7 +46,7 @@ extern "C" { #define NULL_CLASS_HANDLE 0 -/* class flags should be same as class flags in rm_class.h */ +/* class flags must be same as class flags in altq_rmclass.h */ #define CBQCLF_RED 0x0001 /* use RED */ #define CBQCLF_ECN 0x0002 /* use RED/ECN */ #define CBQCLF_RIO 0x0004 /* use RIO */ @@ -54,6 +54,15 @@ extern "C" { #define CBQCLF_CLEARDSCP 0x0010 /* clear diffserv codepoint */ #define CBQCLF_BORROW 0x0020 /* borrow from parent */ #define CBQCLF_CODEL 0x0040 /* use CoDel */ + +#ifdef _KERNEL +CTASSERT(CBQCLF_RED == RMCF_RED); +CTASSERT(CBQCLF_ECN == RMCF_ECN); +CTASSERT(CBQCLF_RIO == RMCF_RIO); +CTASSERT(CBQCLF_FLOWVALVE == RMCF_FLOWVALVE); +CTASSERT(CBQCLF_CLEARDSCP == RMCF_CLEARDSCP); +CTASSERT(CBQCLF_CODEL == RMCF_CODEL); +#endif /* class flags only for root class */ #define CBQCLF_WRR 0x0100 /* weighted-round robin */ Modified: stable/12/sys/net/altq/altq_rmclass.h ============================================================================== --- stable/12/sys/net/altq/altq_rmclass.h Sat Dec 8 14:32:19 2018 (r341736) +++ stable/12/sys/net/altq/altq_rmclass.h Sat Dec 8 14:54:33 2018 (r341737) @@ -233,13 +233,13 @@ struct rm_ifdat { }; /* flags for rmc_init and rmc_newclass */ -/* class flags */ +/* class flags; must be the same as class flags in altq_cbq.h */ #define RMCF_RED 0x0001 #define RMCF_ECN 0x0002 #define RMCF_RIO 0x0004 #define RMCF_FLOWVALVE 0x0008 /* use flowvalve (aka penalty-box) */ #define RMCF_CLEARDSCP 0x0010 /* clear diffserv codepoint */ -#define RMCF_CODEL 0x0020 +#define RMCF_CODEL 0x0040 /* flags for rmc_init */ #define RMCF_WRR 0x0100 From owner-svn-src-all@freebsd.org Sat Dec 8 14:58:18 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-all@freebsd.org Sat Dec 8 17:28:53 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 87AFB1323496; Sat, 8 Dec 2018 17:28:53 +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 2A3C887056; Sat, 8 Dec 2018 17:28:53 +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 058E6252BE; Sat, 8 Dec 2018 17:28:53 +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 wB8HSqjh049668; Sat, 8 Dec 2018 17:28:52 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB8HSqsp049667; Sat, 8 Dec 2018 17:28:52 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201812081728.wB8HSqsp049667@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sat, 8 Dec 2018 17:28:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r341739 - in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 341739 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2A3C887056 X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.996,0]; NEURAL_HAM_LONG(-0.99)[-0.990,0]; NEURAL_HAM_SHORT(-0.97)[-0.975,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Dec 2018 17:28:53 -0000 Author: cy Date: Sat Dec 8 17:28:52 2018 New Revision: 341739 URL: https://svnweb.freebsd.org/changeset/base/341739 Log: MFC r341384: Remove IFF_DRVRLOCK as it is used in IRIX only (and we all know IRIX is dead). This includes collaterally removing code shared by HP/UX, SGI, and Linux, where IP Filter will in all likelihood for various reasons never run again. Modified: stable/11/sys/contrib/ipfilter/netinet/ip_log.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/contrib/ipfilter/netinet/ip_log.c stable/12/sys/contrib/ipfilter/netinet/ip_log.c Directory Properties: stable/10/ (props changed) stable/12/ (props changed) Modified: stable/11/sys/contrib/ipfilter/netinet/ip_log.c ============================================================================== --- stable/11/sys/contrib/ipfilter/netinet/ip_log.c Sat Dec 8 14:58:17 2018 (r341738) +++ stable/11/sys/contrib/ipfilter/netinet/ip_log.c Sat Dec 8 17:28:52 2018 (r341739) @@ -97,14 +97,8 @@ struct file; #include #ifdef __sgi # include -# ifdef IFF_DRVRLOCK /* IRIX6 */ -# include -# endif #endif -#if !defined(__hpux) && !defined(linux) && \ - !(defined(__sgi) && !defined(IFF_DRVRLOCK)) /*IRIX<6*/ # include -#endif #include #include #include From owner-svn-src-all@freebsd.org Sat Dec 8 17:28:54 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 33F9013234A1; Sat, 8 Dec 2018 17:28:54 +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 CC25187058; Sat, 8 Dec 2018 17:28:53 +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 A74BD252C0; Sat, 8 Dec 2018 17:28:53 +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 wB8HSrVF049680; Sat, 8 Dec 2018 17:28:53 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB8HSrQS049679; Sat, 8 Dec 2018 17:28:53 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201812081728.wB8HSrQS049679@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sat, 8 Dec 2018 17:28:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r341739 - in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-10 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 341739 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: CC25187058 X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.996,0]; NEURAL_HAM_SHORT(-0.97)[-0.975,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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Dec 2018 17:28:54 -0000 Author: cy Date: Sat Dec 8 17:28:52 2018 New Revision: 341739 URL: https://svnweb.freebsd.org/changeset/base/341739 Log: MFC r341384: Remove IFF_DRVRLOCK as it is used in IRIX only (and we all know IRIX is dead). This includes collaterally removing code shared by HP/UX, SGI, and Linux, where IP Filter will in all likelihood for various reasons never run again. Modified: stable/10/sys/contrib/ipfilter/netinet/ip_log.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/contrib/ipfilter/netinet/ip_log.c stable/12/sys/contrib/ipfilter/netinet/ip_log.c Directory Properties: stable/11/ (props changed) stable/12/ (props changed) Modified: stable/10/sys/contrib/ipfilter/netinet/ip_log.c ============================================================================== --- stable/10/sys/contrib/ipfilter/netinet/ip_log.c Sat Dec 8 14:58:17 2018 (r341738) +++ stable/10/sys/contrib/ipfilter/netinet/ip_log.c Sat Dec 8 17:28:52 2018 (r341739) @@ -97,14 +97,8 @@ struct file; #include #ifdef __sgi # include -# ifdef IFF_DRVRLOCK /* IRIX6 */ -# include -# endif #endif -#if !defined(__hpux) && !defined(linux) && \ - !(defined(__sgi) && !defined(IFF_DRVRLOCK)) /*IRIX<6*/ # include -#endif #include #include #include From owner-svn-src-all@freebsd.org Sat Dec 8 17:28:54 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EF6BC132349C; Sat, 8 Dec 2018 17:28:53 +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 8CBD987057; Sat, 8 Dec 2018 17:28:53 +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 6D621252BF; Sat, 8 Dec 2018 17:28:53 +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 wB8HSr9E049674; Sat, 8 Dec 2018 17:28:53 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB8HSrRx049673; Sat, 8 Dec 2018 17:28:53 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201812081728.wB8HSrRx049673@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sat, 8 Dec 2018 17:28:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341739 - in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 341739 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8CBD987057 X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.996,0]; NEURAL_HAM_SHORT(-0.97)[-0.975,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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Dec 2018 17:28:54 -0000 Author: cy Date: Sat Dec 8 17:28:52 2018 New Revision: 341739 URL: https://svnweb.freebsd.org/changeset/base/341739 Log: MFC r341384: Remove IFF_DRVRLOCK as it is used in IRIX only (and we all know IRIX is dead). This includes collaterally removing code shared by HP/UX, SGI, and Linux, where IP Filter will in all likelihood for various reasons never run again. Modified: stable/12/sys/contrib/ipfilter/netinet/ip_log.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/contrib/ipfilter/netinet/ip_log.c stable/11/sys/contrib/ipfilter/netinet/ip_log.c Directory Properties: stable/10/ (props changed) stable/11/ (props changed) Modified: stable/12/sys/contrib/ipfilter/netinet/ip_log.c ============================================================================== --- stable/12/sys/contrib/ipfilter/netinet/ip_log.c Sat Dec 8 14:58:17 2018 (r341738) +++ stable/12/sys/contrib/ipfilter/netinet/ip_log.c Sat Dec 8 17:28:52 2018 (r341739) @@ -97,14 +97,8 @@ struct file; #include #ifdef __sgi # include -# ifdef IFF_DRVRLOCK /* IRIX6 */ -# include -# endif #endif -#if !defined(__hpux) && !defined(linux) && \ - !(defined(__sgi) && !defined(IFF_DRVRLOCK)) /*IRIX<6*/ # include -#endif #include #include #include From owner-svn-src-all@freebsd.org Sat Dec 8 17:50:02 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6DA531323E8D; Sat, 8 Dec 2018 17:50:02 +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 03E2E888B6; Sat, 8 Dec 2018 17:50:02 +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 DA5B9255F4; Sat, 8 Dec 2018 17:50:01 +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 wB8Ho1sL060282; Sat, 8 Dec 2018 17:50:01 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB8Ho1NR060281; Sat, 8 Dec 2018 17:50:01 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201812081750.wB8Ho1NR060281@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sat, 8 Dec 2018 17:50:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341740 - in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 341740 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 03E2E888B6 X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.996,0]; NEURAL_HAM_SHORT(-0.96)[-0.961,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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Dec 2018 17:50:02 -0000 Author: cy Date: Sat Dec 8 17:50:00 2018 New Revision: 341740 URL: https://svnweb.freebsd.org/changeset/base/341740 Log: MFC r341377, r341388 (fixup): Restore handling of PMTU discovery, removed through an unifdef(1) following the MFV of r254219 into r255332. In addition the 'FreeBSD' macro was never defined in ipfilter 5.1.2 thus it never would have been enabled in the first place. This work is prompted by a general cleanup of the IP Filter code prompted by working to resolve a PR. More to follow. Modified: stable/12/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c stable/11/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Directory Properties: stable/10/ (props changed) stable/11/ (props changed) Modified: stable/12/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c ============================================================================== --- stable/12/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Sat Dec 8 17:28:52 2018 (r341739) +++ stable/12/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Sat Dec 8 17:50:00 2018 (r341740) @@ -85,7 +85,6 @@ static const char rcsid[] = "@(#)$Id$"; #endif extern int ip_optcopy __P((struct ip *, struct ip *)); - # ifdef IPFILTER_M_IPFILTER MALLOC_DEFINE(M_IPFILTER, "ipfilter", "IP Filter packet filter data structures"); # endif @@ -477,11 +476,7 @@ ipf_send_ip(fin, m) IP_HL_A(ip, sizeof(*oip) >> 2); ip->ip_tos = oip->ip_tos; ip->ip_id = fin->fin_ip->ip_id; -#if defined(FreeBSD) && (__FreeBSD_version > 460000) - ip->ip_off = htons(path_mtu_discovery ? IP_DF : 0); -#else - ip->ip_off = 0; -#endif + ip->ip_off = htons(V_path_mtu_discovery ? IP_DF : 0); ip->ip_ttl = V_ip_defttl; ip->ip_sum = 0; break; From owner-svn-src-all@freebsd.org Sat Dec 8 17:50:02 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0917C1323E70; Sat, 8 Dec 2018 17:50:02 +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 A5028888B4; Sat, 8 Dec 2018 17:50:01 +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 87A4F255F3; Sat, 8 Dec 2018 17:50:01 +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 wB8Ho13v060276; Sat, 8 Dec 2018 17:50:01 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB8Ho1ZD060275; Sat, 8 Dec 2018 17:50:01 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201812081750.wB8Ho1ZD060275@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sat, 8 Dec 2018 17:50:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r341740 - in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 341740 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A5028888B4 X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.996,0]; NEURAL_HAM_SHORT(-0.96)[-0.961,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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Dec 2018 17:50:02 -0000 Author: cy Date: Sat Dec 8 17:50:00 2018 New Revision: 341740 URL: https://svnweb.freebsd.org/changeset/base/341740 Log: MFC r341377, r341388 (fixup): Restore handling of PMTU discovery, removed through an unifdef(1) following the MFV of r254219 into r255332. In addition the 'FreeBSD' macro was never defined in ipfilter 5.1.2 thus it never would have been enabled in the first place. This work is prompted by a general cleanup of the IP Filter code prompted by working to resolve a PR. More to follow. Modified: stable/11/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c stable/12/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Directory Properties: stable/10/ (props changed) stable/12/ (props changed) Modified: stable/11/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c ============================================================================== --- stable/11/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Sat Dec 8 17:28:52 2018 (r341739) +++ stable/11/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Sat Dec 8 17:50:00 2018 (r341740) @@ -85,7 +85,6 @@ static const char rcsid[] = "@(#)$Id$"; #endif extern int ip_optcopy __P((struct ip *, struct ip *)); - # ifdef IPFILTER_M_IPFILTER MALLOC_DEFINE(M_IPFILTER, "ipfilter", "IP Filter packet filter data structures"); # endif @@ -477,11 +476,7 @@ ipf_send_ip(fin, m) IP_HL_A(ip, sizeof(*oip) >> 2); ip->ip_tos = oip->ip_tos; ip->ip_id = fin->fin_ip->ip_id; -#if defined(FreeBSD) && (__FreeBSD_version > 460000) - ip->ip_off = htons(path_mtu_discovery ? IP_DF : 0); -#else - ip->ip_off = 0; -#endif + ip->ip_off = htons(V_path_mtu_discovery ? IP_DF : 0); ip->ip_ttl = V_ip_defttl; ip->ip_sum = 0; break; From owner-svn-src-all@freebsd.org Sat Dec 8 17:50:02 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9AB351323E8E; Sat, 8 Dec 2018 17:50:02 +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 41BA3888B8; Sat, 8 Dec 2018 17:50:02 +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 1F078255F5; Sat, 8 Dec 2018 17:50:02 +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 wB8Ho2VP060288; Sat, 8 Dec 2018 17:50:02 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB8Ho2dN060287; Sat, 8 Dec 2018 17:50:02 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201812081750.wB8Ho2dN060287@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sat, 8 Dec 2018 17:50:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r341740 - in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-10 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 341740 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 41BA3888B8 X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.996,0]; NEURAL_HAM_SHORT(-0.96)[-0.961,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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Dec 2018 17:50:02 -0000 Author: cy Date: Sat Dec 8 17:50:00 2018 New Revision: 341740 URL: https://svnweb.freebsd.org/changeset/base/341740 Log: MFC r341377, r341388 (fixup): Restore handling of PMTU discovery, removed through an unifdef(1) following the MFV of r254219 into r255332. In addition the 'FreeBSD' macro was never defined in ipfilter 5.1.2 thus it never would have been enabled in the first place. This work is prompted by a general cleanup of the IP Filter code prompted by working to resolve a PR. More to follow. Modified: stable/10/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c stable/12/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Directory Properties: stable/11/ (props changed) stable/12/ (props changed) Modified: stable/10/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c ============================================================================== --- stable/10/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Sat Dec 8 17:28:52 2018 (r341739) +++ stable/10/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Sat Dec 8 17:50:00 2018 (r341740) @@ -88,7 +88,6 @@ static const char rcsid[] = "@(#)$Id$"; #endif extern int ip_optcopy __P((struct ip *, struct ip *)); - # ifdef IPFILTER_M_IPFILTER MALLOC_DEFINE(M_IPFILTER, "ipfilter", "IP Filter packet filter data structures"); # endif @@ -472,11 +471,7 @@ ipf_send_ip(fin, m) IP_HL_A(ip, sizeof(*oip) >> 2); ip->ip_tos = oip->ip_tos; ip->ip_id = fin->fin_ip->ip_id; -#if defined(FreeBSD) && (__FreeBSD_version > 460000) - ip->ip_off = htons(path_mtu_discovery ? IP_DF : 0); -#else - ip->ip_off = 0; -#endif + ip->ip_off = htons(V_path_mtu_discovery ? IP_DF : 0); ip->ip_ttl = V_ip_defttl; ip->ip_sum = 0; break; From owner-svn-src-all@freebsd.org Sat Dec 8 18:34:06 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-all@freebsd.org Sat Dec 8 19:11:00 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-all@freebsd.org Sat Dec 8 19:32:24 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-all@freebsd.org Sat Dec 8 19:38:57 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-all@freebsd.org Sat Dec 8 19:42:02 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-all@freebsd.org Sat Dec 8 19:45:07 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1DD7013279E1; Sat, 8 Dec 2018 19:45:07 +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 B9F068D5A8; Sat, 8 Dec 2018 19:45:06 +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 7E35F269EC; Sat, 8 Dec 2018 19:45:06 +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 wB8Jj67S023784; Sat, 8 Dec 2018 19:45:06 GMT (envelope-from yuripv@FreeBSD.org) Received: (from yuripv@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB8Jj5jh023781; Sat, 8 Dec 2018 19:45:05 GMT (envelope-from yuripv@FreeBSD.org) Message-Id: <201812081945.wB8Jj5jh023781@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: yuripv set sender to yuripv@FreeBSD.org using -f From: Yuri Pankov Date: Sat, 8 Dec 2018 19:45:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341745 - in stable/12/lib/libc: regex tests/regex X-SVN-Group: stable-12 X-SVN-Commit-Author: yuripv X-SVN-Commit-Paths: in stable/12/lib/libc: regex tests/regex X-SVN-Commit-Revision: 341745 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B9F068D5A8 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.990,0]; NEURAL_HAM_SHORT(-0.97)[-0.972,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Dec 2018 19:45:07 -0000 Author: yuripv Date: Sat Dec 8 19:45:05 2018 New Revision: 341745 URL: https://svnweb.freebsd.org/changeset/base/341745 Log: MFC r340835: regexec: fix processing multibyte strings. Matcher function incorrectly assumed that moffset that we get from findmust is in bytes. Fix this by introducing a stepback function, taking short path if MB_CUR_MAX is 1, and going back byte-by-byte, checking if we have a legal character sequence otherwise. PR: 153502 Reviewed by: pfg, kevans Differential revision: https://reviews.freebsd.org/D18297 Added: stable/12/lib/libc/tests/regex/multibyte.sh - copied unchanged from r340835, head/lib/libc/tests/regex/multibyte.sh Modified: stable/12/lib/libc/regex/engine.c stable/12/lib/libc/tests/regex/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libc/regex/engine.c ============================================================================== --- stable/12/lib/libc/regex/engine.c Sat Dec 8 19:42:01 2018 (r341744) +++ stable/12/lib/libc/regex/engine.c Sat Dec 8 19:45:05 2018 (r341745) @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); */ #ifdef SNAMES +#define stepback sstepback #define matcher smatcher #define walk swalk #define dissect sdissect @@ -58,6 +59,7 @@ __FBSDID("$FreeBSD$"); #define match smat #endif #ifdef LNAMES +#define stepback lstepback #define matcher lmatcher #define walk lwalk #define dissect ldissect @@ -68,6 +70,7 @@ __FBSDID("$FreeBSD$"); #define match lmat #endif #ifdef MNAMES +#define stepback mstepback #define matcher mmatcher #define walk mwalk #define dissect mdissect @@ -142,6 +145,39 @@ static const char *pchar(int ch); #endif /* + * Given a multibyte string pointed to by start, step back nchar characters + * from current position pointed to by cur. + */ +static const char * +stepback(const char *start, const char *cur, int nchar) +{ + const char *ret; + int wc, mbc; + mbstate_t mbs; + size_t clen; + + if (MB_CUR_MAX == 1) + return ((cur - nchar) > start ? cur - nchar : NULL); + + ret = cur; + for (wc = nchar; wc > 0; wc--) { + for (mbc = 1; mbc <= MB_CUR_MAX; mbc++) { + if ((ret - mbc) < start) + return (NULL); + memset(&mbs, 0, sizeof(mbs)); + clen = mbrtowc(NULL, ret - mbc, mbc, &mbs); + if (clen != (size_t)-1 && clen != (size_t)-2) + break; + } + if (mbc > MB_CUR_MAX) + return (NULL); + ret -= mbc; + } + + return (ret); +} + +/* - matcher - the actual matching engine == static int matcher(struct re_guts *g, const char *string, \ == size_t nmatch, regmatch_t pmatch[], int eflags); @@ -244,9 +280,14 @@ matcher(struct re_guts *g, ZAPSTATE(&m->mbs); /* Adjust start according to moffset, to speed things up */ - if (dp != NULL && g->moffset > -1) - start = ((dp - g->moffset) < start) ? start : dp - g->moffset; + if (dp != NULL && g->moffset > -1) { + const char *nstart; + nstart = stepback(start, dp, g->moffset); + if (nstart != NULL) + start = nstart; + } + SP("mloop", m->st, *start); /* this loop does only one repetition except for backrefs */ @@ -1083,6 +1124,7 @@ pchar(int ch) #endif #endif +#undef stepback #undef matcher #undef walk #undef dissect Modified: stable/12/lib/libc/tests/regex/Makefile ============================================================================== --- stable/12/lib/libc/tests/regex/Makefile Sat Dec 8 19:42:01 2018 (r341744) +++ stable/12/lib/libc/tests/regex/Makefile Sat Dec 8 19:45:05 2018 (r341745) @@ -2,6 +2,9 @@ PACKAGE= tests +# local test cases +ATF_TESTS_SH+= multibyte + .include "Makefile.inc" .include "${.CURDIR:H}/Makefile.netbsd-tests" .include Copied: stable/12/lib/libc/tests/regex/multibyte.sh (from r340835, head/lib/libc/tests/regex/multibyte.sh) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/lib/libc/tests/regex/multibyte.sh Sat Dec 8 19:45:05 2018 (r341745, copy of r340835, head/lib/libc/tests/regex/multibyte.sh) @@ -0,0 +1,35 @@ +# $FreeBSD$ + +atf_test_case multibyte +multibyte_head() +{ + atf_set "descr" "Check matching multibyte characters (PR153502)" +} +multibyte_body() +{ + export LC_CTYPE="C.UTF-8" + + printf 'é' | atf_check -o "inline:é" \ + sed -ne '/^.$/p' + printf 'éé' | atf_check -o "inline:éé" \ + sed -ne '/^..$/p' + printf 'aéa' | atf_check -o "inline:aéa" \ + sed -ne '/a.a/p' + printf 'aéa'| atf_check -o "inline:aéa" \ + sed -ne '/a.*a/p' + printf 'aaéaa' | atf_check -o "inline:aaéaa" \ + sed -ne '/aa.aa/p' + printf 'aéaéa' | atf_check -o "inline:aéaéa" \ + sed -ne '/a.a.a/p' + printf 'éa' | atf_check -o "inline:éa" \ + sed -ne '/.a/p' + printf 'aéaa' | atf_check -o "inline:aéaa" \ + sed -ne '/a.aa/p' + printf 'éaé' | atf_check -o "inline:éaé" \ + sed -ne '/.a./p' +} + +atf_init_test_cases() +{ + atf_add_test_case multibyte +} From owner-svn-src-all@freebsd.org Sat Dec 8 22:12:58 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org 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-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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