From owner-svn-src-all@freebsd.org Sun Aug 9 00:34:36 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5D3B43A9233; Sun, 9 Aug 2020 00:34:36 +0000 (UTC) (envelope-from grog@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BPKqJ1n7rz4VCV; Sun, 9 Aug 2020 00:34:36 +0000 (UTC) (envelope-from grog@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2071A10EF4; Sun, 9 Aug 2020 00:34:36 +0000 (UTC) (envelope-from grog@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0790YaB0041267; Sun, 9 Aug 2020 00:34:36 GMT (envelope-from grog@FreeBSD.org) Received: (from grog@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0790YZYL041266; Sun, 9 Aug 2020 00:34:35 GMT (envelope-from grog@FreeBSD.org) Message-Id: <202008090034.0790YZYL041266@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: grog set sender to grog@FreeBSD.org using -f From: Greg Lehey Date: Sun, 9 Aug 2020 00:34:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364056 - head/usr.bin/calendar/calendars X-SVN-Group: head X-SVN-Commit-Author: grog X-SVN-Commit-Paths: head/usr.bin/calendar/calendars X-SVN-Commit-Revision: 364056 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2020 00:34:36 -0000 Author: grog Date: Sun Aug 9 00:34:35 2020 New Revision: 364056 URL: https://svnweb.freebsd.org/changeset/base/364056 Log: Remove incorrect duplicate. Modified: head/usr.bin/calendar/calendars/calendar.history Modified: head/usr.bin/calendar/calendars/calendar.history ============================================================================== --- head/usr.bin/calendar/calendars/calendar.history Sat Aug 8 19:48:15 2020 (r364055) +++ head/usr.bin/calendar/calendars/calendar.history Sun Aug 9 00:34:35 2020 (r364056) @@ -408,7 +408,6 @@ 08/06 Caricom in Barbados 08/06 Cy Young pitches first game, 1890 08/07 Jack the Ripper makes his first kill, 1888 -08/08 Atomic bomb dropped on Nagasaki, 1945 08/08 Montenegro declares war on Germany, 1914 08/08 Richard Nixon resigns the US presidency, 1974 08/08 The Great Train Robbery -- $7,368,000, 1963 From owner-svn-src-all@freebsd.org Sun Aug 9 00:35:47 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C67643A9248; Sun, 9 Aug 2020 00:35:47 +0000 (UTC) (envelope-from grog@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BPKrg4vK7z4VRv; Sun, 9 Aug 2020 00:35:47 +0000 (UTC) (envelope-from grog@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8BBA310DEF; Sun, 9 Aug 2020 00:35:47 +0000 (UTC) (envelope-from grog@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0790Zlut041380; Sun, 9 Aug 2020 00:35:47 GMT (envelope-from grog@FreeBSD.org) Received: (from grog@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0790Zltf041379; Sun, 9 Aug 2020 00:35:47 GMT (envelope-from grog@FreeBSD.org) Message-Id: <202008090035.0790Zltf041379@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: grog set sender to grog@FreeBSD.org using -f From: Greg Lehey Date: Sun, 9 Aug 2020 00:35:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364057 - head/usr.bin/calendar/calendars/de_DE.ISO8859-1 X-SVN-Group: head X-SVN-Commit-Author: grog X-SVN-Commit-Paths: head/usr.bin/calendar/calendars/de_DE.ISO8859-1 X-SVN-Commit-Revision: 364057 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2020 00:35:47 -0000 Author: grog Date: Sun Aug 9 00:35:47 2020 New Revision: 364057 URL: https://svnweb.freebsd.org/changeset/base/364057 Log: Correct date for Nagasaki bombing. Modified: head/usr.bin/calendar/calendars/de_DE.ISO8859-1/calendar.geschichte Modified: head/usr.bin/calendar/calendars/de_DE.ISO8859-1/calendar.geschichte ============================================================================== --- head/usr.bin/calendar/calendars/de_DE.ISO8859-1/calendar.geschichte Sun Aug 9 00:34:35 2020 (r364056) +++ head/usr.bin/calendar/calendars/de_DE.ISO8859-1/calendar.geschichte Sun Aug 9 00:35:47 2020 (r364057) @@ -104,7 +104,7 @@ LANG=de_DE.ISO8859-1 10/01 Verkündigung der Urteile im Nürnberger Hauptkriegsverbrecherprozeß, 1946 02/25 Auflösung der Landes Preußen durch den Kontrollrat, 1947 08/06 Erster Atombombenabwurf auf Hiroshima, 1945 -08/08 Atombombenabwurf auf Nagasaki, 1945 +08/09 Atombombenabwurf auf Nagasaki, 1945 04/19 Aufstand im Warschauer Ghetto, 1943 12/07 Japan bombardiert Pearl Harbor, 1941 From owner-svn-src-all@freebsd.org Sun Aug 9 08:48:39 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C44D33B06EB; Sun, 9 Aug 2020 08:48:39 +0000 (UTC) (envelope-from arichardson.kde@gmail.com) Received: from mail-ed1-f66.google.com (mail-ed1-f66.google.com [209.85.208.66]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BPXnM3PWbz3ZrX; Sun, 9 Aug 2020 08:48:39 +0000 (UTC) (envelope-from arichardson.kde@gmail.com) Received: by mail-ed1-f66.google.com with SMTP id di22so4250838edb.12; Sun, 09 Aug 2020 01:48:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=mo/6WYqFgWPmyS2mUqkBmq+N7zXh/q8YMJyBZvFxju4=; b=eUOSOWLcFNLWZjquWHnhBKy+11CrfYSCXYZgcyIsPW9/lLRoHBq2MRXUPeJbO3lPd2 i9S+TN4hpo2JRhaWuXXU6inZOqwDPTVU2ryrzbf2sa5moNCsF4bbIxpVgDdeyFP5Yp1Z HiZO7D+W1OpMS4epdRcohgljbh5eAXqV3B9wkaz2LOs1e6hhBXep5CDe8bAsSw1LGH9k 811gj9j4RLsEPWdJuVYhQGIYe0aQgUARzCgRI/N8P/1zFooHoIHq10rfQHszNnCP48pq Y3kykOo4727/v1DWnv2I9PYDh2d34j8HJkXmKtZOU/pwuzUDifHlVORUhnhys/f6le8a f5TA== X-Gm-Message-State: AOAM530kjME/aQJyBRbfbnxKGgd7/SjK9JW8YIzFiwLUpFtJXjCQijVz 3fkKclABCKesfjQBfT9VO6CwsMTf9Z3afQ== X-Google-Smtp-Source: ABdhPJxVESQZPC97HxsAdTD/HV6QYZ4lI8fsb8dm0RxbnmvV3i/xBBTh4exnfXlJi9A2z/u0jKeoKw== X-Received: by 2002:a05:6402:3130:: with SMTP id dd16mr9451083edb.55.1596962916788; Sun, 09 Aug 2020 01:48:36 -0700 (PDT) Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com. [209.85.221.53]) by smtp.gmail.com with ESMTPSA id l7sm9505409edn.45.2020.08.09.01.48.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 09 Aug 2020 01:48:36 -0700 (PDT) Received: by mail-wr1-f53.google.com with SMTP id c15so5388345wrs.11; Sun, 09 Aug 2020 01:48:36 -0700 (PDT) X-Received: by 2002:adf:f806:: with SMTP id s6mr20228665wrp.252.1596962915963; Sun, 09 Aug 2020 01:48:35 -0700 (PDT) MIME-Version: 1.0 References: <202008062046.076KkDSc013901@repo.freebsd.org> <11fb770c36b3da67506c9a8fb919490d038b98e5.camel@freebsd.org> In-Reply-To: <11fb770c36b3da67506c9a8fb919490d038b98e5.camel@freebsd.org> From: Alexander Richardson Date: Sun, 9 Aug 2020 09:48:25 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r363992 - head/usr.sbin/pwd_mkdb To: Ian Lepore Cc: Mateusz Guzik , src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4BPXnM3PWbz3ZrX X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; TAGGED_FROM(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2020 08:48:39 -0000 On Sat, 8 Aug 2020 at 17:27, Ian Lepore wrote: > > On Sat, 2020-08-08 at 11:08 +0100, Alexander Richardson wrote: > > On Sat, 8 Aug 2020 at 02:19, Mateusz Guzik wrote: > > > > > > This broke i386 builds: > > > > > > /usr/src/usr.bin/chpass/field.c:175:15: error: incompatible pointer > > > types passing > > > '_bootstrap_time_t *' (aka 'unsigned long long *') to > > > parameter > > > of type 'time_t *' > > > (aka 'int *') [-Werror,-Wincompatible-pointer-types] > > > if (!atot(p, &pw->pw_change)) > > > ^~~~~~~~~~~~~~ > > > /usr/src/usr.bin/chpass/chpass.h:67:27: note: passing argument to > > > parameter here > > > int atot(char *, time_t *); > > > ^ > > > /usr/src/usr.bin/chpass/field.c:185:15: error: incompatible pointer > > > types passing > > > '_bootstrap_time_t *' (aka 'unsigned long long *') to > > > parameter > > > of type 'time_t *' > > > (aka 'int *') [-Werror,-Wincompatible-pointer-types] > > > if (!atot(p, &pw->pw_expire)) > > > ^~~~~~~~~~~~~~ > > > /usr/src/usr.bin/chpass/chpass.h:67:27: note: passing argument to > > > parameter here > > > int atot(char *, time_t *); > > > ^ > > > > Sorry, fixed in r364049. > > > > It may be fixed in terms of compiling, but how about at runtime? > _bootstrap_time_t is still typedef'd as 64-bit, but on i386 a time_t is > a 32-bit type. > > -- Ian > The structure is only used as a temporary buffer before serializing the values to a fixed format. That format truncates all integers to 32-bit so changing it to 64-bits on i386 it does not change the format. Arguably, pwd_mkdb should be using 64-bit time_t values everywhere, but this commit is intended to allow bootstrapping and not to introduce a future-proof binary format. Alex > > > On 8/6/20, Alex Richardson wrote: > > > > Author: arichardson > > > > Date: Thu Aug 6 20:46:13 2020 > > > > New Revision: 363992 > > > > URL: https://svnweb.freebsd.org/changeset/base/363992 > > > > > > > > Log: > > > > Allow bootstrapping pwd_mkdb on Linux/macOS > > > > > > > > We need to provide a struct passwd that is compatible with the > > > > target > > > > system and this is not the case when cross-building from > > > > macOS/Linux. > > > > It should also be a problem when bootstrapping for an i386 > > > > target from a > > > > FreeBSD amd64 host since time_t does not match across those > > > > systems. > > > > However, pwd_mkdb always truncates integer values to 32-bit so > > > > this > > > > difference does not result in different databases. > > > > > > > > Reviewed By: brooks > > > > Differential Revision: https://reviews.freebsd.org/D25931 > > > > > > > > Added: > > > > head/usr.sbin/pwd_mkdb/pwd.h (contents, props changed) > > > > Modified: > > > > head/usr.sbin/pwd_mkdb/Makefile > > > > > > > > Modified: head/usr.sbin/pwd_mkdb/Makefile > > > > ================================================================= > > > > ============= > > > > --- head/usr.sbin/pwd_mkdb/Makefile Thu Aug 6 20:44:40 > > > > 2020 (r363991) > > > > +++ head/usr.sbin/pwd_mkdb/Makefile Thu Aug 6 20:46:13 > > > > 2020 (r363992) > > > > @@ -9,5 +9,8 @@ MAN= pwd_mkdb.8 > > > > SRCS= pw_scan.c pwd_mkdb.c > > > > > > > > CFLAGS+= -I${SRCTOP}/lib/libc/gen # for pw_scan.h > > > > +.if defined(BOOTSTRAPPING) > > > > +CFLAGS+=-I${.CURDIR} > > > > +.endif > > > > > > > > .include > > > > > > > > Added: head/usr.sbin/pwd_mkdb/pwd.h > > > > ================================================================= > > > > ============= > > > > --- /dev/null 00:00:00 1970 (empty, because file is newly > > > > added) > > > > +++ head/usr.sbin/pwd_mkdb/pwd.h Thu Aug 6 20:46:13 > > > > 2020 (r363992) > > > > @@ -0,0 +1,66 @@ > > > > +/*- > > > > + * SPDX-License-Identifier: BSD-2-Clause > > > > + * > > > > + * Copyright 2018-2020 Alex Richardson > > > > + * > > > > + * This software was developed by SRI International and the > > > > University of > > > > + * Cambridge Computer Laboratory (Department of Computer Science > > > > and > > > > + * Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), > > > > as part of > > > > the > > > > + * DARPA SSITH research programme. > > > > + * > > > > + * This software was developed by SRI International and the > > > > University of > > > > + * Cambridge Computer Laboratory under DARPA/AFRL contract > > > > (FA8750-10-C-0237) > > > > + * ("CTSRD"), as part of the DARPA CRASH research programme. > > > > + * > > > > + * 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$ > > > > + */ > > > > + > > > > +/* > > > > + * When building pwd_mkdb we need to use target systems > > > > definition of > > > > + * struct passwd. This protects against future changes to struct > > > > passwd > > > > and > > > > + * is essential to allow cross-building from Linux/macOS hosts > > > > since the > > > > + * structure is not compatible there. > > > > + */ > > > > +#include > > > > +#include > > > > +/* > > > > + * Note: pwd_mkdb always stores uint32_t for all integer fields > > > > (including > > > > + * time_t!) so these definitions do not need to match > > > > sys/sys/_types.h > > > > + */ > > > > +typedef uint32_t _bootstrap_gid_t; > > > > +typedef uint32_t _bootstrap_uid_t; > > > > +typedef uint64_t _bootstrap_time_t; > > > > +#define _GID_T_DECLARED > > > > +#define _TIME_T_DECLARED > > > > +#define _UID_T_DECLARED > > > > +#define _SIZE_T_DECLARED > > > > + > > > > +#define gid_t _bootstrap_gid_t > > > > +#define uid_t _bootstrap_uid_t > > > > +#define time_t _bootstrap_time_t > > > > +#define passwd _bootstrap_passwd > > > > +#include "../../include/pwd.h" > > > > +#undef gid_t > > > > +#undef uid_t > > > > +#undef time_t > > > > > > > > > > > > > -- > > > Mateusz Guzik > From owner-svn-src-all@freebsd.org Sun Aug 9 16:27:30 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2D10F3B8D83; Sun, 9 Aug 2020 16:27:30 +0000 (UTC) (envelope-from freqlabs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BPkyp0nFSz4BlR; Sun, 9 Aug 2020 16:27:30 +0000 (UTC) (envelope-from freqlabs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D9DB81C0A3; Sun, 9 Aug 2020 16:27:29 +0000 (UTC) (envelope-from freqlabs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 079GRTIQ026000; Sun, 9 Aug 2020 16:27:29 GMT (envelope-from freqlabs@FreeBSD.org) Received: (from freqlabs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 079GRSPP025994; Sun, 9 Aug 2020 16:27:28 GMT (envelope-from freqlabs@FreeBSD.org) Message-Id: <202008091627.079GRSPP025994@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: freqlabs set sender to freqlabs@FreeBSD.org using -f From: Ryan Moeller Date: Sun, 9 Aug 2020 16:27:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364058 - in head: lib/libifconfig rescue/rescue sbin/ifconfig tools/lua X-SVN-Group: head X-SVN-Commit-Author: freqlabs X-SVN-Commit-Paths: in head: lib/libifconfig rescue/rescue sbin/ifconfig tools/lua X-SVN-Commit-Revision: 364058 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2020 16:27:30 -0000 Author: freqlabs Date: Sun Aug 9 16:27:28 2020 New Revision: 364058 URL: https://svnweb.freebsd.org/changeset/base/364058 Log: Move ifconfig SFP status functionality into libifconfig libifconfig_sfp.h provides an API in libifconfig for querying SFP module properties, operational status, and vendor strings, as well as descriptions of the various fields, string conversions, and other useful helpers for implementing user interfaces. SFP module status is obtained by reading registers via an I2C interface. Descriptions of these registers and the values therein have been collected in a Lua table which is used to generate all the boilerplace C headers and source files for accessing these values, their names, and descriptions. The generated code is fully commented and readable. This is the first use of libifconfig in ifconfig itself. For now, the scope remains very limited. Over time, more of ifconfig will be replaced with libifconfig. Some minor changes to the formatting of ifconfig output have been made: - Module memory hex dumps are indented one extra space as a result of using hexdump(3) instead of a bespoke hex dump function. - Media descriptions have an added two-character short-name in parenthesis. - QSFP modules were incorrectly displaying TX bias current as power. Now TX channels display bias current, and this change has been made for both SFP and QSFP modules for consistency. A Lua binding for libifconfig including this functionality is implemented but has not been included in this commit. The plan is for it to be committed after dynamic module loading has been enabled in flua. Reviewed by: kp, melifaro Relnotes: yes Differential Revision: https://reviews.freebsd.org/D25494 Added: head/lib/libifconfig/libifconfig_sfp.c (contents, props changed) head/lib/libifconfig/libifconfig_sfp.h (contents, props changed) head/lib/libifconfig/libifconfig_sfp_tables.tpl.c (contents, props changed) head/lib/libifconfig/libifconfig_sfp_tables.tpl.h (contents, props changed) head/lib/libifconfig/libifconfig_sfp_tables_internal.tpl.h (contents, props changed) head/lib/libifconfig/sfp.lua (contents, props changed) head/tools/lua/ head/tools/lua/template.lua (contents, props changed) Modified: head/lib/libifconfig/Makefile head/lib/libifconfig/libifconfig.h head/rescue/rescue/Makefile head/sbin/ifconfig/Makefile head/sbin/ifconfig/sfp.c Modified: head/lib/libifconfig/Makefile ============================================================================== --- head/lib/libifconfig/Makefile Sun Aug 9 00:35:47 2020 (r364057) +++ head/lib/libifconfig/Makefile Sun Aug 9 16:27:28 2020 (r364058) @@ -13,15 +13,30 @@ SRCS= libifconfig.c \ libifconfig_inet6.c \ libifconfig_internal.c \ libifconfig_lagg.c \ - libifconfig_media.c + libifconfig_media.c \ + libifconfig_sfp.c +GEN= libifconfig_sfp_tables.h \ + libifconfig_sfp_tables.c \ + libifconfig_sfp_tables_internal.h + +SRCS+= ${GEN} + +.include + +.SUFFIXES: .tpl.c .tpl.h +.tpl.c.c .tpl.h.h: sfp.lua + ${LUA} ${.CURDIR}/sfp.lua ${.IMPSRC} >${.TARGET} + +CLEANFILES+= ${GEN} + # If libifconfig become public uncomment those two lines #INCSDIR= ${INCLUDEDIR} -#INCS= libifconfig.h +#INCS= libifconfig.h libifconfig_sfp.h libifconfig_sfp_tables.h #MAN= libifconfig.3 -CFLAGS+= -I${.CURDIR} +CFLAGS+= -I${.CURDIR} -I${.OBJDIR} NO_WCAST_ALIGN= yes .include Modified: head/lib/libifconfig/libifconfig.h ============================================================================== --- head/lib/libifconfig/libifconfig.h Sun Aug 9 00:35:47 2020 (r364057) +++ head/lib/libifconfig/libifconfig.h Sun Aug 9 16:27:28 2020 (r364058) @@ -28,6 +28,10 @@ #pragma once +#include + +#include + #include #include Added: head/lib/libifconfig/libifconfig_sfp.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libifconfig/libifconfig_sfp.c Sun Aug 9 16:27:28 2020 (r364058) @@ -0,0 +1,592 @@ +/*- + * Copyright (c) 2014, Alexander V. Chernikov + * Copyright (c) 2020, Ryan Moeller + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#define SFF_8636_EXT_COMPLIANCE 0x80 + +struct i2c_info { + struct ifreq ifr; + ifconfig_handle_t *h; + int error; /* Store first error */ + enum sfp_id id; /* Module type */ +}; + +static uint8_t +find_zero_bit(const struct sfp_enum_metadata *table, int value, int sz) +{ + int v, m; + + for (v = 1, m = 1 << (8 * sz); v < m; v <<= 1) { + if ((value & v) == 0) + continue; + if (find_metadata(table, value & v) != NULL) { + return (value & v); + } + } + return (0); +} + +/* + * Reads i2c data from opened kernel socket. + */ +static int +read_i2c(struct i2c_info *ii, uint8_t addr, uint8_t off, uint8_t len, + uint8_t *buf) +{ + struct ifi2creq req; + int i, l; + + if (ii->error != 0) + return (ii->error); + + ii->ifr.ifr_data = (caddr_t)&req; + + i = 0; + l = 0; + memset(&req, 0, sizeof(req)); + req.dev_addr = addr; + req.offset = off; + req.len = len; + + while (len > 0) { + l = MIN(sizeof(req.data), len); + req.len = l; + if (ifconfig_ioctlwrap(ii->h, AF_LOCAL, SIOCGI2C, + &ii->ifr) != 0) { + ii->error = errno; + return (errno); + } + + memcpy(&buf[i], req.data, l); + len -= l; + i += l; + req.offset += l; + } + + return (0); +} + +static int +i2c_info_init(struct i2c_info *ii, ifconfig_handle_t *h, const char *name) +{ + uint8_t id_byte; + + memset(ii, 0, sizeof(*ii)); + strlcpy(ii->ifr.ifr_name, name, sizeof(ii->ifr.ifr_name)); + ii->h = h; + + /* + * Try to read byte 0 from i2c: + * Both SFF-8472 and SFF-8436 use it as + * 'identification byte'. + * Stop reading status on zero as value - + * this might happen in case of empty transceiver slot. + */ + id_byte = 0; + read_i2c(ii, SFF_8472_BASE, SFF_8472_ID, 1, &id_byte); + if (ii->error != 0) + return (-1); + if (id_byte == 0) { + h->error.errtype = OTHER; + h->error.errcode = ENOENT; + return (-1); + } + ii->id = id_byte; + return (0); +} + +static int +get_sfp_info(struct i2c_info *ii, struct ifconfig_sfp_info *sfp) +{ + uint8_t code; + + read_i2c(ii, SFF_8472_BASE, SFF_8472_ID, 1, &sfp->sfp_id); + read_i2c(ii, SFF_8472_BASE, SFF_8472_CONNECTOR, 1, &sfp->sfp_conn); + + /* Use extended compliance code if it's valid */ + read_i2c(ii, SFF_8472_BASE, SFF_8472_TRANS, 1, &sfp->sfp_eth_ext); + if (sfp->sfp_eth_ext == 0) { + /* Next, check 10G Ethernet/IB CCs */ + read_i2c(ii, SFF_8472_BASE, SFF_8472_TRANS_START, 1, &code); + sfp->sfp_eth_10g = find_zero_bit(sfp_eth_10g_table, code, 1); + if (sfp->sfp_eth_10g == 0) { + /* No match. Try Ethernet 1G */ + read_i2c(ii, SFF_8472_BASE, SFF_8472_TRANS_START + 3, + 1, &code); + sfp->sfp_eth = find_zero_bit(sfp_eth_table, code, 1); + } + } + + return (ii->error); +} + +static int +get_qsfp_info(struct i2c_info *ii, struct ifconfig_sfp_info *sfp) +{ + uint8_t code; + + read_i2c(ii, SFF_8436_BASE, SFF_8436_ID, 1, &sfp->sfp_id); + read_i2c(ii, SFF_8436_BASE, SFF_8436_CONNECTOR, 1, &sfp->sfp_conn); + + read_i2c(ii, SFF_8436_BASE, SFF_8436_STATUS, 1, &sfp->sfp_rev); + + /* Check for extended specification compliance */ + read_i2c(ii, SFF_8436_BASE, SFF_8436_CODE_E1040100G, 1, &code); + if (code & SFF_8636_EXT_COMPLIANCE) { + read_i2c(ii, SFF_8436_BASE, SFF_8436_OPTIONS_START, 1, + &sfp->sfp_eth_ext); + } else { + /* Check 10/40G Ethernet class only */ + sfp->sfp_eth_1040g = + find_zero_bit(sfp_eth_1040g_table, code, 1); + } + + return (ii->error); +} + +int +ifconfig_sfp_get_sfp_info(ifconfig_handle_t *h, + const char *name, struct ifconfig_sfp_info *sfp) +{ + struct i2c_info ii; + char buf[8]; + + memset(sfp, 0, sizeof(*sfp)); + + if (i2c_info_init(&ii, h, name) != 0) + return (-1); + + /* Read bytes 3-10 at once */ + read_i2c(&ii, SFF_8472_BASE, SFF_8472_TRANS_START, 8, buf); + if (ii.error != 0) + return (ii.error); + + /* Check 10G ethernet first */ + sfp->sfp_eth_10g = find_zero_bit(sfp_eth_10g_table, buf[0], 1); + if (sfp->sfp_eth_10g == 0) { + /* No match. Try 1G */ + sfp->sfp_eth = find_zero_bit(sfp_eth_table, buf[3], 1); + } + sfp->sfp_fc_len = find_zero_bit(sfp_fc_len_table, buf[4], 1); + sfp->sfp_fc_media = find_zero_bit(sfp_fc_media_table, buf[6], 1); + sfp->sfp_fc_speed = find_zero_bit(sfp_fc_speed_table, buf[7], 1); + sfp->sfp_cab_tech = + find_zero_bit(sfp_cab_tech_table, (buf[4] << 8) | buf[5], 2); + + if (ifconfig_sfp_id_is_qsfp(ii.id)) + return (get_qsfp_info(&ii, sfp)); + return (get_sfp_info(&ii, sfp)); +} + +static size_t +channel_count(enum sfp_id id) +{ + /* TODO: other ids */ + switch (id) { + case SFP_ID_UNKNOWN: + return (0); + case SFP_ID_QSFP: + case SFP_ID_QSFPPLUS: + case SFP_ID_QSFP28: + return (4); + default: + return (1); + } +} + +size_t +ifconfig_sfp_channel_count(const struct ifconfig_sfp_info *sfp) +{ + return (channel_count(sfp->sfp_id)); +} + +/* + * Print SFF-8472/SFF-8436 string to supplied buffer. + * All (vendor-specific) strings are padded right with '0x20'. + */ +static void +get_sff_string(struct i2c_info *ii, uint8_t addr, uint8_t off, char *dst) +{ + read_i2c(ii, addr, off, SFF_VENDOR_STRING_SIZE, dst); + dst += SFF_VENDOR_STRING_SIZE; + do { *dst-- = '\0'; } while (*dst == 0x20); +} + +static void +get_sff_date(struct i2c_info *ii, uint8_t addr, uint8_t off, char *dst) +{ + char buf[SFF_VENDOR_DATE_SIZE]; + + read_i2c(ii, addr, off, SFF_VENDOR_DATE_SIZE, buf); + sprintf(dst, "20%c%c-%c%c-%c%c", buf[0], buf[1], buf[2], buf[3], + buf[4], buf[5]); +} + +static int +get_sfp_vendor_info(struct i2c_info *ii, struct ifconfig_sfp_vendor_info *vi) +{ + get_sff_string(ii, SFF_8472_BASE, SFF_8472_VENDOR_START, vi->name); + get_sff_string(ii, SFF_8472_BASE, SFF_8472_PN_START, vi->pn); + get_sff_string(ii, SFF_8472_BASE, SFF_8472_SN_START, vi->sn); + get_sff_date(ii, SFF_8472_BASE, SFF_8472_DATE_START, vi->date); + return (ii->error); +} + +static int +get_qsfp_vendor_info(struct i2c_info *ii, struct ifconfig_sfp_vendor_info *vi) +{ + get_sff_string(ii, SFF_8436_BASE, SFF_8436_VENDOR_START, vi->name); + get_sff_string(ii, SFF_8436_BASE, SFF_8436_PN_START, vi->pn); + get_sff_string(ii, SFF_8436_BASE, SFF_8436_SN_START, vi->sn); + get_sff_date(ii, SFF_8436_BASE, SFF_8436_DATE_START, vi->date); + return (ii->error); +} + +int +ifconfig_sfp_get_sfp_vendor_info(ifconfig_handle_t *h, + const char *name, struct ifconfig_sfp_vendor_info *vi) +{ + struct i2c_info ii; + + memset(vi, 0, sizeof(*vi)); + + if (i2c_info_init(&ii, h, name) != 0) + return (-1); + + if (ifconfig_sfp_id_is_qsfp(ii.id)) + return (get_qsfp_vendor_info(&ii, vi)); + return (get_sfp_vendor_info(&ii, vi)); +} + +/* + * Converts internal temperature (SFF-8472, SFF-8436) + * 16-bit unsigned value to human-readable representation: + * + * Internally measured Module temperature are represented + * as a 16-bit signed twos complement value in increments of + * 1/256 degrees Celsius, yielding a total range of –128C to +128C + * that is considered valid between –40 and +125C. + */ +static double +get_sff_temp(struct i2c_info *ii, uint8_t addr, uint8_t off) +{ + double d; + uint8_t buf[2]; + + read_i2c(ii, addr, off, 2, buf); + d = (double)buf[0]; + d += (double)buf[1] / 256; + return (d); +} + +/* + * Retrieves supplied voltage (SFF-8472, SFF-8436). + * 16-bit usigned value, treated as range 0..+6.55 Volts + */ +static double +get_sff_voltage(struct i2c_info *ii, uint8_t addr, uint8_t off) +{ + double d; + uint8_t buf[2]; + + read_i2c(ii, addr, off, 2, buf); + d = (double)((buf[0] << 8) | buf[1]); + return (d / 10000); +} + +/* + * The following conversions assume internally-calibrated data. + * This is always true for SFF-8346, and explicitly checked for SFF-8472. + */ + +double +power_mW(uint16_t power) +{ + /* Power is specified in units of 0.1 uW. */ + return (1.0 * power / 10000); +} + +double +power_dBm(uint16_t power) +{ + return (10.0 * log10(power_mW(power))); +} + +double +bias_mA(uint16_t bias) +{ + /* Bias current is specified in units of 2 uA. */ + return (1.0 * bias / 500); +} + +static uint16_t +get_sff_channel(struct i2c_info *ii, uint8_t addr, uint8_t off) +{ + uint8_t buf[2]; + + read_i2c(ii, addr, off, 2, buf); + if (ii->error != 0) + return (0); + + return ((buf[0] << 8) + buf[1]); +} + +static int +get_sfp_status(struct i2c_info *ii, struct ifconfig_sfp_status *ss) +{ + uint8_t diag_type, flags; + + /* Read diagnostic monitoring type */ + read_i2c(ii, SFF_8472_BASE, SFF_8472_DIAG_TYPE, 1, (caddr_t)&diag_type); + if (ii->error != 0) + return (-1); + + /* + * Read monitoring data IFF it is supplied AND is + * internally calibrated + */ + flags = SFF_8472_DDM_DONE | SFF_8472_DDM_INTERNAL; + if ((diag_type & flags) != flags) { + ii->h->error.errtype = OTHER; + ii->h->error.errcode = ENXIO; + return (-1); + } + + ss->temp = get_sff_temp(ii, SFF_8472_DIAG, SFF_8472_TEMP); + ss->voltage = get_sff_voltage(ii, SFF_8472_DIAG, SFF_8472_VCC); + ss->channel = calloc(channel_count(ii->id), sizeof(*ss->channel)); + if (ss->channel == NULL) { + ii->h->error.errtype = OTHER; + ii->h->error.errcode = ENOMEM; + return (-1); + } + ss->channel[0].rx = get_sff_channel(ii, SFF_8472_DIAG, SFF_8472_RX_POWER); + ss->channel[0].tx = get_sff_channel(ii, SFF_8472_DIAG, SFF_8472_TX_BIAS); + return (ii->error); +} + +static uint32_t +get_qsfp_bitrate(struct i2c_info *ii) +{ + uint8_t code; + uint32_t rate; + + code = 0; + read_i2c(ii, SFF_8436_BASE, SFF_8436_BITRATE, 1, &code); + rate = code * 100; + if (code == 0xFF) { + read_i2c(ii, SFF_8436_BASE, SFF_8636_BITRATE, 1, &code); + rate = code * 250; + } + + return (rate); +} + +static int +get_qsfp_status(struct i2c_info *ii, struct ifconfig_sfp_status *ss) +{ + size_t channels; + + ss->temp = get_sff_temp(ii, SFF_8436_BASE, SFF_8436_TEMP); + ss->voltage = get_sff_voltage(ii, SFF_8436_BASE, SFF_8436_VCC); + channels = channel_count(ii->id); + ss->channel = calloc(channels, sizeof(*ss->channel)); + if (ss->channel == NULL) { + ii->h->error.errtype = OTHER; + ii->h->error.errcode = ENOMEM; + return (-1); + } + for (size_t chan = 0; chan < channels; ++chan) { + uint8_t rxoffs = SFF_8436_RX_CH1_MSB + chan * sizeof(uint16_t); + uint8_t txoffs = SFF_8436_TX_CH1_MSB + chan * sizeof(uint16_t); + ss->channel[chan].rx = + get_sff_channel(ii, SFF_8436_BASE, rxoffs); + ss->channel[chan].tx = + get_sff_channel(ii, SFF_8436_BASE, txoffs); + } + ss->bitrate = get_qsfp_bitrate(ii); + return (ii->error); +} + +int +ifconfig_sfp_get_sfp_status(ifconfig_handle_t *h, const char *name, + struct ifconfig_sfp_status *ss) +{ + struct i2c_info ii; + + memset(ss, 0, sizeof(*ss)); + + if (i2c_info_init(&ii, h, name) != 0) + return (-1); + + if (ifconfig_sfp_id_is_qsfp(ii.id)) + return (get_qsfp_status(&ii, ss)); + return (get_sfp_status(&ii, ss)); +} + +void +ifconfig_sfp_free_sfp_status(struct ifconfig_sfp_status *ss) +{ + if (ss != NULL) + free(ss->channel); +} + +static const char * +sfp_id_string_alt(uint8_t value) +{ + const char *id; + + if (value <= SFF_8024_ID_LAST) + id = sff_8024_id[value]; + else if (value > 0x80) + id = "Vendor specific"; + else + id = "Reserved"; + + return (id); +} + +static const char * +sfp_conn_string_alt(uint8_t value) +{ + const char *conn; + + if (value >= 0x0D && value <= 0x1F) + conn = "Unallocated"; + else if (value >= 0x24 && value <= 0x7F) + conn = "Unallocated"; + else + conn = "Vendor specific"; + + return (conn); +} + +void +ifconfig_sfp_get_sfp_info_strings(const struct ifconfig_sfp_info *sfp, + struct ifconfig_sfp_info_strings *strings) +{ + get_sfp_info_strings(sfp, strings); + if (strings->sfp_id == NULL) + strings->sfp_id = sfp_id_string_alt(sfp->sfp_id); + if (strings->sfp_conn == NULL) + strings->sfp_conn = sfp_conn_string_alt(sfp->sfp_conn); + if (strings->sfp_rev == NULL) + strings->sfp_rev = "Unallocated"; +} + +const char * +ifconfig_sfp_physical_spec(const struct ifconfig_sfp_info *sfp, + const struct ifconfig_sfp_info_strings *strings) +{ + switch (sfp->sfp_id) { + case SFP_ID_UNKNOWN: + break; + case SFP_ID_QSFP: + case SFP_ID_QSFPPLUS: + case SFP_ID_QSFP28: + if (sfp->sfp_eth_1040g & SFP_ETH_1040G_EXTENDED) + return (strings->sfp_eth_ext); + else if (sfp->sfp_eth_1040g) + return (strings->sfp_eth_1040g); + break; + default: + if (sfp->sfp_eth_ext) + return (strings->sfp_eth_ext); + else if (sfp->sfp_eth_10g) + return (strings->sfp_eth_10g); + else if (sfp->sfp_eth) + return (strings->sfp_eth); + break; + } + return ("Unknown"); +} + +int +ifconfig_sfp_get_sfp_dump(ifconfig_handle_t *h, const char *name, + struct ifconfig_sfp_dump *dump) +{ + struct i2c_info ii; + uint8_t *buf = dump->data; + + memset(dump->data, 0, sizeof(dump->data)); + + if (i2c_info_init(&ii, h, name) != 0) + return (-1); + + if (ifconfig_sfp_id_is_qsfp(ii.id)) { + read_i2c(&ii, SFF_8436_BASE, QSFP_DUMP0_START, QSFP_DUMP0_SIZE, + buf + QSFP_DUMP0_START); + read_i2c(&ii, SFF_8436_BASE, QSFP_DUMP1_START, QSFP_DUMP1_SIZE, + buf + QSFP_DUMP1_START); + } else { + read_i2c(&ii, SFF_8472_BASE, SFP_DUMP_START, SFP_DUMP_SIZE, + buf + SFP_DUMP_START); + } + + return (ii.error != 0 ? -1 : 0); +} + +size_t +ifconfig_sfp_dump_region_count(const struct ifconfig_sfp_dump *dp) +{ + uint8_t id_byte = dp->data[0]; + + switch ((enum sfp_id)id_byte) { + case SFP_ID_UNKNOWN: + return (0); + case SFP_ID_QSFP: + case SFP_ID_QSFPPLUS: + case SFP_ID_QSFP28: + return (2); + default: + return (1); + } +} Added: head/lib/libifconfig/libifconfig_sfp.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libifconfig/libifconfig_sfp.h Sun Aug 9 16:27:28 2020 (r364058) @@ -0,0 +1,219 @@ +/*- + * Copyright (c) 2014, Alexander V. Chernikov + * Copyright (c) 2020, Ryan Moeller + * + * 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$ + */ + +#pragma once + +#include +#include + +#include +#include + +/** SFP module information in raw numeric form + * These are static properties of the hardware. + */ +struct ifconfig_sfp_info; + +/** SFP module information formatted as strings + * These are static strings that do not need to be freed. + */ +struct ifconfig_sfp_info_strings; + +#define SFF_VENDOR_STRING_SIZE 16 /**< max chars in a vendor string */ +#define SFF_VENDOR_DATE_SIZE 6 /**< chars in a vendor date code */ + +/** SFP module vendor info strings */ +struct ifconfig_sfp_vendor_info { + char name[SFF_VENDOR_STRING_SIZE + 1]; /**< vendor name */ + char pn[SFF_VENDOR_STRING_SIZE + 1]; /**< vendor part number */ + char sn[SFF_VENDOR_STRING_SIZE + 1]; /**< vendor serial number */ + char date[SFF_VENDOR_DATE_SIZE + 5]; /**< formatted vendor date */ +}; + +/** SFP module status + * These are dynamic properties of the hardware. + */ +struct ifconfig_sfp_status { + double temp; /**< module temperature in degrees C, + valid range -40.0 to 125.0 */ + double voltage; /**< module voltage in volts */ + struct sfp_channel { + uint16_t rx; /**< channel receive power, LSB 0.1uW */ + uint16_t tx; /**< channel transmit bias current, LSB 2uA */ + } *channel; /**< array of channel rx/tx status */ + uint32_t bitrate; /**< link bitrate, + only present for QSFP modules, + zero for SFP modules */ +}; + +#define SFF_DUMP_SIZE 256 /**< size of the memory dump buffer */ + +#define SFP_DUMP_START 0 /**< start address of an SFP module dump */ +#define SFP_DUMP_SIZE 128 /**< bytes in an SFP module dump */ + +#define QSFP_DUMP0_START 0 /**< start address of the first region + in a QSFP module dump */ +#define QSFP_DUMP0_SIZE 82 /**< bytes in the first region + in a QSFP module dump */ +#define QSFP_DUMP1_START 128 /**< start address of the second region + in a QSFP module dump */ +#define QSFP_DUMP1_SIZE 128 /**< bytes in the second region + in a QSFP module dump */ + +/** SFP module I2C memory dump + * SFP modules have one region, QSFP modules have two regions. + */ +struct ifconfig_sfp_dump { + uint8_t data[SFF_DUMP_SIZE]; /**< memory dump data */ +}; + +/** Get information about the static properties of an SFP/QSFP module + * The information is returned in numeric form. + * @see ifconfig_sfp_get_sfp_info_strings to get corresponding strings. + * @param h An open ifconfig state handle + * @param name The name of an interface + * @param sfp Pointer to an object to fill, will be zeroed by this function + * @return 0 if successful, -1 with error info set in the handle otherwise + */ +int ifconfig_sfp_get_sfp_info(ifconfig_handle_t *h, const char *name, + struct ifconfig_sfp_info *sfp); + +/** Get the number of channels present on the given module + * @param sfp Pointer to a filled SFP module info object + * @return The number of channels or 0 if unknown + */ +size_t ifconfig_sfp_channel_count(const struct ifconfig_sfp_info *sfp); + +/** Is the given module ID a QSFP + * NB: This convenience function is implemented in the header to keep the + * classification criteria visible to the user. + * @param id The sfp_id field of a SFP module info object + * @return A bool true if QSFP-type sfp_id otherwise false + */ +static inline bool +ifconfig_sfp_id_is_qsfp(enum sfp_id id) +{ + switch (id) { + case SFP_ID_QSFP: + case SFP_ID_QSFPPLUS: + case SFP_ID_QSFP28: + return (true); + default: + return (false); + } +} + +/** Get string descriptions of the given SFP/QSFP module info + * The strings are static and do not need to be freed. + * @see ifconfig_sfp_get_sfp_info to obtain the input info. + * @param sfp Pointer to a filled SFP module info object + * @param strings Pointer to an object to be filled with pointers to + * static strings describing the given info + */ +void ifconfig_sfp_get_sfp_info_strings(const struct ifconfig_sfp_info *sfp, + struct ifconfig_sfp_info_strings *strings); + +/** Get a string describing the given SFP/QSFP module's physical layer spec + * The correct field in ifconfig_sfp_info varies depending on the module. This + * function chooses the appropriate string based on the provided module info. + * The string returned is static and does not need to be freed. + * @param sfp Pointer to a filled SFP module info object + * @param strings Pointer to a filled SFP module strings object + * @return Pointer to a static string describing the module's spec + */ +const char *ifconfig_sfp_physical_spec(const struct ifconfig_sfp_info *sfp, + const struct ifconfig_sfp_info_strings *strings); + +/** Get the vendor info strings from an SFP/QSFP module + * @param h An open ifconfig state handle + * @param name The name of an interface + * @param vi Pointer to an object to be filled with the vendor info strings, + * will be zeroed by this function + * @return 0 if successful, -1 with error info set in the handle otherwise + */ +int ifconfig_sfp_get_sfp_vendor_info(ifconfig_handle_t *h, const char *name, + struct ifconfig_sfp_vendor_info *vi); + +/** Get the status of an SFP/QSFP module's dynamic properties + * @see ifconfig_sfp_free_sfp_status to free the allocations + * @param h An open ifconfig state handle + * @param name The name of an interface + * @param ss Pointer to an object to be filled with the module's status + * @return 0 if successful, -1 with error info set in the handle otherwise + * where the errcode `ENXIO` indicates an SFP module that is not + * calibrated or does not provide diagnostic status measurements + */ +int ifconfig_sfp_get_sfp_status(ifconfig_handle_t *h, const char *name, + struct ifconfig_sfp_status *ss); + +/** Free the memory allocations in an ifconfig_sfp_status struct + * @param ss Pointer to an object whose internal allocations are to be freed + * if not NULL + */ +void ifconfig_sfp_free_sfp_status(struct ifconfig_sfp_status *ss); + +/** Dump the I2C memory of an SFP/QSFP module + * SFP modules have one memory region dumped, QSFP modules have two. + * @param h An open ifconfig state handle + * @param name The name of an interface + * @param buf Pointer to a dump data buffer object + * @return 0 if successful, -1 with error info set in the handle otherwise + */ +int ifconfig_sfp_get_sfp_dump(ifconfig_handle_t *h, const char *name, + struct ifconfig_sfp_dump *buf); + +/** Get the number of I2C memory dump regions present in the given dump + * @param dp Pointer to a filled dump data buffer object + * @return The number of regions or 0 if unknown + */ +size_t ifconfig_sfp_dump_region_count(const struct ifconfig_sfp_dump *dp); + +/** Convert channel power to milliwatts power + * This is provided as a convenience for displaying channel power levels. + * @see (struct ifconfig_sfp_status).channel + * @param power Power in 0.1 mW units + * @return Power in milliwatts (mW) + */ +double power_mW(uint16_t power); + +/** Convert channel power to decibel-milliwats power level + * This is provided as a convenience for displaying channel power levels. + * @see (struct ifconfig_sfp_status).channel + * @param power Power in 0.1 mW units + * @return Power level in decibel-milliwatts (dBm) + */ + +double power_dBm(uint16_t power); + +/** Convert channel bias current to milliamps + * This is provided as a convenience for displaying channel bias currents. + * @see (struct ifconfig_sfp_status).channel + * @param bias Bias current in 2 mA units + * @return Bias current in milliamps (mA) + */ +double bias_mA(uint16_t bias); Added: head/lib/libifconfig/libifconfig_sfp_tables.tpl.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libifconfig/libifconfig_sfp_tables.tpl.c Sun Aug 9 16:27:28 2020 (r364058) @@ -0,0 +1,124 @@ +/*- + * Copyright (c) 2020, Ryan Moeller + * + * 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$ + */ + +{# THIS IS A TEMPLATE PROCESSED BY lib/libifconfig/sfp.lua #} + +#include +#include + +struct sfp_enum_metadata { + int value; /* numeric discriminant value */ + const char *symbol; /* symbolic name */ + const char *description; /* brief description */ + const char *display; /* shortened display name */ +}; + +const struct sfp_enum_metadata * +find_metadata(const struct sfp_enum_metadata *table, int value) +{ + while (table->value != value && table->symbol != NULL) + ++table; + return (table->symbol != NULL ? table : NULL); +} + +{% +for _, ent in ipairs(enums) do + if type(ent) == "string" then +%} +/* + * {*ent*} + */ + +{% + else + local enum = ent + local name = "sfp_"..enum.name + local sym, desc, disp +%} +static const struct sfp_enum_metadata {*name*}_table_[] = { +{% + for _, item in ipairs(enum.values) do + _, sym, desc, disp = table.unpack(item) + local symbol = string.upper(name).."_"..sym +%} + { + .value = {*symbol*}, + .symbol = "{*symbol*}", + .description = "{*desc*}", +{% + if disp then +%} + .display = "{*disp*}", +{% + end +%} + }, +{% + end +%} + {0} +}; +const struct sfp_enum_metadata *{*name*}_table = {*name*}_table_; + +const char * +ifconfig_{*name*}_symbol(enum {*name*} v) +{ + const struct sfp_enum_metadata *metadata; + + if ((metadata = find_metadata({*name*}_table, v)) == NULL) + return (NULL); + return (metadata->symbol); +} + +const char * +ifconfig_{*name*}_description(enum {*name*} v) +{ + const struct sfp_enum_metadata *metadata; + + if ((metadata = find_metadata({*name*}_table, v)) == NULL) + return (NULL); + return (metadata->description); +} + +{% + if disp then +%} +const char * +ifconfig_{*name*}_display(enum {*name*} v) +{ + const struct sfp_enum_metadata *metadata; + + if ((metadata = find_metadata({*name*}_table, v)) == NULL) + return (NULL); + return (metadata->display); +} + +{% + end + end +end +%} Added: head/lib/libifconfig/libifconfig_sfp_tables.tpl.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libifconfig/libifconfig_sfp_tables.tpl.h Sun Aug 9 16:27:28 2020 (r364058) @@ -0,0 +1,130 @@ +/*- + * Copyright (c) 2020, Ryan Moeller + * + * Redistribution and use in source and binary forms, with or without *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Aug 10 00:43:43 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E96043C17EE; Mon, 10 Aug 2020 00:43:43 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BPxzM5sbRz4YQ2; Mon, 10 Aug 2020 00:43:43 +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 AC99421C40; Mon, 10 Aug 2020 00:43:43 +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 07A0hhPV032434; Mon, 10 Aug 2020 00:43:43 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07A0hhb9032433; Mon, 10 Aug 2020 00:43:43 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202008100043.07A0hhb9032433@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 10 Aug 2020 00:43:43 +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: r364059 - stable/12/sys/dev/acpica X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/dev/acpica X-SVN-Commit-Revision: 364059 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2020 00:43:44 -0000 Author: mav Date: Mon Aug 10 00:43:43 2020 New Revision: 364059 URL: https://svnweb.freebsd.org/changeset/base/364059 Log: MFC r364013: Allow ACPI APEI driver build without PCI. On x86 it seems difficult to build ACPI without PCI, but some aarch64 users appears to be doing it. Modified: stable/12/sys/dev/acpica/acpi_apei.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/acpica/acpi_apei.c ============================================================================== --- stable/12/sys/dev/acpica/acpi_apei.c Sun Aug 9 16:27:28 2020 (r364058) +++ stable/12/sys/dev/acpica/acpi_apei.c Mon Aug 10 00:43:43 2020 (r364059) @@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$"); #include "opt_acpi.h" +#include "opt_pci.h" #include #include @@ -207,8 +208,10 @@ static int apei_pcie_handler(ACPI_HEST_GENERIC_DATA *ged) { struct apei_pcie_error *p = (struct apei_pcie_error *)(ged + 1); + int h = 0, off; +#ifdef DEV_PCI device_t dev; - int h = 0, off, sev; + int sev; if ((p->ValidationBits & 0x8) == 0x8) { mtx_lock(&Giant); @@ -235,6 +238,7 @@ apei_pcie_handler(ACPI_HEST_GENERIC_DATA *ged) } if (h) return (h); +#endif printf("APEI %s PCIe Error:\n", apei_severity(ged->ErrorSeverity)); if (p->ValidationBits & 0x01) From owner-svn-src-all@freebsd.org Mon Aug 10 02:39:43 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0B8B13C358D; Mon, 10 Aug 2020 02:39: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQ0YB6cwZz4cmt; Mon, 10 Aug 2020 02:39: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 C7CEF230C6; Mon, 10 Aug 2020 02:39: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 07A2dgmN099595; Mon, 10 Aug 2020 02:39:42 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07A2dgxG099594; Mon, 10 Aug 2020 02:39:42 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202008100239.07A2dgxG099594@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 10 Aug 2020 02:39: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: r364060 - stable/12/sys/dev/safexcel X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/dev/safexcel X-SVN-Commit-Revision: 364060 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2020 02:39:43 -0000 Author: markj Date: Mon Aug 10 02:39:42 2020 New Revision: 364060 URL: https://svnweb.freebsd.org/changeset/base/364060 Log: MFC r363880 (by lwhsu): Appease gcc's -Wparentheses (and -Werror) Modified: stable/12/sys/dev/safexcel/safexcel.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/safexcel/safexcel.c ============================================================================== --- stable/12/sys/dev/safexcel/safexcel.c Mon Aug 10 00:43:43 2020 (r364059) +++ stable/12/sys/dev/safexcel/safexcel.c Mon Aug 10 02:39:42 2020 (r364060) @@ -1651,7 +1651,7 @@ safexcel_instr_ccm(struct safexcel_request *req, struc b0 = (uint8_t *)instr; memset(b0, 0, blen); b0[0] = - L - 1 | /* payload length size */ + (L - 1) | /* payload length size */ ((CCM_CBC_MAX_DIGEST_LEN - 2) / 2) << 3 /* digest length */ | (req->mac->crd_len > 0 ? 1 : 0) << 6 /* AAD present bit */; memcpy(&b0[1], req->iv, AES_CCM_IV_LEN); From owner-svn-src-all@freebsd.org Mon Aug 10 06:19:34 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1C7433C6733; Mon, 10 Aug 2020 06:19:34 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQ5Qs709Pz3YDk; Mon, 10 Aug 2020 06:19:33 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CEE9E25C80; Mon, 10 Aug 2020 06:19:33 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07A6JXdE035210; Mon, 10 Aug 2020 06:19:33 GMT (envelope-from gbe@FreeBSD.org) Received: (from gbe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07A6JXZI035209; Mon, 10 Aug 2020 06:19:33 GMT (envelope-from gbe@FreeBSD.org) Message-Id: <202008100619.07A6JXZI035209@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gbe set sender to gbe@FreeBSD.org using -f From: Gordon Bergling Date: Mon, 10 Aug 2020 06:19: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: r364061 - stable/12/usr.bin/grep X-SVN-Group: stable-12 X-SVN-Commit-Author: gbe X-SVN-Commit-Paths: stable/12/usr.bin/grep X-SVN-Commit-Revision: 364061 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2020 06:19:34 -0000 Author: gbe (doc committer) Date: Mon Aug 10 06:19:33 2020 New Revision: 364061 URL: https://svnweb.freebsd.org/changeset/base/364061 Log: MFC r364021: grep(1): correct typos for 'if a name patches' to 'if a name matches' PR: 237635 Submitted by: durin42 Reviewed by: kevans Approved by: kevans Differential Revision: https://reviews.freebsd.org/D25994 Modified: stable/12/usr.bin/grep/grep.1 Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.bin/grep/grep.1 ============================================================================== --- stable/12/usr.bin/grep/grep.1 Mon Aug 10 02:39:42 2020 (r364060) +++ stable/12/usr.bin/grep/grep.1 Mon Aug 10 06:19:33 2020 (r364061) @@ -30,7 +30,7 @@ .\" .\" @(#)grep.1 8.3 (Berkeley) 4/18/94 .\" -.Dd August 21, 2018 +.Dd August 7, 2020 .Dt GREP 1 .Os .Sh NAME @@ -209,7 +209,7 @@ Note that and .Fl Fl include patterns are processed in the order given. -If a name patches multiple patterns, the latest matching rule wins. +If a name matches multiple patterns, the latest matching rule wins. If no .Fl Fl include pattern is specified, all files are searched that are @@ -228,7 +228,7 @@ Note that and .Fl Fl include-dir patterns are processed in the order given. -If a name patches multiple patterns, the latest matching rule wins. +If a name matches multiple patterns, the latest matching rule wins. If no .Fl Fl include-dir pattern is specified, all directories are searched that are @@ -284,7 +284,7 @@ Note that and .Fl Fl exclude patterns are processed in the order given. -If a name patches multiple patterns, the latest matching rule wins. +If a name matches multiple patterns, the latest matching rule wins. Patterns are matched to the full path specified, not only to the filename component. .It Fl Fl include-dir Ar pattern @@ -298,7 +298,7 @@ Note that and .Fl Fl exclude-dir patterns are processed in the order given. -If a name patches multiple patterns, the latest matching rule wins. +If a name matches multiple patterns, the latest matching rule wins. .It Fl L , Fl Fl files-without-match Only the names of files not containing selected lines are written to standard output. From owner-svn-src-all@freebsd.org Mon Aug 10 09:03:29 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ACA0537B722; Mon, 10 Aug 2020 09:03:29 +0000 (UTC) (envelope-from danfe@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQ94149Ddz41pH; Mon, 10 Aug 2020 09:03:29 +0000 (UTC) (envelope-from danfe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7264E277E7; Mon, 10 Aug 2020 09:03:29 +0000 (UTC) (envelope-from danfe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07A93T9l041382; Mon, 10 Aug 2020 09:03:29 GMT (envelope-from danfe@FreeBSD.org) Received: (from danfe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07A93TOk041381; Mon, 10 Aug 2020 09:03:29 GMT (envelope-from danfe@FreeBSD.org) Message-Id: <202008100903.07A93TOk041381@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: danfe set sender to danfe@FreeBSD.org using -f From: Alexey Dokuchaev Date: Mon, 10 Aug 2020 09:03:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364062 - head/usr.bin/uname X-SVN-Group: head X-SVN-Commit-Author: danfe X-SVN-Commit-Paths: head/usr.bin/uname X-SVN-Commit-Revision: 364062 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2020 09:03:29 -0000 Author: danfe (ports committer) Date: Mon Aug 10 09:03:29 2020 New Revision: 364062 URL: https://svnweb.freebsd.org/changeset/base/364062 Log: Document the order in which the kernel and the user environment versions are printed when both -K and -U options are passed on the command line. Approved by: 0mp Differential Revision: https://reviews.freebsd.org/D25970 Modified: head/usr.bin/uname/uname.1 Modified: head/usr.bin/uname/uname.1 ============================================================================== --- head/usr.bin/uname/uname.1 Mon Aug 10 06:19:33 2020 (r364061) +++ head/usr.bin/uname/uname.1 Mon Aug 10 09:03:29 2020 (r364062) @@ -28,7 +28,7 @@ .\" @(#)uname.1 8.3 (Berkeley) 4/8/94 .\" $FreeBSD$ .\" -.Dd June 27, 2019 +.Dd August 10, 2020 .Dt UNAME 1 .Os .Sh NAME @@ -107,6 +107,9 @@ and flags are intended to be used for fine grain differentiation of incremental .Fx development and user visible changes. +Note that when both of these two options are specified, regardless of their +order, the kernel version would be printed first, followed by the user +environment version. .Sh ENVIRONMENT An environment variable composed of the string .Ev UNAME_ From owner-svn-src-all@freebsd.org Mon Aug 10 10:31:18 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4E76B37D962; Mon, 10 Aug 2020 10:31:18 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQC1L11xBz45tY; Mon, 10 Aug 2020 10:31:18 +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 068E98D7E; Mon, 10 Aug 2020 10:31:18 +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 07AAVHtn092523; Mon, 10 Aug 2020 10:31:17 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07AAVHSq092503; Mon, 10 Aug 2020 10:31:17 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202008101031.07AAVHSq092503@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 10 Aug 2020 10:31:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364063 - head/sys/fs/nullfs X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/fs/nullfs X-SVN-Commit-Revision: 364063 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2020 10:31:18 -0000 Author: mjg Date: Mon Aug 10 10:31:17 2020 New Revision: 364063 URL: https://svnweb.freebsd.org/changeset/base/364063 Log: nullfs: add missing VOP_STAT handling Tested by: pho Modified: head/sys/fs/nullfs/null_vnops.c Modified: head/sys/fs/nullfs/null_vnops.c ============================================================================== --- head/sys/fs/nullfs/null_vnops.c Mon Aug 10 09:03:29 2020 (r364062) +++ head/sys/fs/nullfs/null_vnops.c Mon Aug 10 10:31:17 2020 (r364063) @@ -182,6 +182,7 @@ #include #include #include +#include #include @@ -484,9 +485,21 @@ null_setattr(struct vop_setattr_args *ap) } /* - * We handle getattr only to change the fsid. + * We handle stat and getattr only to change the fsid. */ static int +null_stat(struct vop_stat_args *ap) +{ + int error; + + if ((error = null_bypass((struct vop_generic_args *)ap)) != 0) + return (error); + + ap->a_sb->st_dev = ap->a_vp->v_mount->mnt_stat.f_fsid.val[0]; + return (0); +} + +static int null_getattr(struct vop_getattr_args *ap) { int error; @@ -918,6 +931,7 @@ struct vop_vector null_vnodeops = { .vop_accessx = null_accessx, .vop_advlockpurge = vop_stdadvlockpurge, .vop_bmap = VOP_EOPNOTSUPP, + .vop_stat = null_stat, .vop_getattr = null_getattr, .vop_getwritemount = null_getwritemount, .vop_inactive = null_inactive, From owner-svn-src-all@freebsd.org Mon Aug 10 10:33:41 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6E0F137DBCC; Mon, 10 Aug 2020 10:33:41 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQC452Lh3z46W2; Mon, 10 Aug 2020 10:33:41 +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 33FAE8D8B; Mon, 10 Aug 2020 10:33:41 +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 07AAXfPu096237; Mon, 10 Aug 2020 10:33:41 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07AAXeeo096235; Mon, 10 Aug 2020 10:33:40 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202008101033.07AAXeeo096235@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 10 Aug 2020 10:33:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364064 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 364064 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2020 10:33:41 -0000 Author: mjg Date: Mon Aug 10 10:33:40 2020 New Revision: 364064 URL: https://svnweb.freebsd.org/changeset/base/364064 Log: vfs: disallow NOCACHE with LOOKUP This means there is no expectation lookup will purge the terminal entry, which simplifies lockless lookup. Tested by: pho Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/vfs_lookup.c head/sys/kern/vfs_subr.c Modified: head/sys/kern/vfs_lookup.c ============================================================================== --- head/sys/kern/vfs_lookup.c Mon Aug 10 10:31:17 2020 (r364063) +++ head/sys/kern/vfs_lookup.c Mon Aug 10 10:33:40 2020 (r364064) @@ -484,6 +484,9 @@ namei(struct nameidata *ndp) ("namei: nameiop contaminated with flags")); KASSERT((cnp->cn_flags & OPMASK) == 0, ("namei: flags contaminated with nameiops")); + if (cnp->cn_flags & NOCACHE) + KASSERT(cnp->cn_nameiop != LOOKUP, + ("%s: NOCACHE passed with LOOKUP", __func__)); MPASS(ndp->ni_startdir == NULL || ndp->ni_startdir->v_type == VDIR || ndp->ni_startdir->v_type == VBAD); Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Mon Aug 10 10:31:17 2020 (r364063) +++ head/sys/kern/vfs_subr.c Mon Aug 10 10:33:40 2020 (r364064) @@ -408,7 +408,7 @@ sysctl_try_reclaim_vnode(SYSCTL_HANDLER_ARGS) buf[req->newlen] = '\0'; - ndflags = LOCKLEAF | NOFOLLOW | AUDITVNODE1 | NOCACHE | SAVENAME; + ndflags = LOCKLEAF | NOFOLLOW | AUDITVNODE1 | SAVENAME; NDINIT(&nd, LOOKUP, ndflags, UIO_SYSSPACE, buf, curthread); if ((error = namei(&nd)) != 0) goto out; From owner-svn-src-all@freebsd.org Mon Aug 10 10:34:23 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C074137DE71; Mon, 10 Aug 2020 10:34:23 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQC4v3trBz46Z6; Mon, 10 Aug 2020 10:34:23 +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 6A4A38C2F; Mon, 10 Aug 2020 10:34:23 +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 07AAYNti096322; Mon, 10 Aug 2020 10:34:23 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07AAYNEO096320; Mon, 10 Aug 2020 10:34:23 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202008101034.07AAYNEO096320@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 10 Aug 2020 10:34:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364065 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 364065 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2020 10:34:23 -0000 Author: mjg Date: Mon Aug 10 10:34:22 2020 New Revision: 364065 URL: https://svnweb.freebsd.org/changeset/base/364065 Log: vfs: drop the thread argumemnt from vfs_fplookup_vexec It is guaranteed curthread. Tested by: pho Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/vfs_cache.c head/sys/kern/vnode_if.src Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Mon Aug 10 10:33:40 2020 (r364064) +++ head/sys/kern/vfs_cache.c Mon Aug 10 10:34:22 2020 (r364065) @@ -3938,7 +3938,7 @@ cache_fplookup_impl(struct vnode *dvp, struct cache_fp VNPASS(cache_fplookup_vnode_supported(fpl->dvp), fpl->dvp); - error = VOP_FPLOOKUP_VEXEC(fpl->dvp, cnp->cn_cred, cnp->cn_thread); + error = VOP_FPLOOKUP_VEXEC(fpl->dvp, cnp->cn_cred); if (__predict_false(error != 0)) { error = cache_fplookup_failed_vexec(fpl, error); break; Modified: head/sys/kern/vnode_if.src ============================================================================== --- head/sys/kern/vnode_if.src Mon Aug 10 10:33:40 2020 (r364064) +++ head/sys/kern/vnode_if.src Mon Aug 10 10:34:22 2020 (r364065) @@ -153,7 +153,6 @@ vop_close { vop_fplookup_vexec { IN struct vnode *vp; IN struct ucred *cred; - IN struct thread *td; }; From owner-svn-src-all@freebsd.org Mon Aug 10 10:35:19 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3089A37E12F; Mon, 10 Aug 2020 10:35:19 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQC5z0Tt6z46SJ; Mon, 10 Aug 2020 10:35:19 +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 CE44C89F5; Mon, 10 Aug 2020 10:35:18 +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 07AAZIZp096425; Mon, 10 Aug 2020 10:35:18 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07AAZIxL096424; Mon, 10 Aug 2020 10:35:18 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202008101035.07AAZIxL096424@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 10 Aug 2020 10:35:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364066 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 364066 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2020 10:35:19 -0000 Author: mjg Date: Mon Aug 10 10:35:18 2020 New Revision: 364066 URL: https://svnweb.freebsd.org/changeset/base/364066 Log: vfs: partially support file create/delete/rename in lockless lookup Perform the lookup until the last 2 elements and fallback to slowpath. Tested by: pho Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Mon Aug 10 10:34:22 2020 (r364065) +++ head/sys/kern/vfs_cache.c Mon Aug 10 10:35:18 2020 (r364066) @@ -3143,8 +3143,8 @@ cache_fpl_handled_impl(struct cache_fpl *fpl, int erro #define cache_fpl_handled(x, e) cache_fpl_handled_impl((x), (e), __LINE__) #define CACHE_FPL_SUPPORTED_CN_FLAGS \ - (LOCKLEAF | LOCKPARENT | WANTPARENT | FOLLOW | LOCKSHARED | SAVENAME | \ - ISOPEN | NOMACCHECK | AUDITVNODE1 | AUDITVNODE2) + (LOCKLEAF | LOCKPARENT | WANTPARENT | NOCACHE | FOLLOW | LOCKSHARED | SAVENAME | \ + WILLBEDIR | ISOPEN | NOMACCHECK | AUDITVNODE1 | AUDITVNODE2) #define CACHE_FPL_INTERNAL_CN_FLAGS \ (ISDOTDOT | MAKEENTRY | ISLASTCN) @@ -3194,10 +3194,6 @@ cache_can_fplookup(struct cache_fpl *fpl) cache_fpl_aborted(fpl); return (false); } - if (cnp->cn_nameiop != LOOKUP) { - cache_fpl_aborted(fpl); - return (false); - } if (ndp->ni_dirfd != AT_FDCWD) { cache_fpl_aborted(fpl); return (false); @@ -3407,6 +3403,22 @@ cache_fplookup_final_child(struct cache_fpl *fpl, enum return (cache_fpl_handled(fpl, 0)); } +/* + * They want to possibly modify the state of the namecache. + * + * Don't try to match the API contract, just leave. + * TODO: this leaves scalability on the table + */ +static int +cache_fplookup_final_modifying(struct cache_fpl *fpl) +{ + struct componentname *cnp; + + cnp = fpl->cnp; + MPASS(cnp->cn_nameiop != LOOKUP); + return (cache_fpl_partial(fpl)); +} + static int __noinline cache_fplookup_final_withparent(struct cache_fpl *fpl) { @@ -3489,6 +3501,10 @@ cache_fplookup_final(struct cache_fpl *fpl) VNPASS(cache_fplookup_vnode_supported(dvp), dvp); + if (cnp->cn_nameiop != LOOKUP) { + return (cache_fplookup_final_modifying(fpl)); + } + if ((cnp->cn_flags & (LOCKPARENT|WANTPARENT)) != 0) return (cache_fplookup_final_withparent(fpl)); @@ -3633,6 +3649,12 @@ cache_fplookup_next(struct cache_fpl *fpl) tvp = atomic_load_ptr(&ncp->nc_vp); nc_flag = atomic_load_char(&ncp->nc_flag); if ((nc_flag & NCF_NEGATIVE) != 0) { + /* + * If they want to create an entry we need to replace this one. + */ + if (__predict_false(fpl->cnp->cn_nameiop == CREATE)) { + return (cache_fpl_partial(fpl)); + } negstate = NCP2NEGSTATE(ncp); neg_hot = ((negstate->neg_flag & NEG_HOT) != 0); if (__predict_false(!cache_ncp_canuse(ncp))) { From owner-svn-src-all@freebsd.org Mon Aug 10 10:35:48 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8D34937E145; Mon, 10 Aug 2020 10:35:48 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQC6X3HVCz46rb; Mon, 10 Aug 2020 10:35:48 +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 551E08E11; Mon, 10 Aug 2020 10:35:48 +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 07AAZmfH096493; Mon, 10 Aug 2020 10:35:48 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07AAZmoK096492; Mon, 10 Aug 2020 10:35:48 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202008101035.07AAZmoK096492@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 10 Aug 2020 10:35:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364067 - head/sys/fs/devfs X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/fs/devfs X-SVN-Commit-Revision: 364067 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2020 10:35:48 -0000 Author: mjg Date: Mon Aug 10 10:35:47 2020 New Revision: 364067 URL: https://svnweb.freebsd.org/changeset/base/364067 Log: devfs: use vget_prep/vget_finish Tested by: pho Modified: head/sys/fs/devfs/devfs_vnops.c Modified: head/sys/fs/devfs/devfs_vnops.c ============================================================================== --- head/sys/fs/devfs/devfs_vnops.c Mon Aug 10 10:35:18 2020 (r364066) +++ head/sys/fs/devfs/devfs_vnops.c Mon Aug 10 10:35:47 2020 (r364067) @@ -420,6 +420,7 @@ devfs_allocv(struct devfs_dirent *de, struct mount *mp struct cdev *dev; struct devfs_mount *dmp; struct cdevsw *dsw; + enum vgetstate vs; dmp = VFSTODEVFS(mp); if (de->de_flags & DE_DOOMED) { @@ -432,10 +433,10 @@ loop: mtx_lock(&devfs_de_interlock); vp = de->de_vnode; if (vp != NULL) { - VI_LOCK(vp); + vs = vget_prep(vp); mtx_unlock(&devfs_de_interlock); sx_xunlock(&dmp->dm_lock); - vget(vp, lockmode | LK_INTERLOCK | LK_RETRY, curthread); + vget_finish(vp, lockmode | LK_RETRY, vs); sx_xlock(&dmp->dm_lock); if (devfs_allocv_drop_refs(0, dmp, de)) { vput(vp); @@ -1492,13 +1493,14 @@ devfs_revoke(struct vop_revoke_args *ap) struct cdev *dev; struct cdev_priv *cdp; struct devfs_dirent *de; + enum vgetstate vs; u_int i; KASSERT((ap->a_flags & REVOKEALL) != 0, ("devfs_revoke !REVOKEALL")); dev = vp->v_rdev; cdp = cdev2priv(dev); - + dev_lock(); cdp->cdp_inuse++; dev_unlock(); @@ -1521,17 +1523,16 @@ devfs_revoke(struct vop_revoke_args *ap) vp2 = de->de_vnode; if (vp2 != NULL) { dev_unlock(); - VI_LOCK(vp2); + vs = vget_prep(vp2); mtx_unlock(&devfs_de_interlock); - if (vget(vp2, LK_EXCLUSIVE | LK_INTERLOCK, - curthread)) + if (vget_finish(vp2, LK_EXCLUSIVE, vs) != 0) goto loop; vhold(vp2); vgone(vp2); vdrop(vp2); vput(vp2); break; - } + } } if (vp2 != NULL) { continue; From owner-svn-src-all@freebsd.org Mon Aug 10 10:36:11 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 532AA37E14E; Mon, 10 Aug 2020 10:36:11 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQC6z1VD2z46yP; Mon, 10 Aug 2020 10:36: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 17E0389F6; Mon, 10 Aug 2020 10:36: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 07AAaAuh096556; Mon, 10 Aug 2020 10:36:10 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07AAaA5I096555; Mon, 10 Aug 2020 10:36:10 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202008101036.07AAaA5I096555@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 10 Aug 2020 10:36:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364068 - head/sys/fs/devfs X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/fs/devfs X-SVN-Commit-Revision: 364068 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2020 10:36:11 -0000 Author: mjg Date: Mon Aug 10 10:36:10 2020 New Revision: 364068 URL: https://svnweb.freebsd.org/changeset/base/364068 Log: devfs: use cheaper lockmgr entry points Tested by: pho Modified: head/sys/fs/devfs/devfs_vnops.c Modified: head/sys/fs/devfs/devfs_vnops.c ============================================================================== --- head/sys/fs/devfs/devfs_vnops.c Mon Aug 10 10:35:47 2020 (r364067) +++ head/sys/fs/devfs/devfs_vnops.c Mon Aug 10 10:36:10 2020 (r364068) @@ -1928,6 +1928,9 @@ static struct vop_vector devfs_vnodeops = { #endif .vop_symlink = devfs_symlink, .vop_vptocnp = devfs_vptocnp, + .vop_lock1 = vop_lock, + .vop_unlock = vop_unlock, + .vop_islocked = vop_islocked, }; VFS_VOP_VECTOR_REGISTER(devfs_vnodeops); @@ -1966,6 +1969,9 @@ static struct vop_vector devfs_specops = { .vop_symlink = VOP_PANIC, .vop_vptocnp = devfs_vptocnp, .vop_write = dead_write, + .vop_lock1 = vop_lock, + .vop_unlock = vop_unlock, + .vop_islocked = vop_islocked, }; VFS_VOP_VECTOR_REGISTER(devfs_specops); From owner-svn-src-all@freebsd.org Mon Aug 10 10:36:45 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 06A4237DEF0; Mon, 10 Aug 2020 10:36:45 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQC7c6Mc7z46wP; Mon, 10 Aug 2020 10:36: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 BDF6A8D8C; Mon, 10 Aug 2020 10:36: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 07AAaiXf096624; Mon, 10 Aug 2020 10:36:44 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07AAaiBA096621; Mon, 10 Aug 2020 10:36:44 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202008101036.07AAaiBA096621@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 10 Aug 2020 10:36:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364069 - head/sys/fs/devfs X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/fs/devfs X-SVN-Commit-Revision: 364069 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2020 10:36:45 -0000 Author: mjg Date: Mon Aug 10 10:36:43 2020 New Revision: 364069 URL: https://svnweb.freebsd.org/changeset/base/364069 Log: devfs: save on spurious relocking for devfs_populate Tested by: pho Modified: head/sys/fs/devfs/devfs.h head/sys/fs/devfs/devfs_devs.c head/sys/fs/devfs/devfs_vnops.c Modified: head/sys/fs/devfs/devfs.h ============================================================================== --- head/sys/fs/devfs/devfs.h Mon Aug 10 10:36:10 2020 (r364068) +++ head/sys/fs/devfs/devfs.h Mon Aug 10 10:36:43 2020 (r364069) @@ -192,6 +192,7 @@ char *devfs_fqpn(char *, struct devfs_mount *, struct struct componentname *); void devfs_delete(struct devfs_mount *, struct devfs_dirent *, int); void devfs_dirent_free(struct devfs_dirent *); +bool devfs_populate_needed(struct devfs_mount *dm); void devfs_populate(struct devfs_mount *); void devfs_cleanup(struct devfs_mount *); void devfs_unmount_final(struct devfs_mount *); Modified: head/sys/fs/devfs/devfs_devs.c ============================================================================== --- head/sys/fs/devfs/devfs_devs.c Mon Aug 10 10:36:10 2020 (r364068) +++ head/sys/fs/devfs/devfs_devs.c Mon Aug 10 10:36:43 2020 (r364069) @@ -659,6 +659,13 @@ devfs_populate_loop(struct devfs_mount *dm, int cleanu return (0); } +bool +devfs_populate_needed(struct devfs_mount *dm) +{ + + return (dm->dm_generation != devfs_generation); +} + /* * The caller needs to hold the dm for the duration of the call. */ @@ -668,9 +675,9 @@ devfs_populate(struct devfs_mount *dm) unsigned gen; sx_assert(&dm->dm_lock, SX_XLOCKED); - gen = devfs_generation; - if (dm->dm_generation == gen) + if (!devfs_populate_needed(dm)) return; + gen = devfs_generation; while (devfs_populate_loop(dm, 0)) continue; dm->dm_generation = gen; Modified: head/sys/fs/devfs/devfs_vnops.c ============================================================================== --- head/sys/fs/devfs/devfs_vnops.c Mon Aug 10 10:36:10 2020 (r364068) +++ head/sys/fs/devfs/devfs_vnops.c Mon Aug 10 10:36:43 2020 (r364069) @@ -235,6 +235,11 @@ devfs_populate_vp(struct vnode *vp) ASSERT_VOP_LOCKED(vp, "devfs_populate_vp"); dmp = VFSTODEVFS(vp->v_mount); + if (!devfs_populate_needed(dmp)) { + sx_xlock(&dmp->dm_lock); + goto out_nopopulate; + } + locked = VOP_ISLOCKED(vp); sx_xlock(&dmp->dm_lock); @@ -252,6 +257,7 @@ devfs_populate_vp(struct vnode *vp) devfs_unmount_final(dmp); return (ERESTART); } +out_nopopulate: if (VN_IS_DOOMED(vp)) { sx_xunlock(&dmp->dm_lock); return (ERESTART); From owner-svn-src-all@freebsd.org Mon Aug 10 10:37:18 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0668237E1DF; Mon, 10 Aug 2020 10:37:18 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQC8F33h6z477g; Mon, 10 Aug 2020 10:37:17 +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 4D77885FC; Mon, 10 Aug 2020 10:37:17 +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 07AAbHvi096695; Mon, 10 Aug 2020 10:37:17 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07AAbHnL096694; Mon, 10 Aug 2020 10:37:17 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202008101037.07AAbHnL096694@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 10 Aug 2020 10:37:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364070 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 364070 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2020 10:37:18 -0000 Author: mjg Date: Mon Aug 10 10:37:16 2020 New Revision: 364070 URL: https://svnweb.freebsd.org/changeset/base/364070 Log: vfs: garbage collect unused ISUNICODE namei flag Modified: head/sys/sys/namei.h Modified: head/sys/sys/namei.h ============================================================================== --- head/sys/sys/namei.h Mon Aug 10 10:36:43 2020 (r364069) +++ head/sys/sys/namei.h Mon Aug 10 10:37:16 2020 (r364070) @@ -159,7 +159,6 @@ int cache_fplookup(struct nameidata *ndp, enum cache_f #define ISWHITEOUT 0x00020000 /* found whiteout */ #define DOWHITEOUT 0x00040000 /* do whiteouts */ #define WILLBEDIR 0x00080000 /* new files will be dirs; allow trailing / */ -#define ISUNICODE 0x00100000 /* current component name is unicode*/ #define ISOPEN 0x00200000 /* caller is opening; return a real vnode. */ #define NOCROSSMOUNT 0x00400000 /* do not cross mount points */ #define NOMACCHECK 0x00800000 /* do not perform MAC checks */ From owner-svn-src-all@freebsd.org Mon Aug 10 10:40:14 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CCEF537E503; Mon, 10 Aug 2020 10:40: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQCCf53znz47Cw; Mon, 10 Aug 2020 10:40: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 9140E87E9; Mon, 10 Aug 2020 10:40: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 07AAeEKG096925; Mon, 10 Aug 2020 10:40:14 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07AAeEtt096924; Mon, 10 Aug 2020 10:40:14 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202008101040.07AAeEtt096924@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 10 Aug 2020 10:40:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364071 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 364071 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2020 10:40:14 -0000 Author: mjg Date: Mon Aug 10 10:40:14 2020 New Revision: 364071 URL: https://svnweb.freebsd.org/changeset/base/364071 Log: cache: strlcpy -> memcpy Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Mon Aug 10 10:37:16 2020 (r364070) +++ head/sys/kern/vfs_cache.c Mon Aug 10 10:40:14 2020 (r364071) @@ -1934,7 +1934,8 @@ cache_enter_time(struct vnode *dvp, struct vnode *vp, } len = ncp->nc_nlen = cnp->cn_namelen; hash = cache_get_hash(cnp->cn_nameptr, len, dvp); - strlcpy(ncp->nc_name, cnp->cn_nameptr, len + 1); + memcpy(ncp->nc_name, cnp->cn_nameptr, len); + ncp->nc_name[len] = '\0'; cache_enter_lock(&cel, dvp, vp, hash); /* From owner-svn-src-all@freebsd.org Mon Aug 10 10:40:24 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1F22E37E41D; Mon, 10 Aug 2020 10:40:24 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQCCm6F29z47DT; Mon, 10 Aug 2020 10:40:20 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7DAF28E13; Mon, 10 Aug 2020 10:40:20 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07AAeKIZ096974; Mon, 10 Aug 2020 10:40:20 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07AAeK4e096973; Mon, 10 Aug 2020 10:40:20 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202008101040.07AAeK4e096973@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 10 Aug 2020 10:40:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364072 - in head/sys: netinet netinet6 X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys: netinet netinet6 X-SVN-Commit-Revision: 364072 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2020 10:40:24 -0000 Author: hselasky Date: Mon Aug 10 10:40:19 2020 New Revision: 364072 URL: https://svnweb.freebsd.org/changeset/base/364072 Log: Use proper prototype for SYSINIT() functions. Mark the unused argument using the __unused macro. Discussed with: kib@ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/netinet/in_mcast.c head/sys/netinet6/in6_mcast.c Modified: head/sys/netinet/in_mcast.c ============================================================================== --- head/sys/netinet/in_mcast.c Mon Aug 10 10:40:14 2020 (r364071) +++ head/sys/netinet/in_mcast.c Mon Aug 10 10:40:19 2020 (r364072) @@ -229,7 +229,7 @@ static struct in_multi_head inm_free_list = SLIST_HEAD static void inm_release_task(void *arg __unused, int pending __unused); static void -inm_init(void) +inm_init(void *arg __unused) { TASK_INIT(&free_task, 0, inm_release_task, NULL); } Modified: head/sys/netinet6/in6_mcast.c ============================================================================== --- head/sys/netinet6/in6_mcast.c Mon Aug 10 10:40:14 2020 (r364071) +++ head/sys/netinet6/in6_mcast.c Mon Aug 10 10:40:19 2020 (r364072) @@ -521,7 +521,7 @@ static struct in6_multi_head in6m_free_list = SLIST_HE static void in6m_release_task(void *arg __unused, int pending __unused); static void -in6m_init(void) +in6m_init(void *arg __unused) { TASK_INIT(&in6m_free_task, 0, in6m_release_task, NULL); } From owner-svn-src-all@freebsd.org Mon Aug 10 10:46:10 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E0AC837E30F; Mon, 10 Aug 2020 10:46:10 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQCLV5hXZz47wp; Mon, 10 Aug 2020 10:46:10 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A26478F12; Mon, 10 Aug 2020 10:46:10 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07AAkA0n002744; Mon, 10 Aug 2020 10:46:10 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07AAk9MN002738; Mon, 10 Aug 2020 10:46:09 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202008101046.07AAk9MN002738@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 10 Aug 2020 10:46:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364073 - in head/sys: netinet netinet6 X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys: netinet netinet6 X-SVN-Commit-Revision: 364073 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2020 10:46:10 -0000 Author: hselasky Date: Mon Aug 10 10:46:08 2020 New Revision: 364073 URL: https://svnweb.freebsd.org/changeset/base/364073 Log: Make sure the multicast release tasks are properly drained when destroying a VNET or a network interface. Else the inm release tasks, both IPv4 and IPv6 may cause a panic accessing a freed VNET or network interface. Reviewed by: jmg@ Discussed with: bz@ Differential Revision: https://reviews.freebsd.org/D24914 MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/netinet/in.c head/sys/netinet/in_mcast.c head/sys/netinet/in_var.h head/sys/netinet6/in6_ifattach.c head/sys/netinet6/in6_mcast.c head/sys/netinet6/in6_var.h Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Mon Aug 10 10:40:19 2020 (r364072) +++ head/sys/netinet/in.c Mon Aug 10 10:46:08 2020 (r364073) @@ -998,6 +998,13 @@ in_ifdetach(struct ifnet *ifp) in_pcbpurgeif0(&V_ulitecbinfo, ifp); in_purgemaddrs(ifp); IN_MULTI_UNLOCK(); + + /* + * Make sure all multicast deletions invoking if_ioctl() are + * completed before returning. Else we risk accessing a freed + * ifnet structure pointer. + */ + inm_release_wait(NULL); } /* Modified: head/sys/netinet/in_mcast.c ============================================================================== --- head/sys/netinet/in_mcast.c Mon Aug 10 10:40:19 2020 (r364072) +++ head/sys/netinet/in_mcast.c Mon Aug 10 10:46:08 2020 (r364073) @@ -224,18 +224,37 @@ inm_is_ifp_detached(const struct in_multi *inm) } #endif -static struct task free_task; +/* + * Interface detach can happen in a taskqueue thread context, so we must use a + * dedicated thread to avoid deadlocks when draining inm_release tasks. + */ +TASKQUEUE_DEFINE_THREAD(inm_free); +static struct task inm_free_task; static struct in_multi_head inm_free_list = SLIST_HEAD_INITIALIZER(); static void inm_release_task(void *arg __unused, int pending __unused); static void inm_init(void *arg __unused) { - TASK_INIT(&free_task, 0, inm_release_task, NULL); + TASK_INIT(&inm_free_task, 0, inm_release_task, NULL); } SYSINIT(inm_init, SI_SUB_TASKQ, SI_ORDER_ANY, inm_init, NULL); void +inm_release_wait(void *arg __unused) +{ + + /* + * Make sure all pending multicast addresses are freed before + * the VNET or network device is destroyed: + */ + taskqueue_drain(taskqueue_inm_free, &inm_free_task); +} +#ifdef VIMAGE +VNET_SYSUNINIT(inm_release_wait, SI_SUB_PROTO_DOMAIN, SI_ORDER_FIRST, inm_release_wait, NULL); +#endif + +void inm_release_list_deferred(struct in_multi_head *inmh) { @@ -244,7 +263,7 @@ inm_release_list_deferred(struct in_multi_head *inmh) mtx_lock(&in_multi_free_mtx); SLIST_CONCAT(&inm_free_list, inmh, in_multi, inm_nrele); mtx_unlock(&in_multi_free_mtx); - taskqueue_enqueue(taskqueue_thread, &free_task); + taskqueue_enqueue(taskqueue_inm_free, &inm_free_task); } void Modified: head/sys/netinet/in_var.h ============================================================================== --- head/sys/netinet/in_var.h Mon Aug 10 10:40:19 2020 (r364072) +++ head/sys/netinet/in_var.h Mon Aug 10 10:46:08 2020 (r364073) @@ -450,6 +450,7 @@ void inm_print(const struct in_multi *); int inm_record_source(struct in_multi *inm, const in_addr_t); void inm_release_deferred(struct in_multi *); void inm_release_list_deferred(struct in_multi_head *); +void inm_release_wait(void *); struct in_multi * in_addmulti(struct in_addr *, struct ifnet *); int in_joingroup(struct ifnet *, const struct in_addr *, Modified: head/sys/netinet6/in6_ifattach.c ============================================================================== --- head/sys/netinet6/in6_ifattach.c Mon Aug 10 10:40:19 2020 (r364072) +++ head/sys/netinet6/in6_ifattach.c Mon Aug 10 10:46:08 2020 (r364073) @@ -871,7 +871,7 @@ in6_purgemaddrs(struct ifnet *ifp) * completed before returning. Else we risk accessing a freed * ifnet structure pointer. */ - in6m_release_wait(); + in6m_release_wait(NULL); } void Modified: head/sys/netinet6/in6_mcast.c ============================================================================== --- head/sys/netinet6/in6_mcast.c Mon Aug 10 10:40:19 2020 (r364072) +++ head/sys/netinet6/in6_mcast.c Mon Aug 10 10:46:08 2020 (r364073) @@ -539,10 +539,18 @@ in6m_release_list_deferred(struct in6_multi_head *inmh } void -in6m_release_wait(void) +in6m_release_wait(void *arg __unused) { + + /* + * Make sure all pending multicast addresses are freed before + * the VNET or network device is destroyed: + */ taskqueue_drain_all(taskqueue_in6m_free); } +#ifdef VIMAGE +VNET_SYSUNINIT(in6m_release_wait, SI_SUB_PROTO_DOMAIN, SI_ORDER_FIRST, in6m_release_wait, NULL); +#endif void in6m_disconnect_locked(struct in6_multi_head *inmh, struct in6_multi *inm) Modified: head/sys/netinet6/in6_var.h ============================================================================== --- head/sys/netinet6/in6_var.h Mon Aug 10 10:40:19 2020 (r364072) +++ head/sys/netinet6/in6_var.h Mon Aug 10 10:46:08 2020 (r364073) @@ -870,7 +870,7 @@ void in6m_commit(struct in6_multi *); void in6m_print(const struct in6_multi *); int in6m_record_source(struct in6_multi *, const struct in6_addr *); void in6m_release_list_deferred(struct in6_multi_head *); -void in6m_release_wait(void); +void in6m_release_wait(void *); void ip6_freemoptions(struct ip6_moptions *); int ip6_getmoptions(struct inpcb *, struct sockopt *); int ip6_setmoptions(struct inpcb *, struct sockopt *); From owner-svn-src-all@freebsd.org Mon Aug 10 10:52:55 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BD5BE37E4DC; Mon, 10 Aug 2020 10:52:55 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQCVH4ZRrz48Bv; Mon, 10 Aug 2020 10:52:55 +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 665E49129; Mon, 10 Aug 2020 10:52:55 +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 07AAqttp008986; Mon, 10 Aug 2020 10:52:55 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07AAqsxA008982; Mon, 10 Aug 2020 10:52:54 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202008101052.07AAqsxA008982@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 10 Aug 2020 10:52: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: r364074 - in stable/12: lib/libc/gen share/man/man4 sys/kern sys/sys X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/12: lib/libc/gen share/man/man4 sys/kern sys/sys X-SVN-Commit-Revision: 364074 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2020 10:52:55 -0000 Author: kib Date: Mon Aug 10 10:52:54 2020 New Revision: 364074 URL: https://svnweb.freebsd.org/changeset/base/364074 Log: MFC r363813: Add SOL_LOCAL symbolic constant for unix socket option level. Modified: stable/12/lib/libc/gen/getpeereid.c stable/12/share/man/man4/unix.4 stable/12/sys/kern/uipc_usrreq.c stable/12/sys/sys/un.h Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libc/gen/getpeereid.c ============================================================================== --- stable/12/lib/libc/gen/getpeereid.c Mon Aug 10 10:46:08 2020 (r364073) +++ stable/12/lib/libc/gen/getpeereid.c Mon Aug 10 10:52:54 2020 (r364074) @@ -47,7 +47,7 @@ getpeereid(int s, uid_t *euid, gid_t *egid) int error; xuclen = sizeof(xuc); - error = _getsockopt(s, 0, LOCAL_PEERCRED, &xuc, &xuclen); + error = _getsockopt(s, SOL_LOCAL, LOCAL_PEERCRED, &xuc, &xuclen); if (error != 0) return (error); if (xuc.cr_version != XUCRED_VERSION) { Modified: stable/12/share/man/man4/unix.4 ============================================================================== --- stable/12/share/man/man4/unix.4 Mon Aug 10 10:46:08 2020 (r364073) +++ stable/12/share/man/man4/unix.4 Mon Aug 10 10:52:54 2020 (r364074) @@ -28,7 +28,7 @@ .\" @(#)unix.4 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd August 19, 2018 +.Dd August 3, 2020 .Dt UNIX 4 .Os .Sh NAME @@ -195,7 +195,9 @@ The sending process could have exited and its process reused for a new process. .Sh SOCKET OPTIONS .Tn UNIX -domain sockets support a number of socket options which can be set with +domain sockets support a number of socket options for the options level +.Dv SOL_LOCAL , +which can be set with .Xr setsockopt 2 and tested with .Xr getsockopt 2 : Modified: stable/12/sys/kern/uipc_usrreq.c ============================================================================== --- stable/12/sys/kern/uipc_usrreq.c Mon Aug 10 10:46:08 2020 (r364073) +++ stable/12/sys/kern/uipc_usrreq.c Mon Aug 10 10:52:54 2020 (r364074) @@ -1467,7 +1467,7 @@ uipc_ctloutput(struct socket *so, struct sockopt *sopt struct xucred xu; int error, optval; - if (sopt->sopt_level != 0) + if (sopt->sopt_level != SOL_LOCAL) return (EINVAL); unp = sotounpcb(so); Modified: stable/12/sys/sys/un.h ============================================================================== --- stable/12/sys/sys/un.h Mon Aug 10 10:46:08 2020 (r364073) +++ stable/12/sys/sys/un.h Mon Aug 10 10:52:54 2020 (r364074) @@ -54,6 +54,8 @@ struct sockaddr_un { #if __BSD_VISIBLE +#define SOL_LOCAL 0 /* Options for local socket */ + /* Socket options. */ #define LOCAL_PEERCRED 1 /* retrieve peer credentials */ #define LOCAL_CREDS 2 /* pass credentials to receiver */ From owner-svn-src-all@freebsd.org Mon Aug 10 10:58:44 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1CF6F37E99D; Mon, 10 Aug 2020 10:58:44 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQCcz6vRDz48Ct; Mon, 10 Aug 2020 10:58:43 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D0A46912A; Mon, 10 Aug 2020 10:58:43 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07AAwhju009367; Mon, 10 Aug 2020 10:58:43 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07AAwhUj009365; Mon, 10 Aug 2020 10:58:43 GMT (envelope-from bz@FreeBSD.org) Message-Id: <202008101058.07AAwhUj009365@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Mon, 10 Aug 2020 10:58:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364075 - in head/sys: netinet netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: in head/sys: netinet netinet6 X-SVN-Commit-Revision: 364075 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2020 10:58:44 -0000 Author: bz Date: Mon Aug 10 10:58:43 2020 New Revision: 364075 URL: https://svnweb.freebsd.org/changeset/base/364075 Log: MC: add a note with reference to the discussion and history as-to why we are where we are now. The main thing is to try to get rid of the delayed freeing to avoid blocking on the taskq when shutting down vnets. X-Timeout: if you still see this before 14-RELEASE remove it. Modified: head/sys/netinet/in_mcast.c head/sys/netinet6/in6_mcast.c Modified: head/sys/netinet/in_mcast.c ============================================================================== --- head/sys/netinet/in_mcast.c Mon Aug 10 10:52:54 2020 (r364074) +++ head/sys/netinet/in_mcast.c Mon Aug 10 10:58:43 2020 (r364075) @@ -251,6 +251,7 @@ inm_release_wait(void *arg __unused) taskqueue_drain(taskqueue_inm_free, &inm_free_task); } #ifdef VIMAGE +/* XXX-BZ FIXME, see D24914. */ VNET_SYSUNINIT(inm_release_wait, SI_SUB_PROTO_DOMAIN, SI_ORDER_FIRST, inm_release_wait, NULL); #endif Modified: head/sys/netinet6/in6_mcast.c ============================================================================== --- head/sys/netinet6/in6_mcast.c Mon Aug 10 10:52:54 2020 (r364074) +++ head/sys/netinet6/in6_mcast.c Mon Aug 10 10:58:43 2020 (r364075) @@ -549,6 +549,7 @@ in6m_release_wait(void *arg __unused) taskqueue_drain_all(taskqueue_in6m_free); } #ifdef VIMAGE +/* XXX-BZ FIXME, see D24914. */ VNET_SYSUNINIT(in6m_release_wait, SI_SUB_PROTO_DOMAIN, SI_ORDER_FIRST, in6m_release_wait, NULL); #endif From owner-svn-src-all@freebsd.org Mon Aug 10 11:46:40 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A3FB837F5EB; Mon, 10 Aug 2020 11:46: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQDhJ3vFlz4Bx8; Mon, 10 Aug 2020 11:46: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 6922D9A8D; Mon, 10 Aug 2020 11:46:40 +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 07ABkeKK039898; Mon, 10 Aug 2020 11:46:40 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07ABkeAw039895; Mon, 10 Aug 2020 11:46:40 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202008101146.07ABkeAw039895@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 10 Aug 2020 11:46:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364076 - head/sys/fs/devfs X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/fs/devfs X-SVN-Commit-Revision: 364076 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2020 11:46:40 -0000 Author: mjg Date: Mon Aug 10 11:46:39 2020 New Revision: 364076 URL: https://svnweb.freebsd.org/changeset/base/364076 Log: devfs: bool -> int Fixes buildworld after r364069 Modified: head/sys/fs/devfs/devfs.h head/sys/fs/devfs/devfs_devs.c Modified: head/sys/fs/devfs/devfs.h ============================================================================== --- head/sys/fs/devfs/devfs.h Mon Aug 10 10:58:43 2020 (r364075) +++ head/sys/fs/devfs/devfs.h Mon Aug 10 11:46:39 2020 (r364076) @@ -192,7 +192,7 @@ char *devfs_fqpn(char *, struct devfs_mount *, struct struct componentname *); void devfs_delete(struct devfs_mount *, struct devfs_dirent *, int); void devfs_dirent_free(struct devfs_dirent *); -bool devfs_populate_needed(struct devfs_mount *dm); +int devfs_populate_needed(struct devfs_mount *dm); void devfs_populate(struct devfs_mount *); void devfs_cleanup(struct devfs_mount *); void devfs_unmount_final(struct devfs_mount *); Modified: head/sys/fs/devfs/devfs_devs.c ============================================================================== --- head/sys/fs/devfs/devfs_devs.c Mon Aug 10 10:58:43 2020 (r364075) +++ head/sys/fs/devfs/devfs_devs.c Mon Aug 10 11:46:39 2020 (r364076) @@ -659,7 +659,7 @@ devfs_populate_loop(struct devfs_mount *dm, int cleanu return (0); } -bool +int devfs_populate_needed(struct devfs_mount *dm) { From owner-svn-src-all@freebsd.org Mon Aug 10 11:51:22 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3258637FE8E; Mon, 10 Aug 2020 11:51:22 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQDnk0Mqnz4CBc; Mon, 10 Aug 2020 11:51:22 +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 E40ED97C8; Mon, 10 Aug 2020 11:51:21 +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 07ABpLPK044660; Mon, 10 Aug 2020 11:51:21 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07ABpLXU044656; Mon, 10 Aug 2020 11:51:21 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202008101151.07ABpLXU044656@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 10 Aug 2020 11:51:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364077 - in head/sys: fs/tmpfs kern ufs/ffs X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: fs/tmpfs kern ufs/ffs X-SVN-Commit-Revision: 364077 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2020 11:51:22 -0000 Author: mjg Date: Mon Aug 10 11:51:21 2020 New Revision: 364077 URL: https://svnweb.freebsd.org/changeset/base/364077 Log: vfs: clean MNTK_FPLOOKUP if MNT_UNION is set Elides checking it during lookup. Modified: head/sys/fs/tmpfs/tmpfs_vfsops.c head/sys/kern/vfs_cache.c head/sys/ufs/ffs/ffs_vfsops.c Modified: head/sys/fs/tmpfs/tmpfs_vfsops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vfsops.c Mon Aug 10 11:46:39 2020 (r364076) +++ head/sys/fs/tmpfs/tmpfs_vfsops.c Mon Aug 10 11:51:21 2020 (r364077) @@ -372,6 +372,13 @@ tmpfs_mount(struct mount *mp) } tmp->tm_nomtime = vfs_getopt(mp->mnt_optnew, "nomtime", NULL, 0) == 0; + MNT_ILOCK(mp); + if ((mp->mnt_flag & MNT_UNION) == 0) { + mp->mnt_kern_flag |= MNTK_FPLOOKUP; + } else { + mp->mnt_kern_flag &= ~MNTK_FPLOOKUP; + } + MNT_IUNLOCK(mp); return (0); } @@ -462,7 +469,7 @@ tmpfs_mount(struct mount *mp) mp->mnt_flag |= MNT_LOCAL; mp->mnt_kern_flag |= MNTK_LOOKUP_SHARED | MNTK_EXTENDED_SHARED | MNTK_TEXT_REFS | MNTK_NOMSYNC; - if (!nonc) + if (!nonc && (mp->mnt_flag & MNT_UNION) == 0) mp->mnt_kern_flag |= MNTK_FPLOOKUP; MNT_IUNLOCK(mp); Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Mon Aug 10 11:46:39 2020 (r364076) +++ head/sys/kern/vfs_cache.c Mon Aug 10 11:51:21 2020 (r364077) @@ -3701,8 +3701,6 @@ cache_fplookup_mp_supported(struct mount *mp) return (false); if ((mp->mnt_kern_flag & MNTK_FPLOOKUP) == 0) return (false); - if ((mp->mnt_flag & MNT_UNION) != 0) - return (false); return (true); } Modified: head/sys/ufs/ffs/ffs_vfsops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vfsops.c Mon Aug 10 11:46:39 2020 (r364076) +++ head/sys/ufs/ffs/ffs_vfsops.c Mon Aug 10 11:51:21 2020 (r364077) @@ -805,7 +805,7 @@ ffs_mount(struct mount *mp) */ if ((mp->mnt_kern_flag & MNTK_FPLOOKUP) != 0) panic("MNTK_FPLOOKUP set on mount %p when it should not be", mp); - if ((mp->mnt_flag & (MNT_ACLS | MNT_NFS4ACLS)) == 0) + if ((mp->mnt_flag & (MNT_ACLS | MNT_NFS4ACLS | MNT_UNION)) == 0) mp->mnt_kern_flag |= MNTK_FPLOOKUP; MNT_IUNLOCK(mp); From owner-svn-src-all@freebsd.org Mon Aug 10 11:51:57 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 39FE43A1102; Mon, 10 Aug 2020 11:51:57 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQDpP0v7Zz4C02; Mon, 10 Aug 2020 11:51:57 +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 0367199DF; Mon, 10 Aug 2020 11:51:57 +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 07ABpuZ9045580; Mon, 10 Aug 2020 11:51:56 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07ABpuB9045579; Mon, 10 Aug 2020 11:51:56 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202008101151.07ABpuB9045579@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 10 Aug 2020 11:51:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364078 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 364078 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2020 11:51:57 -0000 Author: mjg Date: Mon Aug 10 11:51:56 2020 New Revision: 364078 URL: https://svnweb.freebsd.org/changeset/base/364078 Log: cache: remove unused variables from cache_fplookup_parse Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Mon Aug 10 11:51:21 2020 (r364077) +++ head/sys/kern/vfs_cache.c Mon Aug 10 11:51:56 2020 (r364078) @@ -3810,8 +3810,6 @@ cache_fplookup_parse(struct cache_fpl *fpl) struct nameidata *ndp; struct componentname *cnp; char *cp; - char *prev_ni_next; /* saved ndp->ni_next */ - size_t prev_ni_pathlen; /* saved ndp->ni_pathlen */ ndp = fpl->ndp; cnp = fpl->cnp; @@ -3831,11 +3829,9 @@ cache_fplookup_parse(struct cache_fpl *fpl) cache_fpl_smr_exit(fpl); return (cache_fpl_handled(fpl, ENAMETOOLONG)); } - prev_ni_pathlen = ndp->ni_pathlen; ndp->ni_pathlen -= cnp->cn_namelen; KASSERT(ndp->ni_pathlen <= PATH_MAX, ("%s: ni_pathlen underflow to %zd\n", __func__, ndp->ni_pathlen)); - prev_ni_next = ndp->ni_next; ndp->ni_next = cp; /* From owner-svn-src-all@freebsd.org Mon Aug 10 12:05:55 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ADCCF3A1EC6; Mon, 10 Aug 2020 12:05: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQF6W4CTcz4CyH; Mon, 10 Aug 2020 12:05: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 743DB9C36; Mon, 10 Aug 2020 12:05: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 07AC5tYL051981; Mon, 10 Aug 2020 12:05:55 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07AC5tnP051980; Mon, 10 Aug 2020 12:05:55 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202008101205.07AC5tnP051980@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 10 Aug 2020 12:05:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364079 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 364079 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2020 12:05:55 -0000 Author: mjg Date: Mon Aug 10 12:05:55 2020 New Revision: 364079 URL: https://svnweb.freebsd.org/changeset/base/364079 Log: cache: resize struct namecache to a multiply of alignment For example struct namecache on amd64 is 100 bytes, but it has to occupies 104. Use the extra bytes to support longer names. Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Mon Aug 10 11:51:56 2020 (r364078) +++ head/sys/kern/vfs_cache.c Mon Aug 10 12:05:55 2020 (r364079) @@ -159,7 +159,18 @@ struct namecache_ts { * alignment for everyone. Note this is a nop for 64-bit platforms. */ #define CACHE_ZONE_ALIGNMENT UMA_ALIGNOF(time_t) +#define CACHE_PATH_CUTOFF 39 +#define CACHE_ZONE_SMALL_SIZE (sizeof(struct namecache) + CACHE_PATH_CUTOFF + 1) +#define CACHE_ZONE_SMALL_TS_SIZE (sizeof(struct namecache_ts) + CACHE_PATH_CUTOFF + 1) +#define CACHE_ZONE_LARGE_SIZE (sizeof(struct namecache) + NAME_MAX + 1) +#define CACHE_ZONE_LARGE_TS_SIZE (sizeof(struct namecache_ts) + NAME_MAX + 1) + +_Static_assert((CACHE_ZONE_SMALL_SIZE % (CACHE_ZONE_ALIGNMENT + 1)) == 0, "bad zone size"); +_Static_assert((CACHE_ZONE_SMALL_TS_SIZE % (CACHE_ZONE_ALIGNMENT + 1)) == 0, "bad zone size"); +_Static_assert((CACHE_ZONE_LARGE_SIZE % (CACHE_ZONE_ALIGNMENT + 1)) == 0, "bad zone size"); +_Static_assert((CACHE_ZONE_LARGE_TS_SIZE % (CACHE_ZONE_ALIGNMENT + 1)) == 0, "bad zone size"); + #define nc_vp n_un.nu_vp #define nc_neg n_un.nu_neg @@ -339,8 +350,6 @@ static uma_zone_t __read_mostly cache_zone_small_ts; static uma_zone_t __read_mostly cache_zone_large; static uma_zone_t __read_mostly cache_zone_large_ts; -#define CACHE_PATH_CUTOFF 35 - static struct namecache * cache_alloc(int len, int ts) { @@ -2095,22 +2104,14 @@ nchinit(void *dummy __unused) { u_int i; - cache_zone_small = uma_zcreate("S VFS Cache", - sizeof(struct namecache) + CACHE_PATH_CUTOFF + 1, - NULL, NULL, NULL, NULL, CACHE_ZONE_ALIGNMENT, - UMA_ZONE_ZINIT); - cache_zone_small_ts = uma_zcreate("STS VFS Cache", - sizeof(struct namecache_ts) + CACHE_PATH_CUTOFF + 1, - NULL, NULL, NULL, NULL, CACHE_ZONE_ALIGNMENT, - UMA_ZONE_ZINIT); - cache_zone_large = uma_zcreate("L VFS Cache", - sizeof(struct namecache) + NAME_MAX + 1, - NULL, NULL, NULL, NULL, CACHE_ZONE_ALIGNMENT, - UMA_ZONE_ZINIT); - cache_zone_large_ts = uma_zcreate("LTS VFS Cache", - sizeof(struct namecache_ts) + NAME_MAX + 1, - NULL, NULL, NULL, NULL, CACHE_ZONE_ALIGNMENT, - UMA_ZONE_ZINIT); + cache_zone_small = uma_zcreate("S VFS Cache", CACHE_ZONE_SMALL_SIZE, + NULL, NULL, NULL, NULL, CACHE_ZONE_ALIGNMENT, UMA_ZONE_ZINIT); + cache_zone_small_ts = uma_zcreate("STS VFS Cache", CACHE_ZONE_SMALL_TS_SIZE, + NULL, NULL, NULL, NULL, CACHE_ZONE_ALIGNMENT, UMA_ZONE_ZINIT); + cache_zone_large = uma_zcreate("L VFS Cache", CACHE_ZONE_LARGE_SIZE, + NULL, NULL, NULL, NULL, CACHE_ZONE_ALIGNMENT, UMA_ZONE_ZINIT); + cache_zone_large_ts = uma_zcreate("LTS VFS Cache", CACHE_ZONE_LARGE_TS_SIZE, + NULL, NULL, NULL, NULL, CACHE_ZONE_ALIGNMENT, UMA_ZONE_ZINIT); VFS_SMR_ZONE_SET(cache_zone_small); VFS_SMR_ZONE_SET(cache_zone_small_ts); From owner-svn-src-all@freebsd.org Mon Aug 10 12:28:57 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 376583A2E1B; Mon, 10 Aug 2020 12:28:57 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQFd50m4qz4FX1; Mon, 10 Aug 2020 12:28:57 +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 F2EA19E32; Mon, 10 Aug 2020 12:28:56 +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 07ACSuKT064507; Mon, 10 Aug 2020 12:28:56 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07ACSuCE064506; Mon, 10 Aug 2020 12:28:56 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202008101228.07ACSuCE064506@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 10 Aug 2020 12:28:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364080 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 364080 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2020 12:28:57 -0000 Author: mjg Date: Mon Aug 10 12:28:56 2020 New Revision: 364080 URL: https://svnweb.freebsd.org/changeset/base/364080 Log: cache: let SAVESTART passthrough The flag is only passed for non-LOOKUP ops and those fallback to the slowpath. Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Mon Aug 10 12:05:55 2020 (r364079) +++ head/sys/kern/vfs_cache.c Mon Aug 10 12:28:56 2020 (r364080) @@ -3146,7 +3146,7 @@ cache_fpl_handled_impl(struct cache_fpl *fpl, int erro #define CACHE_FPL_SUPPORTED_CN_FLAGS \ (LOCKLEAF | LOCKPARENT | WANTPARENT | NOCACHE | FOLLOW | LOCKSHARED | SAVENAME | \ - WILLBEDIR | ISOPEN | NOMACCHECK | AUDITVNODE1 | AUDITVNODE2) + SAVESTART | WILLBEDIR | ISOPEN | NOMACCHECK | AUDITVNODE1 | AUDITVNODE2) #define CACHE_FPL_INTERNAL_CN_FLAGS \ (ISDOTDOT | MAKEENTRY | ISLASTCN) @@ -3654,7 +3654,7 @@ cache_fplookup_next(struct cache_fpl *fpl) /* * If they want to create an entry we need to replace this one. */ - if (__predict_false(fpl->cnp->cn_nameiop == CREATE)) { + if (__predict_false(fpl->cnp->cn_nameiop != LOOKUP)) { return (cache_fpl_partial(fpl)); } negstate = NCP2NEGSTATE(ncp); @@ -4125,6 +4125,9 @@ cache_fplookup(struct nameidata *ndp, enum cache_fpl_s fpl.ndp = ndp; fpl.cnp = &ndp->ni_cnd; MPASS(curthread == fpl.cnp->cn_thread); + + if ((fpl.cnp->cn_flags & SAVESTART) != 0) + MPASS(fpl.cnp->cn_nameiop != LOOKUP); if (!cache_can_fplookup(&fpl)) { SDT_PROBE3(vfs, fplookup, lookup, done, ndp, fpl.line, fpl.status); From owner-svn-src-all@freebsd.org Mon Aug 10 16:46:56 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1E1B63A804E; Mon, 10 Aug 2020 16:46:56 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQMLl74pRz4W7w; Mon, 10 Aug 2020 16:46:55 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qt1-f179.google.com (mail-qt1-f179.google.com [209.85.160.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id D13051567D; Mon, 10 Aug 2020 16:46:55 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qt1-f179.google.com with SMTP id k18so7232499qtm.10; Mon, 10 Aug 2020 09:46:55 -0700 (PDT) X-Gm-Message-State: AOAM532ZWkmkEiDk4SkDZoAMDRxQpYHIeawhZq89xZquzbt6yyJ0ypJv R5Xk3k2CCp5v0RPaS2D+E5RRGt+SZpTbTwqaLig= X-Google-Smtp-Source: ABdhPJy1Z2KfoAP6YJwXPPcmFoBUssIFT9OOwrMTG4MoNg+MB/egl5YjVm6aKuTvftw9UjmvtHD6XZHuZciAmaGJo9k= X-Received: by 2002:ac8:5546:: with SMTP id o6mr26969483qtr.211.1597078015209; Mon, 10 Aug 2020 09:46:55 -0700 (PDT) MIME-Version: 1.0 References: <202008071626.077GQvd8038727@repo.freebsd.org> In-Reply-To: <202008071626.077GQvd8038727@repo.freebsd.org> From: Kyle Evans Date: Mon, 10 Aug 2020 11:46:44 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r364030 - in head: . tools/build To: Warner Losh Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2020 16:46:56 -0000 On Fri, Aug 7, 2020 at 11:27 AM Warner Losh wrote: > > Author: imp > Date: Fri Aug 7 16:26:56 2020 > New Revision: 364030 > URL: https://svnweb.freebsd.org/changeset/base/364030 > > Log: > The practice of creating symbolic links is somewhat fragile. Always > make copies instead. > > There's too many times that we can't run the new binaries with old > libraries. Making the links when things are known to be 'safe' is a > nice optimization, but a copy of all the binaries is only 30MB, so > saving the copies at the cost of increased support when new symbols > are added and used as part of the bootstrap seems to be unwise. > > There may be additional optimizations possible here, especially for > !FreeBSD hosts. However, that's beyond the scope of the problem I'm > trying to fix with make failing mid-way through an installworld across > change r363679. This optimization there caused us to run a new binary > with an old library once a new make was installed due to the symbolic > link. One could just copy make, but then other binaries fail as well, > so rather than play whack-a-mole, I opted to take us back to the old > way. Before r340157 or so we did copies (thogh of a lot fewer > artifacts), and we didn't have issues like this. > Many thanks for pinpointing the real cause here and solving it! Thanks, Kyle Evans From owner-svn-src-all@freebsd.org Mon Aug 10 16:55:55 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 766613A8486; Mon, 10 Aug 2020 16:55:55 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQMY72bysz4WCw; Mon, 10 Aug 2020 16:55: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 3D80FCFFD; Mon, 10 Aug 2020 16:55: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 07AGtt5V031039; Mon, 10 Aug 2020 16:55:55 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07AGtsxh031036; Mon, 10 Aug 2020 16:55:54 GMT (envelope-from dim@FreeBSD.org) Message-Id: <202008101655.07AGtsxh031036@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Mon, 10 Aug 2020 16:55:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364081 - in head/lib/libclang_rt: fuzzer profile xray X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in head/lib/libclang_rt: fuzzer profile xray X-SVN-Commit-Revision: 364081 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2020 16:55:55 -0000 Author: dim Date: Mon Aug 10 16:55:54 2020 New Revision: 364081 URL: https://svnweb.freebsd.org/changeset/base/364081 Log: Follow-up to r358851 (llvm-project 10.0.0-rc3 import), where I added subdirectories for compiler-rt's internal fuzzer, profile and xray headers, but forgot to add installing those headers themselves. MFC after: 3 days Modified: head/lib/libclang_rt/fuzzer/Makefile head/lib/libclang_rt/profile/Makefile head/lib/libclang_rt/xray/Makefile Modified: head/lib/libclang_rt/fuzzer/Makefile ============================================================================== --- head/lib/libclang_rt/fuzzer/Makefile Mon Aug 10 12:28:56 2020 (r364080) +++ head/lib/libclang_rt/fuzzer/Makefile Mon Aug 10 16:55:54 2020 (r364081) @@ -23,4 +23,8 @@ SRCS+= fuzzer/FuzzerUtil.cpp SRCS+= fuzzer/FuzzerUtilLinux.cpp SRCS+= fuzzer/FuzzerUtilPosix.cpp +.PATH: ${CRTSRC}/include/fuzzer +INCSDIR= ${CLANGDIR}/include/fuzzer +INCS+= FuzzedDataProvider.h + .include Modified: head/lib/libclang_rt/profile/Makefile ============================================================================== --- head/lib/libclang_rt/profile/Makefile Mon Aug 10 12:28:56 2020 (r364080) +++ head/lib/libclang_rt/profile/Makefile Mon Aug 10 16:55:54 2020 (r364081) @@ -25,4 +25,8 @@ SRCS+= profile/InstrProfilingUtil.c SRCS+= profile/InstrProfilingValue.c SRCS+= profile/InstrProfilingWriter.c +.PATH: ${CRTSRC}/include/profile +INCSDIR= ${CLANGDIR}/include/profile +INCS+= InstrProfData.inc + .include Modified: head/lib/libclang_rt/xray/Makefile ============================================================================== --- head/lib/libclang_rt/xray/Makefile Mon Aug 10 12:28:56 2020 (r364080) +++ head/lib/libclang_rt/xray/Makefile Mon Aug 10 16:55:54 2020 (r364081) @@ -41,4 +41,10 @@ SRCS+= xray/xray_trampoline_x86_64.S SRCS+= xray/xray_utils.cpp SRCS+= xray/xray_x86_64.cpp +.PATH: ${CRTSRC}/include/xray +INCSDIR= ${CLANGDIR}/include/xray +INCS+= xray_interface.h +INCS+= xray_log_interface.h +INCS+= xray_records.h + .include From owner-svn-src-all@freebsd.org Mon Aug 10 17:01:59 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EE79C3A8CB9; Mon, 10 Aug 2020 17:01:59 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQMh765Dxz4XHX; Mon, 10 Aug 2020 17:01:59 +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 B4F64D24B; Mon, 10 Aug 2020 17:01:59 +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 07AH1xEr035605; Mon, 10 Aug 2020 17:01:59 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07AH1xFL035603; Mon, 10 Aug 2020 17:01:59 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202008101701.07AH1xFL035603@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 10 Aug 2020 17:01:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364083 - in head/usr.bin/fortune: fortune strfile X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/usr.bin/fortune: fortune strfile X-SVN-Commit-Revision: 364083 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2020 17:02:00 -0000 Author: markj Date: Mon Aug 10 17:01:59 2020 New Revision: 364083 URL: https://svnweb.freebsd.org/changeset/base/364083 Log: fortune, strfile: Improve validation of command-line arguments. - Avoid potential overflow when parsing a percentage. - Avoid truncation when copying file paths. PR: 246050 Submitted by: Akos Somfai (original) MFC after: 1 week Modified: head/usr.bin/fortune/fortune/fortune.c head/usr.bin/fortune/strfile/strfile.c Modified: head/usr.bin/fortune/fortune/fortune.c ============================================================================== --- head/usr.bin/fortune/fortune/fortune.c Mon Aug 10 16:58:05 2020 (r364082) +++ head/usr.bin/fortune/fortune/fortune.c Mon Aug 10 17:01:59 2020 (r364083) @@ -400,11 +400,12 @@ form_file_list(char **files, int file_cnt) sp = files[i]; else { percent = 0; - for (sp = files[i]; isdigit((unsigned char)*sp); sp++) + for (sp = files[i]; isdigit((unsigned char)*sp); sp++) { percent = percent * 10 + *sp - '0'; - if (percent > 100) { - fprintf(stderr, "percentages must be <= 100\n"); - return (FALSE); + if (percent > 100) { + fprintf(stderr, "percentages must be <= 100\n"); + return (FALSE); + } } if (*sp == '.') { fprintf(stderr, "percentages must be integers\n"); Modified: head/usr.bin/fortune/strfile/strfile.c ============================================================================== --- head/usr.bin/fortune/strfile/strfile.c Mon Aug 10 16:58:05 2020 (r364082) +++ head/usr.bin/fortune/strfile/strfile.c Mon Aug 10 17:01:59 2020 (r364083) @@ -295,16 +295,26 @@ getargs(int argc, char **argv) if (*argv) { Infile = *argv; - if (*++argv) - strcpy(Outfile, *argv); + if (*++argv) { + if (strlcpy(Outfile, *argv, sizeof(Outfile)) >= + sizeof(Outfile)) { + fprintf(stderr, + "output_file path is too long\n"); + exit(1); + } + } } if (!Infile) { puts("No input file name"); usage(); } if (*Outfile == '\0') { - strlcpy(Outfile, Infile, sizeof(Outfile)); - strlcat(Outfile, ".dat", sizeof(Outfile)); + if ((size_t)snprintf(Outfile, sizeof(Outfile), "%s.dat", + Infile) >= sizeof(Outfile)) { + fprintf(stderr, + "generated output_file path is too long\n"); + exit(1); + } } } From owner-svn-src-all@freebsd.org Mon Aug 10 17:35:59 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 30B863A97B4; Mon, 10 Aug 2020 17:35:59 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQNRM0bsHz4ZC0; Mon, 10 Aug 2020 17:35:59 +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 ED0EFDB17; Mon, 10 Aug 2020 17:35:58 +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 07AHZw4c056566; Mon, 10 Aug 2020 17:35:58 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07AHZwi7056565; Mon, 10 Aug 2020 17:35:58 GMT (envelope-from dim@FreeBSD.org) Message-Id: <202008101735.07AHZwi7056565@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Mon, 10 Aug 2020 17:35:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r364084 - in stable: 10/usr.sbin/yp_mkdb 11/usr.sbin/yp_mkdb 12/usr.sbin/yp_mkdb 9/usr.sbin/yp_mkdb X-SVN-Group: stable-9 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 10/usr.sbin/yp_mkdb 11/usr.sbin/yp_mkdb 12/usr.sbin/yp_mkdb 9/usr.sbin/yp_mkdb X-SVN-Commit-Revision: 364084 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2020 17:35:59 -0000 Author: dim Date: Mon Aug 10 17:35:58 2020 New Revision: 364084 URL: https://svnweb.freebsd.org/changeset/base/364084 Log: MFC r363988: Fix clang 11 -Wformat warnings in yp_mkdb: usr.sbin/yp_mkdb/yp_mkdb.c:91:40: error: format specifies type 'char *' but the argument has type 'void *' [-Werror,-Wformat] printf("%.*s %.*s\n", (int)key.size, key.data, (int)data.size, ~~~~ ^~~~~~~~ usr.sbin/yp_mkdb/yp_mkdb.c:92:7: error: format specifies type 'char *' but the argument has type 'void *' [-Werror,-Wformat] data.data); ^~~~~~~~~ Modified: stable/9/usr.sbin/yp_mkdb/yp_mkdb.c Directory Properties: stable/9/ (props changed) stable/9/usr.sbin/ (props changed) stable/9/usr.sbin/yp_mkdb/ (props changed) Changes in other areas also in this revision: Modified: stable/10/usr.sbin/yp_mkdb/yp_mkdb.c stable/11/usr.sbin/yp_mkdb/yp_mkdb.c stable/12/usr.sbin/yp_mkdb/yp_mkdb.c Directory Properties: stable/10/ (props changed) stable/11/ (props changed) stable/12/ (props changed) Modified: stable/9/usr.sbin/yp_mkdb/yp_mkdb.c ============================================================================== --- stable/9/usr.sbin/yp_mkdb/yp_mkdb.c Mon Aug 10 17:01:59 2020 (r364083) +++ stable/9/usr.sbin/yp_mkdb/yp_mkdb.c Mon Aug 10 17:35:58 2020 (r364084) @@ -88,8 +88,8 @@ unwind(char *map) key.data = NULL; while (yp_next_record(dbp, &key, &data, 1, 1) == YP_TRUE) - printf("%.*s %.*s\n", (int)key.size, key.data, (int)data.size, - data.data); + printf("%.*s %.*s\n", (int)key.size, (char *)key.data, + (int)data.size, (char *)data.data); (void)(dbp->close)(dbp); return; From owner-svn-src-all@freebsd.org Mon Aug 10 17:35:59 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 874333A8F4A; Mon, 10 Aug 2020 17:35:59 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQNRM34Mqz4ZKd; Mon, 10 Aug 2020 17:35:59 +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 4E236DB18; Mon, 10 Aug 2020 17:35:59 +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 07AHZxSM056572; Mon, 10 Aug 2020 17:35:59 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07AHZx1V056571; Mon, 10 Aug 2020 17:35:59 GMT (envelope-from dim@FreeBSD.org) Message-Id: <202008101735.07AHZx1V056571@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Mon, 10 Aug 2020 17:35: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: r364084 - in stable: 10/usr.sbin/yp_mkdb 11/usr.sbin/yp_mkdb 12/usr.sbin/yp_mkdb 9/usr.sbin/yp_mkdb X-SVN-Group: stable-12 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 10/usr.sbin/yp_mkdb 11/usr.sbin/yp_mkdb 12/usr.sbin/yp_mkdb 9/usr.sbin/yp_mkdb X-SVN-Commit-Revision: 364084 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2020 17:35:59 -0000 Author: dim Date: Mon Aug 10 17:35:58 2020 New Revision: 364084 URL: https://svnweb.freebsd.org/changeset/base/364084 Log: MFC r363988: Fix clang 11 -Wformat warnings in yp_mkdb: usr.sbin/yp_mkdb/yp_mkdb.c:91:40: error: format specifies type 'char *' but the argument has type 'void *' [-Werror,-Wformat] printf("%.*s %.*s\n", (int)key.size, key.data, (int)data.size, ~~~~ ^~~~~~~~ usr.sbin/yp_mkdb/yp_mkdb.c:92:7: error: format specifies type 'char *' but the argument has type 'void *' [-Werror,-Wformat] data.data); ^~~~~~~~~ Modified: stable/12/usr.sbin/yp_mkdb/yp_mkdb.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/10/usr.sbin/yp_mkdb/yp_mkdb.c stable/11/usr.sbin/yp_mkdb/yp_mkdb.c stable/9/usr.sbin/yp_mkdb/yp_mkdb.c Directory Properties: stable/10/ (props changed) stable/11/ (props changed) stable/9/ (props changed) stable/9/usr.sbin/ (props changed) stable/9/usr.sbin/yp_mkdb/ (props changed) Modified: stable/12/usr.sbin/yp_mkdb/yp_mkdb.c ============================================================================== --- stable/12/usr.sbin/yp_mkdb/yp_mkdb.c Mon Aug 10 17:01:59 2020 (r364083) +++ stable/12/usr.sbin/yp_mkdb/yp_mkdb.c Mon Aug 10 17:35:58 2020 (r364084) @@ -88,8 +88,8 @@ unwind(char *map) key.data = NULL; while (yp_next_record(dbp, &key, &data, 1, 1) == YP_TRUE) - printf("%.*s %.*s\n", (int)key.size, key.data, (int)data.size, - data.data); + printf("%.*s %.*s\n", (int)key.size, (char *)key.data, + (int)data.size, (char *)data.data); (void)(dbp->close)(dbp); return; From owner-svn-src-all@freebsd.org Mon Aug 10 17:36:01 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 941A23A9B13; Mon, 10 Aug 2020 17:36:01 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQNRN43XWz4ZR5; Mon, 10 Aug 2020 17:36:00 +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 2FD9EDB19; Mon, 10 Aug 2020 17:36:00 +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 07AHZxgo056584; Mon, 10 Aug 2020 17:35:59 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07AHZxwF056583; Mon, 10 Aug 2020 17:35:59 GMT (envelope-from dim@FreeBSD.org) Message-Id: <202008101735.07AHZxwF056583@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Mon, 10 Aug 2020 17:35:59 +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: r364084 - in stable: 10/usr.sbin/yp_mkdb 11/usr.sbin/yp_mkdb 12/usr.sbin/yp_mkdb 9/usr.sbin/yp_mkdb X-SVN-Group: stable-10 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 10/usr.sbin/yp_mkdb 11/usr.sbin/yp_mkdb 12/usr.sbin/yp_mkdb 9/usr.sbin/yp_mkdb X-SVN-Commit-Revision: 364084 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2020 17:36:02 -0000 Author: dim Date: Mon Aug 10 17:35:58 2020 New Revision: 364084 URL: https://svnweb.freebsd.org/changeset/base/364084 Log: MFC r363988: Fix clang 11 -Wformat warnings in yp_mkdb: usr.sbin/yp_mkdb/yp_mkdb.c:91:40: error: format specifies type 'char *' but the argument has type 'void *' [-Werror,-Wformat] printf("%.*s %.*s\n", (int)key.size, key.data, (int)data.size, ~~~~ ^~~~~~~~ usr.sbin/yp_mkdb/yp_mkdb.c:92:7: error: format specifies type 'char *' but the argument has type 'void *' [-Werror,-Wformat] data.data); ^~~~~~~~~ Modified: stable/10/usr.sbin/yp_mkdb/yp_mkdb.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/usr.sbin/yp_mkdb/yp_mkdb.c stable/12/usr.sbin/yp_mkdb/yp_mkdb.c stable/9/usr.sbin/yp_mkdb/yp_mkdb.c Directory Properties: stable/11/ (props changed) stable/12/ (props changed) stable/9/ (props changed) stable/9/usr.sbin/ (props changed) stable/9/usr.sbin/yp_mkdb/ (props changed) Modified: stable/10/usr.sbin/yp_mkdb/yp_mkdb.c ============================================================================== --- stable/10/usr.sbin/yp_mkdb/yp_mkdb.c Mon Aug 10 17:01:59 2020 (r364083) +++ stable/10/usr.sbin/yp_mkdb/yp_mkdb.c Mon Aug 10 17:35:58 2020 (r364084) @@ -88,8 +88,8 @@ unwind(char *map) key.data = NULL; while (yp_next_record(dbp, &key, &data, 1, 1) == YP_TRUE) - printf("%.*s %.*s\n", (int)key.size, key.data, (int)data.size, - data.data); + printf("%.*s %.*s\n", (int)key.size, (char *)key.data, + (int)data.size, (char *)data.data); (void)(dbp->close)(dbp); return; From owner-svn-src-all@freebsd.org Mon Aug 10 17:36:00 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3DE8B3A97B5; Mon, 10 Aug 2020 17:36:00 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQNRM6hLBz4ZTC; Mon, 10 Aug 2020 17:35:59 +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 C4D10DA93; Mon, 10 Aug 2020 17:35:59 +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 07AHZxVh056578; Mon, 10 Aug 2020 17:35:59 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07AHZx9C056577; Mon, 10 Aug 2020 17:35:59 GMT (envelope-from dim@FreeBSD.org) Message-Id: <202008101735.07AHZx9C056577@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Mon, 10 Aug 2020 17:35:59 +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: r364084 - in stable: 10/usr.sbin/yp_mkdb 11/usr.sbin/yp_mkdb 12/usr.sbin/yp_mkdb 9/usr.sbin/yp_mkdb X-SVN-Group: stable-11 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 10/usr.sbin/yp_mkdb 11/usr.sbin/yp_mkdb 12/usr.sbin/yp_mkdb 9/usr.sbin/yp_mkdb X-SVN-Commit-Revision: 364084 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2020 17:36:03 -0000 Author: dim Date: Mon Aug 10 17:35:58 2020 New Revision: 364084 URL: https://svnweb.freebsd.org/changeset/base/364084 Log: MFC r363988: Fix clang 11 -Wformat warnings in yp_mkdb: usr.sbin/yp_mkdb/yp_mkdb.c:91:40: error: format specifies type 'char *' but the argument has type 'void *' [-Werror,-Wformat] printf("%.*s %.*s\n", (int)key.size, key.data, (int)data.size, ~~~~ ^~~~~~~~ usr.sbin/yp_mkdb/yp_mkdb.c:92:7: error: format specifies type 'char *' but the argument has type 'void *' [-Werror,-Wformat] data.data); ^~~~~~~~~ Modified: stable/11/usr.sbin/yp_mkdb/yp_mkdb.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/usr.sbin/yp_mkdb/yp_mkdb.c stable/12/usr.sbin/yp_mkdb/yp_mkdb.c stable/9/usr.sbin/yp_mkdb/yp_mkdb.c Directory Properties: stable/10/ (props changed) stable/12/ (props changed) stable/9/ (props changed) stable/9/usr.sbin/ (props changed) stable/9/usr.sbin/yp_mkdb/ (props changed) Modified: stable/11/usr.sbin/yp_mkdb/yp_mkdb.c ============================================================================== --- stable/11/usr.sbin/yp_mkdb/yp_mkdb.c Mon Aug 10 17:01:59 2020 (r364083) +++ stable/11/usr.sbin/yp_mkdb/yp_mkdb.c Mon Aug 10 17:35:58 2020 (r364084) @@ -86,8 +86,8 @@ unwind(char *map) key.data = NULL; while (yp_next_record(dbp, &key, &data, 1, 1) == YP_TRUE) - printf("%.*s %.*s\n", (int)key.size, key.data, (int)data.size, - data.data); + printf("%.*s %.*s\n", (int)key.size, (char *)key.data, + (int)data.size, (char *)data.data); (void)(dbp->close)(dbp); return; From owner-svn-src-all@freebsd.org Mon Aug 10 17:53:10 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 97C713A9FAF; Mon, 10 Aug 2020 17:53: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQNqB3Th4z4bxy; Mon, 10 Aug 2020 17:53: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 5BEA7DFB2; Mon, 10 Aug 2020 17:53: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 07AHrAPj069225; Mon, 10 Aug 2020 17:53:10 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07AHrATK069224; Mon, 10 Aug 2020 17:53:10 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <202008101753.07AHrATK069224@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Mon, 10 Aug 2020 17:53:10 +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: r364085 - stable/12/sys/net X-SVN-Group: stable-12 X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: stable/12/sys/net X-SVN-Commit-Revision: 364085 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2020 17:53:10 -0000 Author: vmaffione Date: Mon Aug 10 17:53:09 2020 New Revision: 364085 URL: https://svnweb.freebsd.org/changeset/base/364085 Log: MFC r363378 iflib: initialize netmap with the correct number of descriptors In case the network device has a RX or TX control queue, the correct number of TX/RX descriptors is contained in the second entry of the isc_ntxd (or isc_nrxd) array, rather than in the first entry. This case is correctly handled by iflib_device_register() and iflib_pseudo_register(), but not by iflib_netmap_attach(). If the first entry is larger than the second, this can result in a panic. This change fixes the bug by introducing two helper functions that also lead to some code simplification. PR: 247647 Differential Revision: https://reviews.freebsd.org/D25541 Modified: stable/12/sys/net/iflib.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/net/iflib.c ============================================================================== --- stable/12/sys/net/iflib.c Mon Aug 10 17:35:58 2020 (r364084) +++ stable/12/sys/net/iflib.c Mon Aug 10 17:53:09 2020 (r364085) @@ -735,6 +735,26 @@ MTX_SYSINIT(iflib_cpu_offset, &cpu_offset_mtx, "iflib_ NETDUMP_DEFINE(iflib); +static int +iflib_num_rx_descs(if_ctx_t ctx) +{ + if_softc_ctx_t scctx = &ctx->ifc_softc_ctx; + if_shared_ctx_t sctx = ctx->ifc_sctx; + uint16_t first_rxq = (sctx->isc_flags & IFLIB_HAS_RXCQ) ? 1 : 0; + + return scctx->isc_nrxd[first_rxq]; +} + +static int +iflib_num_tx_descs(if_ctx_t ctx) +{ + if_softc_ctx_t scctx = &ctx->ifc_softc_ctx; + if_shared_ctx_t sctx = ctx->ifc_sctx; + uint16_t first_txq = (sctx->isc_flags & IFLIB_HAS_TXCQ) ? 1 : 0; + + return scctx->isc_ntxd[first_txq]; +} + #ifdef DEV_NETMAP #include #include @@ -1170,7 +1190,6 @@ static int iflib_netmap_attach(if_ctx_t ctx) { struct netmap_adapter na; - if_softc_ctx_t scctx = &ctx->ifc_softc_ctx; bzero(&na, sizeof(na)); @@ -1179,8 +1198,8 @@ iflib_netmap_attach(if_ctx_t ctx) MPASS(ctx->ifc_softc_ctx.isc_ntxqsets); MPASS(ctx->ifc_softc_ctx.isc_nrxqsets); - na.num_tx_desc = scctx->isc_ntxd[0]; - na.num_rx_desc = scctx->isc_nrxd[0]; + na.num_tx_desc = iflib_num_tx_descs(ctx); + na.num_rx_desc = iflib_num_rx_descs(ctx); na.nm_txsync = iflib_netmap_txsync; na.nm_rxsync = iflib_netmap_rxsync; na.nm_register = iflib_netmap_register; @@ -4570,7 +4589,7 @@ iflib_device_register(device_t dev, void *sc, if_share kobjop_desc_t kobj_desc; kobj_method_t *kobj_method; int err, msix, rid; - uint16_t main_rxq, main_txq; + int num_txd, num_rxd; ctx = malloc(sizeof(* ctx), M_IFLIB, M_WAITOK|M_ZERO); @@ -4615,21 +4634,20 @@ iflib_device_register(device_t dev, void *sc, if_share if (scctx->isc_nrxqsets == 0 || (scctx->isc_nrxqsets_max && scctx->isc_nrxqsets_max < scctx->isc_nrxqsets)) scctx->isc_nrxqsets = scctx->isc_nrxqsets_max; - main_txq = (sctx->isc_flags & IFLIB_HAS_TXCQ) ? 1 : 0; - main_rxq = (sctx->isc_flags & IFLIB_HAS_RXCQ) ? 1 : 0; + num_txd = iflib_num_tx_descs(ctx); + num_rxd = iflib_num_rx_descs(ctx); /* XXX change for per-queue sizes */ device_printf(dev, "Using %d TX descriptors and %d RX descriptors\n", - scctx->isc_ntxd[main_txq], scctx->isc_nrxd[main_rxq]); + num_txd, num_rxd); - if (scctx->isc_tx_nsegments > scctx->isc_ntxd[main_txq] / - MAX_SINGLE_PACKET_FRACTION) - scctx->isc_tx_nsegments = max(1, scctx->isc_ntxd[main_txq] / + if (scctx->isc_tx_nsegments > num_txd / MAX_SINGLE_PACKET_FRACTION) + scctx->isc_tx_nsegments = max(1, num_txd / MAX_SINGLE_PACKET_FRACTION); - if (scctx->isc_tx_tso_segments_max > scctx->isc_ntxd[main_txq] / + if (scctx->isc_tx_tso_segments_max > num_txd / MAX_SINGLE_PACKET_FRACTION) scctx->isc_tx_tso_segments_max = max(1, - scctx->isc_ntxd[main_txq] / MAX_SINGLE_PACKET_FRACTION); + num_txd / MAX_SINGLE_PACKET_FRACTION); /* TSO parameters - dig these out of the data sheet - simply correspond to tag setup */ if (if_getcapabilities(ifp) & IFCAP_TSO) { @@ -4817,14 +4835,13 @@ int iflib_pseudo_register(device_t dev, if_shared_ctx_t sctx, if_ctx_t *ctxp, struct iflib_cloneattach_ctx *clctx) { + int num_txd, num_rxd; int err; if_ctx_t ctx; if_t ifp; if_softc_ctx_t scctx; int i; void *sc; - uint16_t main_txq; - uint16_t main_rxq; ctx = malloc(sizeof(*ctx), M_IFLIB, M_WAITOK|M_ZERO); sc = malloc(sctx->isc_driver->size, M_IFLIB, M_WAITOK|M_ZERO); @@ -4912,21 +4929,20 @@ iflib_pseudo_register(device_t dev, if_shared_ctx_t sc if (scctx->isc_nrxqsets == 0 || (scctx->isc_nrxqsets_max && scctx->isc_nrxqsets_max < scctx->isc_nrxqsets)) scctx->isc_nrxqsets = scctx->isc_nrxqsets_max; - main_txq = (sctx->isc_flags & IFLIB_HAS_TXCQ) ? 1 : 0; - main_rxq = (sctx->isc_flags & IFLIB_HAS_RXCQ) ? 1 : 0; + num_txd = iflib_num_tx_descs(ctx); + num_rxd = iflib_num_rx_descs(ctx); /* XXX change for per-queue sizes */ device_printf(dev, "Using %d TX descriptors and %d RX descriptors\n", - scctx->isc_ntxd[main_txq], scctx->isc_nrxd[main_rxq]); + num_txd, num_rxd); - if (scctx->isc_tx_nsegments > scctx->isc_ntxd[main_txq] / - MAX_SINGLE_PACKET_FRACTION) - scctx->isc_tx_nsegments = max(1, scctx->isc_ntxd[main_txq] / + if (scctx->isc_tx_nsegments > num_txd / MAX_SINGLE_PACKET_FRACTION) + scctx->isc_tx_nsegments = max(1, num_txd / MAX_SINGLE_PACKET_FRACTION); - if (scctx->isc_tx_tso_segments_max > scctx->isc_ntxd[main_txq] / + if (scctx->isc_tx_tso_segments_max > num_txd / MAX_SINGLE_PACKET_FRACTION) scctx->isc_tx_tso_segments_max = max(1, - scctx->isc_ntxd[main_txq] / MAX_SINGLE_PACKET_FRACTION); + num_txd / MAX_SINGLE_PACKET_FRACTION); /* TSO parameters - dig these out of the data sheet - simply correspond to tag setup */ if (if_getcapabilities(ifp) & IFCAP_TSO) { From owner-svn-src-all@freebsd.org Mon Aug 10 18:11:01 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8E1613AA613; Mon, 10 Aug 2020 18:11:01 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQPCn22LCz4cjM; Mon, 10 Aug 2020 18:11:01 +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 27E75E0D1; Mon, 10 Aug 2020 18:11:01 +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 07AIB10H078522; Mon, 10 Aug 2020 18:11:01 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07AIB06c078520; Mon, 10 Aug 2020 18:11:00 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202008101811.07AIB06c078520@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 10 Aug 2020 18:11:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364086 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 364086 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2020 18:11:01 -0000 Author: mjg Date: Mon Aug 10 18:11:00 2020 New Revision: 364086 URL: https://svnweb.freebsd.org/changeset/base/364086 Log: vfs: drop the hello world stat probes from the vfs provider Interested parties can get the same information by hoooking on vop_stat. Modified: head/sys/kern/vfs_lookup.c head/sys/kern/vfs_syscalls.c Modified: head/sys/kern/vfs_lookup.c ============================================================================== --- head/sys/kern/vfs_lookup.c Mon Aug 10 17:53:09 2020 (r364085) +++ head/sys/kern/vfs_lookup.c Mon Aug 10 18:11:00 2020 (r364086) @@ -70,7 +70,7 @@ __FBSDID("$FreeBSD$"); #define NAMEI_DIAGNOSTIC 1 #undef NAMEI_DIAGNOSTIC -SDT_PROVIDER_DECLARE(vfs); +SDT_PROVIDER_DEFINE(vfs); SDT_PROBE_DEFINE4(vfs, namei, lookup, entry, "struct vnode *", "char *", "unsigned long", "bool"); SDT_PROBE_DEFINE3(vfs, namei, lookup, return, "int", "struct vnode *", "bool"); Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Mon Aug 10 17:53:09 2020 (r364085) +++ head/sys/kern/vfs_syscalls.c Mon Aug 10 18:11:00 2020 (r364086) @@ -91,10 +91,6 @@ __FBSDID("$FreeBSD$"); MALLOC_DEFINE(M_FADVISE, "fadvise", "posix_fadvise(2) information"); -SDT_PROVIDER_DEFINE(vfs); -SDT_PROBE_DEFINE2(vfs, , stat, mode, "char *", "int"); -SDT_PROBE_DEFINE2(vfs, , stat, reg, "char *", "int"); - static int kern_chflagsat(struct thread *td, int fd, const char *path, enum uio_seg pathseg, u_long flags, int atflag); static int setfflags(struct thread *td, struct vnode *, u_long); @@ -2383,9 +2379,6 @@ kern_statat(struct thread *td, int flag, int fd, const return (error); error = VOP_STAT(nd.ni_vp, sbp, td->td_ucred, NOCRED, td); if (error == 0) { - SDT_PROBE2(vfs, , stat, mode, path, sbp->st_mode); - if (S_ISREG(sbp->st_mode)) - SDT_PROBE2(vfs, , stat, reg, path, pathseg); if (__predict_false(hook != NULL)) hook(nd.ni_vp, sbp); } From owner-svn-src-all@freebsd.org Mon Aug 10 18:26:19 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A29873AC031; Mon, 10 Aug 2020 18:26:19 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQPYR3qByz4fTs; Mon, 10 Aug 2020 18:26:19 +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 620E5E074; Mon, 10 Aug 2020 18:26:19 +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 07AIQJaf088561; Mon, 10 Aug 2020 18:26:19 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07AIQJ5i088560; Mon, 10 Aug 2020 18:26:19 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <202008101826.07AIQJ5i088560@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Mon, 10 Aug 2020 18:26: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: r364087 - stable/12/sys/vm X-SVN-Group: stable-12 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: stable/12/sys/vm X-SVN-Commit-Revision: 364087 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2020 18:26:19 -0000 Author: brooks Date: Mon Aug 10 18:26:18 2020 New Revision: 364087 URL: https://svnweb.freebsd.org/changeset/base/364087 Log: MFC r363966: Preserve ASLR vm_map flags across fork In the most common case (fork+execve) this doesn't matter, but further attempts to apply entropy would fail in (e.g.) a pre-fork server. Reported by: Alfredo Mazzinghi Reviewed by: kib, markj Obtained from: CheriBSD Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D25966 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 Mon Aug 10 18:11:00 2020 (r364086) +++ stable/12/sys/vm/vm_map.c Mon Aug 10 18:26:18 2020 (r364087) @@ -3932,6 +3932,7 @@ vmspace_fork(struct vmspace *vm1, vm_ooffset_t *fork_c } new_map->anon_loc = old_map->anon_loc; + new_map->flags |= old_map->flags & (MAP_ASLR | MAP_ASLR_IGNSTART); old_entry = old_map->header.next; From owner-svn-src-all@freebsd.org Mon Aug 10 19:37:07 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A3A753AD894; Mon, 10 Aug 2020 19:37:07 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQR7740Ncz4kGm; Mon, 10 Aug 2020 19:37:07 +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 6C6E5F21C; Mon, 10 Aug 2020 19:37:07 +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 07AJb7uS031641; Mon, 10 Aug 2020 19:37:07 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07AJb6W9031636; Mon, 10 Aug 2020 19:37:06 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <202008101937.07AJb6W9031636@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Mon, 10 Aug 2020 19:37:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364088 - in head/sys: arm64/rockchip dev/dwc X-SVN-Group: head X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: in head/sys: arm64/rockchip dev/dwc X-SVN-Commit-Revision: 364088 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2020 19:37:07 -0000 Author: gonzo Date: Mon Aug 10 19:37:06 2020 New Revision: 364088 URL: https://svnweb.freebsd.org/changeset/base/364088 Log: Improve Rockchip's integration of if_dwc - Do not rely on U-Boot for clocks configuration, enable and set frequencies in the driver's attach method. - Adjust MAC settings according to detected linespeed on RK3399 and RK3328. - Add support for RMII PHY mode on RK3328. Reviewed by: manu Differential Revision: https://reviews.freebsd.org/D26006 Modified: head/sys/arm64/rockchip/if_dwc_rk.c head/sys/dev/dwc/if_dwc.c head/sys/dev/dwc/if_dwc.h head/sys/dev/dwc/if_dwc_if.m head/sys/dev/dwc/if_dwcvar.h Modified: head/sys/arm64/rockchip/if_dwc_rk.c ============================================================================== --- head/sys/arm64/rockchip/if_dwc_rk.c Mon Aug 10 18:26:18 2020 (r364087) +++ head/sys/arm64/rockchip/if_dwc_rk.c Mon Aug 10 19:37:06 2020 (r364088) @@ -23,7 +23,7 @@ * 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$"); @@ -33,97 +33,350 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include +#include +#include + #include #include #include #include #include +#include #include - #include +#include "if_dwc_if.h" #include "syscon_if.h" -#include "if_dwc_if.h" - #define RK3328_GRF_MAC_CON0 0x0900 -#define RK3328_GRF_MAC_CON0_TX_MASK 0x7F -#define RK3328_GRF_MAC_CON0_TX_SHIFT 0 -#define RK3328_GRF_MAC_CON0_RX_MASK 0x7F -#define RK3328_GRF_MAC_CON0_RX_SHIFT 7 +#define MAC_CON0_GMAC2IO_TX_DL_CFG_MASK 0x7F +#define MAC_CON0_GMAC2IO_TX_DL_CFG_SHIFT 0 +#define MAC_CON0_GMAC2IO_RX_DL_CFG_MASK 0x7F +#define MAC_CON0_GMAC2IO_RX_DL_CFG_SHIFT 7 #define RK3328_GRF_MAC_CON1 0x0904 -#define RK3328_GRF_MAC_CON1_RX_ENA (1 << 1) -#define RK3328_GRF_MAC_CON1_TX_ENA (1 << 0) +#define MAC_CON1_GMAC2IO_GMAC_TXCLK_DLY_ENA (1 << 0) +#define MAC_CON1_GMAC2IO_GMAC_RXCLK_DLY_ENA (1 << 1) +#define MAC_CON1_GMAC2IO_GMII_CLK_SEL_MASK (3 << 11) +#define MAC_CON1_GMAC2IO_GMII_CLK_SEL_125 (0 << 11) +#define MAC_CON1_GMAC2IO_GMII_CLK_SEL_25 (3 << 11) +#define MAC_CON1_GMAC2IO_GMII_CLK_SEL_2_5 (2 << 11) +#define MAC_CON1_GMAC2IO_RMII_MODE_MASK (1 << 9) +#define MAC_CON1_GMAC2IO_RMII_MODE (1 << 9) +#define MAC_CON1_GMAC2IO_INTF_SEL_MASK (7 << 4) +#define MAC_CON1_GMAC2IO_INTF_RMII (4 << 4) +#define MAC_CON1_GMAC2IO_INTF_RGMII (1 << 4) +#define MAC_CON1_GMAC2IO_RMII_CLK_SEL_MASK (1 << 7) +#define MAC_CON1_GMAC2IO_RMII_CLK_SEL_25 (1 << 7) +#define MAC_CON1_GMAC2IO_RMII_CLK_SEL_2_5 (0 << 7) +#define MAC_CON1_GMAC2IO_MAC_SPEED_MASK (1 << 2) +#define MAC_CON1_GMAC2IO_MAC_SPEED_100 (1 << 2) +#define MAC_CON1_GMAC2IO_MAC_SPEED_10 (0 << 2) #define RK3328_GRF_MAC_CON2 0x0908 #define RK3328_GRF_MACPHY_CON0 0x0B00 +#define MACPHY_CON0_CLK_50M_MASK (1 << 14) +#define MACPHY_CON0_CLK_50M (1 << 14) +#define MACPHY_CON0_RMII_MODE_MASK (3 << 6) +#define MACPHY_CON0_RMII_MODE (1 << 6) #define RK3328_GRF_MACPHY_CON1 0x0B04 +#define MACPHY_CON1_RMII_MODE_MASK (1 << 9) +#define MACPHY_CON1_RMII_MODE (1 << 9) #define RK3328_GRF_MACPHY_CON2 0x0B08 #define RK3328_GRF_MACPHY_CON3 0x0B0C #define RK3328_GRF_MACPHY_STATUS 0x0B10 +#define RK3399_GRF_SOC_CON5 0xc214 +#define SOC_CON5_GMAC_CLK_SEL_MASK (3 << 4) +#define SOC_CON5_GMAC_CLK_SEL_125 (0 << 4) +#define SOC_CON5_GMAC_CLK_SEL_25 (3 << 4) +#define SOC_CON5_GMAC_CLK_SEL_2_5 (2 << 4) +#define RK3399_GRF_SOC_CON6 0xc218 +#define SOC_CON6_GMAC_TXCLK_DLY_ENA (1 << 7) +#define SOC_CON6_TX_DL_CFG_MASK 0x7F +#define SOC_CON6_TX_DL_CFG_SHIFT 0 +#define SOC_CON6_RX_DL_CFG_MASK 0x7F +#define SOC_CON6_GMAC_RXCLK_DLY_ENA (1 << 15) +#define SOC_CON6_RX_DL_CFG_SHIFT 8 + +struct if_dwc_rk_softc; + +typedef void (*if_dwc_rk_set_delaysfn_t)(struct if_dwc_rk_softc *); +typedef int (*if_dwc_rk_set_speedfn_t)(struct if_dwc_rk_softc *, int); +typedef void (*if_dwc_rk_set_phy_modefn_t)(struct if_dwc_rk_softc *); +typedef void (*if_dwc_rk_phy_powerupfn_t)(struct if_dwc_rk_softc *); + +struct if_dwc_rk_ops { + if_dwc_rk_set_delaysfn_t set_delays; + if_dwc_rk_set_speedfn_t set_speed; + if_dwc_rk_set_phy_modefn_t set_phy_mode; + if_dwc_rk_phy_powerupfn_t phy_powerup; +}; + +struct if_dwc_rk_softc { + struct dwc_softc base; + uint32_t tx_delay; + uint32_t rx_delay; + bool integrated_phy; + bool clock_in; + phandle_t phy_node; + struct syscon *grf; + struct if_dwc_rk_ops *ops; + /* Common clocks */ + clk_t mac_clk_rx; + clk_t mac_clk_tx; + clk_t aclk_mac; + clk_t pclk_mac; + clk_t clk_stmmaceth; + /* RMII clocks */ + clk_t clk_mac_ref; + clk_t clk_mac_refout; + /* PHY clock */ + clk_t clk_phy; +}; + +static void rk3328_set_delays(struct if_dwc_rk_softc *sc); +static int rk3328_set_speed(struct if_dwc_rk_softc *sc, int speed); +static void rk3328_set_phy_mode(struct if_dwc_rk_softc *sc); +static void rk3328_phy_powerup(struct if_dwc_rk_softc *sc); + +static void rk3399_set_delays(struct if_dwc_rk_softc *sc); +static int rk3399_set_speed(struct if_dwc_rk_softc *sc, int speed); + +static struct if_dwc_rk_ops rk3288_ops = { +}; + +static struct if_dwc_rk_ops rk3328_ops = { + .set_delays = rk3328_set_delays, + .set_speed = rk3328_set_speed, + .set_phy_mode = rk3328_set_phy_mode, + .phy_powerup = rk3328_phy_powerup, +}; + +static struct if_dwc_rk_ops rk3399_ops = { + .set_delays = rk3399_set_delays, + .set_speed = rk3399_set_speed, +}; + static struct ofw_compat_data compat_data[] = { - {"rockchip,rk3288-gmac", 1}, - {"rockchip,rk3328-gmac", 1}, - {"rockchip,rk3399-gmac", 1}, + {"rockchip,rk3288-gmac", (uintptr_t)&rk3288_ops}, + {"rockchip,rk3328-gmac", (uintptr_t)&rk3328_ops}, + {"rockchip,rk3399-gmac", (uintptr_t)&rk3399_ops}, {NULL, 0} }; static void -rk3328_set_delays(struct syscon *grf, phandle_t node) +rk3328_set_delays(struct if_dwc_rk_softc *sc) { + uint32_t reg; uint32_t tx, rx; - if (OF_getencprop(node, "tx_delay", &tx, sizeof(tx)) <= 0) - tx = 0x30; - if (OF_getencprop(node, "rx_delay", &rx, sizeof(rx)) <= 0) - rx = 0x10; + if (sc->base.phy_mode != PHY_MODE_RGMII) + return; - if (bootverbose) - printf("setting RK3328 RX/TX delays: %d/%d\n", rx, tx); - tx = ((tx & RK3328_GRF_MAC_CON0_TX_MASK) << - RK3328_GRF_MAC_CON0_TX_SHIFT); - rx = ((rx & RK3328_GRF_MAC_CON0_TX_MASK) << - RK3328_GRF_MAC_CON0_RX_SHIFT); + reg = SYSCON_READ_4(sc->grf, RK3328_GRF_MAC_CON0); + tx = ((reg >> MAC_CON0_GMAC2IO_TX_DL_CFG_SHIFT) & MAC_CON0_GMAC2IO_TX_DL_CFG_MASK); + rx = ((reg >> MAC_CON0_GMAC2IO_RX_DL_CFG_SHIFT) & MAC_CON0_GMAC2IO_RX_DL_CFG_MASK); - SYSCON_WRITE_4(grf, RK3328_GRF_MAC_CON0, tx | rx | 0xFFFF0000); - SYSCON_WRITE_4(grf, RK3328_GRF_MAC_CON1, RK3328_GRF_MAC_CON1_TX_ENA | RK3328_GRF_MAC_CON1_RX_ENA | - ((RK3328_GRF_MAC_CON1_TX_ENA | RK3328_GRF_MAC_CON1_RX_ENA) << 16)); + reg = SYSCON_READ_4(sc->grf, RK3328_GRF_MAC_CON1); + if (bootverbose) { + device_printf(sc->base.dev, "current delays settings: tx=%u(%s) rx=%u(%s)\n", + tx, ((reg & MAC_CON1_GMAC2IO_GMAC_TXCLK_DLY_ENA) ? "enabled" : "disabled"), + rx, ((reg & MAC_CON1_GMAC2IO_GMAC_RXCLK_DLY_ENA) ? "enabled" : "disabled")); + + device_printf(sc->base.dev, "setting new RK3328 RX/TX delays: %d/%d\n", + sc->tx_delay, sc->rx_delay); + } + + reg = (MAC_CON1_GMAC2IO_GMAC_TXCLK_DLY_ENA | MAC_CON1_GMAC2IO_GMAC_RXCLK_DLY_ENA) << 16; + reg |= (MAC_CON1_GMAC2IO_GMAC_TXCLK_DLY_ENA | MAC_CON1_GMAC2IO_GMAC_RXCLK_DLY_ENA); + SYSCON_WRITE_4(sc->grf, RK3328_GRF_MAC_CON1, reg); + + reg = 0xffff << 16; + reg |= ((sc->tx_delay & MAC_CON0_GMAC2IO_TX_DL_CFG_MASK) << + MAC_CON0_GMAC2IO_TX_DL_CFG_SHIFT); + reg |= ((sc->rx_delay & MAC_CON0_GMAC2IO_TX_DL_CFG_MASK) << + MAC_CON0_GMAC2IO_RX_DL_CFG_SHIFT); + SYSCON_WRITE_4(sc->grf, RK3328_GRF_MAC_CON0, reg); } -#define RK3399_GRF_SOC_CON6 0xc218 -#define RK3399_GRF_SOC_CON6_TX_ENA (1 << 7) -#define RK3399_GRF_SOC_CON6_TX_MASK 0x7F -#define RK3399_GRF_SOC_CON6_TX_SHIFT 0 -#define RK3399_GRF_SOC_CON6_RX_MASK 0x7F -#define RK3399_GRF_SOC_CON6_RX_ENA (1 << 15) -#define RK3399_GRF_SOC_CON6_RX_SHIFT 8 +static int +rk3328_set_speed(struct if_dwc_rk_softc *sc, int speed) +{ + uint32_t reg; + switch (sc->base.phy_mode) { + case PHY_MODE_RGMII: + switch (speed) { + case IFM_1000_T: + case IFM_1000_SX: + reg = MAC_CON1_GMAC2IO_GMII_CLK_SEL_125; + break; + case IFM_100_TX: + reg = MAC_CON1_GMAC2IO_GMII_CLK_SEL_25; + break; + case IFM_10_T: + reg = MAC_CON1_GMAC2IO_GMII_CLK_SEL_2_5; + break; + default: + device_printf(sc->base.dev, "unsupported RGMII media %u\n", speed); + return (-1); + } + + SYSCON_WRITE_4(sc->grf, RK3328_GRF_MAC_CON1, + ((MAC_CON1_GMAC2IO_GMII_CLK_SEL_MASK << 16) | reg)); + break; + case PHY_MODE_RMII: + switch (speed) { + case IFM_100_TX: + reg = MAC_CON1_GMAC2IO_RMII_CLK_SEL_25 | + MAC_CON1_GMAC2IO_MAC_SPEED_100; + break; + case IFM_10_T: + reg = MAC_CON1_GMAC2IO_RMII_CLK_SEL_2_5 | + MAC_CON1_GMAC2IO_MAC_SPEED_10; + break; + default: + device_printf(sc->base.dev, "unsupported RMII media %u\n", speed); + return (-1); + } + + SYSCON_WRITE_4(sc->grf, + sc->integrated_phy ? RK3328_GRF_MAC_CON2 : RK3328_GRF_MAC_CON1, + reg | + ((MAC_CON1_GMAC2IO_RMII_CLK_SEL_MASK | MAC_CON1_GMAC2IO_MAC_SPEED_MASK) << 16)); + break; + } + + return (0); +} + static void -rk3399_set_delays(struct syscon *grf, phandle_t node) +rk3328_set_phy_mode(struct if_dwc_rk_softc *sc) { - uint32_t tx, rx; - if (OF_getencprop(node, "tx_delay", &tx, sizeof(tx)) <= 0) - tx = 0x30; - if (OF_getencprop(node, "rx_delay", &rx, sizeof(rx)) <= 0) - rx = 0x10; + switch (sc->base.phy_mode) { + case PHY_MODE_RGMII: + SYSCON_WRITE_4(sc->grf, RK3328_GRF_MAC_CON1, + ((MAC_CON1_GMAC2IO_INTF_SEL_MASK | MAC_CON1_GMAC2IO_RMII_MODE_MASK) << 16) | + MAC_CON1_GMAC2IO_INTF_RGMII); + break; + case PHY_MODE_RMII: + SYSCON_WRITE_4(sc->grf, sc->integrated_phy ? RK3328_GRF_MAC_CON2 : RK3328_GRF_MAC_CON1, + ((MAC_CON1_GMAC2IO_INTF_SEL_MASK | MAC_CON1_GMAC2IO_RMII_MODE_MASK) << 16) | + MAC_CON1_GMAC2IO_INTF_RMII | MAC_CON1_GMAC2IO_RMII_MODE); + break; + } +} - if (bootverbose) - printf("setting RK3399 RX/TX delays: %d/%d\n", rx, tx); - tx = ((tx & RK3399_GRF_SOC_CON6_TX_MASK) << - RK3399_GRF_SOC_CON6_TX_SHIFT) | RK3399_GRF_SOC_CON6_TX_ENA; - rx = ((rx & RK3399_GRF_SOC_CON6_TX_MASK) << - RK3399_GRF_SOC_CON6_RX_SHIFT) | RK3399_GRF_SOC_CON6_RX_ENA; +static void +rk3328_phy_powerup(struct if_dwc_rk_softc *sc) +{ + SYSCON_WRITE_4(sc->grf, RK3328_GRF_MACPHY_CON1, + (MACPHY_CON1_RMII_MODE_MASK << 16) | + MACPHY_CON1_RMII_MODE); +} - SYSCON_WRITE_4(grf, RK3399_GRF_SOC_CON6, tx | rx | 0xFFFF0000); +static void +rk3399_set_delays(struct if_dwc_rk_softc *sc) +{ + uint32_t reg, tx, rx; + + if (sc->base.phy_mode != PHY_MODE_RGMII) + return; + + reg = SYSCON_READ_4(sc->grf, RK3399_GRF_SOC_CON6); + tx = ((reg >> SOC_CON6_TX_DL_CFG_SHIFT) & SOC_CON6_TX_DL_CFG_MASK); + rx = ((reg >> SOC_CON6_RX_DL_CFG_SHIFT) & SOC_CON6_RX_DL_CFG_MASK); + + if (bootverbose) { + device_printf(sc->base.dev, "current delays settings: tx=%u(%s) rx=%u(%s)\n", + tx, ((reg & SOC_CON6_GMAC_TXCLK_DLY_ENA) ? "enabled" : "disabled"), + rx, ((reg & SOC_CON6_GMAC_RXCLK_DLY_ENA) ? "enabled" : "disabled")); + + device_printf(sc->base.dev, "setting new RK3399 RX/TX delays: %d/%d\n", + sc->rx_delay, sc->tx_delay); + } + + reg = 0xFFFF << 16; + reg |= ((sc->tx_delay & SOC_CON6_TX_DL_CFG_MASK) << + SOC_CON6_TX_DL_CFG_SHIFT); + reg |= ((sc->rx_delay & SOC_CON6_RX_DL_CFG_MASK) << + SOC_CON6_RX_DL_CFG_SHIFT); + reg |= SOC_CON6_GMAC_TXCLK_DLY_ENA | SOC_CON6_GMAC_RXCLK_DLY_ENA; + + SYSCON_WRITE_4(sc->grf, RK3399_GRF_SOC_CON6, reg); } static int +rk3399_set_speed(struct if_dwc_rk_softc *sc, int speed) +{ + uint32_t reg; + + switch (speed) { + case IFM_1000_T: + case IFM_1000_SX: + reg = SOC_CON5_GMAC_CLK_SEL_125; + break; + case IFM_100_TX: + reg = SOC_CON5_GMAC_CLK_SEL_25; + break; + case IFM_10_T: + reg = SOC_CON5_GMAC_CLK_SEL_2_5; + break; + default: + device_printf(sc->base.dev, "unsupported media %u\n", speed); + return (-1); + } + + SYSCON_WRITE_4(sc->grf, RK3399_GRF_SOC_CON5, + ((SOC_CON5_GMAC_CLK_SEL_MASK << 16) | reg)); + return (0); +} + +static int +if_dwc_rk_sysctl_delays(SYSCTL_HANDLER_ARGS) +{ + struct if_dwc_rk_softc *sc; + int rv; + uint32_t rxtx; + + sc = arg1; + rxtx = ((sc->rx_delay << 8) | sc->tx_delay); + + rv = sysctl_handle_int(oidp, &rxtx, 0, req); + if (rv != 0 || req->newptr == NULL) + return (rv); + sc->tx_delay = rxtx & 0xff; + sc->rx_delay = (rxtx >> 8) & 0xff; + + if (sc->ops->set_delays) + sc->ops->set_delays(sc); + + return (0); +} + +static int +if_dwc_rk_init_sysctl(struct if_dwc_rk_softc *sc) +{ + struct sysctl_oid *child; + struct sysctl_ctx_list *ctx_list; + + ctx_list = device_get_sysctl_ctx(sc->base.dev); + child = device_get_sysctl_tree(sc->base.dev); + SYSCTL_ADD_PROC(ctx_list, + SYSCTL_CHILDREN(child), OID_AUTO, "delays", + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, sc, 0, + if_dwc_rk_sysctl_delays, "", "RGMII RX/TX delays: ((rx << 8) | tx)"); + + return (0); +} + +static int if_dwc_rk_probe(device_t dev) { @@ -137,26 +390,189 @@ if_dwc_rk_probe(device_t dev) } static int +if_dwc_rk_init_clocks(device_t dev) +{ + struct if_dwc_rk_softc *sc; + int error; + + sc = device_get_softc(dev); + error = clk_set_assigned(dev, ofw_bus_get_node(dev)); + if (error != 0) { + device_printf(dev, "clk_set_assigned failed\n"); + return (error); + } + + /* Enable clocks */ + error = clk_get_by_ofw_name(dev, 0, "stmmaceth", &sc->clk_stmmaceth); + if (error != 0) { + device_printf(dev, "could not find clock stmmaceth\n"); + return (error); + } + + if (clk_get_by_ofw_name(dev, 0, "mac_clk_rx", &sc->mac_clk_rx) != 0) { + device_printf(sc->base.dev, "could not get mac_clk_rx clock\n"); + sc->mac_clk_rx = NULL; + } + + if (clk_get_by_ofw_name(dev, 0, "mac_clk_tx", &sc->mac_clk_tx) != 0) { + device_printf(sc->base.dev, "could not get mac_clk_tx clock\n"); + sc->mac_clk_tx = NULL; + } + + if (clk_get_by_ofw_name(dev, 0, "aclk_mac", &sc->aclk_mac) != 0) { + device_printf(sc->base.dev, "could not get aclk_mac clock\n"); + sc->aclk_mac = NULL; + } + + if (clk_get_by_ofw_name(dev, 0, "pclk_mac", &sc->pclk_mac) != 0) { + device_printf(sc->base.dev, "could not get pclk_mac clock\n"); + sc->pclk_mac = NULL; + } + + if (sc->base.phy_mode == PHY_MODE_RGMII) { + if (clk_get_by_ofw_name(dev, 0, "clk_mac_ref", &sc->clk_mac_ref) != 0) { + device_printf(sc->base.dev, "could not get clk_mac_ref clock\n"); + sc->clk_mac_ref = NULL; + } + + if (!sc->clock_in) { + if (clk_get_by_ofw_name(dev, 0, "clk_mac_refout", &sc->clk_mac_refout) != 0) { + device_printf(sc->base.dev, "could not get clk_mac_refout clock\n"); + sc->clk_mac_refout = NULL; + } + + clk_set_freq(sc->clk_stmmaceth, 50000000, 0); + } + } + + if ((sc->phy_node != 0) && sc->integrated_phy) { + if (clk_get_by_ofw_index(dev, sc->phy_node, 0, &sc->clk_phy) != 0) { + device_printf(sc->base.dev, "could not get PHY clock\n"); + sc->clk_phy = NULL; + } + + if (sc->clk_phy) { + clk_set_freq(sc->clk_phy, 50000000, 0); + } + } + + if (sc->base.phy_mode == PHY_MODE_RMII) { + if (sc->mac_clk_rx) + clk_enable(sc->mac_clk_rx); + if (sc->clk_mac_ref) + clk_enable(sc->clk_mac_ref); + if (sc->clk_mac_refout) + clk_enable(sc->clk_mac_refout); + } + if (sc->clk_phy) + clk_enable(sc->clk_phy); + if (sc->aclk_mac) + clk_enable(sc->aclk_mac); + if (sc->pclk_mac) + clk_enable(sc->pclk_mac); + if (sc->mac_clk_tx) + clk_enable(sc->mac_clk_tx); + + DELAY(50); + + return (0); +} + +static int if_dwc_rk_init(device_t dev) { + struct if_dwc_rk_softc *sc; phandle_t node; - struct syscon *grf = NULL; + uint32_t rx, tx; + int err; + pcell_t phy_handle; + char *clock_in_out; + hwreset_t phy_reset; + regulator_t phy_supply; + sc = device_get_softc(dev); node = ofw_bus_get_node(dev); + sc->ops = (struct if_dwc_rk_ops *)ofw_bus_search_compatible(dev, compat_data)->ocd_data; if (OF_hasprop(node, "rockchip,grf") && syscon_get_by_ofw_property(dev, node, - "rockchip,grf", &grf) != 0) { + "rockchip,grf", &sc->grf) != 0) { device_printf(dev, "cannot get grf driver handle\n"); return (ENXIO); } - if (ofw_bus_is_compatible(dev, "rockchip,rk3399-gmac")) - rk3399_set_delays(grf, node); - else if (ofw_bus_is_compatible(dev, "rockchip,rk3328-gmac")) - rk3328_set_delays(grf, node); + if (OF_getencprop(node, "tx_delay", &tx, sizeof(tx)) <= 0) + tx = 0x30; + if (OF_getencprop(node, "rx_delay", &rx, sizeof(rx)) <= 0) + rx = 0x10; + sc->tx_delay = tx; + sc->rx_delay = rx; - /* Mode should be set according to dtb property */ + sc->clock_in = true; + if (OF_getprop_alloc(node, "clock_in_out", (void **)&clock_in_out)) { + if (strcmp(clock_in_out, "input") == 0) + sc->clock_in = true; + else + sc->clock_in = false; + OF_prop_free(clock_in_out); + } + if (OF_getencprop(node, "phy-handle", (void *)&phy_handle, + sizeof(phy_handle)) > 0) + sc->phy_node = OF_node_from_xref(phy_handle); + + if (sc->phy_node) + sc->integrated_phy = OF_hasprop(sc->phy_node, "phy-is-integrated"); + + if (sc->integrated_phy) + device_printf(sc->base.dev, "PHY is integrated\n"); + + if_dwc_rk_init_clocks(dev); + + if (sc->ops->set_phy_mode) + sc->ops->set_phy_mode(sc); + + if (sc->ops->set_delays) + sc->ops->set_delays(sc); + + /* + * this also sets delays if tunable is defined + */ + err = if_dwc_rk_init_sysctl(sc); + if (err != 0) + return (err); + + if (regulator_get_by_ofw_property(sc->base.dev, 0, + "phy-supply", &phy_supply) == 0) { + if (regulator_enable(phy_supply)) { + device_printf(sc->base.dev, + "cannot enable 'phy' regulator\n"); + } + } + else + device_printf(sc->base.dev, "no phy-supply property\n"); + + /* Power up */ + if (sc->integrated_phy) { + if (sc->ops->phy_powerup) + sc->ops->phy_powerup(sc); + + SYSCON_WRITE_4(sc->grf, RK3328_GRF_MACPHY_CON0, + (MACPHY_CON0_CLK_50M_MASK << 16) | + MACPHY_CON0_CLK_50M); + SYSCON_WRITE_4(sc->grf, RK3328_GRF_MACPHY_CON0, + (MACPHY_CON0_RMII_MODE_MASK << 16) | + MACPHY_CON0_RMII_MODE); + SYSCON_WRITE_4(sc->grf, RK3328_GRF_MACPHY_CON2, 0xffff1234); + SYSCON_WRITE_4(sc->grf, RK3328_GRF_MACPHY_CON3, 0x003f0035); + + if (hwreset_get_by_ofw_idx(dev, sc->phy_node, 0, &phy_reset) == 0) { + hwreset_assert(phy_reset); + DELAY(20); + hwreset_deassert(phy_reset); + DELAY(20); + } + } + return (0); } @@ -175,12 +591,26 @@ if_dwc_rk_mii_clk(device_t dev) return (GMAC_MII_CLK_150_250M_DIV102); } +static int +if_dwc_rk_set_speed(device_t dev, int speed) +{ + struct if_dwc_rk_softc *sc; + + sc = device_get_softc(dev); + + if (sc->ops->set_speed) + return sc->ops->set_speed(sc, speed); + + return (0); +} + static device_method_t if_dwc_rk_methods[] = { DEVMETHOD(device_probe, if_dwc_rk_probe), DEVMETHOD(if_dwc_init, if_dwc_rk_init), DEVMETHOD(if_dwc_mac_type, if_dwc_rk_mac_type), DEVMETHOD(if_dwc_mii_clk, if_dwc_rk_mii_clk), + DEVMETHOD(if_dwc_set_speed, if_dwc_rk_set_speed), DEVMETHOD_END }; @@ -190,6 +620,6 @@ static devclass_t dwc_rk_devclass; extern driver_t dwc_driver; DEFINE_CLASS_1(dwc, dwc_rk_driver, if_dwc_rk_methods, - sizeof(struct dwc_softc), dwc_driver); + sizeof(struct if_dwc_rk_softc), dwc_driver); DRIVER_MODULE(dwc_rk, simplebus, dwc_rk_driver, dwc_rk_devclass, 0, 0); MODULE_DEPEND(dwc_rk, dwc, 1, 1, 1); Modified: head/sys/dev/dwc/if_dwc.c ============================================================================== --- head/sys/dev/dwc/if_dwc.c Mon Aug 10 18:26:18 2020 (r364087) +++ head/sys/dev/dwc/if_dwc.c Mon Aug 10 19:37:06 2020 (r364088) @@ -1209,15 +1209,23 @@ dwc_clock_init(device_t dev) hwreset_t rst; clk_t clk; int error; + int64_t freq; - /* Enable clock */ + /* Enable clocks */ if (clk_get_by_ofw_name(dev, 0, "stmmaceth", &clk) == 0) { error = clk_enable(clk); if (error != 0) { device_printf(dev, "could not enable main clock\n"); return (error); } + if (bootverbose) { + clk_get_freq(clk, &freq); + device_printf(dev, "MAC clock(%s) freq: %ld\n", clk_get_name(clk), freq); + } } + else { + device_printf(dev, "could not find clock stmmaceth\n"); + } /* De-assert reset */ if (hwreset_get_by_ofw_name(dev, 0, "stmmaceth", &rst) == 0) { @@ -1254,6 +1262,8 @@ dwc_attach(device_t dev) struct ifnet *ifp; int error, i; uint32_t reg; + char *phy_mode; + phandle_t node; sc = device_get_softc(dev); sc->dev = dev; @@ -1262,6 +1272,15 @@ dwc_attach(device_t dev) sc->mii_clk = IF_DWC_MII_CLK(dev); sc->mactype = IF_DWC_MAC_TYPE(dev); + node = ofw_bus_get_node(dev); + if (OF_getprop_alloc(node, "phy-mode", (void **)&phy_mode)) { + if (strcmp(phy_mode, "rgmii") == 0) + sc->phy_mode = PHY_MODE_RGMII; + if (strcmp(phy_mode, "rmii") == 0) + sc->phy_mode = PHY_MODE_RMII; + OF_prop_free(phy_mode); + } + if (IF_DWC_INIT(dev) != 0) return (ENXIO); @@ -1475,6 +1494,9 @@ dwc_miibus_statchg(device_t dev) else reg &= ~(CONF_DM); WRITE4(sc, MAC_CONFIGURATION, reg); + + IF_DWC_SET_SPEED(dev, IFM_SUBTYPE(mii->mii_media_active)); + } static device_method_t dwc_methods[] = { Modified: head/sys/dev/dwc/if_dwc.h ============================================================================== --- head/sys/dev/dwc/if_dwc.h Mon Aug 10 18:26:18 2020 (r364087) +++ head/sys/dev/dwc/if_dwc.h Mon Aug 10 19:37:06 2020 (r364088) @@ -37,6 +37,10 @@ #ifndef __IF_DWC_H__ #define __IF_DWC_H__ +#define PHY_MODE_UNKNOWN 0x0 +#define PHY_MODE_RMII 0x1 +#define PHY_MODE_RGMII 0x2 + #define MAC_CONFIGURATION 0x0 #define CONF_JD (1 << 22) /* jabber timer disable */ #define CONF_BE (1 << 21) /* Frame Burst Enable */ Modified: head/sys/dev/dwc/if_dwc_if.m ============================================================================== --- head/sys/dev/dwc/if_dwc_if.m Mon Aug 10 18:26:18 2020 (r364087) +++ head/sys/dev/dwc/if_dwc_if.m Mon Aug 10 19:37:06 2020 (r364088) @@ -49,6 +49,12 @@ CODE { { return (GMAC_MII_CLK_25_35M_DIV16); } + + static int + if_dwc_default_set_speed(device_t dev, int speed) + { + return (0); + } }; HEADER { @@ -74,3 +80,11 @@ METHOD int mac_type { METHOD int mii_clk { device_t dev; } DEFAULT if_dwc_default_mii_clk; + +# +# Signal media change to a specific hardware +# +METHOD int set_speed { + device_t dev; + int speed; +} DEFAULT if_dwc_default_set_speed; Modified: head/sys/dev/dwc/if_dwcvar.h ============================================================================== --- head/sys/dev/dwc/if_dwcvar.h Mon Aug 10 18:26:18 2020 (r364087) +++ head/sys/dev/dwc/if_dwcvar.h Mon Aug 10 19:37:06 2020 (r364088) @@ -71,6 +71,7 @@ struct dwc_softc { boolean_t is_detaching; int tx_watchdog_count; int stats_harvest_count; + int phy_mode; /* RX */ bus_dma_tag_t rxdesc_tag; From owner-svn-src-all@freebsd.org Mon Aug 10 20:24:49 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 564B93AE126; Mon, 10 Aug 2020 20:24:49 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQSB91h17z4mQr; Mon, 10 Aug 2020 20:24:49 +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 19BACF7CD; Mon, 10 Aug 2020 20:24:49 +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 07AKOmFL062127; Mon, 10 Aug 2020 20:24:48 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07AKOmiT062126; Mon, 10 Aug 2020 20:24:48 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008102024.07AKOmiT062126@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 10 Aug 2020 20:24:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364089 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 364089 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2020 20:24:49 -0000 Author: tuexen Date: Mon Aug 10 20:24:48 2020 New Revision: 364089 URL: https://svnweb.freebsd.org/changeset/base/364089 Log: Fix the following issues related to the TCP SYN-cache: * Let the accepted TCP/IPv4 socket inherit the configured TTL and TOS value. * Let the accepted TCP/IPv6 socket inherit the configured Hop Limit. * Use the configured Hop Limit and Traffic Class when sending IPv6 packets. Reviewed by: rrs, lutz_donnerhacke.de MFC after: 1 week Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D25909 Modified: head/sys/netinet/tcp_syncache.c head/sys/netinet/tcp_syncache.h Modified: head/sys/netinet/tcp_syncache.c ============================================================================== --- head/sys/netinet/tcp_syncache.c Mon Aug 10 19:37:06 2020 (r364088) +++ head/sys/netinet/tcp_syncache.c Mon Aug 10 20:24:48 2020 (r364089) @@ -831,6 +831,8 @@ syncache_socket(struct syncache *sc, struct socket *ls inp->inp_vflag &= ~INP_IPV6; inp->inp_vflag |= INP_IPV4; #endif + inp->inp_ip_ttl = sc->sc_ip_ttl; + inp->inp_ip_tos = sc->sc_ip_tos; inp->inp_laddr = sc->sc_inc.inc_laddr; #ifdef INET6 } @@ -866,6 +868,7 @@ syncache_socket(struct syncache *sc, struct socket *ls if (oinp->in6p_outputopts) inp->in6p_outputopts = ip6_copypktopts(oinp->in6p_outputopts, M_NOWAIT); + inp->in6p_hops = oinp->in6p_hops; } if (sc->sc_inc.inc_flags & INC_ISIPV6) { @@ -1389,12 +1392,28 @@ syncache_add(struct in_conninfo *inc, struct tcpopt *t cred = crhold(so->so_cred); #ifdef INET6 - if ((inc->inc_flags & INC_ISIPV6) && - (inp->inp_flags & IN6P_AUTOFLOWLABEL)) - autoflowlabel = 1; + if (inc->inc_flags & INC_ISIPV6) { + if (inp->inp_flags & IN6P_AUTOFLOWLABEL) { + autoflowlabel = 1; + } + ip_ttl = in6_selecthlim(inp, NULL); + if ((inp->in6p_outputopts == NULL) || + (inp->in6p_outputopts->ip6po_tclass == -1)) { + ip_tos = 0; + } else { + ip_tos = inp->in6p_outputopts->ip6po_tclass; + } + } #endif - ip_ttl = inp->inp_ip_ttl; - ip_tos = inp->inp_ip_tos; +#if defined(INET6) && defined(INET) + else +#endif +#ifdef INET + { + ip_ttl = inp->inp_ip_ttl; + ip_tos = inp->inp_ip_tos; + } +#endif win = so->sol_sbrcv_hiwat; ltflags = (tp->t_flags & (TF_NOOPT | TF_SIGNATURE)); @@ -1599,13 +1618,8 @@ skip_alloc: cred = NULL; sc->sc_ipopts = ipopts; bcopy(inc, &sc->sc_inc, sizeof(struct in_conninfo)); -#ifdef INET6 - if (!(inc->inc_flags & INC_ISIPV6)) -#endif - { - sc->sc_ip_tos = ip_tos; - sc->sc_ip_ttl = ip_ttl; - } + sc->sc_ip_tos = ip_tos; + sc->sc_ip_ttl = ip_ttl; #ifdef TCP_OFFLOAD sc->sc_tod = tod; sc->sc_todctx = todctx; @@ -1807,6 +1821,7 @@ syncache_respond(struct syncache *sc, const struct mbu /* Zero out traffic class and flow label. */ ip6->ip6_flow &= ~IPV6_FLOWINFO_MASK; ip6->ip6_flow |= sc->sc_flowlabel; + ip6->ip6_flow |= htonl(sc->sc_ip_tos << 20); th = (struct tcphdr *)(ip6 + 1); } @@ -1935,7 +1950,7 @@ syncache_respond(struct syncache *sc, const struct mbu m->m_pkthdr.csum_flags = CSUM_TCP_IPV6; th->th_sum = in6_cksum_pseudo(ip6, tlen + optlen - hlen, IPPROTO_TCP, 0); - ip6->ip6_hlim = in6_selecthlim(NULL, NULL); + ip6->ip6_hlim = sc->sc_ip_ttl; #ifdef TCP_OFFLOAD if (ADDED_BY_TOE(sc)) { struct toedev *tod = sc->sc_tod; Modified: head/sys/netinet/tcp_syncache.h ============================================================================== --- head/sys/netinet/tcp_syncache.h Mon Aug 10 19:37:06 2020 (r364088) +++ head/sys/netinet/tcp_syncache.h Mon Aug 10 20:24:48 2020 (r364089) @@ -63,8 +63,8 @@ struct syncache { struct mbuf *sc_ipopts; /* source route */ u_int16_t sc_peer_mss; /* peer's MSS */ u_int16_t sc_wnd; /* advertised window */ - u_int8_t sc_ip_ttl; /* IPv4 TTL */ - u_int8_t sc_ip_tos; /* IPv4 TOS */ + u_int8_t sc_ip_ttl; /* TTL / Hop Limit */ + u_int8_t sc_ip_tos; /* TOS / Traffic Class */ u_int8_t sc_requested_s_scale:4, sc_requested_r_scale:4; u_int16_t sc_flags; From owner-svn-src-all@freebsd.org Mon Aug 10 20:34:46 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 96D473AE3AE; Mon, 10 Aug 2020 20:34: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQSPf3Yp6z4mqJ; Mon, 10 Aug 2020 20:34: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 5E16EF866; Mon, 10 Aug 2020 20:34: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 07AKYk3c068582; Mon, 10 Aug 2020 20:34:46 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07AKYk6G068581; Mon, 10 Aug 2020 20:34:46 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202008102034.07AKYk6G068581@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 10 Aug 2020 20:34:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364090 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 364090 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2020 20:34:46 -0000 Author: markj Date: Mon Aug 10 20:34:45 2020 New Revision: 364090 URL: https://svnweb.freebsd.org/changeset/base/364090 Log: Check the UMA zone's full bucket cache before short-circuiting an alloc. The global "bucketdisable" flag indicates that we are in a low memory situation and should avoid allocating buckets. However, in the allocation path we were checking it before the full bucket cache and bailing even if the cache is non-empty. Defer the check so that we have a shot at allocating from the cache. This came up because M_NOWAIT allocations from the buf trie node zone must always succeed. In one scenario, all of the preallocated trie nodes were in the bucket list, and a new slab allocation could not succeed due to a memory shortage. The short-circuiting caused an allocation failure which triggered a panic. Reported by: pho Reviewed by: cem Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25980 Modified: head/sys/vm/uma_core.c Modified: head/sys/vm/uma_core.c ============================================================================== --- head/sys/vm/uma_core.c Mon Aug 10 20:24:48 2020 (r364089) +++ head/sys/vm/uma_core.c Mon Aug 10 20:34:45 2020 (r364090) @@ -3429,12 +3429,6 @@ cache_alloc(uma_zone_t zone, uma_cache_t cache, void * bucket_free(zone, bucket, udata); } - /* Short-circuit for zones without buckets and low memory. */ - if (zone->uz_bucket_size == 0 || bucketdisable) { - critical_enter(); - return (false); - } - /* * Attempt to retrieve the item from the per-CPU cache has failed, so * we must go back to the zone. This requires the zdom lock, so we @@ -3449,11 +3443,12 @@ cache_alloc(uma_zone_t zone, uma_cache_t cache, void * VM_DOMAIN_EMPTY(domain)) domain = zone_domain_highest(zone, domain); bucket = cache_fetch_bucket(zone, cache, domain); - if (bucket == NULL) { + if (bucket == NULL && zone->uz_bucket_size != 0 && !bucketdisable) { bucket = zone_alloc_bucket(zone, udata, domain, flags); new = true; - } else + } else { new = false; + } CTR3(KTR_UMA, "uma_zalloc: zone %s(%p) bucket zone returned %p", zone->uz_name, zone, bucket); From owner-svn-src-all@freebsd.org Mon Aug 10 21:41:50 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DCDBB3AF302; Mon, 10 Aug 2020 21:41: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQTv25Rdnz4qZ9; Mon, 10 Aug 2020 21:41:50 +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 9E601106DE; Mon, 10 Aug 2020 21:41:50 +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 07ALfoWR009841; Mon, 10 Aug 2020 21:41:50 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07ALfnDj009838; Mon, 10 Aug 2020 21:41:49 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202008102141.07ALfnDj009838@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 10 Aug 2020 21:41:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364091 - head/lib/libc/gen X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/lib/libc/gen X-SVN-Commit-Revision: 364091 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2020 21:41:50 -0000 Author: kib Date: Mon Aug 10 21:41:49 2020 New Revision: 364091 URL: https://svnweb.freebsd.org/changeset/base/364091 Log: Export scandir_b from libc. Apparently it was not exported, because scandir_b.c was not included into libc SRCS. Export it with the CURRENT-13 version. Also, because it was not exported before ino64, clean up scandir-compat11.c. PR: 248572 Reported by: Alex S Reviewed by: emaste Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D26020 Modified: head/lib/libc/gen/Makefile.inc head/lib/libc/gen/Symbol.map head/lib/libc/gen/scandir-compat11.c head/lib/libc/gen/scandir.c Modified: head/lib/libc/gen/Makefile.inc ============================================================================== --- head/lib/libc/gen/Makefile.inc Mon Aug 10 20:34:45 2020 (r364090) +++ head/lib/libc/gen/Makefile.inc Mon Aug 10 21:41:49 2020 (r364091) @@ -120,6 +120,7 @@ SRCS+= __getosreldate.c \ recvmmsg.c \ rewinddir.c \ scandir.c \ + scandir_b.c \ scandir-compat11.c \ seed48.c \ seekdir.c \ Modified: head/lib/libc/gen/Symbol.map ============================================================================== --- head/lib/libc/gen/Symbol.map Mon Aug 10 20:34:45 2020 (r364090) +++ head/lib/libc/gen/Symbol.map Mon Aug 10 21:41:49 2020 (r364091) @@ -416,7 +416,6 @@ FBSD_1.5 { readdir; readdir_r; scandir; - scandir_b; sem_clockwait_np; setproctitle_fast; timespec_get; @@ -424,6 +423,7 @@ FBSD_1.5 { FBSD_1.6 { memalign; + scandir_b; sigandset; sigisemptyset; sigorset; Modified: head/lib/libc/gen/scandir-compat11.c ============================================================================== --- head/lib/libc/gen/scandir-compat11.c Mon Aug 10 20:34:45 2020 (r364090) +++ head/lib/libc/gen/scandir-compat11.c Mon Aug 10 21:41:49 2020 (r364091) @@ -49,32 +49,25 @@ __FBSDID("$FreeBSD$"); #include "gen-compat.h" -#ifdef I_AM_SCANDIR_B -#include "block_abi.h" -#define SELECT(x) CALL_BLOCK(select, x) -#ifndef __BLOCKS__ -void -qsort_b(void *, size_t, size_t, void*); -#endif -#else +/* + * scandir_b@FBSD_1.4 was never exported from libc.so.7 due to a + * mistake, so there is no use of exporting it now with some earlier + * symbol version. As result, we do not need to implement compat + * function freebsd11_scandir_b(). + */ + #define SELECT(x) select(x) -#endif +void qsort_b(void *, size_t, size_t, void *); + static int freebsd11_alphasort_thunk(void *thunk, const void *p1, const void *p2); int -#ifdef I_AM_SCANDIR_B -freebsd11_scandir_b(const char *dirname, struct freebsd11_dirent ***namelist, - DECLARE_BLOCK(int, select, const struct freebsd11_dirent *), - DECLARE_BLOCK(int, dcomp, const struct freebsd11_dirent **, - const struct freebsd11_dirent **)) -#else freebsd11_scandir(const char *dirname, struct freebsd11_dirent ***namelist, int (*select)(const struct freebsd11_dirent *), int (*dcomp)(const struct freebsd11_dirent **, const struct freebsd11_dirent **)) -#endif { struct freebsd11_dirent *d, *p, **names = NULL; size_t arraysz, numitems; @@ -124,13 +117,8 @@ freebsd11_scandir(const char *dirname, struct freebsd1 } closedir(dirp); if (numitems && dcomp != NULL) -#ifdef I_AM_SCANDIR_B - qsort_b(names, numitems, sizeof(struct freebsd11_dirent *), - (void*)dcomp); -#else qsort_r(names, numitems, sizeof(struct freebsd11_dirent *), &dcomp, freebsd11_alphasort_thunk); -#endif *namelist = names; return (numitems); @@ -168,4 +156,3 @@ freebsd11_alphasort_thunk(void *thunk, const void *p1, __sym_compat(alphasort, freebsd11_alphasort, FBSD_1.0); __sym_compat(scandir, freebsd11_scandir, FBSD_1.0); -__sym_compat(scandir_b, freebsd11_scandir_b, FBSD_1.4); Modified: head/lib/libc/gen/scandir.c ============================================================================== --- head/lib/libc/gen/scandir.c Mon Aug 10 20:34:45 2020 (r364090) +++ head/lib/libc/gen/scandir.c Mon Aug 10 21:41:49 2020 (r364091) @@ -50,8 +50,7 @@ __FBSDID("$FreeBSD$"); #include "block_abi.h" #define SELECT(x) CALL_BLOCK(select, x) #ifndef __BLOCKS__ -void -qsort_b(void *, size_t, size_t, void*); +void qsort_b(void *, size_t, size_t, void *); #endif #else #define SELECT(x) select(x) @@ -134,6 +133,7 @@ fail: return (-1); } +#ifndef I_AM_SCANDIR_B /* * Alphabetic order comparison routine for those who want it. * POSIX 2008 requires that alphasort() uses strcoll(). @@ -153,3 +153,4 @@ alphasort_thunk(void *thunk, const void *p1, const voi dc = *(int (**)(const struct dirent **, const struct dirent **))thunk; return (dc((const struct dirent **)p1, (const struct dirent **)p2)); } +#endif From owner-svn-src-all@freebsd.org Mon Aug 10 22:41:50 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C19183AFAE3; Mon, 10 Aug 2020 22:41:50 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQWDG4XDjz4sBS; Mon, 10 Aug 2020 22:41:50 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from [192.168.1.10] (c-98-207-126-143.hsd1.ca.comcast.net [98.207.126.143]) (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 F1B4F18530; Mon, 10 Aug 2020 22:41:49 +0000 (UTC) (envelope-from rpokala@freebsd.org) User-Agent: Microsoft-MacOutlook/16.39.20071300 Date: Mon, 10 Aug 2020 15:41:44 -0700 Subject: Re: svn commit: r364071 - head/sys/kern From: Ravi Pokala To: Mateusz Guzik , , , Message-ID: Thread-Topic: svn commit: r364071 - head/sys/kern References: <202008101040.07AAeEtt096924@repo.freebsd.org> In-Reply-To: <202008101040.07AAeEtt096924@repo.freebsd.org> Mime-version: 1.0 Content-type: text/plain; charset="UTF-8" Content-transfer-encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2020 22:41:50 -0000 -----Original Message----- From: on behalf of Mateusz Guzik Date: 2020-08-10, Monday at 03:40 To: , , Subject: svn commit: r364071 - head/sys/kern Author: mjg Date: Mon Aug 10 10:40:14 2020 New Revision: 364071 URL: https://svnweb.freebsd.org/changeset/base/364071 Log: cache: strlcpy -> memcpy But why? -Ravi (rpokala@) Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Mon Aug 10 10:37:16 2020 (r364070) +++ head/sys/kern/vfs_cache.c Mon Aug 10 10:40:14 2020 (r364071) @@ -1934,7 +1934,8 @@ cache_enter_time(struct vnode *dvp, struct vnode *vp, } len = ncp->nc_nlen = cnp->cn_namelen; hash = cache_get_hash(cnp->cn_nameptr, len, dvp); - strlcpy(ncp->nc_name, cnp->cn_nameptr, len + 1); + memcpy(ncp->nc_name, cnp->cn_nameptr, len); + ncp->nc_name[len] = '\0'; cache_enter_lock(&cel, dvp, vp, hash); /* From owner-svn-src-all@freebsd.org Mon Aug 10 22:42:39 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 537223AF777; Mon, 10 Aug 2020 22:42:39 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQWFC1XyJz4snd; Mon, 10 Aug 2020 22:42:39 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from [192.168.1.10] (c-98-207-126-143.hsd1.ca.comcast.net [98.207.126.143]) (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 0B63A17E49; Mon, 10 Aug 2020 22:42:37 +0000 (UTC) (envelope-from rpokala@freebsd.org) User-Agent: Microsoft-MacOutlook/16.39.20071300 Date: Mon, 10 Aug 2020 15:42:37 -0700 Subject: Re: svn commit: r364076 - head/sys/fs/devfs From: Ravi Pokala To: Mateusz Guzik , , , Message-ID: <7EDE5621-FB3C-4FA5-A925-30F2367ADEBD@panasas.com> Thread-Topic: svn commit: r364076 - head/sys/fs/devfs References: <202008101146.07ABkeAw039895@repo.freebsd.org> In-Reply-To: <202008101146.07ABkeAw039895@repo.freebsd.org> Mime-version: 1.0 Content-type: text/plain; charset="UTF-8" Content-transfer-encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2020 22:42:39 -0000 -----Original Message----- From: on behalf of Mateusz Guzik Date: 2020-08-10, Monday at 04:46 To: , , Subject: svn commit: r364076 - head/sys/fs/devfs Author: mjg Date: Mon Aug 10 11:46:39 2020 New Revision: 364076 URL: https://svnweb.freebsd.org/changeset/base/364076 Log: devfs: bool -> int Fixes buildworld after r364069 It was returning the result of a "!=" test; is that not a bool? -Ravi (rpokala@) Modified: head/sys/fs/devfs/devfs.h head/sys/fs/devfs/devfs_devs.c Modified: head/sys/fs/devfs/devfs.h ============================================================================== --- head/sys/fs/devfs/devfs.h Mon Aug 10 10:58:43 2020 (r364075) +++ head/sys/fs/devfs/devfs.h Mon Aug 10 11:46:39 2020 (r364076) @@ -192,7 +192,7 @@ char *devfs_fqpn(char *, struct devfs_mount *, struct struct componentname *); void devfs_delete(struct devfs_mount *, struct devfs_dirent *, int); void devfs_dirent_free(struct devfs_dirent *); -bool devfs_populate_needed(struct devfs_mount *dm); +int devfs_populate_needed(struct devfs_mount *dm); void devfs_populate(struct devfs_mount *); void devfs_cleanup(struct devfs_mount *); void devfs_unmount_final(struct devfs_mount *); Modified: head/sys/fs/devfs/devfs_devs.c ============================================================================== --- head/sys/fs/devfs/devfs_devs.c Mon Aug 10 10:58:43 2020 (r364075) +++ head/sys/fs/devfs/devfs_devs.c Mon Aug 10 11:46:39 2020 (r364076) @@ -659,7 +659,7 @@ devfs_populate_loop(struct devfs_mount *dm, int cleanu return (0); } -bool +int devfs_populate_needed(struct devfs_mount *dm) { From owner-svn-src-all@freebsd.org Mon Aug 10 23:10:15 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E98263B05F4; Mon, 10 Aug 2020 23:10:15 +0000 (UTC) (envelope-from steffen@sdaoden.eu) Received: from sdaoden.eu (sdaoden.eu [217.144.132.164]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQWs24z2wz4tpk; Mon, 10 Aug 2020 23:10:14 +0000 (UTC) (envelope-from steffen@sdaoden.eu) Received: by sdaoden.eu (Postfix, from userid 1000) id 0580D16058; Tue, 11 Aug 2020 01:10:05 +0200 (CEST) Date: Tue, 11 Aug 2020 01:10:05 +0200 From: Steffen Nurpmeso To: Ravi Pokala Cc: Mateusz Guzik , , , Subject: Re: svn commit: r364071 - head/sys/kern Message-ID: <20200810231005.yX2pB%steffen@sdaoden.eu> In-Reply-To: References: <202008101040.07AAeEtt096924@repo.freebsd.org> Mail-Followup-To: Ravi Pokala , Mateusz Guzik , , , User-Agent: s-nail v14.9.19-103-ga01f6c13 OpenPGP: id=EE19E1C1F2F7054F8D3954D8308964B51883A0DD; url=https://ftp.sdaoden.eu/steffen.asc; preference=signencrypt BlahBlahBlah: Any stupid boy can crush a beetle. But all the professors in the world can make no bugs. X-Rspamd-Queue-Id: 4BQWs24z2wz4tpk X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of steffen@sdaoden.eu designates 217.144.132.164 as permitted sender) smtp.mailfrom=steffen@sdaoden.eu X-Spamd-Result: default: False [-0.87 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.87)[-0.873]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_SPF_ALLOW(-0.20)[+a]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[sdaoden.eu]; NEURAL_HAM_LONG(-0.86)[-0.863]; RCPT_COUNT_FIVE(0.00)[5]; NEURAL_SPAM_SHORT(0.17)[0.171]; MID_CONTAINS_FROM(1.00)[]; RCVD_COUNT_ZERO(0.00)[0]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15987, ipnet:217.144.128.0/20, country:DE] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2020 23:10:16 -0000 Ravi Pokala wrote in : |-----Original Message----- |From: on behalf of Mateusz Guzik \ | |Date: 2020-08-10, Monday at 03:40 |To: , , |Subject: svn commit: r364071 - head/sys/kern | | Author: mjg | Date: Mon Aug 10 10:40:14 2020 | New Revision: 364071 | URL: https://svnweb.freebsd.org/changeset/base/364071 | | Log: | cache: strlcpy -> memcpy | |But why? Ach, i like it! I, coming from (basic ->) perl -> java -> C++ -> C always hated that C string functions which iterate stuff over and over again, but especially so if working on buffers of which the length is known. I mean, you know, if i know i have a NUL terminated buffer and its length, why in the world should i use one of those mysterious C string functions? I know there is one NUL, it is at LENGTH, dammit! I like it, several such commits flew by over the last at least weeks, and i could imagine that in a cache it also matters. --steffen | |Der Kragenbaer, The moon bear, |der holt sich munter he cheerfully and one by one |einen nach dem anderen runter wa.ks himself off |(By Robert Gernhardt) From owner-svn-src-all@freebsd.org Mon Aug 10 23:42:38 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F3B1F3B0A1E; Mon, 10 Aug 2020 23:42:37 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-io1-f46.google.com (mail-io1-f46.google.com [209.85.166.46]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQXZN6T6hz4vdN; Mon, 10 Aug 2020 23:42:36 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-io1-f46.google.com with SMTP id b17so3245327ion.7; Mon, 10 Aug 2020 16:42:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=YzFeK5GUPrM5GyCkUzkxlF+MozaVuvia5uKz/LMIkkw=; b=DuqcJdb4E7gD9eyjJ/BuWodgpj8Kjo4QXjeatzt06sek3KTLeauGnizFj2CPR3Ghb/ ejk/zJGTt5/c9ZRzSUi6/X4ukq8WFeo207lfstE5dy3zks2mwtQq1AU2IpcnKTAtyX2m Y5w1I+0mhORwcaxPSsZghxWNPYi1pOB1qjbeezWJQtxKUYG7UNCYFKdmXD58lxjWuQpK KLvsTKBGidfQ1beLlKF7qwyNRoSr0MYgf5ggND3b0xpa+ttizLObjVCj7zTwYm6rAfhH Qxks7+CEEpqc+lUn2YxKOuwRnp1NX6qI3cCMuUC4J5y4aFV9xDfROol1UMK9Qp7kg719 MO4w== X-Gm-Message-State: AOAM5304c8PKQ42lqo9cWwZ1okR0zGPUs3WOo5ux6ZjhmA66QZUspFwl L7C8R+K5D6WDweYmcI/LO4yjPNIb4pI2MyH74JwzIKlx X-Google-Smtp-Source: ABdhPJzFTH/E4MvyHVyXuec4OFC6OPlsVqc1mmFBWo+uYFdl+RbpVtqNzX/gB02w2m0zA2scGxYGOh9b5Tw7nxOaVL4= X-Received: by 2002:a5d:9ac5:: with SMTP id x5mr20750628ion.111.1597102955110; Mon, 10 Aug 2020 16:42:35 -0700 (PDT) MIME-Version: 1.0 References: <202007290034.06T0YOPQ044582@repo.freebsd.org> <20200729114322.4ff17fde@FreeBSD.org> In-Reply-To: <20200729114322.4ff17fde@FreeBSD.org> From: Ed Maste Date: Mon, 10 Aug 2020 19:42:23 -0400 Message-ID: Subject: Re: svn commit: r363657 - head/crypto/openssh To: =?UTF-8?Q?T=C4=B3l_Coosemans?= Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4BQXZN6T6hz4vdN X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of carpeddiem@gmail.com designates 209.85.166.46 as permitted sender) smtp.mailfrom=carpeddiem@gmail.com X-Spamd-Result: default: False [-0.15 / 15.00]; ARC_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.org]; NEURAL_HAM_LONG(-0.35)[-0.347]; NEURAL_SPAM_MEDIUM(0.03)[0.032]; NEURAL_SPAM_SHORT(0.17)[0.165]; TO_DN_ALL(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[209.85.166.46:from]; FORGED_SENDER(0.30)[emaste@freebsd.org,carpeddiem@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.166.46:from]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; RCVD_TLS_ALL(0.00)[]; FROM_NEQ_ENVFROM(0.00)[emaste@freebsd.org,carpeddiem@gmail.com]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2020 23:42:38 -0000 On Wed, 29 Jul 2020 at 05:43, T=C4=B3l Coosemans wrote: > > On Wed, 29 Jul 2020 00:34:24 +0000 (UTC) Ed Maste > wrote: > > I realise this is very pedantic, but my spell checker says it's > "block list", two words, so if you're using camel case it should > be UseBlockList. Indeed, I gave this some brief thought before committing, but decided to treat blocklist as a compound noun (as was blacklist). The name of the thing being enabled here is blocklist, using the blocklistd daemon. Also, Google shows me about 1.7M results for "blocklist" vs 2.5M for "block list" so it seems to be at least somewhat accepted as a single word / jargon in technical circles. From owner-svn-src-all@freebsd.org Tue Aug 11 00:26:48 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0474D3B200C; Tue, 11 Aug 2020 00:26:48 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQYYM65Rrz3TJ0; Tue, 11 Aug 2020 00:26:47 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AFEFE12914; Tue, 11 Aug 2020 00:26:47 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07B0QlxR009567; Tue, 11 Aug 2020 00:26:47 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07B0QjRp009558; Tue, 11 Aug 2020 00:26:45 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <202008110026.07B0QjRp009558@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Tue, 11 Aug 2020 00:26:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364092 - in head/sys: fs/nfs fs/nfsclient fs/nfsserver rpc sys X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: in head/sys: fs/nfs fs/nfsclient fs/nfsserver rpc sys X-SVN-Commit-Revision: 364092 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 00:26:48 -0000 Author: rmacklem Date: Tue Aug 11 00:26:45 2020 New Revision: 364092 URL: https://svnweb.freebsd.org/changeset/base/364092 Log: Add an argument to newnfs_connect() that indicates use TLS for the connection. For NFSv4.0, the server creates a server->client TCP connection for callbacks. If the client mount on the server is using TLS, enable TLS for this callback TCP connection. TLS connections from clients will not be supported until the kernel RPC changes are committed. Since this changes the internal ABI between the NFS kernel modules that will require a version bump, delete newnfs_trimtrailing(), which is no longer used. Since LCL_TLSCB is not yet set, these changes should not have any semantic affect at this time. Modified: head/sys/fs/nfs/nfs.h head/sys/fs/nfs/nfs_commonkrpc.c head/sys/fs/nfs/nfs_commonsubs.c head/sys/fs/nfs/nfs_var.h head/sys/fs/nfsclient/nfs_clrpcops.c head/sys/fs/nfsclient/nfs_clvfsops.c head/sys/fs/nfsserver/nfs_nfsdstate.c head/sys/rpc/clnt.h head/sys/sys/param.h Modified: head/sys/fs/nfs/nfs.h ============================================================================== --- head/sys/fs/nfs/nfs.h Mon Aug 10 21:41:49 2020 (r364091) +++ head/sys/fs/nfs/nfs.h Tue Aug 11 00:26:45 2020 (r364092) @@ -336,6 +336,7 @@ struct nfsreferral { #define LCL_DONEBINDCONN 0x00040000 #define LCL_RECLAIMONEFS 0x00080000 #define LCL_NFSV42 0x00100000 +#define LCL_TLSCB 0x00200000 #define LCL_GSS LCL_KERBV /* Or of all mechs */ Modified: head/sys/fs/nfs/nfs_commonkrpc.c ============================================================================== --- head/sys/fs/nfs/nfs_commonkrpc.c Mon Aug 10 21:41:49 2020 (r364091) +++ head/sys/fs/nfs/nfs_commonkrpc.c Tue Aug 11 00:26:45 2020 (r364092) @@ -167,7 +167,7 @@ static int nfsv2_procid[NFS_V3NPROCS] = { */ int newnfs_connect(struct nfsmount *nmp, struct nfssockreq *nrp, - struct ucred *cred, NFSPROC_T *p, int callback_retry_mult) + struct ucred *cred, NFSPROC_T *p, int callback_retry_mult, bool dotls) { int rcvreserve, sndreserve; int pktscale, pktscalesav; @@ -374,6 +374,8 @@ newnfs_connect(struct nfsmount *nmp, struct nfssockreq } else { retries = NFSV4_CALLBACKRETRY * callback_retry_mult; } + if (dotls) + CLNT_CONTROL(client, CLSET_TLS, &one); } CLNT_CONTROL(client, CLSET_RETRIES, &retries); @@ -586,7 +588,7 @@ newnfs_request(struct nfsrv_descript *nd, struct nfsmo * and let clnt_reconnect_create handle reconnects. */ if (nrp->nr_client == NULL) - newnfs_connect(nmp, nrp, cred, td, 0); + newnfs_connect(nmp, nrp, cred, td, 0, false); /* * For a client side mount, nmp is != NULL and clp == NULL. For Modified: head/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- head/sys/fs/nfs/nfs_commonsubs.c Mon Aug 10 21:41:49 2020 (r364091) +++ head/sys/fs/nfs/nfs_commonsubs.c Tue Aug 11 00:26:45 2020 (r364092) @@ -1058,25 +1058,6 @@ nfsaddr2_match(NFSSOCKADDR_T nam1, NFSSOCKADDR_T nam2) } /* - * Trim trailing data off the mbuf list being built. - */ -void -newnfs_trimtrailing(nd, mb, bpos) - struct nfsrv_descript *nd; - struct mbuf *mb; - caddr_t bpos; -{ - - if (mb->m_next) { - m_freem(mb->m_next); - mb->m_next = NULL; - } - mb->m_len = bpos - mtod(mb, caddr_t); - nd->nd_mb = mb; - nd->nd_bpos = bpos; -} - -/* * Dissect a file handle on the client. */ int @@ -3650,7 +3631,7 @@ nfsrv_nfsuserdport(struct nfsuserd_args *nargs, NFSPRO } rp->nr_vers = RPCNFSUSERD_VERS; if (error == 0) - error = newnfs_connect(NULL, rp, NFSPROCCRED(p), p, 0); + error = newnfs_connect(NULL, rp, NFSPROCCRED(p), p, 0, false); if (error == 0) { NFSLOCKNAMEID(); nfsrv_nfsuserd = RUNNING; Modified: head/sys/fs/nfs/nfs_var.h ============================================================================== --- head/sys/fs/nfs/nfs_var.h Mon Aug 10 21:41:49 2020 (r364091) +++ head/sys/fs/nfs/nfs_var.h Tue Aug 11 00:26:45 2020 (r364092) @@ -324,8 +324,6 @@ int nfsm_mbufuio(struct nfsrv_descript *, struct uio * int nfsm_fhtom(struct nfsrv_descript *, u_int8_t *, int, int); int nfsm_advance(struct nfsrv_descript *, int, int); void *nfsm_dissct(struct nfsrv_descript *, int, int); -void newnfs_trimtrailing(struct nfsrv_descript *, struct mbuf *, - caddr_t); void newnfs_copycred(struct nfscred *, struct ucred *); void newnfs_copyincred(struct ucred *, struct nfscred *); int nfsrv_dissectacl(struct nfsrv_descript *, NFSACL_T *, int *, @@ -766,7 +764,7 @@ int newnfs_request(struct nfsrv_descript *, struct nfs struct ucred *, u_int32_t, u_int32_t, u_char *, int, u_int64_t *, struct nfsclsession *); int newnfs_connect(struct nfsmount *, struct nfssockreq *, - struct ucred *, NFSPROC_T *, int); + struct ucred *, NFSPROC_T *, int, bool); void newnfs_disconnect(struct nfssockreq *); int newnfs_sigintr(struct nfsmount *, NFSPROC_T *); Modified: head/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clrpcops.c Mon Aug 10 21:41:49 2020 (r364091) +++ head/sys/fs/nfsclient/nfs_clrpcops.c Tue Aug 11 00:26:45 2020 (r364092) @@ -5617,7 +5617,7 @@ nfsrpc_fillsa(struct nfsmount *nmp, struct sockaddr_in * unmount, but I did it anyhow. */ nrp->nr_cred = crhold(nmp->nm_sockreq.nr_cred); - error = newnfs_connect(nmp, nrp, NULL, p, 0); + error = newnfs_connect(nmp, nrp, NULL, p, 0, false); NFSCL_DEBUG(3, "DS connect=%d\n", error); dsp = NULL; Modified: head/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clvfsops.c Mon Aug 10 21:41:49 2020 (r364091) +++ head/sys/fs/nfsclient/nfs_clvfsops.c Tue Aug 11 00:26:45 2020 (r364092) @@ -718,7 +718,7 @@ nfs_decode_args(struct mount *mp, struct nfsmount *nmp nmp->nm_soproto = argp->proto; if (nmp->nm_sotype == SOCK_DGRAM) while (newnfs_connect(nmp, &nmp->nm_sockreq, - cred, td, 0)) { + cred, td, 0, false)) { printf("newnfs_args: retrying connect\n"); (void) nfs_catnap(PSOCK, 0, "nfscon"); } @@ -1527,7 +1527,7 @@ mountnfs(struct nfs_args *argp, struct mount *mp, stru nmp->nm_sockreq.nr_vers = NFS_VER2; - if ((error = newnfs_connect(nmp, &nmp->nm_sockreq, cred, td, 0))) + if ((error = newnfs_connect(nmp, &nmp->nm_sockreq, cred, td, 0, false))) goto bad; /* For NFSv4.1, get the clientid now. */ if (nmp->nm_minorvers > 0) { Modified: head/sys/fs/nfsserver/nfs_nfsdstate.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdstate.c Mon Aug 10 21:41:49 2020 (r364091) +++ head/sys/fs/nfsserver/nfs_nfsdstate.c Tue Aug 11 00:26:45 2020 (r364092) @@ -4423,6 +4423,7 @@ nfsrv_docallback(struct nfsclient *clp, int procnum, n u_int32_t callback; struct nfsdsession *sep = NULL; uint64_t tval; + bool dotls; nd = malloc(sizeof(*nd), M_TEMP, M_WAITOK | M_ZERO); cred = newnfs_getcred(); @@ -4547,6 +4548,9 @@ nfsrv_docallback(struct nfsclient *clp, int procnum, n /* * Call newnfs_connect(), as required, and then newnfs_request(). */ + dotls = false; + if ((clp->lc_flags & LCL_TLSCB) != 0) + dotls = true; (void) newnfs_sndlock(&clp->lc_req.nr_lock); if (clp->lc_req.nr_client == NULL) { if ((clp->lc_flags & LCL_NFSV41) != 0) { @@ -4554,10 +4558,10 @@ nfsrv_docallback(struct nfsclient *clp, int procnum, n nfsrv_freesession(sep, NULL); } else if (nd->nd_procnum == NFSV4PROC_CBNULL) error = newnfs_connect(NULL, &clp->lc_req, cred, - NULL, 1); + NULL, 1, dotls); else error = newnfs_connect(NULL, &clp->lc_req, cred, - NULL, 3); + NULL, 3, dotls); } newnfs_sndunlock(&clp->lc_req.nr_lock); NFSD_DEBUG(4, "aft sndunlock=%d\n", error); Modified: head/sys/rpc/clnt.h ============================================================================== --- head/sys/rpc/clnt.h Mon Aug 10 21:41:49 2020 (r364091) +++ head/sys/rpc/clnt.h Tue Aug 11 00:26:45 2020 (r364092) @@ -357,6 +357,8 @@ enum clnt_stat clnt_call_private(CLIENT *, struct rpc_ #define CLSET_PRIVPORT 27 /* set privileged source port flag */ #define CLGET_PRIVPORT 28 /* get privileged source port flag */ #define CLSET_BACKCHANNEL 29 /* set backchannel for socket */ +#define CLSET_TLS 30 /* set TLS for socket */ +#define CLSET_BLOCKRCV 31 /* Temporarily block reception */ #endif Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Mon Aug 10 21:41:49 2020 (r364091) +++ head/sys/sys/param.h Tue Aug 11 00:26:45 2020 (r364092) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300105 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300106 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-all@freebsd.org Tue Aug 11 00:41:49 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A29573B221E; Tue, 11 Aug 2020 00:41:49 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQYtj3wDjz3VK6; Tue, 11 Aug 2020 00:41:49 +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 69E56127EC; Tue, 11 Aug 2020 00:41:49 +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 07B0fn3Q021063; Tue, 11 Aug 2020 00:41:49 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07B0fnmK021062; Tue, 11 Aug 2020 00:41:49 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202008110041.07B0fnmK021062@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 11 Aug 2020 00:41: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: r364093 - in stable/12/sys/dev: mpr mps X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/12/sys/dev: mpr mps X-SVN-Commit-Revision: 364093 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 00:41:49 -0000 Author: mav Date: Tue Aug 11 00:41:48 2020 New Revision: 364093 URL: https://svnweb.freebsd.org/changeset/base/364093 Log: MFC r363852: Remove extra memset() left after r342388. This memset() wiped MPI2_FUNCTION_SCSI_TASK_MGMT set by mprsas_alloc_tm(), that broke target reset on device removal, making later re-insertion into the same slot impossible, since firmware was still waiting for the driver to finish with the removed device. Modified: stable/12/sys/dev/mpr/mpr_sas.c stable/12/sys/dev/mps/mps_sas.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mpr/mpr_sas.c ============================================================================== --- stable/12/sys/dev/mpr/mpr_sas.c Tue Aug 11 00:26:45 2020 (r364092) +++ stable/12/sys/dev/mpr/mpr_sas.c Tue Aug 11 00:41:48 2020 (r364093) @@ -534,7 +534,6 @@ mprsas_prepare_remove(struct mprsas_softc *sassc, uint mprsas_rescan_target(sc, targ); req = (MPI2_SCSI_TASK_MANAGE_REQUEST *)tm->cm_req; - memset(req, 0, sizeof(*req)); req->DevHandle = htole16(targ->handle); req->TaskType = MPI2_SCSITASKMGMT_TASKTYPE_TARGET_RESET; Modified: stable/12/sys/dev/mps/mps_sas.c ============================================================================== --- stable/12/sys/dev/mps/mps_sas.c Tue Aug 11 00:26:45 2020 (r364092) +++ stable/12/sys/dev/mps/mps_sas.c Tue Aug 11 00:41:48 2020 (r364093) @@ -531,7 +531,6 @@ mpssas_prepare_remove(struct mpssas_softc *sassc, uint mpssas_rescan_target(sc, targ); req = (MPI2_SCSI_TASK_MANAGE_REQUEST *)cm->cm_req; - memset(req, 0, sizeof(*req)); req->DevHandle = htole16(targ->handle); req->TaskType = MPI2_SCSITASKMGMT_TASKTYPE_TARGET_RESET; From owner-svn-src-all@freebsd.org Tue Aug 11 01:09:07 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5F73F3B26D1; Tue, 11 Aug 2020 01:09:07 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQZVC1R96z3W5X; Tue, 11 Aug 2020 01:09:07 +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 157DC12EA8; Tue, 11 Aug 2020 01:09:07 +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 07B196Ll034655; Tue, 11 Aug 2020 01:09:06 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07B196gc034654; Tue, 11 Aug 2020 01:09:06 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <202008110109.07B196gc034654@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Tue, 11 Aug 2020 01:09:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364094 - head/tests/sys/fs/fusefs X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/tests/sys/fs/fusefs X-SVN-Commit-Revision: 364094 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 01:09:07 -0000 Author: asomers Date: Tue Aug 11 01:09:06 2020 New Revision: 364094 URL: https://svnweb.freebsd.org/changeset/base/364094 Log: fusefs: fix the FUSE_FORGET unit test after r364064 Thanks to r364064, the name cache now returns a hit where previously it would miss. Adjust the expectations accordingly. PR: 248583 Reported by: lwhsu MFC with: r364064 Modified: head/tests/sys/fs/fusefs/forget.cc Modified: head/tests/sys/fs/fusefs/forget.cc ============================================================================== --- head/tests/sys/fs/fusefs/forget.cc Tue Aug 11 00:41:48 2020 (r364093) +++ head/tests/sys/fs/fusefs/forget.cc Tue Aug 11 01:09:06 2020 (r364094) @@ -116,6 +116,7 @@ TEST_F(Forget, invalidate_names) int err; EXPECT_LOOKUP(FUSE_ROOT_ID, DNAME) + .Times(2) .WillRepeatedly(Invoke( ReturnImmediate([=](auto in __unused, auto& out) { SET_OUT_HEADER_LEN(out, entry); @@ -142,7 +143,7 @@ TEST_F(Forget, invalidate_names) out.body.entry.attr_valid = UINT64_MAX; out.body.entry.entry_valid = UINT64_MAX; }))); - expect_forget(dir_ino, 2); + expect_forget(dir_ino, 1); /* Access the file to cache its name */ ASSERT_EQ(0, access(FULLFPATH, F_OK)) << strerror(errno); From owner-svn-src-all@freebsd.org Tue Aug 11 01:34:41 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D838C3B3D92; Tue, 11 Aug 2020 01:34:41 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQb3j5Nk8z3Xxf; Tue, 11 Aug 2020 01:34:41 +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 9C21C1378E; Tue, 11 Aug 2020 01:34:41 +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 07B1YfZl052766; Tue, 11 Aug 2020 01:34:41 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07B1YfLQ052764; Tue, 11 Aug 2020 01:34:41 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202008110134.07B1YfLQ052764@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 11 Aug 2020 01:34:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364095 - 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: 364095 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 01:34:41 -0000 Author: mjg Date: Tue Aug 11 01:34:40 2020 New Revision: 364095 URL: https://svnweb.freebsd.org/changeset/base/364095 Log: vfs: stricter validation for flags passed to namei in cn_flags namei de facto expects that the naimeidata object is properly initialized, but at the same time it mixes consumer-passable and internal flags, while tolerating this part by explicitly clearing some of them. Tighten the interface instead. While here renumber the flags and denote the gap between the 2 variants. Try to piggy back th renumber on the just bumped __FreeBSD_version. Modified: head/sys/kern/vfs_lookup.c head/sys/sys/namei.h Modified: head/sys/kern/vfs_lookup.c ============================================================================== --- head/sys/kern/vfs_lookup.c Tue Aug 11 01:09:06 2020 (r364094) +++ head/sys/kern/vfs_lookup.c Tue Aug 11 01:34:40 2020 (r364095) @@ -61,6 +61,9 @@ __FBSDID("$FreeBSD$"); #ifdef KTRACE #include #endif +#ifdef INVARIANTS +#include +#endif #include #include @@ -484,14 +487,14 @@ namei(struct nameidata *ndp) ("namei: nameiop contaminated with flags")); KASSERT((cnp->cn_flags & OPMASK) == 0, ("namei: flags contaminated with nameiops")); + KASSERT((cnp->cn_flags & NAMEI_INTERNAL_FLAGS) == 0, + ("namei: unexpected flags: %" PRIx64 "\n", + cnp->cn_flags & NAMEI_INTERNAL_FLAGS)); if (cnp->cn_flags & NOCACHE) KASSERT(cnp->cn_nameiop != LOOKUP, ("%s: NOCACHE passed with LOOKUP", __func__)); MPASS(ndp->ni_startdir == NULL || ndp->ni_startdir->v_type == VDIR || ndp->ni_startdir->v_type == VBAD); - - /* We will set this ourselves if we need it. */ - cnp->cn_flags &= ~TRAILINGSLASH; ndp->ni_lcf = 0; ndp->ni_vp = NULL; Modified: head/sys/sys/namei.h ============================================================================== --- head/sys/sys/namei.h Tue Aug 11 01:09:06 2020 (r364094) +++ head/sys/sys/namei.h Tue Aug 11 01:34:40 2020 (r364095) @@ -152,22 +152,31 @@ int cache_fplookup(struct nameidata *ndp, enum cache_f #define HASBUF 0x00000400 /* has allocated pathname buffer */ #define SAVENAME 0x00000800 /* save pathname buffer */ #define SAVESTART 0x00001000 /* save starting directory */ -#define ISDOTDOT 0x00002000 /* current component name is .. */ -#define MAKEENTRY 0x00004000 /* entry is to be added to name cache */ -#define ISLASTCN 0x00008000 /* this is last component of pathname */ -#define ISSYMLINK 0x00010000 /* symlink needs interpretation */ -#define ISWHITEOUT 0x00020000 /* found whiteout */ -#define DOWHITEOUT 0x00040000 /* do whiteouts */ -#define WILLBEDIR 0x00080000 /* new files will be dirs; allow trailing / */ -#define ISOPEN 0x00200000 /* caller is opening; return a real vnode. */ -#define NOCROSSMOUNT 0x00400000 /* do not cross mount points */ -#define NOMACCHECK 0x00800000 /* do not perform MAC checks */ -#define AUDITVNODE1 0x04000000 /* audit the looked up vnode information */ -#define AUDITVNODE2 0x08000000 /* audit the looked up vnode information */ -#define TRAILINGSLASH 0x10000000 /* path ended in a slash */ -#define NOCAPCHECK 0x20000000 /* do not perform capability checks */ -#define NOEXECCHECK 0x40000000 /* do not perform exec check on dir */ +#define ISWHITEOUT 0x00002000 /* found whiteout */ +#define DOWHITEOUT 0x00004000 /* do whiteouts */ +#define WILLBEDIR 0x00008000 /* new files will be dirs; allow trailing / */ +#define ISOPEN 0x00010000 /* caller is opening; return a real vnode. */ +#define NOCROSSMOUNT 0x00020000 /* do not cross mount points */ +#define NOMACCHECK 0x00040000 /* do not perform MAC checks */ +#define AUDITVNODE1 0x00080000 /* audit the looked up vnode information */ +#define AUDITVNODE2 0x00100000 /* audit the looked up vnode information */ +#define NOCAPCHECK 0x00200000 /* do not perform capability checks */ +/* UNUSED 0x00400000 */ +/* UNUSED 0x00800000 */ +/* UNUSED 0x01000000 */ +#define NOEXECCHECK 0x02000000 /* do not perform exec check on dir */ +#define MAKEENTRY 0x04000000 /* entry is to be added to name cache */ +#define ISSYMLINK 0x08000000 /* symlink needs interpretation */ +#define ISLASTCN 0x10000000 /* this is last component of pathname */ +#define ISDOTDOT 0x20000000 /* current component name is .. */ +#define TRAILINGSLASH 0x40000000 /* path ended in a slash */ #define PARAMASK 0x7ffffe00 /* mask of parameter descriptors */ + +/* + * Flags which must not be passed in by callers. + */ +#define NAMEI_INTERNAL_FLAGS \ + (NOEXECCHECK | MAKEENTRY | ISSYMLINK | ISLASTCN | ISDOTDOT | TRAILINGSLASH) /* * Namei results flags From owner-svn-src-all@freebsd.org Tue Aug 11 02:05:10 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 945C23B47E0; Tue, 11 Aug 2020 02:05:10 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQbkt3PkZz3ZDD; Tue, 11 Aug 2020 02:05:10 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 590FD13757; Tue, 11 Aug 2020 02:05:10 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07B25ANl071131; Tue, 11 Aug 2020 02:05:10 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07B25AUM071130; Tue, 11 Aug 2020 02:05:10 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <202008110205.07B25AUM071130@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Tue, 11 Aug 2020 02:05:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364096 - head X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 364096 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 02:05:10 -0000 Author: rmacklem Date: Tue Aug 11 02:05:09 2020 New Revision: 364096 URL: https://svnweb.freebsd.org/changeset/base/364096 Log: Add an UPDATING entry for r364092, since it did a version bump. Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Tue Aug 11 01:34:40 2020 (r364095) +++ head/UPDATING Tue Aug 11 02:05:09 2020 (r364096) @@ -26,6 +26,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".) +20200810: + r364092 modified the internal ABI used between the kernel NFS + modules. As such, all of these modules need to be rebuilt + from sources, so a version bump was done. + 20200807: Makefile.inc has been updated to work around the issue documented in 20200729. It was a case where the optimization of using symbolic links From owner-svn-src-all@freebsd.org Tue Aug 11 05:10:02 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 58BF437AADC; Tue, 11 Aug 2020 05:10:02 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQgrB0TD8z426y; Tue, 11 Aug 2020 05:10:02 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E7CED16103; Tue, 11 Aug 2020 05:10:01 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07B5A19g082473; Tue, 11 Aug 2020 05:10:01 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07B5A1HV082472; Tue, 11 Aug 2020 05:10:01 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <202008110510.07B5A1HV082472@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Tue, 11 Aug 2020 05:10: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: r364097 - stable/12/sys/fs/nfsclient X-SVN-Group: stable-12 X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: stable/12/sys/fs/nfsclient X-SVN-Commit-Revision: 364097 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 05:10:02 -0000 Author: rmacklem Date: Tue Aug 11 05:10:01 2020 New Revision: 364097 URL: https://svnweb.freebsd.org/changeset/base/364097 Log: MFC: r363210 Fix the pNFS flexible file layout client for servers with small write size. The code in nfscl_dofflayout() loops when a flexible file layout server provides a small write data limit (no extant server is known to do this). If/when it looped, it erroneously reused the "drpc" argument for the mirror worker thread, corrupting it. This patch fixes the problem by only using the calling thread after the first loop iteration. Found during testing by simulating a server with a small write size. Since no extant pNFS server is known to provide a small write size, this fix it not needed in practice at this time. Modified: stable/12/sys/fs/nfsclient/nfs_clrpcops.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- stable/12/sys/fs/nfsclient/nfs_clrpcops.c Tue Aug 11 02:05:09 2020 (r364096) +++ stable/12/sys/fs/nfsclient/nfs_clrpcops.c Tue Aug 11 05:10:01 2020 (r364097) @@ -6103,10 +6103,17 @@ nfscl_dofflayoutio(vnode_t vp, struct uio *uiop, int * NFSCL_DEBUG(4, "mcopy reloff=%d xfer=%jd\n", rel_off, (uintmax_t)xfer); /* - * Do last write to a mirrored DS with this + * Do the writes after the first loop iteration + * and the write for the last mirror via this * thread. + * This loop only iterates for small values + * of nfsdi_wsize, which may never occur in + * practice. However, the drpc is completely + * used by the first iteration and, as such, + * cannot be used after that. */ - if (mirror < flp->nfsfl_mirrorcnt - 1) + if (mirror < flp->nfsfl_mirrorcnt - 1 && + rel_off == 0) error = nfsio_writedsmir(vp, iomode, must_commit, stateidp, *dspp, off, xfer, fhp, m, dp->nfsdi_vers, From owner-svn-src-all@freebsd.org Tue Aug 11 05:17:11 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2251137AE3D; Tue, 11 Aug 2020 05:17:11 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQh0R05cPz42Mj; Tue, 11 Aug 2020 05:17:11 +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 D6E941612A; Tue, 11 Aug 2020 05:17:10 +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 07B5HAga088238; Tue, 11 Aug 2020 05:17:10 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07B5HAoX088237; Tue, 11 Aug 2020 05:17:10 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <202008110517.07B5HAoX088237@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Tue, 11 Aug 2020 05:17:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364098 - head/sys/dev/dwc X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/sys/dev/dwc X-SVN-Commit-Revision: 364098 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 05:17:11 -0000 Author: lwhsu Date: Tue Aug 11 05:17:10 2020 New Revision: 364098 URL: https://svnweb.freebsd.org/changeset/base/364098 Log: Fix armv{6,7} build after r364088 Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/dwc/if_dwc.c Modified: head/sys/dev/dwc/if_dwc.c ============================================================================== --- head/sys/dev/dwc/if_dwc.c Tue Aug 11 05:10:01 2020 (r364097) +++ head/sys/dev/dwc/if_dwc.c Tue Aug 11 05:17:10 2020 (r364098) @@ -1220,7 +1220,8 @@ dwc_clock_init(device_t dev) } if (bootverbose) { clk_get_freq(clk, &freq); - device_printf(dev, "MAC clock(%s) freq: %ld\n", clk_get_name(clk), freq); + device_printf(dev, "MAC clock(%s) freq: %jd\n", + clk_get_name(clk), (intmax_t)freq); } } else { From owner-svn-src-all@freebsd.org Tue Aug 11 05:37:57 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C92F837B3C0; Tue, 11 Aug 2020 05:37:57 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (glebi.us [162.251.186.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQhSP2nySz43q2; Tue, 11 Aug 2020 05:37:57 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.16.1/8.16.1) with ESMTPS id 07B5boGK024796 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 10 Aug 2020 22:37:50 -0700 (PDT) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.16.1/8.16.1/Submit) id 07B5boHq024795; Mon, 10 Aug 2020 22:37:50 -0700 (PDT) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Mon, 10 Aug 2020 22:37:50 -0700 From: Gleb Smirnoff To: Hans Petter Selasky Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r364072 - in head/sys: netinet netinet6 Message-ID: <20200811053750.GB1307@FreeBSD.org> References: <202008101040.07AAeK4e096973@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202008101040.07AAeK4e096973@repo.freebsd.org> X-Rspamd-Queue-Id: 4BQhSP2nySz43q2 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:27348, ipnet:162.251.186.0/24, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 05:37:57 -0000 Hans, On Mon, Aug 10, 2020 at 10:40:20AM +0000, Hans Petter Selasky wrote: H> Author: hselasky H> Date: Mon Aug 10 10:40:19 2020 H> New Revision: 364072 H> URL: https://svnweb.freebsd.org/changeset/base/364072 H> H> Log: H> Use proper prototype for SYSINIT() functions. H> Mark the unused argument using the __unused macro. H> H> Discussed with: kib@ H> MFC after: 1 week H> Sponsored by: Mellanox Technologies Why just do not use the SYSINIT at all? Index: in_mcast.c =================================================================== --- in_mcast.c (revision 364098) +++ in_mcast.c (working copy) @@ -229,17 +229,10 @@ inm_is_ifp_detached(const struct in_multi *inm) * dedicated thread to avoid deadlocks when draining inm_release tasks. */ TASKQUEUE_DEFINE_THREAD(inm_free); -static struct task inm_free_task; static struct in_multi_head inm_free_list = SLIST_HEAD_INITIALIZER(); static void inm_release_task(void *arg __unused, int pending __unused); +static struct task inm_free_task = TASK_INITIALIZER(0, inm_release_task, NULL); -static void -inm_init(void *arg __unused) -{ - TASK_INIT(&inm_free_task, 0, inm_release_task, NULL); -} -SYSINIT(inm_init, SI_SUB_TASKQ, SI_ORDER_ANY, inm_init, NULL); - void inm_release_wait(void *arg __unused) { Same for inm6. -- Gleb Smirnoff From owner-svn-src-all@freebsd.org Tue Aug 11 07:05:31 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AD70237CD15; Tue, 11 Aug 2020 07:05:31 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQkPR47bcz47Gc; Tue, 11 Aug 2020 07:05:31 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 71593175A4; Tue, 11 Aug 2020 07:05:31 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07B75VVI056268; Tue, 11 Aug 2020 07:05:31 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07B75U6j056266; Tue, 11 Aug 2020 07:05:30 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <202008110705.07B75U6j056266@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Tue, 11 Aug 2020 07:05:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364099 - in head/sys: net/route netinet6 X-SVN-Group: head X-SVN-Commit-Author: melifaro X-SVN-Commit-Paths: in head/sys: net/route netinet6 X-SVN-Commit-Revision: 364099 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 07:05:31 -0000 Author: melifaro Date: Tue Aug 11 07:05:30 2020 New Revision: 364099 URL: https://svnweb.freebsd.org/changeset/base/364099 Log: Fix rib_subscribe() waitok flag by performing allocation outside epoch. Make in6_inithead() use rib_subscribe with waitok to achieve reliable subscription allocation. Reviewed by: glebius Modified: head/sys/net/route/route_ctl.c head/sys/net/route/route_ctl.h head/sys/netinet6/in6_rmx.c Modified: head/sys/net/route/route_ctl.c ============================================================================== --- head/sys/net/route/route_ctl.c Tue Aug 11 05:17:10 2020 (r364098) +++ head/sys/net/route/route_ctl.c Tue Aug 11 07:05:30 2020 (r364099) @@ -743,26 +743,26 @@ rib_notify(struct rib_head *rnh, enum rib_subscription /* * Subscribe for the changes in the routing table specified by @fibnum and * @family. - * Needs to be run in network epoch. * * Returns pointer to the subscription structure on success. */ struct rib_subscription * rib_subscribe(uint32_t fibnum, int family, rib_subscription_cb_t *f, void *arg, - enum rib_subscription_type type, int waitok) + enum rib_subscription_type type, bool waitok) { struct rib_head *rnh; struct rib_subscription *rs; + struct epoch_tracker et; int flags = M_ZERO | (waitok ? M_WAITOK : 0); - NET_EPOCH_ASSERT(); - KASSERT((fibnum < rt_numfibs), ("%s: bad fibnum", __func__)); - rnh = rt_tables_get_rnh(fibnum, family); - rs = malloc(sizeof(struct rib_subscription), M_RTABLE, flags); if (rs == NULL) return (NULL); + NET_EPOCH_ENTER(et); + KASSERT((fibnum < rt_numfibs), ("%s: bad fibnum", __func__)); + rnh = rt_tables_get_rnh(fibnum, family); + rs->func = f; rs->arg = arg; rs->type = type; @@ -770,6 +770,7 @@ rib_subscribe(uint32_t fibnum, int family, rib_subscri RIB_WLOCK(rnh); CK_STAILQ_INSERT_TAIL(&rnh->rnh_subscribers, rs, next); RIB_WUNLOCK(rnh); + NET_EPOCH_EXIT(et); return (rs); } Modified: head/sys/net/route/route_ctl.h ============================================================================== --- head/sys/net/route/route_ctl.h Tue Aug 11 05:17:10 2020 (r364098) +++ head/sys/net/route/route_ctl.h Tue Aug 11 07:05:30 2020 (r364099) @@ -78,7 +78,7 @@ typedef void rib_subscription_cb_t(struct rib_head *rn struct rib_subscription *rib_subscribe(uint32_t fibnum, int family, rib_subscription_cb_t *f, void *arg, enum rib_subscription_type type, - int waitok); + bool waitok); int rib_unsibscribe(uint32_t fibnum, int family, struct rib_subscription *rs); #endif Modified: head/sys/netinet6/in6_rmx.c ============================================================================== --- head/sys/netinet6/in6_rmx.c Tue Aug 11 05:17:10 2020 (r364098) +++ head/sys/netinet6/in6_rmx.c Tue Aug 11 07:05:30 2020 (r364099) @@ -150,8 +150,8 @@ rib6_preadd(u_int fibnum, const struct sockaddr *addr, int in6_inithead(void **head, int off, u_int fibnum) { - struct epoch_tracker et; struct rib_head *rh; + struct rib_subscription *rs; rh = rt_table_init(offsetof(struct sockaddr_in6, sin6_addr) << 3, AF_INET6, fibnum); @@ -164,12 +164,9 @@ in6_inithead(void **head, int off, u_int fibnum) #endif *head = (void *)rh; - NET_EPOCH_ENTER(et); - if (rib_subscribe(fibnum, AF_INET6, nd6_subscription_cb, NULL, - RIB_NOTIFY_IMMEDIATE, M_NOWAIT) == NULL) - log(LOG_ERR, "in6_inithead(): unable to subscribe to fib %u\n", - fibnum); - NET_EPOCH_EXIT(et); + rs = rib_subscribe(fibnum, AF_INET6, nd6_subscription_cb, NULL, + RIB_NOTIFY_IMMEDIATE, true); + KASSERT(rs != NULL, ("Unable to subscribe to fib %u\n", fibnum)); return (1); } From owner-svn-src-all@freebsd.org Tue Aug 11 07:21:33 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0B05637D4B6; Tue, 11 Aug 2020 07:21:33 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQklw6VHFz48Kx; Tue, 11 Aug 2020 07:21:32 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AAF1E178EF; Tue, 11 Aug 2020 07:21:32 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07B7LWTc064115; Tue, 11 Aug 2020 07:21:32 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07B7LWQe064113; Tue, 11 Aug 2020 07:21:32 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <202008110721.07B7LWQe064113@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Tue, 11 Aug 2020 07:21:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364100 - head/sys/net/route X-SVN-Group: head X-SVN-Commit-Author: melifaro X-SVN-Commit-Paths: head/sys/net/route X-SVN-Commit-Revision: 364100 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 07:21:33 -0000 Author: melifaro Date: Tue Aug 11 07:21:32 2020 New Revision: 364100 URL: https://svnweb.freebsd.org/changeset/base/364100 Log: Make _route() static to finish the transition to the new kpi. Discussed with: glebius Modified: head/sys/net/route/route_ctl.c head/sys/net/route/route_var.h Modified: head/sys/net/route/route_ctl.c ============================================================================== --- head/sys/net/route/route_ctl.c Tue Aug 11 07:05:30 2020 (r364099) +++ head/sys/net/route/route_ctl.c Tue Aug 11 07:21:32 2020 (r364100) @@ -76,6 +76,12 @@ struct rib_subscription { struct epoch_context epoch_ctx; }; +static int add_route(struct rib_head *rnh, struct rt_addrinfo *info, + struct rib_cmd_info *rc); +static int del_route(struct rib_head *rnh, struct rt_addrinfo *info, + struct rib_cmd_info *rc); +static int change_route(struct rib_head *, struct rt_addrinfo *, + struct rib_cmd_info *rc); static void rib_notify(struct rib_head *rnh, enum rib_subscription_type type, struct rib_cmd_info *rc); @@ -128,7 +134,7 @@ rib_add_route(uint32_t fibnum, struct rt_addrinfo *inf return (add_route(rnh, info, rc)); } -int +static int add_route(struct rib_head *rnh, struct rt_addrinfo *info, struct rib_cmd_info *rc) { @@ -389,7 +395,7 @@ rt_unlinkrte(struct rib_head *rnh, struct rt_addrinfo return (rt); } -int +static int del_route(struct rib_head *rnh, struct rt_addrinfo *info, struct rib_cmd_info *rc) { @@ -566,7 +572,7 @@ change_route_one(struct rib_head *rnh, struct rt_addri return (0); } -int +static int change_route(struct rib_head *rnh, struct rt_addrinfo *info, struct rib_cmd_info *rc) { Modified: head/sys/net/route/route_var.h ============================================================================== --- head/sys/net/route/route_var.h Tue Aug 11 07:05:30 2020 (r364099) +++ head/sys/net/route/route_var.h Tue Aug 11 07:21:32 2020 (r364100) @@ -113,12 +113,6 @@ struct radix_node *rt_mpath_unlink(struct rib_head *rn struct rt_addrinfo *info, struct rtentry *rto, int *perror); #endif struct rib_cmd_info; -int add_route(struct rib_head *rnh, struct rt_addrinfo *info, - struct rib_cmd_info *rc); -int del_route(struct rib_head *rnh, struct rt_addrinfo *info, - struct rib_cmd_info *rc); -int change_route(struct rib_head *, struct rt_addrinfo *, - struct rib_cmd_info *rc); VNET_PCPUSTAT_DECLARE(struct rtstat, rtstat); #define RTSTAT_ADD(name, val) \ From owner-svn-src-all@freebsd.org Tue Aug 11 07:23:07 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E687037DD31; Tue, 11 Aug 2020 07:23:07 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQknl5rj2z48q0; Tue, 11 Aug 2020 07:23:07 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AC09217A91; Tue, 11 Aug 2020 07:23:07 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07B7N70J068492; Tue, 11 Aug 2020 07:23:07 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07B7N7bI068491; Tue, 11 Aug 2020 07:23:07 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <202008110723.07B7N7bI068491@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Tue, 11 Aug 2020 07:23:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364101 - head/sys/net/route X-SVN-Group: head X-SVN-Commit-Author: melifaro X-SVN-Commit-Paths: head/sys/net/route X-SVN-Commit-Revision: 364101 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 07:23:08 -0000 Author: melifaro Date: Tue Aug 11 07:23:07 2020 New Revision: 364101 URL: https://svnweb.freebsd.org/changeset/base/364101 Log: Do not enter epoch in add_route(), as it is already called in epoch. Reviewed by: glebius Modified: head/sys/net/route/route_ctl.c Modified: head/sys/net/route/route_ctl.c ============================================================================== --- head/sys/net/route/route_ctl.c Tue Aug 11 07:21:32 2020 (r364100) +++ head/sys/net/route/route_ctl.c Tue Aug 11 07:23:07 2020 (r364101) @@ -144,7 +144,6 @@ add_route(struct rib_head *rnh, struct rt_addrinfo *in struct radix_node *rn; struct ifaddr *ifa; int error, flags; - struct epoch_tracker et; dst = info->rti_info[RTAX_DST]; gateway = info->rti_info[RTAX_GATEWAY]; @@ -168,9 +167,7 @@ add_route(struct rib_head *rnh, struct rt_addrinfo *in ifa_ref(info->rti_ifa); } - NET_EPOCH_ENTER(et); error = nhop_create_from_info(rnh, info, &nh); - NET_EPOCH_EXIT(et); if (error != 0) { ifa_free(info->rti_ifa); return (error); From owner-svn-src-all@freebsd.org Tue Aug 11 08:31:40 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D3FEA37FB23; Tue, 11 Aug 2020 08:31:40 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQmJr5MCMz4Cxb; Tue, 11 Aug 2020 08:31:40 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9B0651860D; Tue, 11 Aug 2020 08:31:40 +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 07B8Ve5d010342; Tue, 11 Aug 2020 08:31:40 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07B8VeDE010341; Tue, 11 Aug 2020 08:31:40 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202008110831.07B8VeDE010341@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 11 Aug 2020 08:31:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364102 - in head/sys: netinet netinet6 X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys: netinet netinet6 X-SVN-Commit-Revision: 364102 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 08:31:40 -0000 Author: hselasky Date: Tue Aug 11 08:31:40 2020 New Revision: 364102 URL: https://svnweb.freebsd.org/changeset/base/364102 Log: Use a static initializer for the multicast free tasks. This makes the SYSINIT() function updated in r364072 superfluous. Suggested by: glebius@ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/netinet/in_mcast.c head/sys/netinet6/in6_mcast.c Modified: head/sys/netinet/in_mcast.c ============================================================================== --- head/sys/netinet/in_mcast.c Tue Aug 11 07:23:07 2020 (r364101) +++ head/sys/netinet/in_mcast.c Tue Aug 11 08:31:40 2020 (r364102) @@ -229,16 +229,9 @@ inm_is_ifp_detached(const struct in_multi *inm) * dedicated thread to avoid deadlocks when draining inm_release tasks. */ TASKQUEUE_DEFINE_THREAD(inm_free); -static struct task inm_free_task; static struct in_multi_head inm_free_list = SLIST_HEAD_INITIALIZER(); static void inm_release_task(void *arg __unused, int pending __unused); - -static void -inm_init(void *arg __unused) -{ - TASK_INIT(&inm_free_task, 0, inm_release_task, NULL); -} -SYSINIT(inm_init, SI_SUB_TASKQ, SI_ORDER_ANY, inm_init, NULL); +static struct task inm_free_task = TASK_INITIALIZER(0, inm_release_task, NULL); void inm_release_wait(void *arg __unused) Modified: head/sys/netinet6/in6_mcast.c ============================================================================== --- head/sys/netinet6/in6_mcast.c Tue Aug 11 07:23:07 2020 (r364101) +++ head/sys/netinet6/in6_mcast.c Tue Aug 11 08:31:40 2020 (r364102) @@ -516,16 +516,9 @@ in6m_release(struct in6_multi *inm) * dedicated thread to avoid deadlocks when draining in6m_release tasks. */ TASKQUEUE_DEFINE_THREAD(in6m_free); -static struct task in6m_free_task; static struct in6_multi_head in6m_free_list = SLIST_HEAD_INITIALIZER(); static void in6m_release_task(void *arg __unused, int pending __unused); - -static void -in6m_init(void *arg __unused) -{ - TASK_INIT(&in6m_free_task, 0, in6m_release_task, NULL); -} -SYSINIT(in6m_init, SI_SUB_TASKQ, SI_ORDER_ANY, in6m_init, NULL); +static struct task in6m_free_task = TASK_INITIALIZER(0, in6m_release_task, NULL); void in6m_release_list_deferred(struct in6_multi_head *inmh) From owner-svn-src-all@freebsd.org Tue Aug 11 08:32:26 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B8F5237FC9E; Tue, 11 Aug 2020 08:32:26 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQmKk2xWmz4D9S; Tue, 11 Aug 2020 08:32:26 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2020.home.selasky.org (unknown [178.17.145.105]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 087B12602A3; Tue, 11 Aug 2020 10:32:23 +0200 (CEST) Subject: Re: svn commit: r364072 - in head/sys: netinet netinet6 To: Gleb Smirnoff Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202008101040.07AAeK4e096973@repo.freebsd.org> <20200811053750.GB1307@FreeBSD.org> From: Hans Petter Selasky Message-ID: Date: Tue, 11 Aug 2020 10:32:01 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200811053750.GB1307@FreeBSD.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4BQmKk2xWmz4D9S X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; ASN(0.00)[asn:24940, ipnet:88.99.0.0/16, country:DE]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 08:32:26 -0000 On 2020-08-11 07:37, Gleb Smirnoff wrote: > Hans, > > On Mon, Aug 10, 2020 at 10:40:20AM +0000, Hans Petter Selasky wrote: > H> Author: hselasky > H> Date: Mon Aug 10 10:40:19 2020 > H> New Revision: 364072 > H> URL: https://svnweb.freebsd.org/changeset/base/364072 > H> > H> Log: > H> Use proper prototype for SYSINIT() functions. > H> Mark the unused argument using the __unused macro. > H> > H> Discussed with: kib@ > H> MFC after: 1 week > H> Sponsored by: Mellanox Technologies > > Why just do not use the SYSINIT at all? > Good point. See: https://svnweb.freebsd.org/changeset/base/364102 --HPS From owner-svn-src-all@freebsd.org Tue Aug 11 08:42:28 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E8CC137FF37; Tue, 11 Aug 2020 08:42:28 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQmYJ5yQnz4Dpc; Tue, 11 Aug 2020 08:42:28 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AFD70185A7; Tue, 11 Aug 2020 08:42:28 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07B8gSEV017510; Tue, 11 Aug 2020 08:42:28 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07B8gOUT016869; Tue, 11 Aug 2020 08:42:24 GMT (envelope-from manu@FreeBSD.org) Message-Id: <202008110842.07B8gOUT016869@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Tue, 11 Aug 2020 08:42:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364103 - in head: . release/packages X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: in head: . release/packages X-SVN-Commit-Revision: 364103 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 08:42:29 -0000 Author: manu Date: Tue Aug 11 08:42:24 2020 New Revision: 364103 URL: https://svnweb.freebsd.org/changeset/base/364103 Log: pkgbase: Add PKG_NAME_PREFIX, PKG_MAINTAINER and PKG_WWW This is useful for downstream users to customize the packages. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D26019 Modified: head/Makefile.inc1 head/release/packages/binutils.ucl head/release/packages/caroot.ucl head/release/packages/clang.ucl head/release/packages/gdb.ucl head/release/packages/generate-ucl.sh head/release/packages/groff.ucl head/release/packages/jail.ucl head/release/packages/kernel.ucl head/release/packages/lld.ucl head/release/packages/lldb.ucl head/release/packages/runtime.ucl head/release/packages/ssh.ucl head/release/packages/svn.ucl head/release/packages/template.ucl head/release/packages/unbound.ucl head/release/packages/utilities.ucl Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Tue Aug 11 08:31:40 2020 (r364102) +++ head/Makefile.inc1 Tue Aug 11 08:42:24 2020 (r364103) @@ -552,6 +552,13 @@ SOURCE_DATE_EPOCH= ${TIMEEPOCHNOW:gmtime} SOURCE_DATE_EPOCH= ${PKG_TIMESTAMP} .endif +PKG_NAME_PREFIX?= FreeBSD +PKG_MAINTAINER?= re@FreeBSD.org +PKG_WWW?= https://www.FreeBSD.org +.export PKG_NAME_PREFIX +.export PKG_MAINTAINER +.export PKG_WWW + .if !defined(_MKSHOWCONFIG) _CPUTYPE!= MAKEFLAGS= CPUTYPE=${_TARGET_CPUTYPE} ${MAKE} -f /dev/null \ -m ${.CURDIR}/share/mk MK_AUTO_OBJ=no -V CPUTYPE @@ -1906,6 +1913,9 @@ create-kernel-packages-flavor${flavor:C,^""$,${_defaul -e "s/%COMMENT%/FreeBSD ${INSTALLKERNEL} kernel ${flavor}/" \ -e "s/%DESC%/FreeBSD ${INSTALLKERNEL} kernel ${flavor}/" \ -e "s/ %VCS_REVISION%/${VCS_REVISION}/" \ + -e "s/%PKG_NAME_PREFIX%/${PKG_NAME_PREFIX}/" \ + -e "s/%PKG_MAINTAINER%/${PKG_MAINTAINER}/" \ + -e "s/%PKG_WWW%/${PKG_WWW}/" \ ${SRCDIR}/release/packages/kernel.ucl \ > ${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.ucl ; \ awk -F\" ' \ @@ -1939,6 +1949,9 @@ create-kernel-packages-extra-flavor${flavor:C,^""$,${_ -e "s/%COMMENT%/FreeBSD ${_kernel} kernel ${flavor}/" \ -e "s/%DESC%/FreeBSD ${_kernel} kernel ${flavor}/" \ -e "s/ %VCS_REVISION%/${VCS_REVISION}/" \ + -e "s/%PKG_NAME_PREFIX%/${PKG_NAME_PREFIX}/" \ + -e "s/%PKG_MAINTAINER%/${PKG_MAINTAINER}/" \ + -e "s/%PKG_WWW%/${PKG_WWW}/" \ ${SRCDIR}/release/packages/kernel.ucl \ > ${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.ucl ; \ awk -F\" ' \ Modified: head/release/packages/binutils.ucl ============================================================================== --- head/release/packages/binutils.ucl Tue Aug 11 08:31:40 2020 (r364102) +++ head/release/packages/binutils.ucl Tue Aug 11 08:42:24 2020 (r364103) @@ -2,13 +2,13 @@ # $FreeBSD$ # -name = "FreeBSD-%PKGNAME%" +name = "%PKG_NAME_PREFIX%-%PKGNAME%" origin = "base" version = "%VERSION%" comment = "%COMMENT%" categories = [ base ] -maintainer = "re@FreeBSD.org" -www = "https://www.FreeBSD.org" +maintainer = "%PKG_MAINTAINER%" +www = "%PKG_WWW%" prefix = "/" licenselogic = "single" licenses = [ GPLv2 ] Modified: head/release/packages/caroot.ucl ============================================================================== --- head/release/packages/caroot.ucl Tue Aug 11 08:31:40 2020 (r364102) +++ head/release/packages/caroot.ucl Tue Aug 11 08:42:24 2020 (r364103) @@ -2,13 +2,13 @@ # $FreeBSD$ # -name = "FreeBSD-%PKGNAME%" +name = "%PKG_NAME_PREFIX%-%PKGNAME%" origin = "base" version = "%VERSION%" comment = "%COMMENT%" categories = [ base ] -maintainer = "re@FreeBSD.org" -www = "https://www.FreeBSD.org" +maintainer = %PKG_MAINTAINER% +www = "%PKG_WWW%" prefix = "/" licenselogic = "single" licenses = [ BSD2CLAUSE ] Modified: head/release/packages/clang.ucl ============================================================================== --- head/release/packages/clang.ucl Tue Aug 11 08:31:40 2020 (r364102) +++ head/release/packages/clang.ucl Tue Aug 11 08:42:24 2020 (r364103) @@ -2,13 +2,13 @@ # $FreeBSD$ # -name = "FreeBSD-%PKGNAME%" +name = "%PKG_NAME_PREFIX%-%PKGNAME%" origin = "base" version = "%VERSION%" comment = "%COMMENT%" categories = [ base ] -maintainer = "re@FreeBSD.org" -www = "https://www.FreeBSD.org" +maintainer = "%PKG_MAINTAINER%" +www = "%PKG_WWW%" prefix = "/" licenselogic = "single" licenses = [ NCSA ] Modified: head/release/packages/gdb.ucl ============================================================================== --- head/release/packages/gdb.ucl Tue Aug 11 08:31:40 2020 (r364102) +++ head/release/packages/gdb.ucl Tue Aug 11 08:42:24 2020 (r364103) @@ -2,13 +2,13 @@ # $FreeBSD$ # -name = "FreeBSD-%PKGNAME%" +name = "%PKG_NAME_PREFIX%-%PKGNAME%" origin = "base" version = "%VERSION%" comment = "%COMMENT%" categories = [ base ] -maintainer = "re@FreeBSD.org" -www = "https://www.FreeBSD.org" +maintainer = "%PKG_MAINTAINER%" +www = "%PKG_WWW%" prefix = "/" licenselogic = "single" licenses = [ GPLv2 ] Modified: head/release/packages/generate-ucl.sh ============================================================================== --- head/release/packages/generate-ucl.sh Tue Aug 11 08:31:40 2020 (r364102) +++ head/release/packages/generate-ucl.sh Tue Aug 11 08:42:24 2020 (r364103) @@ -146,6 +146,9 @@ EOF -e "s/%COMMENT%/${comment}/" \ -e "s/%DESC%/${desc}/" \ -e "s/%CAP_MKDB_ENDIAN%/${cap_arg}/g" \ + -e "s/%PKG_NAME_PREFIX%/${PKG_NAME_PREFIX}/" \ + -e "s/%PKG_WWW%/${PKG_WWW}/" \ + -e "s/%PKG_MAINTAINER%/${PKG_MAINTAINER}/" \ ${uclfile} return 0 } Modified: head/release/packages/groff.ucl ============================================================================== --- head/release/packages/groff.ucl Tue Aug 11 08:31:40 2020 (r364102) +++ head/release/packages/groff.ucl Tue Aug 11 08:42:24 2020 (r364103) @@ -2,13 +2,13 @@ # $FreeBSD$ # -name = "FreeBSD-%PKGNAME%" +name = "%PKG_NAME_PREFIX%-%PKGNAME%" origin = "base" version = "%VERSION%" comment = "%COMMENT%" categories = [ base ] -maintainer = "re@FreeBSD.org" -www = "https://www.FreeBSD.org" +maintainer = "%PKG_MAINTAINER%" +www = "%PKG_WWW%" prefix = "/" licenselogic = "single" licenses = [ GPLv2 ] Modified: head/release/packages/jail.ucl ============================================================================== --- head/release/packages/jail.ucl Tue Aug 11 08:31:40 2020 (r364102) +++ head/release/packages/jail.ucl Tue Aug 11 08:42:24 2020 (r364103) @@ -2,13 +2,13 @@ # $FreeBSD$ # -name = "FreeBSD-%PKGNAME%" +name = "%PKG_NAME_PREFIX%-%PKGNAME%" origin = "base" version = "%VERSION%" comment = "%COMMENT%" categories = [ base ] -maintainer = "re@FreeBSD.org" -www = "https://www.FreeBSD.org" +maintainer = "%PKG_MAINTAINER%" +www = "%PKG_WWW%" prefix = "/" vital = true licenselogic = "single" Modified: head/release/packages/kernel.ucl ============================================================================== --- head/release/packages/kernel.ucl Tue Aug 11 08:31:40 2020 (r364102) +++ head/release/packages/kernel.ucl Tue Aug 11 08:42:24 2020 (r364103) @@ -2,13 +2,13 @@ # $FreeBSD$ # -name = "FreeBSD-%PKGNAME%" +name = "%PKG_NAME_PREFIX%-%PKGNAME%" origin = "base" version = "%VERSION%" comment = "%COMMENT%" categories = [ base ] -maintainer = "re@FreeBSD.org" -www = "https://www.FreeBSD.org" +maintainer = "%PKG_MAINTAINER%" +www = "%PKG_WWW%" prefix = "/" licenselogic = "single" licenses = [ BSD2CLAUSE ] Modified: head/release/packages/lld.ucl ============================================================================== --- head/release/packages/lld.ucl Tue Aug 11 08:31:40 2020 (r364102) +++ head/release/packages/lld.ucl Tue Aug 11 08:42:24 2020 (r364103) @@ -2,13 +2,13 @@ # $FreeBSD$ # -name = "FreeBSD-%PKGNAME%" +name = "%PKG_NAME_PREFIX%-%PKGNAME%" origin = "base" version = "%VERSION%" comment = "%COMMENT%" categories = [ base ] -maintainer = "re@FreeBSD.org" -www = "https://www.FreeBSD.org" +maintainer = "%PKG_MAINTAINER%" +www = "%PKG_WWW%" prefix = "/" licenselogic = "single" licenses = [ NCSA ] Modified: head/release/packages/lldb.ucl ============================================================================== --- head/release/packages/lldb.ucl Tue Aug 11 08:31:40 2020 (r364102) +++ head/release/packages/lldb.ucl Tue Aug 11 08:42:24 2020 (r364103) @@ -2,13 +2,13 @@ # $FreeBSD$ # -name = "FreeBSD-%PKGNAME%" +name = "%PKG_NAME_PREFIX%-%PKGNAME%" origin = "base" version = "%VERSION%" comment = "%COMMENT%" categories = [ base ] -maintainer = "re@FreeBSD.org" -www = "https://www.FreeBSD.org" +maintainer = "%PKG_MAINTAINER%" +www = "%PKG_WWW%" prefix = "/" licenselogic = "single" licenses = [ NCSA ] Modified: head/release/packages/runtime.ucl ============================================================================== --- head/release/packages/runtime.ucl Tue Aug 11 08:31:40 2020 (r364102) +++ head/release/packages/runtime.ucl Tue Aug 11 08:42:24 2020 (r364103) @@ -2,13 +2,13 @@ # $FreeBSD$ # -name = "FreeBSD-%PKGNAME%" +name = "%PKG_NAME_PREFIX%-%PKGNAME%" origin = "base" version = "%VERSION%" comment = "%COMMENT%" categories = [ base ] -maintainer = "re@FreeBSD.org" -www = "https://www.FreeBSD.org" +maintainer = "%PKG_MAINTAINER%" +www = "%PKG_WWW%" prefix = "/" vital = true licenselogic = "single" Modified: head/release/packages/ssh.ucl ============================================================================== --- head/release/packages/ssh.ucl Tue Aug 11 08:31:40 2020 (r364102) +++ head/release/packages/ssh.ucl Tue Aug 11 08:42:24 2020 (r364103) @@ -2,13 +2,13 @@ # $FreeBSD$ # -name = "FreeBSD-%PKGNAME%" +name = "%PKG_NAME_PREFIX%-%PKGNAME%" origin = "base" version = "%VERSION%" comment = "%COMMENT%" categories = [ base ] -maintainer = "re@FreeBSD.org" -www = "https://www.FreeBSD.org" +maintainer = "%PKG_MAINTAINER%" +www = "%PKG_WWW%" prefix = "/" licenselogic = "single" licenses = [ ISCL ] Modified: head/release/packages/svn.ucl ============================================================================== --- head/release/packages/svn.ucl Tue Aug 11 08:31:40 2020 (r364102) +++ head/release/packages/svn.ucl Tue Aug 11 08:42:24 2020 (r364103) @@ -2,13 +2,13 @@ # $FreeBSD$ # -name = "FreeBSD-%PKGNAME%" +name = "%PKG_NAME_PREFIX%-%PKGNAME%" origin = "base" version = "%VERSION%" comment = "%COMMENT%" categories = [ base ] -maintainer = "re@FreeBSD.org" -www = "https://www.FreeBSD.org" +maintainer = "%PKG_MAINTAINER%" +www = "%PKG_WWW%" prefix = "/" licenselogic = "single" licenses = [ APACHE20 ] Modified: head/release/packages/template.ucl ============================================================================== --- head/release/packages/template.ucl Tue Aug 11 08:31:40 2020 (r364102) +++ head/release/packages/template.ucl Tue Aug 11 08:42:24 2020 (r364103) @@ -2,13 +2,13 @@ # $FreeBSD$ # -name = "FreeBSD-%PKGNAME%" +name = "%PKG_NAME_PREFIX%-%PKGNAME%" origin = "base" version = "%VERSION%" comment = "%COMMENT%" categories = [ base ] -maintainer = "re@FreeBSD.org" -www = "https://www.FreeBSD.org" +maintainer = "%PKG_MAINTAINER%" +www = "%PKG_WWW%" prefix = "/" licenselogic = "single" licenses = [ BSD2CLAUSE ] Modified: head/release/packages/unbound.ucl ============================================================================== --- head/release/packages/unbound.ucl Tue Aug 11 08:31:40 2020 (r364102) +++ head/release/packages/unbound.ucl Tue Aug 11 08:42:24 2020 (r364103) @@ -2,13 +2,13 @@ # $FreeBSD$ # -name = "FreeBSD-%PKGNAME%" +name = "%PKG_NAME_PREFIX%-%PKGNAME%" origin = "base" version = "%VERSION%" comment = "%COMMENT%" categories = [ base ] -maintainer = "re@FreeBSD.org" -www = "https://www.FreeBSD.org" +maintainer = "%PKG_MAINTAINER%" +www = "%PKG_WWW%" prefix = "/" licenselogic = "single" licenses = [ BSD4CLAUSE ] Modified: head/release/packages/utilities.ucl ============================================================================== --- head/release/packages/utilities.ucl Tue Aug 11 08:31:40 2020 (r364102) +++ head/release/packages/utilities.ucl Tue Aug 11 08:42:24 2020 (r364103) @@ -2,13 +2,13 @@ # $FreeBSD$ # -name = "FreeBSD-%PKGNAME%" +name = "%PKG_NAME_PREFIX%-%PKGNAME%" origin = "base" version = "%VERSION%" comment = "%COMMENT% %VCS_REVISION%" categories = [ base ] -maintainer = "re@FreeBSD.org" -www = "https://www.FreeBSD.org" +maintainer = "%PKG_MAINTAINER%" +www = "%PKG_WWW%" prefix = "/" vital = true licenselogic = "single" From owner-svn-src-all@freebsd.org Tue Aug 11 10:08:00 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 643AD3A98CA; Tue, 11 Aug 2020 10:08:00 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQpS024CKz4JT0; Tue, 11 Aug 2020 10:08:00 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2B0A419629; Tue, 11 Aug 2020 10:08:00 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07BA80VT067153; Tue, 11 Aug 2020 10:08:00 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07BA7xmW067150; Tue, 11 Aug 2020 10:07:59 GMT (envelope-from manu@FreeBSD.org) Message-Id: <202008111007.07BA7xmW067150@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Tue, 11 Aug 2020 10:07:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364104 - in head: . release/packages X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: in head: . release/packages X-SVN-Commit-Revision: 364104 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 10:08:00 -0000 Author: manu Date: Tue Aug 11 10:07:59 2020 New Revision: 364104 URL: https://svnweb.freebsd.org/changeset/base/364104 Log: pkgbase: Replace / with | for PKG_WWW PKG_WWW contain / char, replace the delimiter by a '|'. Reported by: 0mp Modified: head/Makefile.inc1 head/release/packages/generate-ucl.sh Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Tue Aug 11 08:42:24 2020 (r364103) +++ head/Makefile.inc1 Tue Aug 11 10:07:59 2020 (r364104) @@ -1915,7 +1915,7 @@ create-kernel-packages-flavor${flavor:C,^""$,${_defaul -e "s/ %VCS_REVISION%/${VCS_REVISION}/" \ -e "s/%PKG_NAME_PREFIX%/${PKG_NAME_PREFIX}/" \ -e "s/%PKG_MAINTAINER%/${PKG_MAINTAINER}/" \ - -e "s/%PKG_WWW%/${PKG_WWW}/" \ + -e "s|%PKG_WWW%|${PKG_WWW}|" \ ${SRCDIR}/release/packages/kernel.ucl \ > ${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.ucl ; \ awk -F\" ' \ @@ -1951,7 +1951,7 @@ create-kernel-packages-extra-flavor${flavor:C,^""$,${_ -e "s/ %VCS_REVISION%/${VCS_REVISION}/" \ -e "s/%PKG_NAME_PREFIX%/${PKG_NAME_PREFIX}/" \ -e "s/%PKG_MAINTAINER%/${PKG_MAINTAINER}/" \ - -e "s/%PKG_WWW%/${PKG_WWW}/" \ + -e "s|%PKG_WWW%|${PKG_WWW}|" \ ${SRCDIR}/release/packages/kernel.ucl \ > ${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.ucl ; \ awk -F\" ' \ Modified: head/release/packages/generate-ucl.sh ============================================================================== --- head/release/packages/generate-ucl.sh Tue Aug 11 08:42:24 2020 (r364103) +++ head/release/packages/generate-ucl.sh Tue Aug 11 10:07:59 2020 (r364104) @@ -147,7 +147,7 @@ EOF -e "s/%DESC%/${desc}/" \ -e "s/%CAP_MKDB_ENDIAN%/${cap_arg}/g" \ -e "s/%PKG_NAME_PREFIX%/${PKG_NAME_PREFIX}/" \ - -e "s/%PKG_WWW%/${PKG_WWW}/" \ + -e "s|%PKG_WWW%|${PKG_WWW}|" \ -e "s/%PKG_MAINTAINER%/${PKG_MAINTAINER}/" \ ${uclfile} return 0 From owner-svn-src-all@freebsd.org Tue Aug 11 10:41:37 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8F6063A9EEE; Tue, 11 Aug 2020 10:41:37 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQqBn2NmCz4LpN; Tue, 11 Aug 2020 10:41:37 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 20F1819E87; Tue, 11 Aug 2020 10:41:37 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07BAfaI6088745; Tue, 11 Aug 2020 10:41:36 GMT (envelope-from gbe@FreeBSD.org) Received: (from gbe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07BAfab7088744; Tue, 11 Aug 2020 10:41:36 GMT (envelope-from gbe@FreeBSD.org) Message-Id: <202008111041.07BAfab7088744@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gbe set sender to gbe@FreeBSD.org using -f From: Gordon Bergling Date: Tue, 11 Aug 2020 10:41: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: r364105 - stable/12/usr.sbin/iovctl X-SVN-Group: stable-12 X-SVN-Commit-Author: gbe X-SVN-Commit-Paths: stable/12/usr.sbin/iovctl X-SVN-Commit-Revision: 364105 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 10:41:37 -0000 Author: gbe (doc committer) Date: Tue Aug 11 10:41:36 2020 New Revision: 364105 URL: https://svnweb.freebsd.org/changeset/base/364105 Log: MFC r363830: iovctl.conf(5): Use Lk macro for the URL of the UCL website PR: 248334 Submitted by: chuck at tuffli dot net Reviewed by: bcr, 0mp Approved by: bcr, 0mp Differential Revision: https://reviews.freebsd.org/D25891 Modified: stable/12/usr.sbin/iovctl/iovctl.conf.5 Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/iovctl/iovctl.conf.5 ============================================================================== --- stable/12/usr.sbin/iovctl/iovctl.conf.5 Tue Aug 11 10:07:59 2020 (r364104) +++ stable/12/usr.sbin/iovctl/iovctl.conf.5 Tue Aug 11 10:41:36 2020 (r364105) @@ -51,7 +51,7 @@ The .Nm file uses UCL format. UCL syntax is documented at the official UCL website: -http://github.com/vstakhov/libucl. +.Lk http://github.com/vstakhov/libucl . .Pp There are three types of sections in the .Nm From owner-svn-src-all@freebsd.org Tue Aug 11 10:56:44 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B8F013AAA10; Tue, 11 Aug 2020 10:56:44 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQqXD4XyLz4Mln; Tue, 11 Aug 2020 10:56:44 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 804AC1A109; Tue, 11 Aug 2020 10:56:44 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07BAuiT4097417; Tue, 11 Aug 2020 10:56:44 GMT (envelope-from gbe@FreeBSD.org) Received: (from gbe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07BAuiuE097416; Tue, 11 Aug 2020 10:56:44 GMT (envelope-from gbe@FreeBSD.org) Message-Id: <202008111056.07BAuiuE097416@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gbe set sender to gbe@FreeBSD.org using -f From: Gordon Bergling Date: Tue, 11 Aug 2020 10:56: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: r364106 - stable/12/lib/libc/gen X-SVN-Group: stable-12 X-SVN-Commit-Author: gbe X-SVN-Commit-Paths: stable/12/lib/libc/gen X-SVN-Commit-Revision: 364106 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 10:56:44 -0000 Author: gbe (doc committer) Date: Tue Aug 11 10:56:44 2020 New Revision: 364106 URL: https://svnweb.freebsd.org/changeset/base/364106 Log: MFC r363829: directory(3): Add an ERRORS section - Add an ERRORS section for opendir(3) and closedir(3) - Document also the errors of readdir(3), readdir_r(3) and telldir(3) - Convert the code sample into an EXAMPLES section PR: 75711 Submitted by: abc Reviewed by: 0mp, bcr, jilles Approved by: 0mp, bcr, jilles Obtained from: partial from OpenBSD Differential Revision: https://reviews.freebsd.org/D25892 Modified: stable/12/lib/libc/gen/directory.3 Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libc/gen/directory.3 ============================================================================== --- stable/12/lib/libc/gen/directory.3 Tue Aug 11 10:41:36 2020 (r364105) +++ stable/12/lib/libc/gen/directory.3 Tue Aug 11 10:56:44 2020 (r364106) @@ -28,7 +28,7 @@ .\" @(#)directory.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd April 30, 2019 +.Dd August 1, 2020 .Dt DIRECTORY 3 .Os .Sh NAME @@ -242,7 +242,7 @@ returns the integer file descriptor associated with th .Em directory stream , see .Xr open 2 . -.Pp +.Sh EXAMPLES Sample code which searches a directory for entry ``name'' is: .Bd -literal -offset indent dirp = opendir("."); @@ -258,6 +258,76 @@ while ((dp = readdir(dirp)) != NULL) { (void)closedir(dirp); return (NOT_FOUND); .Ed +.Sh ERRORS +The +.Fn opendir +function will fail if: +.Bl -tag -width Er +.It Bq Er EACCES +Search permission is denied for the component of the path prefix of +.Fa filename +or read permission is denied for +.Fa filename . +.It Bq Er ELOOP +A loop exists in symbolic links encountered during resolution of the +.Fa filename +argument. +.It Bq Er ENAMETOOLONG +The length of the +.Fa filename +argument exceeds +.Brq Dv PATH_MAX +or +a pathname component is longer than +.Brq Dv NAME_MAX . +.It Bq Er ENOENT +A component of +.Fa filename +does not name an existing directory or +.Fa filename +is an empty string. +.It Bq Er ENOTDIR +A component of +.Fa filename +is not a directory. +.El +.Pp +The +.Fn fdopendir +function will fail if: +.Bl -tag -width Er +.It Bq Er EBADF +The +.Fa fd +argument is not a valid file descriptor open for reading. +.It Bq Er ENOTDIR +The descriptor +.Fa fd +is not associated with a directory. +.El +.Pp +The +.Fn readdir +and +.Fn readdir_r +functions may also fail and set +.Va errno +for any of the errors specified for the routine +.Xr getdents 2 . +.Pp +The +.Fn telldir +function may also fail and set +.Va errno +for any of the errors specified for the routine +.Xr realloc 3 . +.Pp +The +.Fn closedir +function may also fail and set +.Va errno +for any of the errors specified for the routine +.Xr close 2 . .Sh SEE ALSO .Xr close 2 , .Xr lseek 2 , From owner-svn-src-all@freebsd.org Tue Aug 11 11:32:44 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C8FA83AB14F; Tue, 11 Aug 2020 11:32: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQrKm4zsWz4PyY; Tue, 11 Aug 2020 11:32: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 8E3981A5B1; Tue, 11 Aug 2020 11:32: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 07BBWiQQ022306; Tue, 11 Aug 2020 11:32:44 GMT (envelope-from eugen@FreeBSD.org) Received: (from eugen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07BBWiDc022305; Tue, 11 Aug 2020 11:32:44 GMT (envelope-from eugen@FreeBSD.org) Message-Id: <202008111132.07BBWiDc022305@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eugen set sender to eugen@FreeBSD.org using -f From: Eugene Grosbein Date: Tue, 11 Aug 2020 11:32: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: r364107 - stable/12/usr.bin/xinstall X-SVN-Group: stable-12 X-SVN-Commit-Author: eugen X-SVN-Commit-Paths: stable/12/usr.bin/xinstall X-SVN-Commit-Revision: 364107 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 11:32:44 -0000 Author: eugen Date: Tue Aug 11 11:32:44 2020 New Revision: 364107 URL: https://svnweb.freebsd.org/changeset/base/364107 Log: MFC r363064,363067,363081,363136: optimize install(1) a bit. Currently, "install -s -S" behaviour is inefficient for upgrade. First it finds that destination file already exists and copies source file to temporary file. Then it calls strip(1) with name of temporary file as single agrument and our strip(1) creates another temporary file in the /tmp (or TMPDIR) making another copy that is finally copied to DESTDIR third time. Meantime, strip(1) has an option "-o dst" to specify destination so install(1) is allowed to skip initial copying from obj to DESTDIR. This change makes it do so. This optimization descreases total amount of data sent to both of /tmp and DESTDIR during "make installworld" by 32% or so. See the differential for details. Differential Revision: https://reviews.freebsd.org/D25551 Modified: stable/12/usr.bin/xinstall/xinstall.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.bin/xinstall/xinstall.c ============================================================================== --- stable/12/usr.bin/xinstall/xinstall.c Tue Aug 11 10:56:44 2020 (r364106) +++ stable/12/usr.bin/xinstall/xinstall.c Tue Aug 11 11:32:44 2020 (r364107) @@ -136,7 +136,7 @@ static void install_dir(char *); static void metadata_log(const char *, const char *, struct timespec *, const char *, const char *, off_t); static int parseid(const char *, id_t *); -static void strip(const char *); +static int strip(const char *, int, const char *, char **); static int trymmap(int); static void usage(void); @@ -756,12 +756,13 @@ install(const char *from_name, const char *to_name, u_ { struct stat from_sb, temp_sb, to_sb; struct timespec tsb[2]; - int devnull, files_match, from_fd, serrno, target; + int devnull, files_match, from_fd, serrno, stripped, target; int tempcopy, temp_fd, to_fd; char backup[MAXPATHLEN], *p, pathbuf[MAXPATHLEN], tempfile[MAXPATHLEN]; char *digestresult; - files_match = 0; + digestresult = NULL; + files_match = stripped = 0; from_fd = -1; to_fd = -1; @@ -847,19 +848,24 @@ install(const char *from_name, const char *to_name, u_ (void)printf("install: %s -> %s\n", from_name, to_name); } - if (!devnull) - digestresult = copy(from_fd, from_name, to_fd, - tempcopy ? tempfile : to_name, from_sb.st_size); - else - digestresult = NULL; + if (!devnull) { + if (dostrip) + stripped = strip(tempcopy ? tempfile : to_name, + to_fd, from_name, &digestresult); + if (!stripped) + digestresult = copy(from_fd, from_name, to_fd, + tempcopy ? tempfile : to_name, from_sb.st_size); + } } if (dostrip) { - strip(tempcopy ? tempfile : to_name); + if (!stripped) + (void)strip(tempcopy ? tempfile : to_name, to_fd, + NULL, &digestresult); /* - * Re-open our fd on the target, in case we used a strip - * that does not work in-place -- like GNU binutils strip. + * Re-open our fd on the target, in case + * we did not strip in-place. */ close(to_fd); to_fd = open(tempcopy ? tempfile : to_name, O_RDONLY, 0); @@ -1046,7 +1052,9 @@ install(const char *from_name, const char *to_name, u_ /* * compare -- - * compare two files; non-zero means files differ + * Compare two files; non-zero means files differ. + * Compute digest and return its address in *dresp + * unless it points to pre-computed digest. */ static int compare(int from_fd, const char *from_name __unused, size_t from_len, @@ -1055,15 +1063,17 @@ compare(int from_fd, const char *from_name __unused, s { char *p, *q; int rv; - int done_compare; + int do_digest, done_compare; DIGEST_CTX ctx; rv = 0; if (from_len != to_len) return 1; + do_digest = (digesttype != DIGEST_NONE && dresp != NULL && + *dresp == NULL); if (from_len <= MAX_CMP_SIZE) { - if (dresp != NULL) + if (do_digest) digest_init(&ctx); done_compare = 0; if (trymmap(from_fd) && trymmap(to_fd)) { @@ -1079,7 +1089,7 @@ compare(int from_fd, const char *from_name __unused, s } rv = memcmp(p, q, from_len); - if (dresp != NULL) + if (do_digest) digest_update(&ctx, p, from_len); munmap(p, from_len); munmap(q, from_len); @@ -1106,7 +1116,8 @@ compare(int from_fd, const char *from_name __unused, s rv = 1; /* out of sync */ } else rv = 1; /* read failure */ - digest_update(&ctx, buf1, n1); + if (do_digest) + digest_update(&ctx, buf1, n1); } lseek(from_fd, 0, SEEK_SET); lseek(to_fd, 0, SEEK_SET); @@ -1114,7 +1125,7 @@ compare(int from_fd, const char *from_name __unused, s } else rv = 1; /* don't bother in this case */ - if (dresp != NULL) { + if (do_digest) { if (rv == 0) *dresp = digest_end(&ctx, NULL); else @@ -1287,22 +1298,34 @@ copy(int from_fd, const char *from_name, int to_fd, co /* * strip -- - * use strip(1) to strip the target file + * Use strip(1) to strip the target file. + * Just invoke strip(1) on to_name if from_name is NULL, else try + * to run "strip -o to_name -- from_name" and return 0 on failure. + * Return 1 on success and assign result of digest_file(to_name) + * to *dresp. */ -static void -strip(const char *to_name) +static int +strip(const char *to_name, int to_fd, const char *from_name, char **dresp) { const char *stripbin; - const char *args[3]; + const char *args[6]; pid_t pid; - int error, status; + int error, serrno, status; stripbin = getenv("STRIPBIN"); if (stripbin == NULL) stripbin = "strip"; args[0] = stripbin; - args[1] = to_name; - args[2] = NULL; + if (from_name == NULL) { + args[1] = to_name; + args[2] = NULL; + } else { + args[1] = "-o"; + args[2] = to_name; + args[3] = "--"; + args[4] = from_name; + args[5] = NULL; + } error = posix_spawnp(&pid, stripbin, NULL, NULL, __DECONST(char **, args), environ); if (error != 0) { @@ -1317,10 +1340,21 @@ strip(const char *to_name) /* NOTREACHED */ } if (status != 0) { + if (from_name != NULL) + return (0); (void)unlink(to_name); errx(EX_SOFTWARE, "strip command %s failed on %s", stripbin, to_name); } + if (from_name != NULL && safecopy && fsync(to_fd) == -1) { + serrno = errno; + (void)unlink(to_name); + errno = serrno; + err(EX_OSERR, "fsync failed for %s", to_name); + } + if (dresp != NULL) + *dresp = digest_file(to_name); + return (1); } /* From owner-svn-src-all@freebsd.org Tue Aug 11 11:33:58 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D54E63AB1FB; Tue, 11 Aug 2020 11:33:58 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQrMB5GmCz4Ptn; Tue, 11 Aug 2020 11:33:58 +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 979B81A9CA; Tue, 11 Aug 2020 11:33:58 +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 07BBXw87022444; Tue, 11 Aug 2020 11:33:58 GMT (envelope-from eugen@FreeBSD.org) Received: (from eugen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07BBXwiW022443; Tue, 11 Aug 2020 11:33:58 GMT (envelope-from eugen@FreeBSD.org) Message-Id: <202008111133.07BBXwiW022443@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eugen set sender to eugen@FreeBSD.org using -f From: Eugene Grosbein Date: Tue, 11 Aug 2020 11:33:58 +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: r364108 - stable/11/usr.bin/xinstall X-SVN-Group: stable-11 X-SVN-Commit-Author: eugen X-SVN-Commit-Paths: stable/11/usr.bin/xinstall X-SVN-Commit-Revision: 364108 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 11:33:58 -0000 Author: eugen Date: Tue Aug 11 11:33:58 2020 New Revision: 364108 URL: https://svnweb.freebsd.org/changeset/base/364108 Log: MFC r363064,363067,363081,363136: optimize install(1) a bit. Currently, "install -s -S" behaviour is inefficient for upgrade. First it finds that destination file already exists and copies source file to temporary file. Then it calls strip(1) with name of temporary file as single agrument and our strip(1) creates another temporary file in the /tmp (or TMPDIR) making another copy that is finally copied to DESTDIR third time. Meantime, strip(1) has an option "-o dst" to specify destination so install(1) is allowed to skip initial copying from obj to DESTDIR. This change makes it do so. This optimization descreases total amount of data sent to both of /tmp and DESTDIR during "make installworld" by 32% or so. See the differential for details. Differential Revision: https://reviews.freebsd.org/D25551 Modified: stable/11/usr.bin/xinstall/xinstall.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/xinstall/xinstall.c ============================================================================== --- stable/11/usr.bin/xinstall/xinstall.c Tue Aug 11 11:32:44 2020 (r364107) +++ stable/11/usr.bin/xinstall/xinstall.c Tue Aug 11 11:33:58 2020 (r364108) @@ -134,7 +134,7 @@ static void install_dir(char *); static void metadata_log(const char *, const char *, struct timespec *, const char *, const char *, off_t); static int parseid(const char *, id_t *); -static void strip(const char *); +static int strip(const char *, int, const char *, char **); static int trymmap(int); static void usage(void); @@ -750,12 +750,13 @@ install(const char *from_name, const char *to_name, u_ { struct stat from_sb, temp_sb, to_sb; struct timespec tsb[2]; - int devnull, files_match, from_fd, serrno, target; + int devnull, files_match, from_fd, serrno, stripped, target; int tempcopy, temp_fd, to_fd; char backup[MAXPATHLEN], *p, pathbuf[MAXPATHLEN], tempfile[MAXPATHLEN]; char *digestresult; - files_match = 0; + digestresult = NULL; + files_match = stripped = 0; from_fd = -1; to_fd = -1; @@ -839,19 +840,24 @@ install(const char *from_name, const char *to_name, u_ (void)printf("install: %s -> %s\n", from_name, to_name); } - if (!devnull) - digestresult = copy(from_fd, from_name, to_fd, - tempcopy ? tempfile : to_name, from_sb.st_size); - else - digestresult = NULL; + if (!devnull) { + if (dostrip) + stripped = strip(tempcopy ? tempfile : to_name, + to_fd, from_name, &digestresult); + if (!stripped) + digestresult = copy(from_fd, from_name, to_fd, + tempcopy ? tempfile : to_name, from_sb.st_size); + } } if (dostrip) { - strip(tempcopy ? tempfile : to_name); + if (!stripped) + (void)strip(tempcopy ? tempfile : to_name, to_fd, + NULL, &digestresult); /* - * Re-open our fd on the target, in case we used a strip - * that does not work in-place -- like GNU binutils strip. + * Re-open our fd on the target, in case + * we did not strip in-place. */ close(to_fd); to_fd = open(tempcopy ? tempfile : to_name, O_RDONLY, 0); @@ -1029,7 +1035,9 @@ install(const char *from_name, const char *to_name, u_ /* * compare -- - * compare two files; non-zero means files differ + * Compare two files; non-zero means files differ. + * Compute digest and return its address in *dresp + * unless it points to pre-computed digest. */ static int compare(int from_fd, const char *from_name __unused, size_t from_len, @@ -1038,15 +1046,17 @@ compare(int from_fd, const char *from_name __unused, s { char *p, *q; int rv; - int done_compare; + int do_digest, done_compare; DIGEST_CTX ctx; rv = 0; if (from_len != to_len) return 1; + do_digest = (digesttype != DIGEST_NONE && dresp != NULL && + *dresp == NULL); if (from_len <= MAX_CMP_SIZE) { - if (dresp != NULL) + if (do_digest) digest_init(&ctx); done_compare = 0; if (trymmap(from_fd) && trymmap(to_fd)) { @@ -1062,7 +1072,7 @@ compare(int from_fd, const char *from_name __unused, s } rv = memcmp(p, q, from_len); - if (dresp != NULL) + if (do_digest) digest_update(&ctx, p, from_len); munmap(p, from_len); munmap(q, from_len); @@ -1089,7 +1099,8 @@ compare(int from_fd, const char *from_name __unused, s rv = 1; /* out of sync */ } else rv = 1; /* read failure */ - digest_update(&ctx, buf1, n1); + if (do_digest) + digest_update(&ctx, buf1, n1); } lseek(from_fd, 0, SEEK_SET); lseek(to_fd, 0, SEEK_SET); @@ -1097,7 +1108,7 @@ compare(int from_fd, const char *from_name __unused, s } else rv = 1; /* don't bother in this case */ - if (dresp != NULL) { + if (do_digest) { if (rv == 0) *dresp = digest_end(&ctx, NULL); else @@ -1258,22 +1269,34 @@ copy(int from_fd, const char *from_name, int to_fd, co /* * strip -- - * use strip(1) to strip the target file + * Use strip(1) to strip the target file. + * Just invoke strip(1) on to_name if from_name is NULL, else try + * to run "strip -o to_name -- from_name" and return 0 on failure. + * Return 1 on success and assign result of digest_file(to_name) + * to *dresp. */ -static void -strip(const char *to_name) +static int +strip(const char *to_name, int to_fd, const char *from_name, char **dresp) { const char *stripbin; - const char *args[3]; + const char *args[6]; pid_t pid; - int error, status; + int error, serrno, status; stripbin = getenv("STRIPBIN"); if (stripbin == NULL) stripbin = "strip"; args[0] = stripbin; - args[1] = to_name; - args[2] = NULL; + if (from_name == NULL) { + args[1] = to_name; + args[2] = NULL; + } else { + args[1] = "-o"; + args[2] = to_name; + args[3] = "--"; + args[4] = from_name; + args[5] = NULL; + } error = posix_spawnp(&pid, stripbin, NULL, NULL, __DECONST(char **, args), environ); if (error != 0) { @@ -1288,10 +1311,21 @@ strip(const char *to_name) /* NOTREACHED */ } if (status != 0) { + if (from_name != NULL) + return (0); (void)unlink(to_name); errx(EX_SOFTWARE, "strip command %s failed on %s", stripbin, to_name); } + if (from_name != NULL && safecopy && fsync(to_fd) == -1) { + serrno = errno; + (void)unlink(to_name); + errno = serrno; + err(EX_OSERR, "fsync failed for %s", to_name); + } + if (dresp != NULL) + *dresp = digest_file(to_name); + return (1); } /* From owner-svn-src-all@freebsd.org Tue Aug 11 12:17:47 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 854803ACC73; Tue, 11 Aug 2020 12:17:47 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQsKl30yKz4S2F; Tue, 11 Aug 2020 12:17:47 +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 4657E1AF19; Tue, 11 Aug 2020 12:17:47 +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 07BCHlNW047301; Tue, 11 Aug 2020 12:17:47 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07BCHkQh047298; Tue, 11 Aug 2020 12:17:46 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202008111217.07BCHkQh047298@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 11 Aug 2020 12:17:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364109 - in head/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src sys X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src sys X-SVN-Commit-Revision: 364109 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 12:17:47 -0000 Author: hselasky Date: Tue Aug 11 12:17:46 2020 New Revision: 364109 URL: https://svnweb.freebsd.org/changeset/base/364109 Log: Need to clone the task struct fields related to RCU aswell in the LinuxKPI after r359727. This fixes a minor regression issue. Else the priority tracking won't work properly when both sleepable and non-sleepable RCU is in use on the same thread. Bump the __FreeBSD_version to force recompilation of external kernel modules. PR: 242272 MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/sched.h head/sys/compat/linuxkpi/common/src/linux_rcu.c head/sys/sys/param.h Modified: head/sys/compat/linuxkpi/common/include/linux/sched.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/sched.h Tue Aug 11 11:33:58 2020 (r364108) +++ head/sys/compat/linuxkpi/common/include/linux/sched.h Tue Aug 11 12:17:46 2020 (r364109) @@ -76,8 +76,9 @@ struct task_struct { unsigned bsd_ioctl_len; struct completion parked; struct completion exited; - TAILQ_ENTRY(task_struct) rcu_entry; - int rcu_recurse; +#define TS_RCU_TYPE_MAX 2 + TAILQ_ENTRY(task_struct) rcu_entry[TS_RCU_TYPE_MAX]; + int rcu_recurse[TS_RCU_TYPE_MAX]; int bsd_interrupt_value; struct work_struct *work; /* current work struct, if set */ struct task_struct *group_leader; Modified: head/sys/compat/linuxkpi/common/src/linux_rcu.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_rcu.c Tue Aug 11 11:33:58 2020 (r364108) +++ head/sys/compat/linuxkpi/common/src/linux_rcu.c Tue Aug 11 12:17:46 2020 (r364109) @@ -74,6 +74,7 @@ struct linux_epoch_record { ck_epoch_record_t epoch_record; TAILQ_HEAD(, task_struct) ts_head; int cpuid; + int type; } __aligned(CACHE_LINE_SIZE); /* @@ -90,6 +91,8 @@ CTASSERT(sizeof(struct rcu_head) == sizeof(struct call */ CTASSERT(offsetof(struct linux_epoch_record, epoch_record) == 0); +CTASSERT(TS_RCU_TYPE_MAX == RCU_TYPE_MAX); + static ck_epoch_t linux_epoch[RCU_TYPE_MAX]; static struct linux_epoch_head linux_epoch_head[RCU_TYPE_MAX]; DPCPU_DEFINE_STATIC(struct linux_epoch_record, linux_epoch_record[RCU_TYPE_MAX]); @@ -118,6 +121,7 @@ linux_rcu_runtime_init(void *arg __unused) record = &DPCPU_ID_GET(i, linux_epoch_record[j]); record->cpuid = i; + record->type = j; ck_epoch_register(&linux_epoch[j], &record->epoch_record, NULL); TAILQ_INIT(&record->ts_head); @@ -201,9 +205,9 @@ linux_rcu_read_lock(unsigned type) */ critical_enter(); ck_epoch_begin(&record->epoch_record, NULL); - ts->rcu_recurse++; - if (ts->rcu_recurse == 1) - TAILQ_INSERT_TAIL(&record->ts_head, ts, rcu_entry); + ts->rcu_recurse[type]++; + if (ts->rcu_recurse[type] == 1) + TAILQ_INSERT_TAIL(&record->ts_head, ts, rcu_entry[type]); critical_exit(); } @@ -227,9 +231,9 @@ linux_rcu_read_unlock(unsigned type) */ critical_enter(); ck_epoch_end(&record->epoch_record, NULL); - ts->rcu_recurse--; - if (ts->rcu_recurse == 0) - TAILQ_REMOVE(&record->ts_head, ts, rcu_entry); + ts->rcu_recurse[type]--; + if (ts->rcu_recurse[type] == 0) + TAILQ_REMOVE(&record->ts_head, ts, rcu_entry[type]); critical_exit(); sched_unpin(); @@ -254,7 +258,7 @@ linux_synchronize_rcu_cb(ck_epoch_t *epoch __unused, c * the threads in the queue are CPU-pinned and cannot * go anywhere while the current thread is locked. */ - TAILQ_FOREACH(ts, &record->ts_head, rcu_entry) { + TAILQ_FOREACH(ts, &record->ts_head, rcu_entry[record->type]) { if (ts->task_thread->td_priority > prio) prio = ts->task_thread->td_priority; is_sleeping |= (ts->task_thread->td_inhibitors != 0); Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Tue Aug 11 11:33:58 2020 (r364108) +++ head/sys/sys/param.h Tue Aug 11 12:17:46 2020 (r364109) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300106 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300107 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-all@freebsd.org Tue Aug 11 12:31:30 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C7B6E3AD380; Tue, 11 Aug 2020 12:31:30 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQsdY3xn1z4T1b; Tue, 11 Aug 2020 12:31:29 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wm1-x344.google.com with SMTP id d190so2411229wmd.4; Tue, 11 Aug 2020 05:31:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=urVBsRCTzk8JhLFX4HhuYkDKJesw/VE+vV1ydiLhVu0=; b=jmKWJ1H/fU9L/+ALlx1L1Jsgc0TVRlQERACvaIwzTOBSdL9f3r1h/4Bav25R5vJL8R LhREE5akojwRs3RyF4m1E91WtckhV09TXKGTHJrilLer9bsvm6vHQT2oXiEFwu5iBGJF cskbpSCocblGYg8dt+3iIhf/c8FgoJId0fpfgUahU2dxSSLgoEY7D6XBYsQgKkBj3/uC skqsrZJgRPDnQfOtLv2sRSFnrFN77TGHYw5T94FZisWq+z220h06mwBNS4JizVJbVGYz a1djiZBN0n3iU1j3Ikh/wF26vB1H3tZby6CpXZVH4fdYKh4KHhHAD2vA9yaiKfPcGIft X9lw== 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:content-transfer-encoding; bh=urVBsRCTzk8JhLFX4HhuYkDKJesw/VE+vV1ydiLhVu0=; b=SRn6vGVmvywzV24sm9NiNNew8Xc07S4XLuABJmbG+CUOMuv9HfYrbrBxv6ND/gOSAv wmAJGIUy03xQIiip6YojzV1Pn7FozXtZ2DDTJXTRBL9Vkj87ETnKkk6CJk3U7i52VGD5 LiANMtwux5dJkg5otZPL3zB0DXG20Qkb8BcHz6k4ZuuVhbbO0VYIgY6VVNQb44q60Ls7 MZQyPbYLAtam2fUJ3Y7RME4zPqohY3v4uHyCjEX4lojY412oszN9xmf0qmnPPCWk2fs6 v05rrNCK/q9H5cppc5WEyYBjbvBJ8NqPcGcbqeYmg/67a8uUQvfARueogw4hE2mbh08Y MLdg== X-Gm-Message-State: AOAM532kDMOsW8B/d92I2qiSp+dc1u6JrryWs3XiNbkBHpiJfl51svmQ mUhOS5NBgAGY57sw3mxDy0Yj2nVR0Z7tcz8Yc5E= X-Google-Smtp-Source: ABdhPJxb5e7+aqOgA28VnIHEL0sqDHHHr9JKCTeFKCVAVIHVFcabwHFfnmbZ99weOGkbjBlvKETAyU/NQZ9hkCZeRuQ= X-Received: by 2002:a1c:41c5:: with SMTP id o188mr3914057wma.187.1597149088042; Tue, 11 Aug 2020 05:31:28 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a5d:614c:0:0:0:0:0 with HTTP; Tue, 11 Aug 2020 05:31:26 -0700 (PDT) In-Reply-To: <20200804202541.0b6b3eb6ce26522ee12a796c@bidouilliste.com> References: <202008041525.074FPNLh043749@repo.freebsd.org> <1c90911b-d5f6-f8b1-8f4d-97a88fa028bd@rice.edu> <20200804202541.0b6b3eb6ce26522ee12a796c@bidouilliste.com> From: Mateusz Guzik Date: Tue, 11 Aug 2020 14:31:26 +0200 Message-ID: Subject: Re: svn commit: r363842 - head/sys/compat/linuxkpi/common/include/linux To: Emmanuel Vadot Cc: Alan Cox , Emmanuel Vadot , src-committers@freebsd.org, 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: 4BQsdY3xn1z4T1b X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=jmKWJ1H/; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of mjguzik@gmail.com designates 2a00:1450:4864:20::344 as permitted sender) smtp.mailfrom=mjguzik@gmail.com X-Spamd-Result: default: False [-3.56 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.01)[-1.010]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; MIME_GOOD(-0.10)[text/plain]; NEURAL_HAM_LONG(-1.01)[-1.011]; RCPT_COUNT_FIVE(0.00)[6]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::344:from]; NEURAL_HAM_SHORT(-0.54)[-0.539]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 12:31:30 -0000 Hi. This remains unfixed. On 8/4/20, Emmanuel Vadot wrote: > On Tue, 4 Aug 2020 13:11:02 -0500 > Alan Cox wrote: > >> >> On 8/4/20 10:25 AM, Emmanuel Vadot wrote: >> > Author: manu >> > Date: Tue Aug 4 15:25:22 2020 >> > New Revision: 363842 >> > URL: https://svnweb.freebsd.org/changeset/base/363842 >> > >> > Log: >> > linuxkpi: Add clear_bit_unlock >> > >> > This calls clear_bit and adds a memory barrier. >> > >> > Sponsored by: The FreeBSD Foundation >> > >> > Reviewed by: hselasky >> > MFC after: 1 week >> > Differential Revision: https://reviews.freebsd.org/D25943 >> > >> > Modified: >> > head/sys/compat/linuxkpi/common/include/linux/bitops.h >> > >> > Modified: head/sys/compat/linuxkpi/common/include/linux/bitops.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/compat/linuxkpi/common/include/linux/bitops.h Tue Aug 4 >> > 15:00:02 2020 (r363841) >> > +++ head/sys/compat/linuxkpi/common/include/linux/bitops.h Tue Aug 4 >> > 15:25:22 2020 (r363842) >> > @@ -275,6 +275,13 @@ find_next_zero_bit(const unsigned long *addr, >> > unsigned >> > #define test_bit(i, a) \ >> > !!(READ_ONCE(((volatile const unsigned long *)(a))[BIT_WORD(i)])= & >> > BIT_MASK(i)) >> > >> > +static inline void >> > +clear_bit_unlock(long bit, volatile unsigned long *var) >> > +{ >> > + clear_bit(bit, var); >> > + wmb(); >> >> >> For an unlock operation, the memory barrier should come before the >> clear_bit() call, not after.=C2=A0 See, for example, the alpha implement= ation >> in Linux.=C2=A0 Also, the correct "spelling" for this memory barrier in >> FreeBSD would be atomic_thread_fence_rel(). See, for example, the >> comment at the top of sys/amd64/include/atomic.h. > > Ah yes, thanks. I probably got lost looking for the linux implem but > that does make sense, I'll fix that probably tomorow. > > Thanks. > >> >> > +} >> > + >> > static inline int >> > test_and_clear_bit(long bit, volatile unsigned long *var) >> > { > > > -- > Emmanuel Vadot > --=20 Mateusz Guzik From owner-svn-src-all@freebsd.org Tue Aug 11 12:34:27 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E9A963ACCDF for ; Tue, 11 Aug 2020 12:34:27 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qv1-xf2e.google.com (mail-qv1-xf2e.google.com [IPv6:2607:f8b0:4864:20::f2e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQshy50chz4Src for ; Tue, 11 Aug 2020 12:34:26 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qv1-xf2e.google.com with SMTP id b2so5816052qvp.9 for ; Tue, 11 Aug 2020 05:34:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=UixUOCz2M3HCMzLw7FIfJsLC53SCRSM+fPTHeYxvJCA=; b=SKWEilvfWv1LBIC9zxo0bRAWaEOS1RnuwO1PNd9zSQA6SrQVUbLq2XuWrT0POXFBw/ DawAADmsOOqbLHJbC8nlYEfjxIA9jAIVxSkxEmFO5lWkLh4C4fuRP55uD2zKLX77GJBH HPc1M/RizZfOveOSQIIfcKxGaVbuhpxeQz1rUEWYY/y9kPXsg7tFZmaBTvNoSo+iBnl/ iirbj+OUjyg31TKUE2VHYRlQlH5DH/fmS4nCiXRTNmioMq2AsRTVMo/rs8ht6etrrYw1 0hRciRsrvFAv8K+ajDzoLmXZS+5jh2eBcGLCATHOUYYP9Ey+hrjLy69WlJeoS2UHMk7W BVjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=UixUOCz2M3HCMzLw7FIfJsLC53SCRSM+fPTHeYxvJCA=; b=ZYwvae5iusgbhq3jWg1KQeG6xVXJQJZT3xLYjdWoBWPhaCmx0V0BGccn5Bz0J1zH7A oRnBIkpgM5NvglAAEdIc39uAOfEiHeNDy8tNM++6vCU8o92f5cSsfmRyIQ9wjEWRXI0n hBCMws2dILxtKsl19bdKw6tK8Al4lMNnVovLmCIxGI5b6kAA2426c8E3aBod4x1J44eZ qOZjkNHdHJMqtDsz81pPPzyUAD0/dBFa3k8lmuOz/4yXXateTTiHpoyh+FYqpzX7DXV6 PuTvvp5MnW3U+3NUg9lS3Ux2oKG+at7HYYHeenb3VgoOj9lGnWyGYFADJynQL5lA0Kh0 2LUQ== X-Gm-Message-State: AOAM530wK7kY1VhtcJHTIGvge0uqlvV7X14qje9r3eLD32ZnRzkULUXv MVVfPdaZMzwsMprZ3EmXIjqTAg== X-Google-Smtp-Source: ABdhPJy3/aOMGDnFOTNIHOUwWFbEJQ+DBeFDRqMHkKwWJAsqw6J+YyiRahLCQOxU0byDxitxZ7G0Ew== X-Received: by 2002:a0c:b312:: with SMTP id s18mr1001792qve.34.1597149265451; Tue, 11 Aug 2020 05:34:25 -0700 (PDT) Received: from mutt-hbsd (75-148-2-186-WashingtonDC.hfc.comcastbusiness.net. [75.148.2.186]) by smtp.gmail.com with ESMTPSA id o21sm16610977qkk.94.2020.08.11.05.34.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Aug 2020 05:34:24 -0700 (PDT) Date: Tue, 11 Aug 2020 08:34:22 -0400 From: Shawn Webb To: Mateusz Guzik Cc: Emmanuel Vadot , Alan Cox , Emmanuel Vadot , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r363842 - head/sys/compat/linuxkpi/common/include/linux Message-ID: <20200811123422.sf63z62buxqcnv3c@mutt-hbsd> X-Operating-System: FreeBSD mutt-hbsd 13.0-CURRENT-HBSD FreeBSD 13.0-CURRENT-HBSD X-PGP-Key: http://pgp.mit.edu/pks/lookup?op=vindex&search=0xFF2E67A277F8E1FA References: <202008041525.074FPNLh043749@repo.freebsd.org> <1c90911b-d5f6-f8b1-8f4d-97a88fa028bd@rice.edu> <20200804202541.0b6b3eb6ce26522ee12a796c@bidouilliste.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="mjzj2rmpidkza7u7" Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4BQshy50chz4Src X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=hardenedbsd.org header.s=google header.b=SKWEilvf; dmarc=none; spf=pass (mx1.freebsd.org: domain of shawn.webb@hardenedbsd.org designates 2607:f8b0:4864:20::f2e as permitted sender) smtp.mailfrom=shawn.webb@hardenedbsd.org X-Spamd-Result: default: False [-4.39 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[hardenedbsd.org:s=google]; NEURAL_HAM_MEDIUM(-0.98)[-0.978]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; NEURAL_HAM_LONG(-1.02)[-1.020]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-all@freebsd.org]; DMARC_NA(0.00)[hardenedbsd.org]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[hardenedbsd.org:+]; NEURAL_HAM_SHORT(-0.29)[-0.294]; RCPT_COUNT_SEVEN(0.00)[7]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::f2e:from]; SIGNED_PGP(-2.00)[]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; MID_RHS_NOT_FQDN(0.50)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 12:34:28 -0000 --mjzj2rmpidkza7u7 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable If you use git, you can easily cherry-pick the fix from HardenedBSD: https://github.com/HardenedBSD/hardenedBSD/commit/e7ee74598b987fdc702614668= b7ea85884289cf1 On Tue, Aug 11, 2020 at 02:31:26PM +0200, Mateusz Guzik wrote: > Hi. This remains unfixed. >=20 > On 8/4/20, Emmanuel Vadot wrote: > > On Tue, 4 Aug 2020 13:11:02 -0500 > > Alan Cox wrote: > > > >> > >> On 8/4/20 10:25 AM, Emmanuel Vadot wrote: > >> > Author: manu > >> > Date: Tue Aug 4 15:25:22 2020 > >> > New Revision: 363842 > >> > URL: https://svnweb.freebsd.org/changeset/base/363842 > >> > > >> > Log: > >> > linuxkpi: Add clear_bit_unlock > >> > > >> > This calls clear_bit and adds a memory barrier. > >> > > >> > Sponsored by: The FreeBSD Foundation > >> > > >> > Reviewed by: hselasky > >> > MFC after: 1 week > >> > Differential Revision: https://reviews.freebsd.org/D25943 > >> > > >> > Modified: > >> > head/sys/compat/linuxkpi/common/include/linux/bitops.h > >> > > >> > Modified: head/sys/compat/linuxkpi/common/include/linux/bitops.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/compat/linuxkpi/common/include/linux/bitops.h Tue Aug 4 > >> > 15:00:02 2020 (r363841) > >> > +++ head/sys/compat/linuxkpi/common/include/linux/bitops.h Tue Aug 4 > >> > 15:25:22 2020 (r363842) > >> > @@ -275,6 +275,13 @@ find_next_zero_bit(const unsigned long *addr, > >> > unsigned > >> > #define test_bit(i, a) \ > >> > !!(READ_ONCE(((volatile const unsigned long *)(a))[BIT_WORD(i)= ]) & > >> > BIT_MASK(i)) > >> > > >> > +static inline void > >> > +clear_bit_unlock(long bit, volatile unsigned long *var) > >> > +{ > >> > + clear_bit(bit, var); > >> > + wmb(); > >> > >> > >> For an unlock operation, the memory barrier should come before the > >> clear_bit() call, not after.?? See, for example, the alpha implementat= ion > >> in Linux.?? Also, the correct "spelling" for this memory barrier in > >> FreeBSD would be atomic_thread_fence_rel(). See, for example, the > >> comment at the top of sys/amd64/include/atomic.h. > > > > Ah yes, thanks. I probably got lost looking for the linux implem but > > that does make sense, I'll fix that probably tomorow. > > > > Thanks. > > > >> > >> > +} > >> > + > >> > static inline int > >> > test_and_clear_bit(long bit, volatile unsigned long *var) > >> > { > > > > > > -- > > Emmanuel Vadot > > >=20 >=20 > --=20 > Mateusz Guzik > _______________________________________________ > svn-src-all@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD GPG Key ID: 0xFF2E67A277F8E1FA GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9 3633 C85B 0AF8 AB23 0FB2 https://git-01.md.hardenedbsd.org/HardenedBSD/pubkeys/src/branch/master/Sha= wn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc --mjzj2rmpidkza7u7 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAl8ykEwACgkQ/y5nonf4 4fpS7A//V2iZ37Ya8JjEUlinCTwY3xpP77vHbx9c4KEofwI+av2BWFFLcYA9lIxG k2DjWfwjuPgqUYCL4/NPN6hGy2NrpNXl4IT1gpo1hKiWH9M5m4vI0ZP5+SW1bqi6 92ytAZUshzpLacklVbmG+GZT1BIpydjjA7tSNvA4YRWjPy65BATQYdzjlNCdgcSe OnF2VIyMFzdwycZn+a3+N14jEnv6+EqxJYJZroJLqHMK+rlS1v4LZvaZVky4qm9U eP7jbwaRbdJ+CTUooQPEwmcjcfqdGDuXyaBdutWLyz7dOZI/IjLjaAywbTAcBX3l E4XGa1qHrrOlaiP7yJjLS7efZn1Sr+d0ZdKQ7By1un7JEh+FCz90tK2qYuGK1QxI pMnX1SsPpshsi1Dk6zYmosdWVlZQZNmS9n+SLWKy4jPzbhbJSq2kjNRn+GvvaxpJ J/BqkfB+XTWJKDkIzIAQdlDrcknMuPsV08NC4Jd1OtT5gqKAZehIsb7o/0wbadiu Ll3ree/n/+mr6wSou1h2pdSLy3U4nSGAvDPPacz2nR3uVg1MGAs+turtd6CHNknu eFGnGu5KD9I+Ygg7tPm5JiUK9U8sKlMEvY9gIXwrYEnp9scwTb4i4zxt/G5Jmf5r YETkeQU3S5u94vEdbMg+5SQLbxW2UXknERpyD+hW6UtcyDG2gD0= =5HEO -----END PGP SIGNATURE----- --mjzj2rmpidkza7u7-- From owner-svn-src-all@freebsd.org Tue Aug 11 12:41:40 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F250A3AD5A1; Tue, 11 Aug 2020 12:41:40 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQssJ6DpMz4TJ7; Tue, 11 Aug 2020 12:41:40 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B94921AF79; Tue, 11 Aug 2020 12:41:40 +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 07BCfeYK064366; Tue, 11 Aug 2020 12:41:40 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07BCfeC9064365; Tue, 11 Aug 2020 12:41:40 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202008111241.07BCfeC9064365@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 11 Aug 2020 12:41:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364110 - 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: 364110 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 12:41:41 -0000 Author: hselasky Date: Tue Aug 11 12:41:40 2020 New Revision: 364110 URL: https://svnweb.freebsd.org/changeset/base/364110 Log: Use atomic_clear_rel_long() to implement clear_bit_unlock() in the LinuxKPI after r363842. Suggested by: alc@ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/bitops.h Modified: head/sys/compat/linuxkpi/common/include/linux/bitops.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/bitops.h Tue Aug 11 12:17:46 2020 (r364109) +++ head/sys/compat/linuxkpi/common/include/linux/bitops.h Tue Aug 11 12:41:40 2020 (r364110) @@ -272,15 +272,11 @@ find_next_zero_bit(const unsigned long *addr, unsigned #define clear_bit(i, a) \ atomic_clear_long(&((volatile unsigned long *)(a))[BIT_WORD(i)], BIT_MASK(i)) +#define clear_bit_unlock(i, a) \ + atomic_clear_rel_long(&((volatile unsigned long *)(a))[BIT_WORD(i)], BIT_MASK(i)) + #define test_bit(i, a) \ !!(READ_ONCE(((volatile const unsigned long *)(a))[BIT_WORD(i)]) & BIT_MASK(i)) - -static inline void -clear_bit_unlock(long bit, volatile unsigned long *var) -{ - clear_bit(bit, var); - wmb(); -} static inline int test_and_clear_bit(long bit, volatile unsigned long *var) From owner-svn-src-all@freebsd.org Tue Aug 11 12:43:51 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 189213AD564; Tue, 11 Aug 2020 12:43:51 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQsvp0WlZz4TXP; Tue, 11 Aug 2020 12:43:49 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2020.home.selasky.org (unknown [178.17.145.105]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 077D22602A3; Tue, 11 Aug 2020 14:43:47 +0200 (CEST) Subject: Re: svn commit: r363842 - head/sys/compat/linuxkpi/common/include/linux To: Shawn Webb , Mateusz Guzik Cc: Emmanuel Vadot , Alan Cox , Emmanuel Vadot , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202008041525.074FPNLh043749@repo.freebsd.org> <1c90911b-d5f6-f8b1-8f4d-97a88fa028bd@rice.edu> <20200804202541.0b6b3eb6ce26522ee12a796c@bidouilliste.com> <20200811123422.sf63z62buxqcnv3c@mutt-hbsd> From: Hans Petter Selasky Message-ID: <2b046c3d-ef74-257b-e4ad-a7352a17b988@selasky.org> Date: Tue, 11 Aug 2020 14:43:26 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200811123422.sf63z62buxqcnv3c@mutt-hbsd> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4BQsvp0WlZz4TXP X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of hps@selasky.org designates 2a01:4f8:c17:6c4b::2 as permitted sender) smtp.mailfrom=hps@selasky.org X-Spamd-Result: default: False [-2.69 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+a:mail.turbocat.net:c]; NEURAL_HAM_LONG(-1.00)[-0.998]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[selasky.org]; NEURAL_HAM_MEDIUM(-0.98)[-0.982]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-0.41)[-0.414]; RCPT_COUNT_SEVEN(0.00)[8]; FREEMAIL_TO(0.00)[hardenedbsd.org,gmail.com]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:24940, ipnet:2a01:4f8::/29, country:DE]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 12:43:51 -0000 On 2020-08-11 14:34, Shawn Webb wrote: > If you use git, you can easily cherry-pick the fix from HardenedBSD: > Hi, There is atomic_clear_rel_long() which does the release in addition to clearing. See: https://svnweb.freebsd.org/changeset/base/364110 I used a macro, in case it is not implemented on all platforms yet. --HPS From owner-svn-src-all@freebsd.org Tue Aug 11 12:46:29 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 393F83AD98B; Tue, 11 Aug 2020 12:46:29 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mx.blih.net (mx.blih.net [212.83.155.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mx.blih.net", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQsyq5v50z4Tdb; Tue, 11 Aug 2020 12:46:27 +0000 (UTC) (envelope-from manu@bidouilliste.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bidouilliste.com; s=mx; t=1597149984; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9ArO/rth6KYhAZxPRiMoV5o6X4/zRtkg5B/Y+BND4k0=; b=fTHH7eL3SJ0AmIW5CvpNds1aQrrvVAutZq7ubCRDbaqIyD0onXU05tEC2tc4Zn0xZ3z7mE IiG/L/V6YC/OT5PMxRvvcL3zhZv8YRhTUQWD8UZKmmm2fn30yNT0nEhyB0EdeiAhuSUOjC afUkI0055ylZY22XfTh7lMYYNclUbyA= Received: from skull.home.blih.net (lfbn-idf2-1-1138-237.w90-92.abo.wanadoo.fr [90.92.20.237]) by mx.blih.net (OpenSMTPD) with ESMTPSA id b7ce17eb (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 11 Aug 2020 12:46:19 +0000 (UTC) Date: Tue, 11 Aug 2020 14:46:18 +0200 From: Emmanuel Vadot To: Hans Petter Selasky Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r364110 - head/sys/compat/linuxkpi/common/include/linux Message-Id: <20200811144618.38021590f1a2b5eb3fa963c9@bidouilliste.com> In-Reply-To: <202008111241.07BCfeC9064365@repo.freebsd.org> References: <202008111241.07BCfeC9064365@repo.freebsd.org> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; amd64-portbld-freebsd13.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4BQsyq5v50z4Tdb X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bidouilliste.com header.s=mx header.b=fTHH7eL3; dmarc=pass (policy=none) header.from=bidouilliste.com; spf=pass (mx1.freebsd.org: domain of manu@bidouilliste.com designates 212.83.155.74 as permitted sender) smtp.mailfrom=manu@bidouilliste.com X-Spamd-Result: default: False [-2.89 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[bidouilliste.com:s=mx]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; MV_CASE(0.50)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; R_SPF_ALLOW(-0.20)[+mx]; NEURAL_HAM_LONG(-1.00)[-1.001]; TO_DN_SOME(0.00)[]; NEURAL_HAM_MEDIUM(-1.01)[-1.014]; DKIM_TRACE(0.00)[bidouilliste.com:+]; DMARC_POLICY_ALLOW(-0.50)[bidouilliste.com,none]; NEURAL_HAM_SHORT(-0.38)[-0.378]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:12876, ipnet:212.83.128.0/19, country:FR]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 12:46:29 -0000 On Tue, 11 Aug 2020 12:41:40 +0000 (UTC) Hans Petter Selasky wrote: > Author: hselasky > Date: Tue Aug 11 12:41:40 2020 > New Revision: 364110 > URL: https://svnweb.freebsd.org/changeset/base/364110 > > Log: > Use atomic_clear_rel_long() to implement clear_bit_unlock() in the LinuxKPI > after r363842. > > Suggested by: alc@ > MFC after: 1 week > Sponsored by: Mellanox Technologies > > Modified: > head/sys/compat/linuxkpi/common/include/linux/bitops.h Thanks Hans, I was doing a last build but you beat me to it. And thanks to Alan for suggesting using atomic_clear_rel_long directly. Note that clear_bit_unlock isn't used by any code at the moment so it wasn't a big deal. > Modified: head/sys/compat/linuxkpi/common/include/linux/bitops.h > ============================================================================== > --- head/sys/compat/linuxkpi/common/include/linux/bitops.h Tue Aug 11 12:17:46 2020 (r364109) > +++ head/sys/compat/linuxkpi/common/include/linux/bitops.h Tue Aug 11 12:41:40 2020 (r364110) > @@ -272,15 +272,11 @@ find_next_zero_bit(const unsigned long *addr, unsigned > #define clear_bit(i, a) \ > atomic_clear_long(&((volatile unsigned long *)(a))[BIT_WORD(i)], BIT_MASK(i)) > > +#define clear_bit_unlock(i, a) \ > + atomic_clear_rel_long(&((volatile unsigned long *)(a))[BIT_WORD(i)], BIT_MASK(i)) > + > #define test_bit(i, a) \ > !!(READ_ONCE(((volatile const unsigned long *)(a))[BIT_WORD(i)]) & BIT_MASK(i)) > - > -static inline void > -clear_bit_unlock(long bit, volatile unsigned long *var) > -{ > - clear_bit(bit, var); > - wmb(); > -} > > static inline int > test_and_clear_bit(long bit, volatile unsigned long *var) -- Emmanuel Vadot From owner-svn-src-all@freebsd.org Tue Aug 11 13:51:49 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 191973AEEB9; Tue, 11 Aug 2020 13:51:49 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQvQD71sYz4Xm0; Tue, 11 Aug 2020 13:51:48 +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 D3B151C101; Tue, 11 Aug 2020 13:51:48 +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 07BDpmSB007193; Tue, 11 Aug 2020 13:51:48 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07BDpmKF007192; Tue, 11 Aug 2020 13:51:48 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202008111351.07BDpmKF007192@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 11 Aug 2020 13:51:48 +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: r364111 - stable/12/sys/netinet6 X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/netinet6 X-SVN-Commit-Revision: 364111 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 13:51:49 -0000 Author: markj Date: Tue Aug 11 13:51:48 2020 New Revision: 364111 URL: https://svnweb.freebsd.org/changeset/base/364111 Log: MFC r363841: Remove an incorrect assertion from in6p_lookup_mcast_ifp(). Modified: stable/12/sys/netinet6/in6_mcast.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet6/in6_mcast.c ============================================================================== --- stable/12/sys/netinet6/in6_mcast.c Tue Aug 11 12:41:40 2020 (r364110) +++ stable/12/sys/netinet6/in6_mcast.c Tue Aug 11 13:51:48 2020 (r364111) @@ -1818,31 +1818,27 @@ ip6_getmoptions(struct inpcb *inp, struct sockopt *sop * * This routine exists to support legacy IPv6 multicast applications. * - * If inp is non-NULL, use this socket's current FIB number for any - * required FIB lookup. Look up the group address in the unicast FIB, - * and use its ifp; usually, this points to the default next-hop. - * If the FIB lookup fails, return NULL. + * Use the socket's current FIB number for any required FIB lookup. Look up the + * group address in the unicast FIB, and use its ifp; usually, this points to + * the default next-hop. If the FIB lookup fails, return NULL. * * FUTURE: Support multiple forwarding tables for IPv6. * * Returns NULL if no ifp could be found. */ static struct ifnet * -in6p_lookup_mcast_ifp(const struct inpcb *inp, - const struct sockaddr_in6 *gsin6) +in6p_lookup_mcast_ifp(const struct inpcb *inp, const struct sockaddr_in6 *gsin6) { struct nhop6_basic nh6; struct in6_addr dst; uint32_t scopeid; uint32_t fibnum; - KASSERT(inp->inp_vflag & INP_IPV6, - ("%s: not INP_IPV6 inpcb", __func__)); KASSERT(gsin6->sin6_family == AF_INET6, ("%s: not AF_INET6 group", __func__)); in6_splitscope(&gsin6->sin6_addr, &dst, &scopeid); - fibnum = inp ? inp->inp_inc.inc_fibnum : RT_DEFAULT_FIB; + fibnum = inp->inp_inc.inc_fibnum; if (fib6_lookup_nh_basic(fibnum, &dst, scopeid, 0, 0, &nh6) != 0) return (NULL); From owner-svn-src-all@freebsd.org Tue Aug 11 14:19:06 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 910EF3AF659; Tue, 11 Aug 2020 14:19:06 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQw1k37MHz4Yq9; Tue, 11 Aug 2020 14:19:06 +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 4A4A01C5A4; Tue, 11 Aug 2020 14:19:06 +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 07BEJ6QI021059; Tue, 11 Aug 2020 14:19:06 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07BEJ6jM021058; Tue, 11 Aug 2020 14:19:06 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202008111419.07BEJ6jM021058@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 11 Aug 2020 14:19:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364112 - head/usr.bin/script X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/usr.bin/script X-SVN-Commit-Revision: 364112 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 14:19:06 -0000 Author: markj Date: Tue Aug 11 14:19:05 2020 New Revision: 364112 URL: https://svnweb.freebsd.org/changeset/base/364112 Log: script: Minor cleanups. - Instead of using isatty() to decide whether to call tcgetattr(), just call tcgetattr() directly, since that's all that isatty() does anyway. - Simplify error handling in termset(). Check for errno != ENOTTY from tcgetattr() to handle errors that may be raised while running script(1) under a debugger. PR: 248377 Submitted by: Soumendra Ganguly MFC after: 1 week Modified: head/usr.bin/script/script.c Modified: head/usr.bin/script/script.c ============================================================================== --- head/usr.bin/script/script.c Tue Aug 11 13:51:48 2020 (r364111) +++ head/usr.bin/script/script.c Tue Aug 11 14:19:05 2020 (r364112) @@ -176,16 +176,16 @@ main(int argc, char *argv[]) if (pflg) playback(fscript); - if ((ttyflg = isatty(STDIN_FILENO)) != 0) { - if (tcgetattr(STDIN_FILENO, &tt) == -1) - err(1, "tcgetattr"); - if (ioctl(STDIN_FILENO, TIOCGWINSZ, &win) == -1) - err(1, "ioctl"); - if (openpty(&master, &slave, NULL, &tt, &win) == -1) + if (tcgetattr(STDIN_FILENO, &tt) == -1 || + ioctl(STDIN_FILENO, TIOCGWINSZ, &win) == -1) { + if (errno != ENOTTY) /* For debugger. */ + err(1, "tcgetattr/ioctl"); + if (openpty(&master, &slave, NULL, NULL, NULL) == -1) err(1, "openpty"); } else { - if (openpty(&master, &slave, NULL, NULL, NULL) == -1) + if (openpty(&master, &slave, NULL, &tt, &win) == -1) err(1, "openpty"); + ttyflg = 1; } if (rawout) @@ -433,9 +433,8 @@ termset(void) struct termios traw; if (tcgetattr(STDOUT_FILENO, &tt) == -1) { - if (errno == EBADF) - err(1, "%d not valid fd", STDOUT_FILENO); - /* errno == ENOTTY */ + if (errno != ENOTTY) /* For debugger. */ + err(1, "tcgetattr"); return; } ttyflg = 1; From owner-svn-src-all@freebsd.org Tue Aug 11 14:27:59 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8BE133AFB51; Tue, 11 Aug 2020 14:27:59 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQwCz3WRkz4Zpx; Tue, 11 Aug 2020 14:27:59 +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 5CF031C883; Tue, 11 Aug 2020 14:27:59 +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 07BERxdA027039; Tue, 11 Aug 2020 14:27:59 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07BERwob027033; Tue, 11 Aug 2020 14:27:58 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202008111427.07BERwob027033@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 11 Aug 2020 14:27:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364113 - in head/sys: fs/devfs kern sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: fs/devfs kern sys X-SVN-Commit-Revision: 364113 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 14:27:59 -0000 Author: mjg Date: Tue Aug 11 14:27:57 2020 New Revision: 364113 URL: https://svnweb.freebsd.org/changeset/base/364113 Log: devfs: rework si_usecount to track opens This removes a lot of special casing from the VFS layer. Reviewed by: kib (previous version) Tested by: pho (previous version) Differential Revision: https://reviews.freebsd.org/D25612 Modified: head/sys/fs/devfs/devfs.h head/sys/fs/devfs/devfs_vnops.c head/sys/kern/kern_proc.c head/sys/kern/tty.c head/sys/kern/vfs_subr.c head/sys/kern/vfs_syscalls.c head/sys/sys/vnode.h Modified: head/sys/fs/devfs/devfs.h ============================================================================== --- head/sys/fs/devfs/devfs.h Tue Aug 11 14:19:05 2020 (r364112) +++ head/sys/fs/devfs/devfs.h Tue Aug 11 14:27:57 2020 (r364113) @@ -153,6 +153,7 @@ struct devfs_dirent { struct timespec de_ctime; struct vnode *de_vnode; char *de_symlink; + int de_usecount; }; struct devfs_mount { @@ -202,6 +203,10 @@ struct devfs_dirent *devfs_vmkdir(struct devfs_mount * struct devfs_dirent *, u_int); struct devfs_dirent *devfs_find(struct devfs_dirent *, const char *, int, int); + +void devfs_ctty_ref(struct vnode *); +void devfs_ctty_unref(struct vnode *); +int devfs_usecount(struct vnode *); #endif /* _KERNEL */ Modified: head/sys/fs/devfs/devfs_vnops.c ============================================================================== --- head/sys/fs/devfs/devfs_vnops.c Tue Aug 11 14:19:05 2020 (r364112) +++ head/sys/fs/devfs/devfs_vnops.c Tue Aug 11 14:27:57 2020 (r364113) @@ -222,6 +222,115 @@ devfs_clear_cdevpriv(void) devfs_fpdrop(fp); } +static void +devfs_usecount_add(struct vnode *vp) +{ + struct devfs_dirent *de; + struct cdev *dev; + + mtx_lock(&devfs_de_interlock); + VI_LOCK(vp); + VNPASS(vp->v_type == VCHR || vp->v_type == VBAD, vp); + if (VN_IS_DOOMED(vp)) { + goto out_unlock; + } + + de = vp->v_data; + dev = vp->v_rdev; + MPASS(de != NULL); + MPASS(dev != NULL); + dev->si_usecount++; + de->de_usecount++; +out_unlock: + VI_UNLOCK(vp); + mtx_unlock(&devfs_de_interlock); +} + +static void +devfs_usecount_subl(struct vnode *vp) +{ + struct devfs_dirent *de; + struct cdev *dev; + + mtx_assert(&devfs_de_interlock, MA_OWNED); + ASSERT_VI_LOCKED(vp, __func__); + VNPASS(vp->v_type == VCHR || vp->v_type == VBAD, vp); + + de = vp->v_data; + dev = vp->v_rdev; + if (de == NULL) + return; + if (dev == NULL) { + MPASS(de->de_usecount == 0); + return; + } + if (dev->si_usecount < de->de_usecount) + panic("%s: si_usecount underflow for dev %p " + "(has %ld, dirent has %d)\n", + __func__, dev, dev->si_usecount, de->de_usecount); + if (VN_IS_DOOMED(vp)) { + dev->si_usecount -= de->de_usecount; + de->de_usecount = 0; + } else { + if (de->de_usecount == 0) + panic("%s: de_usecount underflow for dev %p\n", + __func__, dev); + dev->si_usecount--; + de->de_usecount--; + } +} + +static void +devfs_usecount_sub(struct vnode *vp) +{ + + mtx_lock(&devfs_de_interlock); + VI_LOCK(vp); + devfs_usecount_subl(vp); + VI_UNLOCK(vp); + mtx_unlock(&devfs_de_interlock); +} + +static int +devfs_usecountl(struct vnode *vp) +{ + + VNPASS(vp->v_type == VCHR, vp); + mtx_assert(&devfs_de_interlock, MA_OWNED); + ASSERT_VI_LOCKED(vp, __func__); + return (vp->v_rdev->si_usecount); +} + +int +devfs_usecount(struct vnode *vp) +{ + int count; + + VNPASS(vp->v_type == VCHR, vp); + mtx_lock(&devfs_de_interlock); + VI_LOCK(vp); + count = devfs_usecountl(vp); + VI_UNLOCK(vp); + mtx_unlock(&devfs_de_interlock); + return (count); +} + +void +devfs_ctty_ref(struct vnode *vp) +{ + + vrefact(vp); + devfs_usecount_add(vp); +} + +void +devfs_ctty_unref(struct vnode *vp) +{ + + devfs_usecount_sub(vp); + vrele(vp); +} + /* * On success devfs_populate_vp() returns with dmp->dm_lock held. */ @@ -487,7 +596,6 @@ loop: /* XXX: v_rdev should be protect by vnode lock */ vp->v_rdev = dev; VNPASS(vp->v_usecount == 1, vp); - dev->si_usecount++; /* Special casing of ttys for deadfs. Probably redundant. */ dsw = dev->si_devsw; if (dsw != NULL && (dsw->d_flags & D_TTY) != 0) @@ -569,6 +677,7 @@ devfs_close(struct vop_close_args *ap) struct proc *p; struct cdev *dev = vp->v_rdev; struct cdevsw *dsw; + struct devfs_dirent *de = vp->v_data; int dflags, error, ref, vp_locked; /* @@ -587,7 +696,7 @@ devfs_close(struct vop_close_args *ap) * if the reference count is 2 (this last descriptor * plus the session), release the reference from the session. */ - if (vp->v_usecount == 2 && td != NULL) { + if (de->de_usecount == 2 && td != NULL) { p = td->td_proc; PROC_LOCK(p); if (vp == p->p_session->s_ttyvp) { @@ -596,19 +705,20 @@ devfs_close(struct vop_close_args *ap) sx_xlock(&proctree_lock); if (vp == p->p_session->s_ttyvp) { SESS_LOCK(p->p_session); + mtx_lock(&devfs_de_interlock); VI_LOCK(vp); - if (vp->v_usecount == 2 && vcount(vp) == 1 && - !VN_IS_DOOMED(vp)) { + if (devfs_usecountl(vp) == 2 && !VN_IS_DOOMED(vp)) { p->p_session->s_ttyvp = NULL; p->p_session->s_ttydp = NULL; oldvp = vp; } VI_UNLOCK(vp); + mtx_unlock(&devfs_de_interlock); SESS_UNLOCK(p->p_session); } sx_xunlock(&proctree_lock); if (oldvp != NULL) - vrele(oldvp); + devfs_ctty_unref(oldvp); } else PROC_UNLOCK(p); } @@ -625,9 +735,12 @@ devfs_close(struct vop_close_args *ap) if (dsw == NULL) return (ENXIO); dflags = 0; + mtx_lock(&devfs_de_interlock); VI_LOCK(vp); - if (vp->v_usecount == 1 && vcount(vp) == 1) + if (devfs_usecountl(vp) == 1) dflags |= FLASTCLOSE; + devfs_usecount_subl(vp); + mtx_unlock(&devfs_de_interlock); if (VN_IS_DOOMED(vp)) { /* Forced close. */ dflags |= FREVOKE | FNONBLOCK; @@ -850,7 +963,7 @@ devfs_ioctl(struct vop_ioctl_args *ap) return (0); } - vrefact(vp); + devfs_ctty_ref(vp); SESS_LOCK(sess); vpold = sess->s_ttyvp; sess->s_ttyvp = vp; @@ -1159,6 +1272,9 @@ devfs_open(struct vop_open_args *ap) return (ENXIO); } + if (vp->v_type == VCHR) + devfs_usecount_add(vp); + vlocked = VOP_ISLOCKED(vp); VOP_UNLOCK(vp); @@ -1178,6 +1294,9 @@ devfs_open(struct vop_open_args *ap) td->td_fpop = fpop; vn_lock(vp, vlocked | LK_RETRY); + if (error != 0 && vp->v_type == VCHR) + devfs_usecount_sub(vp); + dev_relthread(dev, ref); if (error != 0) { if (error == ERESTART) @@ -1406,19 +1525,28 @@ devfs_readlink(struct vop_readlink_args *ap) return (uiomove(de->de_symlink, strlen(de->de_symlink), ap->a_uio)); } -static int -devfs_reclaim(struct vop_reclaim_args *ap) +static void +devfs_reclaiml(struct vnode *vp) { - struct vnode *vp; struct devfs_dirent *de; - vp = ap->a_vp; - mtx_lock(&devfs_de_interlock); + mtx_assert(&devfs_de_interlock, MA_OWNED); de = vp->v_data; if (de != NULL) { + MPASS(de->de_usecount == 0); de->de_vnode = NULL; vp->v_data = NULL; } +} + +static int +devfs_reclaim(struct vop_reclaim_args *ap) +{ + struct vnode *vp; + + vp = ap->a_vp; + mtx_lock(&devfs_de_interlock); + devfs_reclaiml(vp); mtx_unlock(&devfs_de_interlock); return (0); } @@ -1432,14 +1560,14 @@ devfs_reclaim_vchr(struct vop_reclaim_args *ap) vp = ap->a_vp; MPASS(vp->v_type == VCHR); - devfs_reclaim(ap); - + mtx_lock(&devfs_de_interlock); VI_LOCK(vp); + devfs_usecount_subl(vp); + devfs_reclaiml(vp); + mtx_unlock(&devfs_de_interlock); dev_lock(); dev = vp->v_rdev; vp->v_rdev = NULL; - if (dev != NULL) - dev->si_usecount -= (vp->v_usecount > 0); dev_unlock(); VI_UNLOCK(vp); if (dev != NULL) Modified: head/sys/kern/kern_proc.c ============================================================================== --- head/sys/kern/kern_proc.c Tue Aug 11 14:19:05 2020 (r364112) +++ head/sys/kern/kern_proc.c Tue Aug 11 14:27:57 2020 (r364113) @@ -88,6 +88,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #ifdef COMPAT_FREEBSD32 #include #include @@ -858,7 +860,7 @@ killjobc(void) VOP_REVOKE(ttyvp, REVOKEALL); VOP_UNLOCK(ttyvp); } - vrele(ttyvp); + devfs_ctty_unref(ttyvp); sx_xlock(&proctree_lock); } } Modified: head/sys/kern/tty.c ============================================================================== --- head/sys/kern/tty.c Tue Aug 11 14:19:05 2020 (r364112) +++ head/sys/kern/tty.c Tue Aug 11 14:27:57 2020 (r364113) @@ -67,6 +67,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include static MALLOC_DEFINE(M_TTY, "tty", "tty device"); @@ -1256,7 +1258,7 @@ tty_drop_ctty(struct tty *tp, struct proc *p) * is either changed or released. */ if (vp != NULL) - vrele(vp); + devfs_ctty_unref(vp); return (0); } Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Tue Aug 11 14:19:05 2020 (r364112) +++ head/sys/kern/vfs_subr.c Tue Aug 11 14:27:57 2020 (r364113) @@ -108,8 +108,6 @@ static int flushbuflist(struct bufv *bufv, int flags, static void syncer_shutdown(void *arg, int howto); static int vtryrecycle(struct vnode *vp); static void v_init_counters(struct vnode *); -static void v_incr_devcount(struct vnode *); -static void v_decr_devcount(struct vnode *); static void vgonel(struct vnode *); static void vfs_knllock(void *arg); static void vfs_knlunlock(void *arg); @@ -2794,59 +2792,6 @@ v_init_counters(struct vnode *vp) } /* - * Increment si_usecount of the associated device, if any. - */ -static void -v_incr_devcount(struct vnode *vp) -{ - - ASSERT_VI_LOCKED(vp, __FUNCTION__); - if (vp->v_type == VCHR && vp->v_rdev != NULL) { - dev_lock(); - vp->v_rdev->si_usecount++; - dev_unlock(); - } -} - -/* - * Decrement si_usecount of the associated device, if any. - * - * The caller is required to hold the interlock when transitioning a VCHR use - * count to zero. This prevents a race with devfs_reclaim_vchr() that would - * leak a si_usecount reference. The vnode lock will also prevent this race - * if it is held while dropping the last ref. - * - * The race is: - * - * CPU1 CPU2 - * devfs_reclaim_vchr - * make v_usecount == 0 - * VI_LOCK - * sees v_usecount == 0, no updates - * vp->v_rdev = NULL; - * ... - * VI_UNLOCK - * VI_LOCK - * v_decr_devcount - * sees v_rdev == NULL, no updates - * - * In this scenario si_devcount decrement is not performed. - */ -static void -v_decr_devcount(struct vnode *vp) -{ - - ASSERT_VOP_LOCKED(vp, __func__); - ASSERT_VI_LOCKED(vp, __FUNCTION__); - if (vp->v_type == VCHR && vp->v_rdev != NULL) { - dev_lock(); - VNPASS(vp->v_rdev->si_usecount > 0, vp); - vp->v_rdev->si_usecount--; - dev_unlock(); - } -} - -/* * Grab a particular vnode from the free list, increment its * reference count and lock it. VIRF_DOOMED is set if the vnode * is being destroyed. Only callers who specify LK_RETRY will @@ -2921,41 +2866,6 @@ vget(struct vnode *vp, int flags, struct thread *td) return (vget_finish(vp, flags, vs)); } -static void __noinline -vget_finish_vchr(struct vnode *vp) -{ - - VNASSERT(vp->v_type == VCHR, vp, ("type != VCHR)")); - - /* - * See the comment in vget_finish before usecount bump. - */ - if (refcount_acquire_if_not_zero(&vp->v_usecount)) { -#ifdef INVARIANTS - int old = atomic_fetchadd_int(&vp->v_holdcnt, -1); - VNASSERT(old > 0, vp, ("%s: wrong hold count %d", __func__, old)); -#else - refcount_release(&vp->v_holdcnt); -#endif - return; - } - - VI_LOCK(vp); - if (refcount_acquire_if_not_zero(&vp->v_usecount)) { -#ifdef INVARIANTS - int old = atomic_fetchadd_int(&vp->v_holdcnt, -1); - VNASSERT(old > 1, vp, ("%s: wrong hold count %d", __func__, old)); -#else - refcount_release(&vp->v_holdcnt); -#endif - VI_UNLOCK(vp); - return; - } - v_incr_devcount(vp); - refcount_acquire(&vp->v_usecount); - VI_UNLOCK(vp); -} - int vget_finish(struct vnode *vp, int flags, enum vgetstate vs) { @@ -2993,11 +2903,6 @@ vget_finish_ref(struct vnode *vp, enum vgetstate vs) if (vs == VGET_USECOUNT) return; - if (__predict_false(vp->v_type == VCHR)) { - vget_finish_vchr(vp); - return; - } - /* * We hold the vnode. If the usecount is 0 it will be utilized to keep * the vnode around. Otherwise someone else lended their hold count and @@ -3019,61 +2924,12 @@ vget_finish_ref(struct vnode *vp, enum vgetstate vs) * Increase the reference (use) and hold count of a vnode. * This will also remove the vnode from the free list if it is presently free. */ -static void __noinline -vref_vchr(struct vnode *vp, bool interlock) -{ - - /* - * See the comment in vget_finish before usecount bump. - */ - if (!interlock) { - if (refcount_acquire_if_not_zero(&vp->v_usecount)) { - VNODE_REFCOUNT_FENCE_ACQ(); - VNASSERT(vp->v_holdcnt > 0, vp, - ("%s: active vnode not held", __func__)); - return; - } - VI_LOCK(vp); - /* - * By the time we get here the vnode might have been doomed, at - * which point the 0->1 use count transition is no longer - * protected by the interlock. Since it can't bounce back to - * VCHR and requires vref semantics, punt it back - */ - if (__predict_false(vp->v_type == VBAD)) { - VI_UNLOCK(vp); - vref(vp); - return; - } - } - VNASSERT(vp->v_type == VCHR, vp, ("type != VCHR)")); - if (refcount_acquire_if_not_zero(&vp->v_usecount)) { - VNODE_REFCOUNT_FENCE_ACQ(); - VNASSERT(vp->v_holdcnt > 0, vp, - ("%s: active vnode not held", __func__)); - if (!interlock) - VI_UNLOCK(vp); - return; - } - vhold(vp); - v_incr_devcount(vp); - refcount_acquire(&vp->v_usecount); - if (!interlock) - VI_UNLOCK(vp); - return; -} - void vref(struct vnode *vp) { int old; CTR2(KTR_VFS, "%s: vp %p", __func__, vp); - if (__predict_false(vp->v_type == VCHR)) { - vref_vchr(vp, false); - return; - } - if (refcount_acquire_if_not_zero(&vp->v_usecount)) { VNODE_REFCOUNT_FENCE_ACQ(); VNASSERT(vp->v_holdcnt > 0, vp, @@ -3102,10 +2958,6 @@ vrefl(struct vnode *vp) ASSERT_VI_LOCKED(vp, __func__); CTR2(KTR_VFS, "%s: vp %p", __func__, vp); - if (__predict_false(vp->v_type == VCHR)) { - vref_vchr(vp, true); - return; - } vref(vp); } @@ -3246,9 +3098,6 @@ enum vput_op { VRELE, VPUT, VUNREF }; * By releasing the last usecount we take ownership of the hold count which * provides liveness of the vnode, meaning we have to vdrop. * - * If the vnode is of type VCHR we may need to decrement si_usecount, see - * v_decr_devcount for details. - * * For all vnodes we may need to perform inactive processing. It requires an * exclusive lock on the vnode, while it is legal to call here with only a * shared lock (or no locks). If locking the vnode in an expected manner fails, @@ -3269,8 +3118,6 @@ vput_final(struct vnode *vp, enum vput_op func) VNPASS(vp->v_holdcnt > 0, vp); VI_LOCK(vp); - if (__predict_false(vp->v_type == VCHR && func != VRELE)) - v_decr_devcount(vp); /* * By the time we got here someone else might have transitioned @@ -3358,28 +3205,9 @@ out: * Releasing the last use count requires additional processing, see vput_final * above for details. * - * Note that releasing use count without the vnode lock requires special casing - * for VCHR, see v_decr_devcount for details. - * * Comment above each variant denotes lock state on entry and exit. */ -static void __noinline -vrele_vchr(struct vnode *vp) -{ - - if (refcount_release_if_not_last(&vp->v_usecount)) - return; - VI_LOCK(vp); - if (!refcount_release(&vp->v_usecount)) { - VI_UNLOCK(vp); - return; - } - v_decr_devcount(vp); - VI_UNLOCK(vp); - vput_final(vp, VRELE); -} - /* * in: any * out: same as passed in @@ -3389,10 +3217,6 @@ vrele(struct vnode *vp) { ASSERT_VI_UNLOCKED(vp, __func__); - if (__predict_false(vp->v_type == VCHR)) { - vrele_vchr(vp); - return; - } if (!refcount_release(&vp->v_usecount)) return; vput_final(vp, VRELE); @@ -4141,20 +3965,6 @@ vgonel(struct vnode *vp) vp->v_vnlock = &vp->v_lock; vp->v_op = &dead_vnodeops; vp->v_type = VBAD; -} - -/* - * Calculate the total number of references to a special device. - */ -int -vcount(struct vnode *vp) -{ - int count; - - dev_lock(); - count = vp->v_rdev->si_usecount; - dev_unlock(); - return (count); } /* Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Tue Aug 11 14:19:05 2020 (r364112) +++ head/sys/kern/vfs_syscalls.c Tue Aug 11 14:27:57 2020 (r364113) @@ -87,6 +87,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include MALLOC_DEFINE(M_FADVISE, "fadvise", "posix_fadvise(2) information"); @@ -4213,7 +4215,7 @@ sys_revoke(struct thread *td, struct revoke_args *uap) if (error != 0) goto out; } - if (vp->v_usecount > 1 || vcount(vp) > 1) + if (devfs_usecount(vp) > 0) VOP_REVOKE(vp, REVOKEALL); out: vput(vp); Modified: head/sys/sys/vnode.h ============================================================================== --- head/sys/sys/vnode.h Tue Aug 11 14:19:05 2020 (r364112) +++ head/sys/sys/vnode.h Tue Aug 11 14:27:57 2020 (r364113) @@ -676,7 +676,6 @@ int vaccess_acl_posix1e(enum vtype type, uid_t file_ui gid_t file_gid, struct acl *acl, accmode_t accmode, struct ucred *cred); void vattr_null(struct vattr *vap); -int vcount(struct vnode *vp); void vlazy(struct vnode *); void vdrop(struct vnode *); void vdropl(struct vnode *); From owner-svn-src-all@freebsd.org Tue Aug 11 15:05:03 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6F9C73B0714; Tue, 11 Aug 2020 15:05:03 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQx2l2K9kz4cgC; Tue, 11 Aug 2020 15:05: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 32AA41CBD8; Tue, 11 Aug 2020 15:05: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 07BF52Kj051484; Tue, 11 Aug 2020 15:05:02 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07BF520F051483; Tue, 11 Aug 2020 15:05:02 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008111505.07BF520F051483@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 11 Aug 2020 15:05: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: r364114 - stable/12/usr.sbin/sesutil X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/usr.sbin/sesutil X-SVN-Commit-Revision: 364114 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 15:05:03 -0000 Author: trasz Date: Tue Aug 11 15:05:02 2020 New Revision: 364114 URL: https://svnweb.freebsd.org/changeset/base/364114 Log: MFC r355130: Fix typos. Sponsored by: Klara, Inc. Modified: stable/12/usr.sbin/sesutil/eltsub.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/sesutil/eltsub.c ============================================================================== --- stable/12/usr.sbin/sesutil/eltsub.c Tue Aug 11 14:27:57 2020 (r364113) +++ stable/12/usr.sbin/sesutil/eltsub.c Tue Aug 11 15:05:02 2020 (r364114) @@ -65,11 +65,11 @@ geteltnm(int type) case ELMTYP_FAN: return ("Cooling"); case ELMTYP_THERM: - return ("Temperature Sensors"); + return ("Temperature Sensor"); case ELMTYP_DOORLOCK: return ("Door Lock"); case ELMTYP_ALARM: - return ("Audible alarm"); + return ("Audible Alarm"); case ELMTYP_ESCC: return ("Enclosure Services Controller Electronics"); case ELMTYP_SCC: From owner-svn-src-all@freebsd.org Tue Aug 11 15:07:28 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8D1573B0726; Tue, 11 Aug 2020 15:07:28 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQx5X3bXjz4d5N; Tue, 11 Aug 2020 15:07:28 +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 5F88B1CE1B; Tue, 11 Aug 2020 15:07:28 +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 07BF7SnD051656; Tue, 11 Aug 2020 15:07:28 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07BF7SZR051654; Tue, 11 Aug 2020 15:07:28 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008111507.07BF7SZR051654@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 11 Aug 2020 15:07: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: r364115 - stable/12/usr.sbin/sesutil X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/usr.sbin/sesutil X-SVN-Commit-Revision: 364115 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 15:07:28 -0000 Author: trasz Date: Tue Aug 11 15:07:27 2020 New Revision: 364115 URL: https://svnweb.freebsd.org/changeset/base/364115 Log: MFC r355751: Add 'sesutil show' subcommand to show enclosure and its contents in a user-friendly way. Relnotes: yes Sponsored by: Klara, Inc. Modified: stable/12/usr.sbin/sesutil/sesutil.8 stable/12/usr.sbin/sesutil/sesutil.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/sesutil/sesutil.8 ============================================================================== --- stable/12/usr.sbin/sesutil/sesutil.8 Tue Aug 11 15:05:02 2020 (r364114) +++ stable/12/usr.sbin/sesutil/sesutil.8 Tue Aug 11 15:07:27 2020 (r364115) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 29, 2017 +.Dd December 12, 2019 .Dt SESUTIL 8 .Os .Sh NAME @@ -46,6 +46,10 @@ .Op Fl -libxo Ar options .Op Fl u Ar /dev/sesN .Nm +.Cm show +.Op Fl -libxo Ar options +.Op Fl u Ar /dev/sesN +.Nm .Cm status .Op Fl -libxo Ar options .Op Fl u Ar /dev/sesN @@ -97,6 +101,11 @@ must be the element ID of a valid item attached to the Use the .Cm map command to list the elements attached to a controller. +.It Cm show Op Fl u Ar /dev/sesN +Display user-friendly summary of specified +.Xr ses 4 +controller. +If no controller is specified, all controllers are mapped. .It Cm map Op Fl u Ar /dev/sesN Display a map of all elements connected to the specified .Xr ses 4 Modified: stable/12/usr.sbin/sesutil/sesutil.c ============================================================================== --- stable/12/usr.sbin/sesutil/sesutil.c Tue Aug 11 15:05:02 2020 (r364114) +++ stable/12/usr.sbin/sesutil/sesutil.c Tue Aug 11 15:07:27 2020 (r364115) @@ -1,9 +1,13 @@ /*- + * Copyright (c) 2019 Klara Inc. * Copyright (c) 2015 Baptiste Daroussin * Copyright (c) 2015 Allan Jude * Copyright (c) 2000 by Matthew Jacob * All rights reserved. * + * Portions of this software were developed by Edward Tomasz Napierala + * under sponsorship from Klara Inc. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -31,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -54,12 +59,20 @@ __FBSDID("$FreeBSD$"); #define SESUTIL_XO_VERSION "1" +#define TEMPERATURE_OFFSET 20 + +#define PRINT_STYLE_DASHED 0 +#define PRINT_STYLE_DASHED_2 1 +#define PRINT_STYLE_CSV 2 +#define PRINT_STYLE_CSV_2 3 + static int encstatus(int argc, char **argv); static int fault(int argc, char **argv); static int locate(int argc, char **argv); static int objmap(int argc, char **argv); static int sesled(int argc, char **argv, bool fault); -static void sesutil_print(bool *title, const char *fmt, ...) __printflike(2,3); +static int show(int argc, char **argv); +static void sesutil_print(int *style, const char *fmt, ...) __printflike(2,3); static struct command { const char *name; @@ -77,6 +90,8 @@ static struct command { locate }, { "map", "", "Print a map of the devices managed by the enclosure", objmap } , + { "show", "", + "Print a human-friendly summary of the enclosure", show } , { "status", "", "Print the status of the enclosure", encstatus }, }; @@ -313,64 +328,72 @@ fault(int argc, char **argv) return (sesled(argc, argv, true)); } -#define TEMPERATURE_OFFSET 20 static void -sesutil_print(bool *title, const char *fmt, ...) +sesutil_print(int *style, const char *fmt, ...) { va_list args; - if (!*title) { + if (*style == PRINT_STYLE_DASHED) { xo_open_container("extra_status"); xo_emit("\t\tExtra status:\n"); - *title = true; + *style = PRINT_STYLE_DASHED_2; + } else if (*style == PRINT_STYLE_CSV) { + xo_open_container("extra_status"); + *style = PRINT_STYLE_CSV_2; } + + if (*style == PRINT_STYLE_DASHED_2) + xo_emit("\t\t- "); + else if (*style == PRINT_STYLE_CSV_2) + xo_emit(", "); va_start(args, fmt); xo_emit_hv(NULL, fmt, args); va_end(args); + if (*style == PRINT_STYLE_DASHED_2) + xo_emit("\n"); } static void -print_extra_status(int eletype, u_char *cstat) +print_extra_status(int eletype, u_char *cstat, int style) { - bool title = false; if (cstat[0] & 0x40) { - sesutil_print(&title, "\t\t-{e:predicted_failure/true} Predicted Failure\n"); + sesutil_print(&style, "{e:predicted_failure/true} Predicted Failure"); } if (cstat[0] & 0x20) { - sesutil_print(&title, "\t\t-{e:disabled/true} Disabled\n"); + sesutil_print(&style, "{e:disabled/true} Disabled"); } if (cstat[0] & 0x10) { - sesutil_print(&title, "\t\t-{e:swapped/true} Swapped\n"); + sesutil_print(&style, "{e:swapped/true} Swapped"); } switch (eletype) { case ELMTYP_DEVICE: case ELMTYP_ARRAY_DEV: if (cstat[2] & 0x02) { - sesutil_print(&title, "\t\t- LED={q:led/locate}\n"); + sesutil_print(&style, "LED={q:led/locate}"); } if (cstat[2] & 0x20) { - sesutil_print(&title, "\t\t- LED={q:led/fault}\n"); + sesutil_print(&style, "LED={q:led/fault}"); } break; case ELMTYP_FAN: - sesutil_print(&title, "\t\t- Speed: {:speed/%d}{Uw:rpm}\n", + sesutil_print(&style, "Speed: {:speed/%d}{Uw:rpm}", (((0x7 & cstat[1]) << 8) + cstat[2]) * 10); break; case ELMTYP_THERM: if (cstat[2]) { - sesutil_print(&title, "\t\t- Temperature: {:temperature/%d}{Uw:C}\n", + sesutil_print(&style, "Temperature: {:temperature/%d}{Uw:C}", cstat[2] - TEMPERATURE_OFFSET); } else { - sesutil_print(&title, "\t\t- Temperature: -{q:temperature/reserved}-\n"); + sesutil_print(&style, "Temperature: -{q:temperature/reserved}"); } break; case ELMTYP_VOM: - sesutil_print(&title, "\t\t- Voltage: {:voltage/%.2f}{Uw:V}\n", + sesutil_print(&style, "Voltage: {:voltage/%.2f}{Uw:V}", be16dec(cstat + 2) / 100.0); break; } - if (title) { + if (style) { xo_close_container("extra_status"); } } @@ -499,10 +522,337 @@ objmap(int argc, char **argv __unused) xo_emit("\t\tDevice Names: {:device_names/%s}\n", e_devname.elm_devnames); } - print_extra_status(e_ptr[j].elm_type, e_status.cstat); + print_extra_status(e_ptr[j].elm_type, e_status.cstat, PRINT_STYLE_DASHED); xo_close_instance("elements"); free(e_devname.elm_devnames); } + xo_close_list("elements"); + free(e_ptr); + close(fd); + } + globfree(&g); + xo_close_list("enclosures"); + xo_close_container("sesutil"); + xo_finish(); + + return (EXIT_SUCCESS); +} + +/* + * Get rid of the 'passN' devices, unless there's nothing else to show. + */ +static void +skip_pass_devices(char *devnames, size_t devnameslen) +{ + char *dev, devs[128], passes[128], *tmp; + + devs[0] = passes[0] = '\0'; + tmp = devnames; + + while ((dev = strsep(&tmp, ",")) != NULL) { + if (strncmp(dev, "pass", 4) == 0) { + if (passes[0] != '\0') + strlcat(passes, ",", sizeof(passes)); + strlcat(passes, dev, sizeof(passes)); + } else { + if (devs[0] != '\0') + strlcat(devs, ",", sizeof(devs)); + strlcat(devs, dev, sizeof(devs)); + } + } + strlcpy(devnames, devs, devnameslen); + if (devnames[0] == '\0') + strlcpy(devnames, passes, devnameslen); +} + +static void +fetch_device_details(char *devnames, char **model, char **serial, off_t *size) +{ + char ident[DISK_IDENT_SIZE]; + struct diocgattr_arg arg; + char *device, *tmp; + off_t mediasize; + int fd; + + tmp = strdup(devnames); + if (tmp == NULL) + err(1, "strdup"); + + device = strsep(&tmp, ","); + asprintf(&tmp, "/dev/%s", device); + fd = open(tmp, O_RDONLY); + if (fd < 0) { + /* + * This can happen with a disk so broken it cannot + * be probed by GEOM. + */ + *model = strdup("?"); + *serial = strdup("?"); + *size = -1; + return; + } + + strlcpy(arg.name, "GEOM::descr", sizeof(arg.name)); + arg.len = sizeof(arg.value.str); + if (ioctl(fd, DIOCGATTR, &arg) == 0) + *model = strdup(arg.value.str); + else + *model = NULL; + + if (ioctl(fd, DIOCGIDENT, ident) == 0) + *serial = strdup(ident); + else + *serial = NULL; + + if (ioctl(fd, DIOCGMEDIASIZE, &mediasize) == 0) + *size = mediasize; + else + *size = -1; +} + +static void +show_device(int fd, int elm_idx, encioc_elm_status_t e_status, encioc_elm_desc_t e_desc) +{ + encioc_elm_devnames_t e_devname; + char *model, *serial; + off_t size; + + /* Get the device name(s) of the element */ + memset(&e_devname, 0, sizeof(e_devname)); + e_devname.elm_idx = elm_idx; + e_devname.elm_names_size = 128; + e_devname.elm_devnames = calloc(128, sizeof(char)); + if (e_devname.elm_devnames == NULL) { + close(fd); + xo_err(EXIT_FAILURE, "calloc()"); + } + + if (ioctl(fd, ENCIOC_GETELMDEVNAMES, + (caddr_t) &e_devname) < 0) { + /* We don't care if this fails */ + e_devname.elm_devnames[0] = '\0'; + model = NULL; + serial = NULL; + size = -1; + } else { + skip_pass_devices(e_devname.elm_devnames, 128); + fetch_device_details(e_devname.elm_devnames, &model, &serial, &size); + } + xo_open_instance("elements"); + xo_emit("{e:type/device_slot}"); + xo_emit("{d:description/%-8s} ", e_desc.elm_desc_len > 0 ? e_desc.elm_desc_str : "-"); + xo_emit("{e:description/%-8s}", e_desc.elm_desc_len > 0 ? e_desc.elm_desc_str : ""); + xo_emit("{d:device_names/%-7s} ", e_devname.elm_names_len > 0 ? e_devname.elm_devnames : "-"); + xo_emit("{e:device_names/%s}", e_devname.elm_names_len > 0 ? e_devname.elm_devnames : ""); + xo_emit("{d:model/%-25s} ", model ? model : "-"); + xo_emit("{e:model/%s}", model ? model : ""); + xo_emit("{d:serial/%-20s} ", serial != NULL ? serial : "-"); + xo_emit("{e:serial/%s}", serial != NULL ? serial : ""); + if (e_status.cstat[0] == SES_OBJSTAT_OK && size >= 0) { + xo_emit("{h,hn-1000:size/%ld}{e:status/%s}", + size, scode2ascii(e_status.cstat[0])); + } else { + xo_emit("{:status/%s}", scode2ascii(e_status.cstat[0])); + } + print_extra_status(ELMTYP_ARRAY_DEV, e_status.cstat, PRINT_STYLE_CSV); + xo_emit("\n"); + xo_close_instance("elements"); + free(e_devname.elm_devnames); +} + +static void +show_therm(encioc_elm_status_t e_status, encioc_elm_desc_t e_desc) +{ + + if (e_desc.elm_desc_len <= 0) { + /* We don't have a label to display; might as well skip it. */ + return; + } + + if (e_status.cstat[2] == 0) { + /* No temperature to show. */ + return; + } + + xo_open_instance("elements"); + xo_emit("{e:type/temperature_sensor}"); + xo_emit("{:description/%s}: {:temperature/%d}{Uw:C}", + e_desc.elm_desc_str, e_status.cstat[2] - TEMPERATURE_OFFSET); + xo_close_instance("elements"); +} + +static void +show_vom(encioc_elm_status_t e_status, encioc_elm_desc_t e_desc) +{ + + if (e_desc.elm_desc_len <= 0) { + /* We don't have a label to display; might as well skip it. */ + return; + } + + if (e_status.cstat[2] == 0) { + /* No voltage to show. */ + return; + } + + xo_open_instance("elements"); + xo_emit("{e:type/voltage_sensor}"); + xo_emit("{:description/%s}: {:voltage/%.2f}{Uw:V}", + e_desc.elm_desc_str, be16dec(e_status.cstat + 2) / 100.0); + xo_close_instance("elements"); +} + +static int +show(int argc, char **argv __unused) +{ + encioc_string_t stri; + encioc_elm_status_t e_status; + encioc_elm_desc_t e_desc; + encioc_element_t *e_ptr; + glob_t g; + elm_type_t prev_type; + int fd; + unsigned int j, nobj; + size_t i; + bool first_ses; + char str[32]; + + if (argc != 1) { + usage(stderr, "map"); + } + + first_ses = true; + + /* Get the list of ses devices */ + if (glob(uflag, 0, NULL, &g) == GLOB_NOMATCH) { + globfree(&g); + xo_errx(EXIT_FAILURE, "No SES devices found"); + } + xo_set_version(SESUTIL_XO_VERSION); + xo_open_container("sesutil"); + xo_open_list("enclosures"); + for (i = 0; i < g.gl_pathc; i++) { + /* ensure we only got numbers after ses */ + if (strspn(g.gl_pathv[i] + 8, "0123456789") != + strlen(g.gl_pathv[i] + 8)) { + continue; + } + if ((fd = open(g.gl_pathv[i], O_RDWR)) < 0) { + /* + * Don't treat non-access errors as critical if we are + * accessing all devices + */ + if (errno == EACCES && g.gl_pathc > 1) { + xo_err(EXIT_FAILURE, "unable to access SES device"); + } + xo_warn("unable to access SES device: %s", g.gl_pathv[i]); + continue; + } + + if (ioctl(fd, ENCIOC_GETNELM, (caddr_t) &nobj) < 0) { + close(fd); + xo_err(EXIT_FAILURE, "ENCIOC_GETNELM"); + } + + e_ptr = calloc(nobj, sizeof(encioc_element_t)); + if (e_ptr == NULL) { + close(fd); + xo_err(EXIT_FAILURE, "calloc()"); + } + + if (ioctl(fd, ENCIOC_GETELMMAP, (caddr_t) e_ptr) < 0) { + close(fd); + xo_err(EXIT_FAILURE, "ENCIOC_GETELMMAP"); + } + + xo_open_instance("enclosures"); + + if (first_ses) + first_ses = false; + else + xo_emit("\n"); + + xo_emit("{t:enc/%s}: ", g.gl_pathv[i] + 5); + stri.bufsiz = sizeof(str); + stri.buf = &str[0]; + if (ioctl(fd, ENCIOC_GETENCNAME, (caddr_t) &stri) == 0) + xo_emit("<{t:name/%s}>; ", stri.buf); + stri.bufsiz = sizeof(str); + stri.buf = &str[0]; + if (ioctl(fd, ENCIOC_GETENCID, (caddr_t) &stri) == 0) + xo_emit("ID: {t:id/%s}", stri.buf); + xo_emit("\n"); + + xo_open_list("elements"); + prev_type = -1; + for (j = 0; j < nobj; j++) { + /* Get the status of the element */ + memset(&e_status, 0, sizeof(e_status)); + e_status.elm_idx = e_ptr[j].elm_idx; + if (ioctl(fd, ENCIOC_GETELMSTAT, + (caddr_t) &e_status) < 0) { + close(fd); + xo_err(EXIT_FAILURE, "ENCIOC_GETELMSTAT"); + } + + /* + * Skip "Unsupported" elements; those usually precede + * the actual device entries and are not particularly + * interesting. + */ + if (e_status.cstat[0] == SES_OBJSTAT_UNSUPPORTED) + continue; + + /* Get the description of the element */ + memset(&e_desc, 0, sizeof(e_desc)); + e_desc.elm_idx = e_ptr[j].elm_idx; + e_desc.elm_desc_len = UINT16_MAX; + e_desc.elm_desc_str = calloc(UINT16_MAX, sizeof(char)); + if (e_desc.elm_desc_str == NULL) { + close(fd); + xo_err(EXIT_FAILURE, "calloc()"); + } + if (ioctl(fd, ENCIOC_GETELMDESC, + (caddr_t) &e_desc) < 0) { + close(fd); + xo_err(EXIT_FAILURE, "ENCIOC_GETELMDESC"); + } + + switch (e_ptr[j].elm_type) { + case ELMTYP_DEVICE: + case ELMTYP_ARRAY_DEV: + if (e_ptr[j].elm_type != prev_type) + xo_emit("Desc Dev Model Ident Size/Status\n"); + + show_device(fd, e_ptr[j].elm_idx, e_status, e_desc); + prev_type = e_ptr[j].elm_type; + break; + case ELMTYP_THERM: + if (e_ptr[j].elm_type != prev_type) + xo_emit("\nVoltages: "); + else + xo_emit(", "); + prev_type = e_ptr[j].elm_type; + show_therm(e_status, e_desc); + break; + case ELMTYP_VOM: + if (e_ptr[j].elm_type != prev_type) + xo_emit("\nTemperatures: "); + else + xo_emit(", "); + prev_type = e_ptr[j].elm_type; + show_vom(e_status, e_desc); + break; + default: + /* + * Ignore stuff not interesting to the user. + */ + break; + } + } + if (prev_type != (elm_type_t)-1 && + prev_type != ELMTYP_DEVICE && prev_type != ELMTYP_ARRAY_DEV) + xo_emit("\n"); xo_close_list("elements"); free(e_ptr); close(fd); From owner-svn-src-all@freebsd.org Tue Aug 11 15:08:33 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4A22D3B08C8; Tue, 11 Aug 2020 15:08:33 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQx6n0vqQz4dC7; Tue, 11 Aug 2020 15:08:33 +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 024881CC3A; Tue, 11 Aug 2020 15:08:33 +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 07BF8Wgr051764; Tue, 11 Aug 2020 15:08:32 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07BF8WRQ051763; Tue, 11 Aug 2020 15:08:32 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008111508.07BF8WRQ051763@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 11 Aug 2020 15:08:32 +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: r364116 - stable/12/usr.sbin/sesutil X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/usr.sbin/sesutil X-SVN-Commit-Revision: 364116 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 15:08:33 -0000 Author: trasz Date: Tue Aug 11 15:08:32 2020 New Revision: 364116 URL: https://svnweb.freebsd.org/changeset/base/364116 Log: MFC r362807: Fix misplaced voltages/temperatures labels in 'sesutil show'. PR: bin/247384 Reported by: brd Modified: stable/12/usr.sbin/sesutil/sesutil.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/sesutil/sesutil.c ============================================================================== --- stable/12/usr.sbin/sesutil/sesutil.c Tue Aug 11 15:07:27 2020 (r364115) +++ stable/12/usr.sbin/sesutil/sesutil.c Tue Aug 11 15:08:32 2020 (r364116) @@ -829,7 +829,7 @@ show(int argc, char **argv __unused) break; case ELMTYP_THERM: if (e_ptr[j].elm_type != prev_type) - xo_emit("\nVoltages: "); + xo_emit("\nTemperatures: "); else xo_emit(", "); prev_type = e_ptr[j].elm_type; @@ -837,7 +837,7 @@ show(int argc, char **argv __unused) break; case ELMTYP_VOM: if (e_ptr[j].elm_type != prev_type) - xo_emit("\nTemperatures: "); + xo_emit("\nVoltages: "); else xo_emit(", "); prev_type = e_ptr[j].elm_type; From owner-svn-src-all@freebsd.org Tue Aug 11 15:46:23 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 32A213B0FD9; Tue, 11 Aug 2020 15:46:23 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQxyR0Zx6z4ft1; Tue, 11 Aug 2020 15:46:23 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EABD51D4CC; Tue, 11 Aug 2020 15:46:22 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07BFkMDr076123; Tue, 11 Aug 2020 15:46:22 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07BFkMfS076120; Tue, 11 Aug 2020 15:46:22 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <202008111546.07BFkMfS076120@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Tue, 11 Aug 2020 15:46:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364117 - in head: sbin/ipfw sys/netpfil/ipfw X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: in head: sbin/ipfw sys/netpfil/ipfw X-SVN-Commit-Revision: 364117 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 15:46:23 -0000 Author: glebius Date: Tue Aug 11 15:46:22 2020 New Revision: 364117 URL: https://svnweb.freebsd.org/changeset/base/364117 Log: ipfw: make the "frag" keyword accept additional options "mf", "df", "rf" and "offset". This allows to match on specific bits of ip_off field. For compatibility reasons lack of keyword means "offset". Reviewed by: ae Differential Revision: https://reviews.freebsd.org/D26021 Modified: head/sbin/ipfw/ipfw.8 head/sbin/ipfw/ipfw2.c head/sys/netpfil/ipfw/ip_fw2.c Modified: head/sbin/ipfw/ipfw.8 ============================================================================== --- head/sbin/ipfw/ipfw.8 Tue Aug 11 15:08:32 2020 (r364116) +++ head/sbin/ipfw/ipfw.8 Tue Aug 11 15:46:22 2020 (r364117) @@ -1,7 +1,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 21, 2019 +.Dd August 10, 2020 .Dt IPFW 8 .Os .Sh NAME @@ -600,7 +600,7 @@ See Section By name or address .It Misc. IP header fields Version, type of service, datagram length, identification, -fragment flag (non-zero IP offset), +fragmentation flags, Time To Live .It IP options .It IPv6 Extension headers @@ -1602,12 +1602,29 @@ Matches IPv6 packets containing any of the flow labels .Ar labels . .Ar labels is a comma separated list of numeric flow labels. -.It Cm frag -Matches packets that are fragments and not the first -fragment of an IP datagram. -Note that these packets will not have -the next protocol header (e.g.\& TCP, UDP) so options that look into -these headers cannot match. +.It Cm frag Ar spec +Matches IPv4 packets whose +.Cm ip_off +field contains the comma separated list of IPv4 fragmentation +options specified in +.Ar spec . +The recognized options are: +.Cm df +.Pq Dv don't fragment , +.Cm mf +.Pq Dv more fragments , +.Cm rf +.Pq Dv reserved fragment bit +.Cm offset +.Pq Dv non-zero fragment offset . +The absence of a particular options may be denoted +with a +.Ql \&! . +.Pp +Empty list of options defaults to matching on non-zero fragment offset. +Such rule would match all not the first fragment datagrams, +both IPv4 and IPv6. +This is a backward compatibility with older rulesets. .It Cm gid Ar group Matches all TCP or UDP packets sent by or received for a .Ar group . Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Tue Aug 11 15:08:32 2020 (r364116) +++ head/sbin/ipfw/ipfw2.c Tue Aug 11 15:46:22 2020 (r364117) @@ -168,6 +168,14 @@ static struct _s_x f_iptos[] = { { NULL, 0 } }; +static struct _s_x f_ipoff[] = { + { "rf", IP_RF >> 8 }, + { "df", IP_DF >> 8 }, + { "mf", IP_MF >> 8 }, + { "offset", 0x1 }, + { NULL, 0} +}; + struct _s_x f_ipdscp[] = { { "af11", IPTOS_DSCP_AF11 >> 2 }, /* 001010 */ { "af12", IPTOS_DSCP_AF12 >> 2 }, /* 001100 */ @@ -1531,7 +1539,7 @@ print_instruction(struct buf_pr *bp, const struct form IPPROTO_ETHERTYPE, cmd->opcode); break; case O_FRAG: - bprintf(bp, " frag"); + print_flags(bp, "frag", cmd, f_ipoff); break; case O_FIB: bprintf(bp, " fib %u", cmd->arg1); @@ -4553,7 +4561,15 @@ read_options: break; case TOK_FRAG: - fill_cmd(cmd, O_FRAG, 0, 0); + fill_flags_cmd(cmd, O_FRAG, f_ipoff, *av); + /* + * Compatibility: no argument after "frag" + * keyword equals to "frag offset". + */ + if (cmd->arg1 == 0) + cmd->arg1 = 0x1; + else + av++; break; case TOK_LAYER2: Modified: head/sys/netpfil/ipfw/ip_fw2.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw2.c Tue Aug 11 15:08:32 2020 (r364116) +++ head/sys/netpfil/ipfw/ip_fw2.c Tue Aug 11 15:46:22 2020 (r364117) @@ -1944,7 +1944,23 @@ do { \ break; case O_FRAG: - match = (offset != 0); + if (is_ipv4) { + /* + * Since flags_match() works with + * uint8_t we pack ip_off into 8 bits. + * For this match offset is a boolean. + */ + match = flags_match(cmd, + ((ntohs(ip->ip_off) & ~IP_OFFMASK) + >> 8) | (offset != 0)); + } else { + /* + * Compatiblity: historically bare + * "frag" would match IPv6 fragments. + */ + match = (cmd->arg1 == 0x1 && + (offset != 0)); + } break; case O_IN: /* "out" is "not in" */ From owner-svn-src-all@freebsd.org Tue Aug 11 16:40:10 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 994203B239A; Tue, 11 Aug 2020 16:40:10 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQz8V2F6nz3Tk2; Tue, 11 Aug 2020 16:40:10 +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 161921DDC6; Tue, 11 Aug 2020 16:40:10 +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 07BGe9pZ007517; Tue, 11 Aug 2020 16:40:09 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07BGe9CY007516; Tue, 11 Aug 2020 16:40:09 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202008111640.07BGe9CY007516@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 11 Aug 2020 16:40:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364118 - head/sys/compat/netbsd X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/compat/netbsd X-SVN-Commit-Revision: 364118 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 16:40:10 -0000 Author: markj Date: Tue Aug 11 16:40:09 2020 New Revision: 364118 URL: https://svnweb.freebsd.org/changeset/base/364118 Log: Remove sys/compat/netbsd. It contained only a header used by ncv(4), which was mainly used on pc98 systems. Both ncv(4) and pc98 support have long been removed. Deleted: head/sys/compat/netbsd/ From owner-svn-src-all@freebsd.org Tue Aug 11 16:46:29 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 73F333B25A8; Tue, 11 Aug 2020 16:46:29 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQzHn2TpJz3VDQ; Tue, 11 Aug 2020 16:46:29 +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 38CC01E1EC; Tue, 11 Aug 2020 16:46:29 +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 07BGkT3J013533; Tue, 11 Aug 2020 16:46:29 GMT (envelope-from arichardson@FreeBSD.org) Received: (from arichardson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07BGkSdB013528; Tue, 11 Aug 2020 16:46:28 GMT (envelope-from arichardson@FreeBSD.org) Message-Id: <202008111646.07BGkSdB013528@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arichardson set sender to arichardson@FreeBSD.org using -f From: Alex Richardson Date: Tue, 11 Aug 2020 16:46:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364119 - in head: . share/mk stand/i386/loader sys/modules/linux sys/modules/linux64 X-SVN-Group: head X-SVN-Commit-Author: arichardson X-SVN-Commit-Paths: in head: . share/mk stand/i386/loader sys/modules/linux sys/modules/linux64 X-SVN-Commit-Revision: 364119 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 16:46:29 -0000 Author: arichardson Date: Tue Aug 11 16:46:27 2020 New Revision: 364119 URL: https://svnweb.freebsd.org/changeset/base/364119 Log: Allow overriding the tool used for stripping binaries Since the make variable STRIP is already used for other purposes, this uses STRIPBIN (which is also used for the same purpose by install(1). This allows using LLVM objcopy to strip binaries instead of the in-tree elftoolchain objcopy. We make use of this in CheriBSD since passing binaries generated by our toolchain to elftoolchain strip sometimes results in assertion failures. This allows working around https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=248516 by specifying STRIPBIN=/path/to/llvm-strip Obtained from: CheriBSD Reviewed By: emaste, brooks Differential Revision: https://reviews.freebsd.org/D25988 Modified: head/Makefile.inc1 head/share/mk/sys.mk head/stand/i386/loader/Makefile head/sys/modules/linux/Makefile head/sys/modules/linux64/Makefile Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Tue Aug 11 16:40:09 2020 (r364118) +++ head/Makefile.inc1 Tue Aug 11 16:46:27 2020 (r364119) @@ -180,7 +180,7 @@ MK_SYSTEM_LINKER= no .if defined(CROSS_TOOLCHAIN_PREFIX) CROSS_BINUTILS_PREFIX?=${CROSS_TOOLCHAIN_PREFIX} .endif -XBINUTILS= AS AR LD NM OBJCOPY RANLIB SIZE STRINGS +XBINUTILS= AS AR LD NM OBJCOPY RANLIB SIZE STRINGS STRIPBIN .for BINUTIL in ${XBINUTILS} .if defined(CROSS_BINUTILS_PREFIX) && \ exists(${CROSS_BINUTILS_PREFIX}/${${BINUTIL}}) @@ -755,7 +755,7 @@ CROSSENV+= CC="${XCC} ${XCFLAGS}" CXX="${XCXX} ${XCXXF AS="${XAS}" AR="${XAR}" LD="${XLD}" LLVM_LINK="${XLLVM_LINK}" \ NM=${XNM} OBJCOPY="${XOBJCOPY}" \ RANLIB=${XRANLIB} STRINGS=${XSTRINGS} \ - SIZE="${XSIZE}" + SIZE="${XSIZE}" STRIPBIN="${XSTRIPBIN}" .if defined(CROSS_BINUTILS_PREFIX) && exists(${CROSS_BINUTILS_PREFIX}) # In the case of xdev-build tools, CROSS_BINUTILS_PREFIX won't be a Modified: head/share/mk/sys.mk ============================================================================== --- head/share/mk/sys.mk Tue Aug 11 16:40:09 2020 (r364118) +++ head/share/mk/sys.mk Tue Aug 11 16:46:27 2020 (r364119) @@ -275,6 +275,7 @@ SHELL ?= sh .if !defined(%POSIX) SIZE ?= size +STRIPBIN ?= strip .endif YACC ?= yacc Modified: head/stand/i386/loader/Makefile ============================================================================== --- head/stand/i386/loader/Makefile Tue Aug 11 16:40:09 2020 (r364118) +++ head/stand/i386/loader/Makefile Tue Aug 11 16:46:27 2020 (r364119) @@ -64,7 +64,7 @@ ${LOADER}: ${LOADER}.bin ${BTXLDR} ${BTXKERN} -b ${BTXKERN} ${LOADER}.bin ${LOADER}.bin: ${LOADER}.sym - strip -R .comment -R .note -o ${.TARGET} ${.ALLSRC} + ${STRIPBIN} -R .comment -R .note -o ${.TARGET} ${.ALLSRC} .if ${MK_LOADER_ZFS} == "yes" && ${LOADER_INTERP} == ${LOADER_DEFAULT_INTERP} LINKS+= ${BINDIR}/${LOADER} ${BINDIR}/zfsloader Modified: head/sys/modules/linux/Makefile ============================================================================== --- head/sys/modules/linux/Makefile Tue Aug 11 16:40:09 2020 (r364118) +++ head/sys/modules/linux/Makefile Tue Aug 11 16:46:27 2020 (r364119) @@ -69,12 +69,12 @@ linux${SFX}_support.o: linux${SFX}_assym.h assym.inc ${VDSO}.so: linux${SFX}_locore.o ${OBJCOPY} --input-target binary --output-target elf64-x86-64-freebsd \ --binary-architecture i386 linux${SFX}_locore.o ${.TARGET} - strip -N _binary_linux${SFX}_locore_o_size ${.TARGET} + ${STRIPBIN} -N _binary_linux${SFX}_locore_o_size ${.TARGET} .else ${VDSO}.so: linux${SFX}_locore.o ${OBJCOPY} --input-target binary --output-target elf32-i386-freebsd \ --binary-architecture i386 linux${SFX}_locore.o ${.TARGET} - strip -N _binary_linux_locore_o_size ${.TARGET} + ${STRIPBIN} -N _binary_linux_locore_o_size ${.TARGET} .endif linux${SFX}_genassym.o: offset.inc Modified: head/sys/modules/linux64/Makefile ============================================================================== --- head/sys/modules/linux64/Makefile Tue Aug 11 16:40:09 2020 (r364118) +++ head/sys/modules/linux64/Makefile Tue Aug 11 16:46:27 2020 (r364119) @@ -46,7 +46,7 @@ OBJCOPY_TARGET=--output-target elf64-x86-64 --binary-a ${VDSO}.so: linux_locore.o ${OBJCOPY} --input-target binary ${OBJCOPY_TARGET} -S -g \ linux_locore.o ${.TARGET} - strip -N _binary_linux_locore_o_size ${.TARGET} + ${STRIPBIN} -N _binary_linux_locore_o_size ${.TARGET} linux_support.o: assym.inc linux_assym.h ${CC} -c -x assembler-with-cpp -DLOCORE ${CFLAGS} \ From owner-svn-src-all@freebsd.org Tue Aug 11 16:46:35 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D40BF3B246B; Tue, 11 Aug 2020 16:46:35 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQzHt448xz3VDk; Tue, 11 Aug 2020 16:46:34 +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 2C2E61DE67; Tue, 11 Aug 2020 16:46:34 +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 07BGkYZH013591; Tue, 11 Aug 2020 16:46:34 GMT (envelope-from arichardson@FreeBSD.org) Received: (from arichardson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07BGkXwW013590; Tue, 11 Aug 2020 16:46:33 GMT (envelope-from arichardson@FreeBSD.org) Message-Id: <202008111646.07BGkXwW013590@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arichardson set sender to arichardson@FreeBSD.org using -f From: Alex Richardson Date: Tue, 11 Aug 2020 16:46:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364120 - head/tools/build X-SVN-Group: head X-SVN-Commit-Author: arichardson X-SVN-Commit-Paths: head/tools/build X-SVN-Commit-Revision: 364120 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 16:46:37 -0000 Author: arichardson Date: Tue Aug 11 16:46:33 2020 New Revision: 364120 URL: https://svnweb.freebsd.org/changeset/base/364120 Log: Fix bootstrapping ldd after r362152 r362152 started using DF_1_PIE, which is not present in older versions of sys/elf_common.h. To fix this include the ELF headers as part of -legacy. Modified: head/tools/build/Makefile Modified: head/tools/build/Makefile ============================================================================== --- head/tools/build/Makefile Tue Aug 11 16:46:27 2020 (r364119) +++ head/tools/build/Makefile Tue Aug 11 16:46:33 2020 (r364120) @@ -92,6 +92,12 @@ DISKINCS+= ${SRCTOP}/sys/sys/disk/bsd.h SYSINCS+= ${SRCTOP}/sys/sys/nv.h ${SRCTOP}/sys/sys/cnv.h \ ${SRCTOP}/sys/sys/dnv.h +# Needed when bootstrapping ldd (since it uses DF_1_PIE) +SYSINCS+= ${SRCTOP}/sys/sys/elf32.h +SYSINCS+= ${SRCTOP}/sys/sys/elf64.h +SYSINCS+= ${SRCTOP}/sys/sys/elf_common.h +SYSINCS+= ${SRCTOP}/sys/sys/elf_generic.h + # vtfontcvt is using sys/font.h SYSINCS+= ${SRCTOP}/sys/sys/font.h From owner-svn-src-all@freebsd.org Tue Aug 11 16:46:39 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 56A413B24C8; Tue, 11 Aug 2020 16:46:39 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQzHz0nx3z3V1Q; Tue, 11 Aug 2020 16:46:39 +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 F38691DBFB; Tue, 11 Aug 2020 16:46:38 +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 07BGkcpr013645; Tue, 11 Aug 2020 16:46:38 GMT (envelope-from arichardson@FreeBSD.org) Received: (from arichardson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07BGkc42013644; Tue, 11 Aug 2020 16:46:38 GMT (envelope-from arichardson@FreeBSD.org) Message-Id: <202008111646.07BGkc42013644@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arichardson set sender to arichardson@FreeBSD.org using -f From: Alex Richardson Date: Tue, 11 Aug 2020 16:46:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364121 - head/usr.sbin/pwd_mkdb/bootstrap X-SVN-Group: head X-SVN-Commit-Author: arichardson X-SVN-Commit-Paths: head/usr.sbin/pwd_mkdb/bootstrap X-SVN-Commit-Revision: 364121 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 16:46:39 -0000 Author: arichardson Date: Tue Aug 11 16:46:38 2020 New Revision: 364121 URL: https://svnweb.freebsd.org/changeset/base/364121 Log: Fix bootstrapping of pwd_mkdb after r364049 I moved the bootstrap pwd.h to a subdirectory in r364049 but forgot to adjust the #include path. Modified: head/usr.sbin/pwd_mkdb/bootstrap/pwd.h Modified: head/usr.sbin/pwd_mkdb/bootstrap/pwd.h ============================================================================== --- head/usr.sbin/pwd_mkdb/bootstrap/pwd.h Tue Aug 11 16:46:33 2020 (r364120) +++ head/usr.sbin/pwd_mkdb/bootstrap/pwd.h Tue Aug 11 16:46:38 2020 (r364121) @@ -60,7 +60,7 @@ typedef uint64_t _bootstrap_time_t; #define uid_t _bootstrap_uid_t #define time_t _bootstrap_time_t #define passwd _bootstrap_passwd -#include "../../include/pwd.h" +#include "../../../include/pwd.h" #undef gid_t #undef uid_t #undef time_t From owner-svn-src-all@freebsd.org Tue Aug 11 16:46:45 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B9F553B22E6; Tue, 11 Aug 2020 16:46:45 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQzJ51mQ1z3VW7; Tue, 11 Aug 2020 16:46:44 +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 DDF0C1E0B1; Tue, 11 Aug 2020 16:46:43 +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 07BGkhQP013699; Tue, 11 Aug 2020 16:46:43 GMT (envelope-from arichardson@FreeBSD.org) Received: (from arichardson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07BGkhG0013698; Tue, 11 Aug 2020 16:46:43 GMT (envelope-from arichardson@FreeBSD.org) Message-Id: <202008111646.07BGkhG0013698@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arichardson set sender to arichardson@FreeBSD.org using -f From: Alex Richardson Date: Tue, 11 Aug 2020 16:46:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364122 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: arichardson X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 364122 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 16:46:46 -0000 Author: arichardson Date: Tue Aug 11 16:46:43 2020 New Revision: 364122 URL: https://svnweb.freebsd.org/changeset/base/364122 Log: Add CLANG/LLD/LLD to BROKEN_OPTIONS when building on non-FreeBSD These tools require a bootstrap llvm-tblgen/clang-tblgen and that cannot be built with the current make infrastructure: the config header is not correct for Linux/macOS and we don't include the CMakeLists.txt in contrib so we can't generate one that would be correct. Reviewed By: emaste, imp, dim Differential Revision: https://reviews.freebsd.org/D14245 Modified: head/share/mk/src.opts.mk Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Tue Aug 11 16:46:38 2020 (r364121) +++ head/share/mk/src.opts.mk Tue Aug 11 16:46:43 2020 (r364122) @@ -365,6 +365,14 @@ __DEFAULT_YES_OPTIONS+=OPENMP __DEFAULT_NO_OPTIONS+=OPENMP .endif +.if ${.MAKE.OS} != "FreeBSD" +# Building the target compiler requires building tablegen on the host +# which is (currently) not possible on non-FreeBSD. +BROKEN_OPTIONS+=CLANG LLD LLDB +# The same also applies to the bootstrap LLVM. +BROKEN_OPTIONS+=CLANG_BOOTSTRAP LLD_BOOTSTRAP +.endif + .include # From owner-svn-src-all@freebsd.org Tue Aug 11 16:46:52 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C83FF3B2780; Tue, 11 Aug 2020 16:46:52 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQzJD2wgsz3VJM; Tue, 11 Aug 2020 16:46:52 +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 208FC1E0B2; Tue, 11 Aug 2020 16:46:50 +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 07BGknrf013759; Tue, 11 Aug 2020 16:46:49 GMT (envelope-from arichardson@FreeBSD.org) Received: (from arichardson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07BGknKD013755; Tue, 11 Aug 2020 16:46:49 GMT (envelope-from arichardson@FreeBSD.org) Message-Id: <202008111646.07BGknKD013755@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arichardson set sender to arichardson@FreeBSD.org using -f From: Alex Richardson Date: Tue, 11 Aug 2020 16:46:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364123 - in head: . cddl/contrib/opensolaris/lib/libdtrace/common X-SVN-Group: head X-SVN-Commit-Author: arichardson X-SVN-Commit-Paths: in head: . cddl/contrib/opensolaris/lib/libdtrace/common X-SVN-Commit-Revision: 364123 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 16:46:53 -0000 Author: arichardson Date: Tue Aug 11 16:46:48 2020 New Revision: 364123 URL: https://svnweb.freebsd.org/changeset/base/364123 Log: Fix -DBUILD_WITH_STRICT_TMPPATH dtrace builds Some of the scripts used for libdtrace invoke nawk instead of awk (for example cddl/contrib/opensolaris/lib/libdtrace/common/mknames.sh). When bootstrapping all tools, we get the nawk -> awk link while building usr.bin/awk, but when linking/copying the dependencies from the host we were only adding awk but not nawk. This was silently generating invalid files when building libdtrace with BUILD_WITH_STRICT_TMPPATH=1 since those scripts invoke nawk instead of awk. In addition to adding the missing link this commit also adds set -e to those scripts to catch errors like this in the future. Reviewed By: markj, emaste Differential Revision: https://reviews.freebsd.org/D26025 Modified: head/Makefile.inc1 head/cddl/contrib/opensolaris/lib/libdtrace/common/mkerrno.sh head/cddl/contrib/opensolaris/lib/libdtrace/common/mkerrtags.sh head/cddl/contrib/opensolaris/lib/libdtrace/common/mknames.sh head/cddl/contrib/opensolaris/lib/libdtrace/common/mksignal.sh Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Tue Aug 11 16:46:43 2020 (r364122) +++ head/Makefile.inc1 Tue Aug 11 16:46:48 2020 (r364123) @@ -2240,9 +2240,13 @@ ${_bt}-usr.bin/mandoc: ${_bt}-lib/libopenbsd _basic_bootstrap_tools_multilink=usr.bin/grep grep,egrep,fgrep _basic_bootstrap_tools_multilink+=bin/test test,[ # bootstrap tools needed by buildworld: -_basic_bootstrap_tools=usr.bin/awk usr.bin/cut bin/expr usr.bin/gencat \ +_basic_bootstrap_tools=usr.bin/cut bin/expr usr.bin/gencat \ usr.bin/join usr.bin/mktemp bin/rmdir usr.bin/sed usr.bin/sort \ usr.bin/truncate usr.bin/tsort +# Some build scripts use nawk instead of awk (this happens at least in +# cddl/contrib/opensolaris/lib/libdtrace/common/mknames.sh) so we need both awk +# and nawk in ${WORLDTMP}/legacy/bin. +_basic_bootstrap_tools_multilink+=usr.bin/awk awk,nawk # file2c is required for building usr.sbin/config: _basic_bootstrap_tools+=usr.bin/file2c # uuencode/uudecode required for share/tabset Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/mkerrno.sh ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/mkerrno.sh Tue Aug 11 16:46:43 2020 (r364122) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/mkerrno.sh Tue Aug 11 16:46:48 2020 (r364123) @@ -25,6 +25,7 @@ # Use is subject to license terms. # #ident "%Z%%M% %I% %E% SMI" +set -e echo "\ /*\n\ Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/mkerrtags.sh ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/mkerrtags.sh Tue Aug 11 16:46:43 2020 (r364122) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/mkerrtags.sh Tue Aug 11 16:46:48 2020 (r364123) @@ -25,6 +25,7 @@ # Use is subject to license terms. # #ident "%Z%%M% %I% %E% SMI" +set -e BSDECHO=-e Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/mknames.sh ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/mknames.sh Tue Aug 11 16:46:43 2020 (r364122) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/mknames.sh Tue Aug 11 16:46:48 2020 (r364123) @@ -25,6 +25,7 @@ # Use is subject to license terms. # #ident "%Z%%M% %I% %E% SMI" +set -e BSDECHO=-e Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/mksignal.sh ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/mksignal.sh Tue Aug 11 16:46:43 2020 (r364122) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/mksignal.sh Tue Aug 11 16:46:48 2020 (r364123) @@ -25,6 +25,7 @@ # Use is subject to license terms. # #ident "%Z%%M% %I% %E% SMI" +set -e echo "\ /*\n\ From owner-svn-src-all@freebsd.org Tue Aug 11 16:47:00 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1DD813B23F7; Tue, 11 Aug 2020 16:47:00 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQzJM4y0jz3VVM; Tue, 11 Aug 2020 16:46:59 +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 DC8491DE68; Tue, 11 Aug 2020 16:46:55 +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 07BGktcF013816; Tue, 11 Aug 2020 16:46:55 GMT (envelope-from arichardson@FreeBSD.org) Received: (from arichardson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07BGktOZ013812; Tue, 11 Aug 2020 16:46:55 GMT (envelope-from arichardson@FreeBSD.org) Message-Id: <202008111646.07BGktOZ013812@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arichardson set sender to arichardson@FreeBSD.org using -f From: Alex Richardson Date: Tue, 11 Aug 2020 16:46:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364124 - head/cddl/contrib/opensolaris/lib/libdtrace/common X-SVN-Group: head X-SVN-Commit-Author: arichardson X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/lib/libdtrace/common X-SVN-Commit-Revision: 364124 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 16:47:00 -0000 Author: arichardson Date: Tue Aug 11 16:46:54 2020 New Revision: 364124 URL: https://svnweb.freebsd.org/changeset/base/364124 Log: Fix libdtrace build with zsh as /bin/sh When zsh runs in POSIX sh mode it does not support the -e flag to echo. Use printf instead of echo to avoid the "-e" characters being printed. Obtained from: CheriBSD Reviewed By: markj Differential Revision: https://reviews.freebsd.org/D26026 Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/mkerrno.sh head/cddl/contrib/opensolaris/lib/libdtrace/common/mkerrtags.sh head/cddl/contrib/opensolaris/lib/libdtrace/common/mknames.sh head/cddl/contrib/opensolaris/lib/libdtrace/common/mksignal.sh Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/mkerrno.sh ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/mkerrno.sh Tue Aug 11 16:46:48 2020 (r364123) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/mkerrno.sh Tue Aug 11 16:46:54 2020 (r364124) @@ -24,16 +24,15 @@ # Copyright 2003 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -#ident "%Z%%M% %I% %E% SMI" set -e -echo "\ -/*\n\ - * Copyright 2003 Sun Microsystems, Inc. All rights reserved.\n\ - * Use is subject to license terms.\n\ - */\n\ -\n\ -#pragma ident\t\"%Z%%M%\t%I%\t%E% SMI\"\n" +printf "%s" " +/* + * Copyright 2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +" pattern='^#define[ ]\(E[A-Z0-9]*\)[ ]*\([A-Z0-9]*\).*$' replace='inline int \1 = \2;@#pragma D binding "1.0" \1' Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/mkerrtags.sh ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/mkerrtags.sh Tue Aug 11 16:46:48 2020 (r364123) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/mkerrtags.sh Tue Aug 11 16:46:54 2020 (r364124) @@ -24,37 +24,34 @@ # Copyright 2003 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -#ident "%Z%%M% %I% %E% SMI" set -e -BSDECHO=-e +printf "%s" " +/* + * Copyright 2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ -echo ${BSDECHO} "\ -/*\n\ - * Copyright 2003 Sun Microsystems, Inc. All rights reserved.\n\ - * Use is subject to license terms.\n\ - */\n\ -\n\ -#pragma ident\t\"%Z%%M%\t%I%\t%E% SMI\"\n\ -\n\ #include -\n\ -static const char *const _dt_errtags[] = {" +static const char *const _dt_errtags[] = { +" + pattern='^ \(D_[A-Z0-9_]*\),*' replace=' "\1",' sed -n "s/$pattern/$replace/p" || exit 1 -echo ${BSDECHO} "\ -};\n\ -\n\ -static const int _dt_ntag = sizeof (_dt_errtags) / sizeof (_dt_errtags[0]);\n\ -\n\ +printf "%s" " +}; + +static const int _dt_ntag = sizeof (_dt_errtags) / sizeof (_dt_errtags[0]); + const char * dt_errtag(dt_errtag_t tag) { return (_dt_errtags[(tag > 0 && tag < _dt_ntag) ? tag : 0]); -}" +} +" exit 0 Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/mknames.sh ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/mknames.sh Tue Aug 11 16:46:48 2020 (r364123) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/mknames.sh Tue Aug 11 16:46:54 2020 (r364124) @@ -24,33 +24,30 @@ # Copyright 2005 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -#ident "%Z%%M% %I% %E% SMI" set -e -BSDECHO=-e +printf "%s" " +/* + * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ -echo ${BSDECHO} "\ -/*\n\ - * Copyright 2005 Sun Microsystems, Inc. All rights reserved.\n\ - * Use is subject to license terms.\n\ - */\n\ -\n\ -#pragma ident\t\"%Z%%M%\t%I%\t%E% SMI\"\n\ -\n\ -#include \n\ -\n\ +#include + /*ARGSUSED*/ -const char *\n\ -dtrace_subrstr(dtrace_hdl_t *dtp, int subr)\n\ -{\n\ - switch (subr) {" +const char * +dtrace_subrstr(dtrace_hdl_t *dtp, int subr) +{ + switch (subr) { +" nawk ' /^#define[ ]*DIF_SUBR_/ && $2 != "DIF_SUBR_MAX" { printf("\tcase %s: return (\"%s\");\n", $2, tolower(substr($2, 10))); }' -echo ${BSDECHO} "\ - default: return (\"unknown\");\n\ - }\n\ -}" +printf "%s" " + default: return (\"unknown\"); + } +} +" Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/mksignal.sh ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/mksignal.sh Tue Aug 11 16:46:48 2020 (r364123) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/mksignal.sh Tue Aug 11 16:46:54 2020 (r364124) @@ -24,16 +24,15 @@ # Copyright 2003 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -#ident "%Z%%M% %I% %E% SMI" set -e -echo "\ -/*\n\ - * Copyright 2003 Sun Microsystems, Inc. All rights reserved.\n\ - * Use is subject to license terms.\n\ - */\n\ -\n\ -#pragma ident\t\"%Z%%M%\t%I%\t%E% SMI\"\n" +printf "%s" " +/* + * Copyright 2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +" pattern='^#define[ ]*_*\(SIG[A-Z0-9]*\)[ ]\{1,\}\([A-Z0-9]*\).*$' replace='inline int \1 = \2;@#pragma D binding "1.0" \1' From owner-svn-src-all@freebsd.org Tue Aug 11 16:47:05 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 41DC93B2721; Tue, 11 Aug 2020 16:47:05 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQzJS4hz2z3Vnr; Tue, 11 Aug 2020 16:47:04 +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 23FEE1E300; Tue, 11 Aug 2020 16:47:01 +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 07BGl0wt013875; Tue, 11 Aug 2020 16:47:00 GMT (envelope-from arichardson@FreeBSD.org) Received: (from arichardson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07BGl0MO013873; Tue, 11 Aug 2020 16:47:00 GMT (envelope-from arichardson@FreeBSD.org) Message-Id: <202008111647.07BGl0MO013873@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arichardson set sender to arichardson@FreeBSD.org using -f From: Alex Richardson Date: Tue, 11 Aug 2020 16:47:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364125 - in head: share/mk sys/conf X-SVN-Group: head X-SVN-Commit-Author: arichardson X-SVN-Commit-Paths: in head: share/mk sys/conf X-SVN-Commit-Revision: 364125 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 16:47:05 -0000 Author: arichardson Date: Tue Aug 11 16:47:00 2020 New Revision: 364125 URL: https://svnweb.freebsd.org/changeset/base/364125 Log: Allow linking the kernel with a linker that doesn't support -z ifunc-noplt This can happen when linking with upstream LLD < 9.0. Reviewed By: markj Differential Revision: https://reviews.freebsd.org/D25985 Modified: head/share/mk/bsd.linker.mk head/sys/conf/kern.pre.mk Modified: head/share/mk/bsd.linker.mk ============================================================================== --- head/share/mk/bsd.linker.mk Tue Aug 11 16:46:54 2020 (r364124) +++ head/share/mk/bsd.linker.mk Tue Aug 11 16:47:00 2020 (r364125) @@ -94,6 +94,9 @@ ${X_}LINKER_FEATURES+= riscv-relaxations .if ${${X_}LINKER_TYPE} == "lld" && ${${X_}LINKER_VERSION} >= 60000 ${X_}LINKER_FEATURES+= retpoline .endif +.if ${${X_}LINKER_TYPE} == "lld" && ${${X_}LINKER_VERSION} >= 90000 +${X_}LINKER_FEATURES+= ifunc-noplt +.endif .endif .else # Use LD's values Modified: head/sys/conf/kern.pre.mk ============================================================================== --- head/sys/conf/kern.pre.mk Tue Aug 11 16:46:54 2020 (r364124) +++ head/sys/conf/kern.pre.mk Tue Aug 11 16:47:00 2020 (r364125) @@ -166,9 +166,13 @@ LDFLAGS+= -z max-page-size=2097152 .if ${LINKER_TYPE} != "lld" LDFLAGS+= -z common-page-size=4096 .else +.if defined(LINKER_FEATURES) && !${LINKER_FEATURES:Mifunc-noplt} +.warning "Linker ${LD} does not support -z ifunc-noplt -> ifunc calls are unoptimized." +.else LDFLAGS+= -z notext -z ifunc-noplt .endif .endif +.endif # ${MACHINE_CPUARCH} == "amd64" .if ${MACHINE_CPUARCH} == "riscv" # Hack: Work around undefined weak symbols being out of range when linking with From owner-svn-src-all@freebsd.org Tue Aug 11 16:59:53 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A03623B2AAC for ; Tue, 11 Aug 2020 16:59:53 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BQzbD6ygnz3X2w for ; Tue, 11 Aug 2020 16:59:52 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wm1-f51.google.com with SMTP id 184so3545327wmb.0 for ; Tue, 11 Aug 2020 09:59:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=31Dywo7nKUD/y8Z/HvAfLp/eimwYuuDVq667WJTjaBY=; b=maaRkBuEzNVNZWzmLXqtWOitsoGdNSrY3OIpTm8JYJGUZg960jFIjbCKLjE4WONoyI WeyKc6BSvb7q2Xn2meY6gJoTO8e5YihgxDCOy+k/up9WtyllNjc/JYFXzOQLk8Cnbc1b O+uPByXYd5V4PMdrG3vBQXTsiC1P7MQfj2BvSRghOkr6pFA7mbBlrOqvw/wONV1oaqB6 H8ZfDMZdYs3E1ujJpml1M0zfHAY1y4pCtjV2fvuDV3gbN/tpbiWsu5PAQGRz8hsy1R33 utTgDfb8veR/FTrOkfvWn886QWyw3CXt1pj13nypunFm33CyaltQM7pFfaEP1sggOPoa PdrQ== X-Gm-Message-State: AOAM5333GIlUmjh1dz5KwhuJAbDN5x8GPXjKTUtyWRW0DtWj7h6SbtUz yqX/eM4uhngVsPHAsoSSEaOjfQ== X-Google-Smtp-Source: ABdhPJzb3cyapS2eY5X3Cc0FArqq1lOo2spde8POiNWgVT6EQdASsRXeLv38golY3Jiq7LJm3+uT7g== X-Received: by 2002:a1c:e919:: with SMTP id q25mr4659872wmc.123.1597165191350; Tue, 11 Aug 2020 09:59:51 -0700 (PDT) Received: from [192.168.149.251] (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id b8sm27454161wrv.4.2020.08.11.09.59.50 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Aug 2020 09:59:50 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.1\)) Subject: Re: svn commit: r364124 - head/cddl/contrib/opensolaris/lib/libdtrace/common From: Jessica Clarke In-Reply-To: <202008111646.07BGktOZ013812@repo.freebsd.org> Date: Tue, 11 Aug 2020 17:59:50 +0100 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <1E4AE078-4233-4790-A0B4-9A7B4809CAF0@freebsd.org> References: <202008111646.07BGktOZ013812@repo.freebsd.org> To: Alex Richardson X-Mailer: Apple Mail (2.3608.120.23.2.1) X-Rspamd-Queue-Id: 4BQzbD6ygnz3X2w X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of jrtc27@jrtc27.com designates 209.85.128.51 as permitted sender) smtp.mailfrom=jrtc27@jrtc27.com X-Spamd-Result: default: False [-2.35 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; FROM_HAS_DN(0.00)[]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-all@freebsd.org]; DMARC_NA(0.00)[freebsd.org]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; NEURAL_HAM_LONG(-1.01)[-1.010]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-0.86)[-0.857]; RCVD_IN_DNSWL_NONE(0.00)[209.85.128.51:from]; NEURAL_HAM_MEDIUM(-0.98)[-0.983]; FORGED_SENDER(0.30)[jrtc27@freebsd.org,jrtc27@jrtc27.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.128.51:from]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[jrtc27@freebsd.org,jrtc27@jrtc27.com]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 16:59:53 -0000 On 11 Aug 2020, at 17:46, Alex Richardson = wrote: >=20 > Author: arichardson > Date: Tue Aug 11 16:46:54 2020 > New Revision: 364124 > URL: https://svnweb.freebsd.org/changeset/base/364124 >=20 > Log: > Fix libdtrace build with zsh as /bin/sh >=20 > When zsh runs in POSIX sh mode it does not support the -e flag to = echo. > Use printf instead of echo to avoid the "-e" characters being = printed. >=20 > Obtained from: CheriBSD > Reviewed By: markj > Differential Revision: https://reviews.freebsd.org/D26026 >=20 > Modified: > head/cddl/contrib/opensolaris/lib/libdtrace/common/mkerrno.sh > head/cddl/contrib/opensolaris/lib/libdtrace/common/mkerrtags.sh > head/cddl/contrib/opensolaris/lib/libdtrace/common/mknames.sh > head/cddl/contrib/opensolaris/lib/libdtrace/common/mksignal.sh >=20 > Modified: = head/cddl/contrib/opensolaris/lib/libdtrace/common/mkerrno.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/cddl/contrib/opensolaris/lib/libdtrace/common/mkerrno.sh = Tue Aug 11 16:46:48 2020 (r364123) > +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/mkerrno.sh = Tue Aug 11 16:46:54 2020 (r364124) > @@ -24,16 +24,15 @@ > # Copyright 2003 Sun Microsystems, Inc. All rights reserved. > # Use is subject to license terms. > # > -#ident "%Z%%M% %I% %E% SMI" > set -e >=20 > -echo "\ > -/*\n\ > - * Copyright 2003 Sun Microsystems, Inc. All rights reserved.\n\ > - * Use is subject to license terms.\n\ > - */\n\ > -\n\ > -#pragma ident\t\"%Z%%M%\t%I%\t%E% SMI\"\n" > +printf "%s" " > +/* > + * Copyright 2003 Sun Microsystems, Inc. All rights reserved. > + * Use is subject to license terms. > + */ > + > +" Surely these would be much better as a heredoc? cat < Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D10A33B3874; Tue, 11 Aug 2020 17:51:31 +0000 (UTC) (envelope-from gshapiro@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BR0kq5B0Bz3Zds; Tue, 11 Aug 2020 17:51:31 +0000 (UTC) (envelope-from gshapiro@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9526E1EB54; Tue, 11 Aug 2020 17:51:31 +0000 (UTC) (envelope-from gshapiro@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07BHpVP1054065; Tue, 11 Aug 2020 17:51:31 GMT (envelope-from gshapiro@FreeBSD.org) Received: (from gshapiro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07BHpVaA054064; Tue, 11 Aug 2020 17:51:31 GMT (envelope-from gshapiro@FreeBSD.org) Message-Id: <202008111751.07BHpVaA054064@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gshapiro set sender to gshapiro@FreeBSD.org using -f From: Gregory Neil Shapiro Date: Tue, 11 Aug 2020 17:51:31 +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: r364126 - stable/12/share/examples/etc X-SVN-Group: stable-12 X-SVN-Commit-Author: gshapiro X-SVN-Commit-Paths: stable/12/share/examples/etc X-SVN-Commit-Revision: 364126 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 17:51:31 -0000 Author: gshapiro Date: Tue Aug 11 17:51:31 2020 New Revision: 364126 URL: https://svnweb.freebsd.org/changeset/base/364126 Log: MFC: Mirror recommendation from Handbook to avoid linking conflicts when pulling in SASL libraries. (r363750) Modified: stable/12/share/examples/etc/make.conf Directory Properties: stable/12/ (props changed) Modified: stable/12/share/examples/etc/make.conf ============================================================================== --- stable/12/share/examples/etc/make.conf Tue Aug 11 16:47:00 2020 (r364125) +++ stable/12/share/examples/etc/make.conf Tue Aug 11 17:51:31 2020 (r364126) @@ -238,13 +238,11 @@ # # with SASLv1: # SENDMAIL_CFLAGS=-I/usr/local/include/sasl1 -DSASL -# SENDMAIL_LDFLAGS=-L/usr/local/lib -# SENDMAIL_LDADD=-lsasl +# SENDMAIL_LDADD=/usr/local/lib/libsasl.so # # with SASLv2: # SENDMAIL_CFLAGS=-I/usr/local/include -DSASL=2 -# SENDMAIL_LDFLAGS=-L/usr/local/lib -# SENDMAIL_LDADD=-lsasl2 +# SENDMAIL_LDADD=/usr/local/lib/libsasl2.so # # Note: If you are using Cyrus SASL with other applications which require # access to the sasldb file, you should add the following to your From owner-svn-src-all@freebsd.org Tue Aug 11 17:53:22 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 68B613B3D55; Tue, 11 Aug 2020 17:53:22 +0000 (UTC) (envelope-from gshapiro@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BR0my27Jpz3Zw4; Tue, 11 Aug 2020 17:53:22 +0000 (UTC) (envelope-from gshapiro@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2C6B41ECE9; Tue, 11 Aug 2020 17:53:22 +0000 (UTC) (envelope-from gshapiro@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07BHrLih058162; Tue, 11 Aug 2020 17:53:21 GMT (envelope-from gshapiro@FreeBSD.org) Received: (from gshapiro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07BHrL7K058161; Tue, 11 Aug 2020 17:53:21 GMT (envelope-from gshapiro@FreeBSD.org) Message-Id: <202008111753.07BHrL7K058161@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gshapiro set sender to gshapiro@FreeBSD.org using -f From: Gregory Neil Shapiro Date: Tue, 11 Aug 2020 17:53: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: r364127 - stable/11/share/examples/etc X-SVN-Group: stable-11 X-SVN-Commit-Author: gshapiro X-SVN-Commit-Paths: stable/11/share/examples/etc X-SVN-Commit-Revision: 364127 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 17:53:22 -0000 Author: gshapiro Date: Tue Aug 11 17:53:21 2020 New Revision: 364127 URL: https://svnweb.freebsd.org/changeset/base/364127 Log: MFC: Mirror recommendation from Handbook to avoid linking conflicts when pulling in SASL libraries. (r363750) Modified: stable/11/share/examples/etc/make.conf Directory Properties: stable/11/ (props changed) Modified: stable/11/share/examples/etc/make.conf ============================================================================== --- stable/11/share/examples/etc/make.conf Tue Aug 11 17:51:31 2020 (r364126) +++ stable/11/share/examples/etc/make.conf Tue Aug 11 17:53:21 2020 (r364127) @@ -238,13 +238,11 @@ # # with SASLv1: # SENDMAIL_CFLAGS=-I/usr/local/include/sasl1 -DSASL -# SENDMAIL_LDFLAGS=-L/usr/local/lib -# SENDMAIL_LDADD=-lsasl +# SENDMAIL_LDADD=/usr/local/lib/libsasl.so # # with SASLv2: # SENDMAIL_CFLAGS=-I/usr/local/include -DSASL=2 -# SENDMAIL_LDFLAGS=-L/usr/local/lib -# SENDMAIL_LDADD=-lsasl2 +# SENDMAIL_LDADD=/usr/local/lib/libsasl2.so # # Note: If you are using Cyrus SASL with other applications which require # access to the sasldb file, you should add the following to your From owner-svn-src-all@freebsd.org Tue Aug 11 17:54:10 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B46F63B3ACE; Tue, 11 Aug 2020 17:54:10 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BR0nt4LlLz3Zlp; Tue, 11 Aug 2020 17:54:10 +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 7851F1EB69; Tue, 11 Aug 2020 17:54:10 +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 07BHsAIg058254; Tue, 11 Aug 2020 17:54:10 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07BHsAnf058253; Tue, 11 Aug 2020 17:54:10 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202008111754.07BHsAnf058253@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 11 Aug 2020 17:54:10 +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: r364128 - stable/12/sys/dev/rtwn/pci X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/dev/rtwn/pci X-SVN-Commit-Revision: 364128 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 17:54:10 -0000 Author: markj Date: Tue Aug 11 17:54:10 2020 New Revision: 364128 URL: https://svnweb.freebsd.org/changeset/base/364128 Log: MFC r350885 (by avos): rtwn_pci: add device ID for RTL8192CE. PR: 239795 Modified: stable/12/sys/dev/rtwn/pci/rtwn_pci_attach.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/rtwn/pci/rtwn_pci_attach.h ============================================================================== --- stable/12/sys/dev/rtwn/pci/rtwn_pci_attach.h Tue Aug 11 17:53:21 2020 (r364127) +++ stable/12/sys/dev/rtwn/pci/rtwn_pci_attach.h Tue Aug 11 17:54:10 2020 (r364128) @@ -34,6 +34,7 @@ struct rtwn_pci_ident { static const struct rtwn_pci_ident rtwn_pci_ident_table[] = { { 0x10ec, 0x8176, "Realtek RTL8188CE", RTWN_CHIP_RTL8192CE }, + { 0x10ec, 0x8178, "Realtek RTL8192CE", RTWN_CHIP_RTL8192CE }, { 0x10ec, 0x8179, "Realtek RTL8188EE", RTWN_CHIP_RTL8188EE }, }; From owner-svn-src-all@freebsd.org Tue Aug 11 20:37:46 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CD2433B69E2; Tue, 11 Aug 2020 20:37:46 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BR4Qf5TzMz41kd; Tue, 11 Aug 2020 20:37:46 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9FB9620C23; Tue, 11 Aug 2020 20:37:46 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07BKbk7q056703; Tue, 11 Aug 2020 20:37:46 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07BKbjsL056699; Tue, 11 Aug 2020 20:37:45 GMT (envelope-from cem@FreeBSD.org) Message-Id: <202008112037.07BKbjsL056699@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Tue, 11 Aug 2020 20:37:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364129 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 364129 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 20:37:46 -0000 Author: cem Date: Tue Aug 11 20:37:45 2020 New Revision: 364129 URL: https://svnweb.freebsd.org/changeset/base/364129 Log: Add support for multithreading the inactive queue pageout within a domain. In very high throughput workloads, the inactive scan can become overwhelmed as you have many cores producing pages and a single core freeing. Since Mark's introduction of batched pagequeue operations, we can now run multiple inactive threads working on independent batches. To avoid confusing the pid and other control algorithms, I (Jeff) do this in a mpi-like fan out and collect model that is driven from the primary page daemon. It decides whether the shortfall can be overcome with a single thread and if not dispatches multiple threads and waits for their results. The heuristic is based on timing the pageout activity and averaging a pages-per-second variable which is exponentially decayed. This is visible in sysctl and may be interesting for other purposes. I (Jeff) have verified that this does indeed double our paging throughput when used with two threads. With four we tend to run into other contention problems. For now I would like to commit this infrastructure with only a single thread enabled. The number of worker threads per domain can be controlled with the 'vm.pageout_threads_per_domain' tunable. Submitted by: jeff (earlier version) Discussed with: markj Tested by: pho Sponsored by: probably Netflix (based on contemporary commits) Differential Revision: https://reviews.freebsd.org/D21629 Modified: head/sys/vm/vm_meter.c head/sys/vm/vm_page.c head/sys/vm/vm_page.h head/sys/vm/vm_pageout.c head/sys/vm/vm_pagequeue.h Modified: head/sys/vm/vm_meter.c ============================================================================== --- head/sys/vm/vm_meter.c Tue Aug 11 17:54:10 2020 (r364128) +++ head/sys/vm/vm_meter.c Tue Aug 11 20:37:45 2020 (r364129) @@ -552,6 +552,9 @@ vm_domain_stats_init(struct vm_domain *vmd, struct sys SYSCTL_ADD_UINT(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, "free_severe", CTLFLAG_RD, &vmd->vmd_free_severe, 0, "Severe free pages"); + SYSCTL_ADD_UINT(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, + "inactive_pps", CTLFLAG_RD, &vmd->vmd_inactive_pps, 0, + "inactive pages freed/second"); } Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Tue Aug 11 17:54:10 2020 (r364128) +++ head/sys/vm/vm_page.c Tue Aug 11 20:37:45 2020 (r364129) @@ -421,7 +421,7 @@ sysctl_vm_page_blacklist(SYSCTL_HANDLER_ARGS) * In principle, this function only needs to set the flag PG_MARKER. * Nonetheless, it write busies the page as a safety precaution. */ -static void +void vm_page_init_marker(vm_page_t marker, int queue, uint16_t aflags) { @@ -2488,7 +2488,7 @@ vm_page_zone_import(void *arg, void **store, int cnt, * main purpose is to replenish the store of free pages. */ if (vmd->vmd_severeset || curproc == pageproc || - !_vm_domain_allocate(vmd, VM_ALLOC_NORMAL, cnt)) + !_vm_domain_allocate(vmd, VM_ALLOC_SYSTEM, cnt)) return (0); domain = vmd->vmd_domain; vm_domain_free_lock(vmd); Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Tue Aug 11 17:54:10 2020 (r364128) +++ head/sys/vm/vm_page.h Tue Aug 11 20:37:45 2020 (r364129) @@ -630,6 +630,7 @@ vm_page_t vm_page_find_least(vm_object_t, vm_pindex_t) void vm_page_free_invalid(vm_page_t); vm_page_t vm_page_getfake(vm_paddr_t paddr, vm_memattr_t memattr); void vm_page_initfake(vm_page_t m, vm_paddr_t paddr, vm_memattr_t memattr); +void vm_page_init_marker(vm_page_t marker, int queue, uint16_t aflags); int vm_page_insert (vm_page_t, vm_object_t, vm_pindex_t); void vm_page_invalid(vm_page_t m); void vm_page_launder(vm_page_t m); Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Tue Aug 11 17:54:10 2020 (r364128) +++ head/sys/vm/vm_pageout.c Tue Aug 11 20:37:45 2020 (r364129) @@ -82,6 +82,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -163,6 +164,12 @@ SYSCTL_INT(_vm, OID_AUTO, panic_on_oom, SYSCTL_INT(_vm, OID_AUTO, pageout_update_period, CTLFLAG_RWTUN, &vm_pageout_update_period, 0, "Maximum active LRU update period"); + +/* Access with get_pageout_threads_per_domain(). */ +static int pageout_threads_per_domain = 1; +SYSCTL_INT(_vm, OID_AUTO, pageout_threads_per_domain, CTLFLAG_RDTUN, + &pageout_threads_per_domain, 0, + "Number of worker threads comprising each per-domain pagedaemon"); SYSCTL_INT(_vm, OID_AUTO, lowmem_period, CTLFLAG_RWTUN, &lowmem_period, 0, "Low memory callback period"); @@ -1414,23 +1421,23 @@ vm_pageout_reinsert_inactive(struct scan_state *ss, st vm_batchqueue_init(bq); } -/* - * Attempt to reclaim the requested number of pages from the inactive queue. - * Returns true if the shortage was addressed. - */ -static int -vm_pageout_scan_inactive(struct vm_domain *vmd, int shortage, - int *addl_shortage) +static void +vm_pageout_scan_inactive(struct vm_domain *vmd, int page_shortage) { + struct timeval start, end; struct scan_state ss; struct vm_batchqueue rq; + struct vm_page marker_page; vm_page_t m, marker; struct vm_pagequeue *pq; vm_object_t object; vm_page_astate_t old, new; - int act_delta, addl_page_shortage, deficit, page_shortage, refs; - int starting_page_shortage; + int act_delta, addl_page_shortage, starting_page_shortage, refs; + object = NULL; + vm_batchqueue_init(&rq); + getmicrouptime(&start); + /* * The addl_page_shortage is an estimate of the number of temporarily * stuck pages in the inactive queue. In other words, the @@ -1440,24 +1447,14 @@ vm_pageout_scan_inactive(struct vm_domain *vmd, int sh addl_page_shortage = 0; /* - * vmd_pageout_deficit counts the number of pages requested in - * allocations that failed because of a free page shortage. We assume - * that the allocations will be reattempted and thus include the deficit - * in our scan target. - */ - deficit = atomic_readandclear_int(&vmd->vmd_pageout_deficit); - starting_page_shortage = page_shortage = shortage + deficit; - - object = NULL; - vm_batchqueue_init(&rq); - - /* * Start scanning the inactive queue for pages that we can free. The * scan will stop when we reach the target or we have scanned the * entire queue. (Note that m->a.act_count is not used to make * decisions for the inactive queue, only for the active queue.) */ - marker = &vmd->vmd_markers[PQ_INACTIVE]; + starting_page_shortage = page_shortage; + marker = &marker_page; + vm_page_init_marker(marker, PQ_INACTIVE, 0); pq = &vmd->vmd_pagequeues[PQ_INACTIVE]; vm_pagequeue_lock(pq); vm_pageout_init_scan(&ss, pq, marker, NULL, pq->pq_cnt); @@ -1637,9 +1634,99 @@ reinsert: vm_pageout_end_scan(&ss); vm_pagequeue_unlock(pq); - VM_CNT_ADD(v_dfree, starting_page_shortage - page_shortage); + /* + * Record the remaining shortage and the progress and rate it was made. + */ + atomic_add_int(&vmd->vmd_addl_shortage, addl_page_shortage); + getmicrouptime(&end); + timevalsub(&end, &start); + atomic_add_int(&vmd->vmd_inactive_us, + end.tv_sec * 1000000 + end.tv_usec); + atomic_add_int(&vmd->vmd_inactive_freed, + starting_page_shortage - page_shortage); +} +/* + * Dispatch a number of inactive threads according to load and collect the + * results to prevent a coherent (CEM: incoherent?) view of paging activity on + * this domain. + */ +static int +vm_pageout_inactive_dispatch(struct vm_domain *vmd, int shortage) +{ + u_int freed, pps, threads, us; + + vmd->vmd_inactive_shortage = shortage; + /* + * If we have more work than we can do in a quarter of our interval, we + * fire off multiple threads to process it. + */ + if (vmd->vmd_inactive_threads > 1 && vmd->vmd_inactive_pps != 0 && + shortage > vmd->vmd_inactive_pps / VM_INACT_SCAN_RATE / 4) { + threads = vmd->vmd_inactive_threads; + vm_domain_pageout_lock(vmd); + vmd->vmd_inactive_shortage /= threads; + blockcount_acquire(&vmd->vmd_inactive_starting, threads - 1); + blockcount_acquire(&vmd->vmd_inactive_running, threads - 1); + wakeup(&vmd->vmd_inactive_shortage); + vm_domain_pageout_unlock(vmd); + } + + /* Run the local thread scan. */ + vm_pageout_scan_inactive(vmd, vmd->vmd_inactive_shortage); + + /* + * Block until helper threads report results and then accumulate + * totals. + */ + blockcount_wait(&vmd->vmd_inactive_running, NULL, "vmpoid", PVM); + freed = atomic_readandclear_int(&vmd->vmd_inactive_freed); + VM_CNT_ADD(v_dfree, freed); + + /* + * Calculate the per-thread paging rate with an exponential decay of + * prior results. Careful to avoid integer rounding errors with large + * us values. + */ + us = max(atomic_readandclear_int(&vmd->vmd_inactive_us), 1); + if (us > 1000000) + /* Keep rounding to tenths */ + pps = (freed * 10) / ((us * 10) / 1000000); + else + pps = (1000000 / us) * freed; + vmd->vmd_inactive_pps = (vmd->vmd_inactive_pps / 2) + (pps / 2); + + return (shortage - freed); +} + +/* + * Attempt to reclaim the requested number of pages from the inactive queue. + * Returns true if the shortage was addressed. + */ +static int +vm_pageout_inactive(struct vm_domain *vmd, int shortage, int *addl_shortage) +{ + struct vm_pagequeue *pq; + u_int addl_page_shortage, deficit, page_shortage; + u_int starting_page_shortage; + + /* + * vmd_pageout_deficit counts the number of pages requested in + * allocations that failed because of a free page shortage. We assume + * that the allocations will be reattempted and thus include the deficit + * in our scan target. + */ + deficit = atomic_readandclear_int(&vmd->vmd_pageout_deficit); + starting_page_shortage = shortage + deficit; + + /* + * Run the inactive scan on as many threads as is necessary. + */ + page_shortage = vm_pageout_inactive_dispatch(vmd, starting_page_shortage); + addl_page_shortage = atomic_readandclear_int(&vmd->vmd_addl_shortage); + + /* * Wake up the laundry thread so that it can perform any needed * laundering. If we didn't meet our target, we're in shortfall and * need to launder more aggressively. If PQ_LAUNDRY is empty and no @@ -2066,7 +2153,7 @@ vm_pageout_worker(void *arg) if (vm_pageout_lowmem() && vmd->vmd_free_count > ofree) shortage -= min(vmd->vmd_free_count - ofree, (u_int)shortage); - target_met = vm_pageout_scan_inactive(vmd, shortage, + target_met = vm_pageout_inactive(vmd, shortage, &addl_shortage); } else addl_shortage = 0; @@ -2082,6 +2169,72 @@ vm_pageout_worker(void *arg) } /* + * vm_pageout_helper runs additional pageout daemons in times of high paging + * activity. + */ +static void +vm_pageout_helper(void *arg) +{ + struct vm_domain *vmd; + int domain; + + domain = (uintptr_t)arg; + vmd = VM_DOMAIN(domain); + + vm_domain_pageout_lock(vmd); + for (;;) { + msleep(&vmd->vmd_inactive_shortage, + vm_domain_pageout_lockptr(vmd), PVM, "psleep", 0); + blockcount_release(&vmd->vmd_inactive_starting, 1); + + vm_domain_pageout_unlock(vmd); + vm_pageout_scan_inactive(vmd, vmd->vmd_inactive_shortage); + vm_domain_pageout_lock(vmd); + + /* + * Release the running count while the pageout lock is held to + * prevent wakeup races. + */ + blockcount_release(&vmd->vmd_inactive_running, 1); + } +} + +static int +get_pageout_threads_per_domain(void) +{ + static bool resolved = false; + int half_cpus_per_dom; + + /* + * This is serialized externally by the sorted autoconfig portion of + * boot. + */ + if (__predict_true(resolved)) + return (pageout_threads_per_domain); + + /* + * Semi-arbitrarily constrain pagedaemon threads to less than half the + * total number of threads in the system as an insane upper limit. + */ + half_cpus_per_dom = (mp_ncpus / vm_ndomains) / 2; + + if (pageout_threads_per_domain < 1) { + printf("Invalid tuneable vm.pageout_threads_per_domain value: " + "%d out of valid range: [1-%d]; clamping to 1\n", + pageout_threads_per_domain, half_cpus_per_dom); + pageout_threads_per_domain = 1; + } else if (pageout_threads_per_domain > half_cpus_per_dom) { + printf("Invalid tuneable vm.pageout_threads_per_domain value: " + "%d out of valid range: [1-%d]; clamping to %d\n", + pageout_threads_per_domain, half_cpus_per_dom, + half_cpus_per_dom); + pageout_threads_per_domain = half_cpus_per_dom; + } + resolved = true; + return (pageout_threads_per_domain); +} + +/* * Initialize basic pageout daemon settings. See the comment above the * definition of vm_domain for some explanation of how these thresholds are * used. @@ -2134,6 +2287,8 @@ vm_pageout_init_domain(int domain) oid = SYSCTL_ADD_NODE(NULL, SYSCTL_CHILDREN(vmd->vmd_oid), OID_AUTO, "pidctrl", CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, ""); pidctrl_init_sysctl(&vmd->vmd_pid, SYSCTL_CHILDREN(oid)); + + vmd->vmd_inactive_threads = get_pageout_threads_per_domain(); } static void @@ -2184,10 +2339,11 @@ vm_pageout(void) { struct proc *p; struct thread *td; - int error, first, i; + int error, first, i, j, pageout_threads; p = curproc; td = curthread; + pageout_threads = get_pageout_threads_per_domain(); mtx_init(&vm_oom_ratelim_mtx, "vmoomr", NULL, MTX_DEF); swap_pager_swap_init(); @@ -2206,6 +2362,14 @@ vm_pageout(void) if (error != 0) panic("starting pageout for domain %d: %d\n", i, error); + } + for (j = 0; j < pageout_threads - 1; j++) { + error = kthread_add(vm_pageout_helper, + (void *)(uintptr_t)i, p, NULL, 0, 0, + "dom%d helper%d", i, j); + if (error != 0) + panic("starting pageout helper %d for domain " + "%d: %d\n", j, i, error); } error = kthread_add(vm_pageout_laundry_worker, (void *)(uintptr_t)i, p, NULL, 0, 0, "laundry: dom%d", i); Modified: head/sys/vm/vm_pagequeue.h ============================================================================== --- head/sys/vm/vm_pagequeue.h Tue Aug 11 17:54:10 2020 (r364128) +++ head/sys/vm/vm_pagequeue.h Tue Aug 11 20:37:45 2020 (r364129) @@ -84,6 +84,7 @@ struct vm_batchqueue { } __aligned(CACHE_LINE_SIZE); #include +#include #include struct sysctl_oid; @@ -254,6 +255,14 @@ struct vm_domain { /* Paging control variables, used within single threaded page daemon. */ struct pidctrl vmd_pid; /* Pageout controller. */ boolean_t vmd_oom; + u_int vmd_inactive_threads; + u_int vmd_inactive_shortage; /* Per-thread shortage. */ + blockcount_t vmd_inactive_running; /* Number of inactive threads. */ + blockcount_t vmd_inactive_starting; /* Number of threads started. */ + volatile u_int vmd_addl_shortage; /* Shortage accumulator. */ + volatile u_int vmd_inactive_freed; /* Successful inactive frees. */ + volatile u_int vmd_inactive_us; /* Microseconds for above. */ + u_int vmd_inactive_pps; /* Exponential decay frees/second. */ int vmd_oom_seq; int vmd_last_active_scan; struct vm_page vmd_markers[PQ_COUNT]; /* (q) markers for queue scans */ From owner-svn-src-all@freebsd.org Tue Aug 11 20:42:21 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E74D93B6E8B; Tue, 11 Aug 2020 20:42:21 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BR4Wx5m4Jz4268; Tue, 11 Aug 2020 20:42:21 +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 A9F4720A76; Tue, 11 Aug 2020 20:42:21 +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 07BKgLjL062643; Tue, 11 Aug 2020 20:42:21 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07BKgLLH062642; Tue, 11 Aug 2020 20:42:21 GMT (envelope-from cem@FreeBSD.org) Message-Id: <202008112042.07BKgLLH062642@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Tue, 11 Aug 2020 20:42:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364130 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 364130 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 20:42:22 -0000 Author: cem Date: Tue Aug 11 20:42:21 2020 New Revision: 364130 URL: https://svnweb.freebsd.org/changeset/base/364130 Log: smp.h: Reconcile definition and declaration of smp_ncpus The variable is defined unconditionally; declare it unconditionally as well. It is already initialized to the correct value (1) for !SMP builds. No functional change. Modified: head/sys/sys/smp.h Modified: head/sys/sys/smp.h ============================================================================== --- head/sys/sys/smp.h Tue Aug 11 20:37:45 2020 (r364129) +++ head/sys/sys/smp.h Tue Aug 11 20:42:21 2020 (r364130) @@ -154,7 +154,6 @@ struct cpu_group *smp_topo_2level(int l2share, int l2c struct cpu_group *smp_topo_find(struct cpu_group *top, int cpu); extern void (*cpustop_restartfunc)(void); -extern int smp_cpus; /* The suspend/resume cpusets are x86 only, but minimize ifdefs. */ extern volatile cpuset_t resuming_cpus; /* woken up cpus in suspend pen */ extern volatile cpuset_t started_cpus; /* cpus to let out of stop pen */ @@ -169,6 +168,7 @@ extern u_int mp_maxid; extern int mp_maxcpus; extern int mp_ncores; extern int mp_ncpus; +extern int smp_cpus; extern volatile int smp_started; extern int smp_threads_per_core; From owner-svn-src-all@freebsd.org Tue Aug 11 21:32:24 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F23DB3B806A; Tue, 11 Aug 2020 21:32:24 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4BR5dg0JHrz44Hj; Tue, 11 Aug 2020 21:32:22 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 07BLWDQk011719 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 12 Aug 2020 00:32:16 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 07BLWDQk011719 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 07BLWDHQ011718; Wed, 12 Aug 2020 00:32:13 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 12 Aug 2020 00:32:13 +0300 From: Konstantin Belousov To: Conrad Meyer Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r364129 - head/sys/vm Message-ID: <20200811213213.GT2551@kib.kiev.ua> References: <202008112037.07BKbjsL056699@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202008112037.07BKbjsL056699@repo.freebsd.org> 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.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 4BR5dg0JHrz44Hj X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 21:32:25 -0000 On Tue, Aug 11, 2020 at 08:37:45PM +0000, Conrad Meyer wrote: > Author: cem > Date: Tue Aug 11 20:37:45 2020 > New Revision: 364129 > URL: https://svnweb.freebsd.org/changeset/base/364129 > > Log: > Add support for multithreading the inactive queue pageout within a domain. > > In very high throughput workloads, the inactive scan can become overwhelmed > as you have many cores producing pages and a single core freeing. Since > Mark's introduction of batched pagequeue operations, we can now run multiple > inactive threads working on independent batches. > > To avoid confusing the pid and other control algorithms, I (Jeff) do this in > a mpi-like fan out and collect model that is driven from the primary page > daemon. It decides whether the shortfall can be overcome with a single > thread and if not dispatches multiple threads and waits for their results. > > The heuristic is based on timing the pageout activity and averaging a > pages-per-second variable which is exponentially decayed. This is visible in > sysctl and may be interesting for other purposes. > > I (Jeff) have verified that this does indeed double our paging throughput > when used with two threads. With four we tend to run into other contention > problems. For now I would like to commit this infrastructure with only a > single thread enabled. > > The number of worker threads per domain can be controlled with the > 'vm.pageout_threads_per_domain' tunable. > > Submitted by: jeff (earlier version) > Discussed with: markj > Tested by: pho > Sponsored by: probably Netflix (based on contemporary commits) > Differential Revision: https://reviews.freebsd.org/D21629 > > Modified: > head/sys/vm/vm_meter.c > head/sys/vm/vm_page.c > head/sys/vm/vm_page.h > head/sys/vm/vm_pageout.c > head/sys/vm/vm_pagequeue.h > > Modified: head/sys/vm/vm_meter.c > ============================================================================== > --- head/sys/vm/vm_meter.c Tue Aug 11 17:54:10 2020 (r364128) > +++ head/sys/vm/vm_meter.c Tue Aug 11 20:37:45 2020 (r364129) > @@ -552,6 +552,9 @@ vm_domain_stats_init(struct vm_domain *vmd, struct sys > SYSCTL_ADD_UINT(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, > "free_severe", CTLFLAG_RD, &vmd->vmd_free_severe, 0, > "Severe free pages"); > + SYSCTL_ADD_UINT(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, > + "inactive_pps", CTLFLAG_RD, &vmd->vmd_inactive_pps, 0, > + "inactive pages freed/second"); > > } > > > Modified: head/sys/vm/vm_page.c > ============================================================================== > --- head/sys/vm/vm_page.c Tue Aug 11 17:54:10 2020 (r364128) > +++ head/sys/vm/vm_page.c Tue Aug 11 20:37:45 2020 (r364129) > @@ -421,7 +421,7 @@ sysctl_vm_page_blacklist(SYSCTL_HANDLER_ARGS) > * In principle, this function only needs to set the flag PG_MARKER. > * Nonetheless, it write busies the page as a safety precaution. > */ > -static void > +void > vm_page_init_marker(vm_page_t marker, int queue, uint16_t aflags) > { > > @@ -2488,7 +2488,7 @@ vm_page_zone_import(void *arg, void **store, int cnt, > * main purpose is to replenish the store of free pages. > */ > if (vmd->vmd_severeset || curproc == pageproc || > - !_vm_domain_allocate(vmd, VM_ALLOC_NORMAL, cnt)) > + !_vm_domain_allocate(vmd, VM_ALLOC_SYSTEM, cnt)) Why this change needed ? > return (0); > domain = vmd->vmd_domain; > vm_domain_free_lock(vmd); > From owner-svn-src-all@freebsd.org Tue Aug 11 21:44:44 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A3EA13B7F1C; Tue, 11 Aug 2020 21:44:44 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BR5vw3rNkz456l; Tue, 11 Aug 2020 21:44:44 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 674DC21845; Tue, 11 Aug 2020 21:44:44 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07BLiiHH000554; Tue, 11 Aug 2020 21:44:44 GMT (envelope-from gbe@FreeBSD.org) Received: (from gbe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07BLiivC000553; Tue, 11 Aug 2020 21:44:44 GMT (envelope-from gbe@FreeBSD.org) Message-Id: <202008112144.07BLiivC000553@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gbe set sender to gbe@FreeBSD.org using -f From: Gordon Bergling Date: Tue, 11 Aug 2020 21:44:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364131 - head/usr.bin/tput X-SVN-Group: head X-SVN-Commit-Author: gbe X-SVN-Commit-Paths: head/usr.bin/tput X-SVN-Commit-Revision: 364131 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 21:44:44 -0000 Author: gbe (doc committer) Date: Tue Aug 11 21:44:43 2020 New Revision: 364131 URL: https://svnweb.freebsd.org/changeset/base/364131 Log: tput(1): Several enhancements for the manual page - a couple of descriptions are incomplete - synopsis doesn't show that all arguments are optional - missing an ENVIRONMENT section with TERM mentioned PR: 84670 Submitted by: Gary W. Swearingen Reviewed by: bcr Approved by: bcr MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D26009 Modified: head/usr.bin/tput/tput.1 Modified: head/usr.bin/tput/tput.1 ============================================================================== --- head/usr.bin/tput/tput.1 Tue Aug 11 20:42:21 2020 (r364130) +++ head/usr.bin/tput/tput.1 Tue Aug 11 21:44:43 2020 (r364131) @@ -38,22 +38,24 @@ .Sh SYNOPSIS .Nm .Op Fl T Ar term -.Ar attribute ... +.Op Ar attribute ... .Nm clear .Sh DESCRIPTION The .Nm utility makes terminal-dependent information available to users or shell applications. -When invoked as the +.Pp +The .Nm clear -utility, the screen will be cleared as if +utility executes the .Dl tput clear -had been executed. -The options to +command, ignoring any arguments. +.Pp +The only option to .Nm -are as follows: -.Bl -tag -width Ds +is: +.Bl -tag -width 2n .It Fl T The terminal name as specified in the .Xr termcap 5 @@ -65,7 +67,9 @@ If not specified, .Nm retrieves the .Dq Ev TERM -variable from the environment. +variable from the environment unless that too is not specified, +in which case an error message will be sent to standard error and +the error status will be 2. .El .Pp The @@ -83,45 +87,66 @@ If an is of type string, and takes arguments (e.g.\& cursor movement, the termcap .Dq cm -sequence) the arguments are taken from the command line immediately +capability) the arguments are taken from the command line immediately following the attribute. .Pp -The following special attributes are available: +The following special attributes are available. +The first three use the capabilities of the specified terminal, +and only work if compatible with the utility's terminal. .Bl -tag -width Ar .It Cm clear Clear the screen (the .Xr termcap 5 .Dq cl -sequence). +capability). .It Cm init Initialize the terminal (the .Xr termcap 5 .Dq is -sequence). -.It Cm longname -Print the descriptive name of the user's terminal type. +capability). .It Cm reset Reset the terminal (the .Xr termcap 5 .Dq rs -sequence). +capability). +.It Cm longname +Print the descriptive name of the user's terminal type. .El +.Sh ENVIRONMENT +.Bl -tag -width ".Ev TERM" +.It Ev TERM +The terminal name, if set and +.Fl T +is not used. +.El .Sh EXIT STATUS The exit status of .Nm is as follows: .Bl -tag -width indent .It 0 -If the last attribute +If the last .Ar attribute -argument is of type string or integer, its value was successfully written +is of type string or integer, its value was successfully written to standard output. -If the argument is of type boolean, the terminal has this attribute. +If the +.Ar attribute +is of type boolean, the terminal does have the +.Ar attribute . +Otherwise, no +.Ar attribute +was specified. .It 1 -This terminal does not have the specified boolean +If the last +.Ar attribute +is of type boolean, +this terminal does not have the .Ar attribute . .It 2 Usage error. +For example, see +.Fl T +description. .It 3 No information is available about the specified terminal type. .El From owner-svn-src-all@freebsd.org Tue Aug 11 21:51:12 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D45A53B7F59; Tue, 11 Aug 2020 21:51:12 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-io1-xd2e.google.com (mail-io1-xd2e.google.com [IPv6:2607:f8b0:4864:20::d2e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BR63N3sMLz45ny; Tue, 11 Aug 2020 21:51:12 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-io1-xd2e.google.com with SMTP id u126so377157iod.12; Tue, 11 Aug 2020 14:51:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Jy/HqZFAf5m6OY3HEyMC8JnrFbexJB3TE29yp2WJI9o=; b=t15qbgTVM+fbk/cpkiILsZjIrRVKm3WjqS8GPemyTGRxS+yuJFctuWgbsT/hXtC9Q7 8OgcuhokGKkeUAb0lrtodqVeYzKzlIdAuVFPu7WYNGRX41fmXdb89jAEu5ZZoHzxtaXj 3rUY4tHTT7LZY7rhHx5QHx5tZZMyA2/oAfhSc29X3lqsZIcainK+WFS75y2bt2/ZtFo8 1aUFhFimgxe0rtkulMRgxC7J7N5xrwjUKG6OvDBiwBUtzIWKcsusu3PXgsdfDLWb4oTo hHQPNBHvgYz4DuFTUYLKehQVntTcNj4noma4eU6VxRJa54u8npUdcglZvBHJskJxTNTb 42tA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=Jy/HqZFAf5m6OY3HEyMC8JnrFbexJB3TE29yp2WJI9o=; b=eF8i9QJdRFXnfiYM/SfsLNfOyRDwks9T4LsK5BDetcymClt3lYpNXxCXr6YDIpmETa b/Lvlz07LgLKNvZ3MrKhfU2/mEiZKC5CjdZOE/PszwtEuQca3hG+8V31VLm+4W7H/um4 oLvZSTBELRNWiUet6N17JHmhe2iESwthNOe/lG3UcAul6j4NiGGDwooHpB49bUKjvMfW q/yeLE+DEfWT1Mk/sdMlUPgUV/+uQ0NiC6w80OOTLo7dSH4cn3gsPjcFYNMfd2tNowg/ dKRuWsC4QC2Gw8Vv9HiuKYmpw2RuIfE+DKzj3bPb56zZ6m2etHTembbq3+eIyhK0n0ZB uqiw== X-Gm-Message-State: AOAM533LSRL5JdDN9Roz+OO8tHh0sS45KrITL6shl76iUfCWcayp9vjL gSCRWY5Qvqk300uTnPiqB2uJFWkR X-Google-Smtp-Source: ABdhPJzdovHRxEacj8FLuTNqCsj8YIsuKWIouX3mZBzcE689DXN+yPc+MTExpJfv3XHwx+ykjoD/NA== X-Received: by 2002:a6b:3954:: with SMTP id g81mr24204050ioa.207.1597182671068; Tue, 11 Aug 2020 14:51:11 -0700 (PDT) Received: from raichu (toroon0560w-lp130-08-67-71-176-35.dsl.bell.ca. [67.71.176.35]) by smtp.gmail.com with ESMTPSA id j10sm4379230ili.86.2020.08.11.14.51.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Aug 2020 14:51:10 -0700 (PDT) Sender: Mark Johnston Date: Tue, 11 Aug 2020 17:51:08 -0400 From: Mark Johnston To: Conrad Meyer Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r364129 - head/sys/vm Message-ID: <20200811215108.GB77647@raichu> References: <202008112037.07BKbjsL056699@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202008112037.07BKbjsL056699@repo.freebsd.org> X-Rspamd-Queue-Id: 4BR63N3sMLz45ny X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 21:51:12 -0000 On Tue, Aug 11, 2020 at 08:37:45PM +0000, Conrad Meyer wrote: > Author: cem > Date: Tue Aug 11 20:37:45 2020 > New Revision: 364129 > URL: https://svnweb.freebsd.org/changeset/base/364129 > > Log: > Add support for multithreading the inactive queue pageout within a domain. > > In very high throughput workloads, the inactive scan can become overwhelmed > as you have many cores producing pages and a single core freeing. Since > Mark's introduction of batched pagequeue operations, we can now run multiple > inactive threads working on independent batches. > > To avoid confusing the pid and other control algorithms, I (Jeff) do this in > a mpi-like fan out and collect model that is driven from the primary page > daemon. It decides whether the shortfall can be overcome with a single > thread and if not dispatches multiple threads and waits for their results. > > The heuristic is based on timing the pageout activity and averaging a > pages-per-second variable which is exponentially decayed. This is visible in > sysctl and may be interesting for other purposes. > > I (Jeff) have verified that this does indeed double our paging throughput > when used with two threads. With four we tend to run into other contention > problems. For now I would like to commit this infrastructure with only a > single thread enabled. > > The number of worker threads per domain can be controlled with the > 'vm.pageout_threads_per_domain' tunable. > > Submitted by: jeff (earlier version) > Discussed with: markj > Tested by: pho > Sponsored by: probably Netflix (based on contemporary commits) > Differential Revision: https://reviews.freebsd.org/D21629 > > Modified: > head/sys/vm/vm_meter.c > head/sys/vm/vm_page.c > head/sys/vm/vm_page.h > head/sys/vm/vm_pageout.c > head/sys/vm/vm_pagequeue.h > > Modified: head/sys/vm/vm_page.c > ============================================================================== > --- head/sys/vm/vm_page.c Tue Aug 11 17:54:10 2020 (r364128) > +++ head/sys/vm/vm_page.c Tue Aug 11 20:37:45 2020 (r364129) > @@ -421,7 +421,7 @@ sysctl_vm_page_blacklist(SYSCTL_HANDLER_ARGS) > * In principle, this function only needs to set the flag PG_MARKER. > * Nonetheless, it write busies the page as a safety precaution. > */ > -static void > +void > vm_page_init_marker(vm_page_t marker, int queue, uint16_t aflags) > { > > @@ -2488,7 +2488,7 @@ vm_page_zone_import(void *arg, void **store, int cnt, > * main purpose is to replenish the store of free pages. > */ > if (vmd->vmd_severeset || curproc == pageproc || > - !_vm_domain_allocate(vmd, VM_ALLOC_NORMAL, cnt)) > + !_vm_domain_allocate(vmd, VM_ALLOC_SYSTEM, cnt)) Why did this change? It does not look related to the rest of the change. From owner-svn-src-all@freebsd.org Tue Aug 11 22:21:45 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 981183B8D55; Tue, 11 Aug 2020 22:21:45 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-oi1-f175.google.com (mail-oi1-f175.google.com [209.85.167.175]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BR6kc4rkkz4725; Tue, 11 Aug 2020 22:21:44 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-oi1-f175.google.com with SMTP id l84so32192oig.10; Tue, 11 Aug 2020 15:21:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=BUzzKtEOpWSL4UGcr9QlbSAPqjZ7lQNDMfwRqqzUWoY=; b=myt5CawchqQV0wejwzfqTrp6kIKVaLcVlEo5jY/7h93qt3Xr6tS+SqSNYZAK8gHObA /v5TtExqkBLYBFyGQuEIVa5/iTIOiisCFmS3tm8wPUlGWmaNmAqSZGPsQsFD7/IIIXfy tvOF9MV+U+cCKsSHq8ixisPDLKd+6d2ta3pYDJOfFwu4i3VN0S81BArvRgCOflbzTuA0 fhOzcym9orZUm6VTCFqBcDVGQV/Hp3USzUCLbSDDQgYTDDUuC8KpDqCf2IllR/Dt1RPG axs1U1mq9bHQfgOnfA83q/9RLz05rax3g30lFZ4TlUPYwtCuUtARfAUFTVMNrKrmN7LA SRnQ== X-Gm-Message-State: AOAM531/H+jAasKUHA5cKFbOfcChdb4ENmwwt4OosAccktNirCo2njYb YC9qIxK+SmsWs28zctwzwVcvLgMZ X-Google-Smtp-Source: ABdhPJytWd0KcGDuyosToZON9MU9YaccDRUAIxe/OjT7wEmAUbPISNzNne31MJakX5YC5a60vtwdlQ== X-Received: by 2002:aca:fd46:: with SMTP id b67mr5218283oii.150.1597184503152; Tue, 11 Aug 2020 15:21:43 -0700 (PDT) Received: from mail-oi1-f174.google.com (mail-oi1-f174.google.com. [209.85.167.174]) by smtp.gmail.com with ESMTPSA id w23sm25805otq.57.2020.08.11.15.21.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 11 Aug 2020 15:21:42 -0700 (PDT) Received: by mail-oi1-f174.google.com with SMTP id b22so40876oic.8; Tue, 11 Aug 2020 15:21:42 -0700 (PDT) X-Received: by 2002:aca:f38b:: with SMTP id r133mr5418352oih.81.1597184502720; Tue, 11 Aug 2020 15:21:42 -0700 (PDT) MIME-Version: 1.0 References: <202008112037.07BKbjsL056699@repo.freebsd.org> <20200811213213.GT2551@kib.kiev.ua> In-Reply-To: <20200811213213.GT2551@kib.kiev.ua> Reply-To: cem@freebsd.org From: Conrad Meyer Date: Tue, 11 Aug 2020 15:21:31 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r364129 - head/sys/vm To: Konstantin Belousov , Mark Johnston Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4BR6kc4rkkz4725 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of csecem@gmail.com designates 209.85.167.175 as permitted sender) smtp.mailfrom=csecem@gmail.com X-Spamd-Result: default: False [-1.71 / 15.00]; HAS_REPLYTO(0.00)[cem@freebsd.org]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; REPLYTO_ADDR_EQ_FROM(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[4]; TO_DN_ALL(0.00)[]; NEURAL_HAM_SHORT(-0.82)[-0.816]; FREEMAIL_TO(0.00)[gmail.com,freebsd.org]; FORGED_SENDER(0.30)[cem@freebsd.org,csecem@gmail.com]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; R_DKIM_NA(0.00)[]; TAGGED_FROM(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.56)[-0.562]; FROM_NEQ_ENVFROM(0.00)[cem@freebsd.org,csecem@gmail.com]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-0.33)[-0.333]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[209.85.167.175:from]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.167.175:from]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 22:21:45 -0000 Hi Konstantin, Mark (raised the same question), On Tue, Aug 11, 2020 at 2:32 PM Konstantin Belousov wrote: > > On Tue, Aug 11, 2020 at 08:37:45PM +0000, Conrad Meyer wrote: > > Author: cem > > Date: Tue Aug 11 20:37:45 2020 > > New Revision: 364129 > > URL: https://svnweb.freebsd.org/changeset/base/364129 > > > > Log: > > Add support for multithreading the inactive queue pageout within a domain. > > ... > > @@ -2488,7 +2488,7 @@ vm_page_zone_import(void *arg, void **store, int cnt, > > * main purpose is to replenish the store of free pages. > > */ > > if (vmd->vmd_severeset || curproc == pageproc || > > - !_vm_domain_allocate(vmd, VM_ALLOC_NORMAL, cnt)) > > + !_vm_domain_allocate(vmd, VM_ALLOC_SYSTEM, cnt)) > > Why this change needed ? The change was inherited from Jeff, along with the rest of it. I don't know why he changed it, but it does seem orthogonal to the rest of the revision. This part is nonessential as far as I know, and could be backed out. Best, Conrad From owner-svn-src-all@freebsd.org Tue Aug 11 22:31:05 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ABDD73B8ED9; Tue, 11 Aug 2020 22:31:05 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-il1-x133.google.com (mail-il1-x133.google.com [IPv6:2607:f8b0:4864:20::133]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BR6xP1cPGz47wx; Tue, 11 Aug 2020 22:31:05 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-il1-x133.google.com with SMTP id j9so12447907ilc.11; Tue, 11 Aug 2020 15:31:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=h4z1ythjTQltk4n9byFjedZB9PeF7lFVnzRlKs/IL2M=; b=Dx+5tqmYfY3lSXxTgnJ6TBx3BdZO2/rAvfX9NdDqXqA19xj+yAWamFdrpoP/9ACrBL XSegg6bckbIdelyRtuycX3xzZFxBXV51DfDBuzDawGPieoVn61tsRweZkuL8fJj0byzh ZSmmH+un0N+S82cdbY1nobmxszl3DVpSmiqrL2KHrGLJ+ibAth5Gn5e+TvAyb4nQsfTQ kLG/vcV3gDZnVbM+xab4zHOG/vuu6ETk+t6MetNHLlyurb7cz3M0s5LbInRokPNuvWLp jJGoKf42nlh6n+kU6guoe6ZInLlEY7l6ZPthjJHd8RBOcZmqHJrJ2nrTY6V8P1GyXpvP 0KCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=h4z1ythjTQltk4n9byFjedZB9PeF7lFVnzRlKs/IL2M=; b=RfDLOre7RJeMVefIXYMKGcinej/g3tTEBoGA57dHEmS7T9+a30ZJUpNc2qNp7aqlKT C5xnjd1J3e+u5MyssgZeUo3m5jQPiKM8ouB0fRoHyaZy/jAtfVQzIVjFyJNfwp+CqCuS 3EyW3BkEHlBtoSFxf+FRXvmd5UTX9N+HhfCMGEffV3cgKhZi3VTWseNec1Mmk6XlEr7s hKd2HeIbjrTZTW2F+NRsqOeZR5CpjSfxNnCAxbPeMkwH49S0HhvWtLVIN5JnuErDZjgn 3s4wv724T3aG7S4ffJ4UuWdDfAppvovMskijvM7VQHee16d+p3UkltPmcVi4fPQe6Utw Oc8g== X-Gm-Message-State: AOAM53025uY06+mwgHXdWQc3UduvonT3CKZZpQUQ+dd3lTFXWzWzZxwL HuQKLFMY9M0gFynNW4frkt4RS/CI X-Google-Smtp-Source: ABdhPJzvCuvcCSzAMKwRGZPwbhqa+KChh22qNhno/cxc3gqK2BUrxWAtQep6UoYtM5gxQO3422pZBw== X-Received: by 2002:a92:c092:: with SMTP id h18mr4428786ile.178.1597185063330; Tue, 11 Aug 2020 15:31:03 -0700 (PDT) Received: from raichu (toroon0560w-lp130-08-67-71-176-35.dsl.bell.ca. [67.71.176.35]) by smtp.gmail.com with ESMTPSA id t187sm46771iof.54.2020.08.11.15.31.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Aug 2020 15:31:02 -0700 (PDT) Sender: Mark Johnston Date: Tue, 11 Aug 2020 18:31:00 -0400 From: Mark Johnston To: Conrad Meyer Cc: Konstantin Belousov , src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r364129 - head/sys/vm Message-ID: <20200811223100.GC77647@raichu> References: <202008112037.07BKbjsL056699@repo.freebsd.org> <20200811213213.GT2551@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4BR6xP1cPGz47wx X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 22:31:05 -0000 On Tue, Aug 11, 2020 at 03:21:31PM -0700, Conrad Meyer wrote: > Hi Konstantin, Mark (raised the same question), > > On Tue, Aug 11, 2020 at 2:32 PM Konstantin Belousov wrote: > > > > On Tue, Aug 11, 2020 at 08:37:45PM +0000, Conrad Meyer wrote: > > > Author: cem > > > Date: Tue Aug 11 20:37:45 2020 > > > New Revision: 364129 > > > URL: https://svnweb.freebsd.org/changeset/base/364129 > > > > > > Log: > > > Add support for multithreading the inactive queue pageout within a domain. > > > ... > > > @@ -2488,7 +2488,7 @@ vm_page_zone_import(void *arg, void **store, int cnt, > > > * main purpose is to replenish the store of free pages. > > > */ > > > if (vmd->vmd_severeset || curproc == pageproc || > > > - !_vm_domain_allocate(vmd, VM_ALLOC_NORMAL, cnt)) > > > + !_vm_domain_allocate(vmd, VM_ALLOC_SYSTEM, cnt)) > > > > Why this change needed ? > > The change was inherited from Jeff, along with the rest of it. I > don't know why he changed it, but it does seem orthogonal to the rest > of the revision. This part is nonessential as far as I know, and > could be backed out. To me it doesn't make sense. The difference between VM_ALLOC_NORMAL and _SYSTEM is that they use different thresholds for the free page count before deciding whether to continue the allocation. The _NORMAL threshold is higher than the _SYSTEM threshold, but both are smaller than the "severe" threshold at which we set vmd_severeset. In other words, if the free page count is such that a _NORMAL allocation would fail but a _SYSTEM allocation would succeed, then vmd_severeset would be set and we'd never get to the _vmd_domain_allocate() call to begin with. So, I think this part of the change should be reverted. Even if the analysis is incorrect, it's logically separate from the rest of the diff. Prior to r355003 it made more sense, but per that commit it can be harmful to populate the per-CPU page caches when the system is severely short on free pages, so I would disagree with it anyway without more testing. From owner-svn-src-all@freebsd.org Tue Aug 11 22:33:57 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 40B6C3B929D; Tue, 11 Aug 2020 22:33:57 +0000 (UTC) (envelope-from jmg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BR70j0z4vz480s; Tue, 11 Aug 2020 22:33:57 +0000 (UTC) (envelope-from jmg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DF5472239C; Tue, 11 Aug 2020 22:33:56 +0000 (UTC) (envelope-from jmg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07BMXuSI031227; Tue, 11 Aug 2020 22:33:56 GMT (envelope-from jmg@FreeBSD.org) Received: (from jmg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07BMXuqt031226; Tue, 11 Aug 2020 22:33:56 GMT (envelope-from jmg@FreeBSD.org) Message-Id: <202008112233.07BMXuqt031226@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmg set sender to jmg@FreeBSD.org using -f From: John-Mark Gurney Date: Tue, 11 Aug 2020 22:33:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364132 - head/tools/debugscripts X-SVN-Group: head X-SVN-Commit-Author: jmg X-SVN-Commit-Paths: head/tools/debugscripts X-SVN-Commit-Revision: 364132 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 22:33:57 -0000 Author: jmg Date: Tue Aug 11 22:33:56 2020 New Revision: 364132 URL: https://svnweb.freebsd.org/changeset/base/364132 Log: since kld_deb.py was removed a while back, this script isn't useful anymore... Deleted: head/tools/debugscripts/kgdb From owner-svn-src-all@freebsd.org Tue Aug 11 23:36:40 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6A2873BA11B; Tue, 11 Aug 2020 23:36: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BR8P41n2Bz4Cf7; Tue, 11 Aug 2020 23:36: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 1CF8022B46; Tue, 11 Aug 2020 23:36: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 07BNad9w069405; Tue, 11 Aug 2020 23:36:39 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07BNacOt069399; Tue, 11 Aug 2020 23:36:38 GMT (envelope-from cy@FreeBSD.org) Message-Id: <202008112336.07BNacOt069399@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Tue, 11 Aug 2020 23:36:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364133 - head/libexec/rc/rc.d X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/libexec/rc/rc.d X-SVN-Commit-Revision: 364133 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2020 23:36:40 -0000 Author: cy Date: Tue Aug 11 23:36:38 2020 New Revision: 364133 URL: https://svnweb.freebsd.org/changeset/base/364133 Log: When booting a system with WITHOUT_IPFILTER the following errors are encountered at boot time: rcorder: requirement `ipfs' in file `/etc/rc.d/netif' has no providers. rcorder: requirement `ipfilter' in file `/etc/rc.d/netif' has no providers. rcorder: requirement `ipfilter' in file `/etc/rc.d/netwait' has no providers. rcorder: requirement `ipfilter' in file `/etc/rc.d/net_watchdog' has no providers. rcorder: requirement `ipfilter' in file `/etc/rc.d/securelevel' has no providers. Listing its own requrements in BEFORE rather than use REQUIRE of non-optional scripts resolves this issue. The issue was discovered and patched by glebius at Netflix. Submitted by: glebius Reported by: glebius MFC after: 1 week Modified: head/libexec/rc/rc.d/ipfilter head/libexec/rc/rc.d/ipmon head/libexec/rc/rc.d/ipnat head/libexec/rc/rc.d/netif head/libexec/rc/rc.d/netwait head/libexec/rc/rc.d/securelevel Modified: head/libexec/rc/rc.d/ipfilter ============================================================================== --- head/libexec/rc/rc.d/ipfilter Tue Aug 11 22:33:56 2020 (r364132) +++ head/libexec/rc/rc.d/ipfilter Tue Aug 11 23:36:38 2020 (r364133) @@ -5,6 +5,7 @@ # PROVIDE: ipfilter # REQUIRE: FILESYSTEMS +# BEFORE: ipmon ipnat netif netwait securelevel # KEYWORD: nojailvnet . /etc/rc.subr Modified: head/libexec/rc/rc.d/ipmon ============================================================================== --- head/libexec/rc/rc.d/ipmon Tue Aug 11 22:33:56 2020 (r364132) +++ head/libexec/rc/rc.d/ipmon Tue Aug 11 23:36:38 2020 (r364133) @@ -4,7 +4,7 @@ # # PROVIDE: ipmon -# REQUIRE: FILESYSTEMS hostname sysctl ipfilter +# REQUIRE: FILESYSTEMS hostname sysctl # BEFORE: SERVERS # KEYWORD: nojailvnet Modified: head/libexec/rc/rc.d/ipnat ============================================================================== --- head/libexec/rc/rc.d/ipnat Tue Aug 11 22:33:56 2020 (r364132) +++ head/libexec/rc/rc.d/ipnat Tue Aug 11 23:36:38 2020 (r364133) @@ -4,7 +4,6 @@ # # PROVIDE: ipnat -# REQUIRE: ipfilter # KEYWORD: nojailvnet . /etc/rc.subr Modified: head/libexec/rc/rc.d/netif ============================================================================== --- head/libexec/rc/rc.d/netif Tue Aug 11 22:33:56 2020 (r364132) +++ head/libexec/rc/rc.d/netif Tue Aug 11 23:36:38 2020 (r364133) @@ -27,7 +27,7 @@ # PROVIDE: netif # REQUIRE: FILESYSTEMS iovctl serial sppp sysctl -# REQUIRE: hostid ipfilter ipfs +# REQUIRE: hostid ipfs # KEYWORD: nojailvnet . /etc/rc.subr Modified: head/libexec/rc/rc.d/netwait ============================================================================== --- head/libexec/rc/rc.d/netwait Tue Aug 11 22:33:56 2020 (r364132) +++ head/libexec/rc/rc.d/netwait Tue Aug 11 23:36:38 2020 (r364133) @@ -3,7 +3,7 @@ # $FreeBSD$ # # PROVIDE: netwait -# REQUIRE: devd ipfilter ipfw pf routing +# REQUIRE: devd ipfw pf routing # KEYWORD: nojail # # The netwait script helps handle two situations: Modified: head/libexec/rc/rc.d/securelevel ============================================================================== --- head/libexec/rc/rc.d/securelevel Tue Aug 11 22:33:56 2020 (r364132) +++ head/libexec/rc/rc.d/securelevel Tue Aug 11 23:36:38 2020 (r364133) @@ -4,7 +4,7 @@ # # PROVIDE: securelevel -# REQUIRE: adjkerntz ipfw ipfilter pf +# REQUIRE: adjkerntz ipfw pf . /etc/rc.subr From owner-svn-src-all@freebsd.org Wed Aug 12 00:21:31 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4B44D3BAA7E; Wed, 12 Aug 2020 00:21:31 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BR9Nq131Dz4FJb; Wed, 12 Aug 2020 00:21:31 +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 07585236A2; Wed, 12 Aug 2020 00:21:31 +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 07C0LUAd095869; Wed, 12 Aug 2020 00:21:30 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07C0LUF8095868; Wed, 12 Aug 2020 00:21:30 GMT (envelope-from cem@FreeBSD.org) Message-Id: <202008120021.07C0LUF8095868@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 12 Aug 2020 00:21:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364134 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 364134 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2020 00:21:31 -0000 Author: cem Date: Wed Aug 12 00:21:30 2020 New Revision: 364134 URL: https://svnweb.freebsd.org/changeset/base/364134 Log: Back out unrelated change Reported by: kib, markj X-MFC-With: r364129 Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Tue Aug 11 23:36:38 2020 (r364133) +++ head/sys/vm/vm_page.c Wed Aug 12 00:21:30 2020 (r364134) @@ -2488,7 +2488,7 @@ vm_page_zone_import(void *arg, void **store, int cnt, * main purpose is to replenish the store of free pages. */ if (vmd->vmd_severeset || curproc == pageproc || - !_vm_domain_allocate(vmd, VM_ALLOC_SYSTEM, cnt)) + !_vm_domain_allocate(vmd, VM_ALLOC_NORMAL, cnt)) return (0); domain = vmd->vmd_domain; vm_domain_free_lock(vmd); From owner-svn-src-all@freebsd.org Wed Aug 12 00:22:08 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A8FB63BAB09; Wed, 12 Aug 2020 00:22:08 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-ot1-f48.google.com (mail-ot1-f48.google.com [209.85.210.48]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BR9PX2cvCz4FHM; Wed, 12 Aug 2020 00:22:08 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-ot1-f48.google.com with SMTP id t7so629877otp.0; Tue, 11 Aug 2020 17:22:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=wEWF5O77Ga/rQVJcE4tL3KyRO+dod94J4/+WTFxNl30=; b=C4Ab8FrAUgVWsFzcmZjnagW0jNr2aJWOsBXw0Z6CqFrQ1dOPR34ond5k+uQjBODK4j hTXZrqkhSftYDnLF5iUNgCsHyTLiwYLv2tewGkl2HHdIn3v7mrPLTk31HH0xwULB7z8+ g4yTN0qHTHnDzP3jQD3naU9GRG/OxGN/LXT6wew2GNHe2AvNSG5tPDDCe7OCzG5Rze/V vzOP1eV67GsRvQHeZkREd3XBWUAY2uSOUZpNEFSlOLtk0/Zz4q9L6XxkRk0Zu3mzs+C9 YGqEVsSHs1B9sWUDKB0oay7FTxtUIN+rEmIWRMYjC/6nonliFA9a9w+DXXaLtnnEL+5r T1Iw== X-Gm-Message-State: AOAM532B3VKOb8lZiThYnoNJtvIPcEDnZan0wUz9ikV+t1mFCdPOF1kf Qu7Aa+tU07slaM1QglQT+l2W3x8i X-Google-Smtp-Source: ABdhPJyXg2ly1F47xu1xBtNMI5TUz37fhJDit08KWo8hjBTDoRose/YdEEoXNZ3Q0CQ4xD4q2tCflg== X-Received: by 2002:a05:6830:60f:: with SMTP id w15mr7217494oti.85.1597191727025; Tue, 11 Aug 2020 17:22:07 -0700 (PDT) Received: from mail-oi1-f169.google.com (mail-oi1-f169.google.com. [209.85.167.169]) by smtp.gmail.com with ESMTPSA id l128sm140819oib.4.2020.08.11.17.22.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 11 Aug 2020 17:22:06 -0700 (PDT) Received: by mail-oi1-f169.google.com with SMTP id u63so293190oie.5; Tue, 11 Aug 2020 17:22:06 -0700 (PDT) X-Received: by 2002:aca:5703:: with SMTP id l3mr5305694oib.48.1597191726280; Tue, 11 Aug 2020 17:22:06 -0700 (PDT) MIME-Version: 1.0 References: <202008112037.07BKbjsL056699@repo.freebsd.org> <20200811213213.GT2551@kib.kiev.ua> <20200811223100.GC77647@raichu> In-Reply-To: <20200811223100.GC77647@raichu> Reply-To: cem@freebsd.org From: Conrad Meyer Date: Tue, 11 Aug 2020 17:21:55 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r364129 - head/sys/vm To: Mark Johnston , Konstantin Belousov Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4BR9PX2cvCz4FHM X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; TAGGED_FROM(0.00)[]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2020 00:22:08 -0000 Done in r364134. On Tue, Aug 11, 2020 at 3:31 PM Mark Johnston wrote: > > On Tue, Aug 11, 2020 at 03:21:31PM -0700, Conrad Meyer wrote: > > Hi Konstantin, Mark (raised the same question), > > > > On Tue, Aug 11, 2020 at 2:32 PM Konstantin Belousov wrote: > > > > > > On Tue, Aug 11, 2020 at 08:37:45PM +0000, Conrad Meyer wrote: > > > > Author: cem > > > > Date: Tue Aug 11 20:37:45 2020 > > > > New Revision: 364129 > > > > URL: https://svnweb.freebsd.org/changeset/base/364129 > > > > > > > > Log: > > > > Add support for multithreading the inactive queue pageout within a domain. > > > > ... > > > > @@ -2488,7 +2488,7 @@ vm_page_zone_import(void *arg, void **store, int cnt, > > > > * main purpose is to replenish the store of free pages. > > > > */ > > > > if (vmd->vmd_severeset || curproc == pageproc || > > > > - !_vm_domain_allocate(vmd, VM_ALLOC_NORMAL, cnt)) > > > > + !_vm_domain_allocate(vmd, VM_ALLOC_SYSTEM, cnt)) > > > > > > Why this change needed ? > > > > The change was inherited from Jeff, along with the rest of it. I > > don't know why he changed it, but it does seem orthogonal to the rest > > of the revision. This part is nonessential as far as I know, and > > could be backed out. > > To me it doesn't make sense. The difference between VM_ALLOC_NORMAL and > _SYSTEM is that they use different thresholds for the free page count > before deciding whether to continue the allocation. The _NORMAL > threshold is higher than the _SYSTEM threshold, but both are smaller > than the "severe" threshold at which we set vmd_severeset. In other > words, if the free page count is such that a _NORMAL allocation would > fail but a _SYSTEM allocation would succeed, then vmd_severeset would be > set and we'd never get to the _vmd_domain_allocate() call to begin with. > > So, I think this part of the change should be reverted. Even if the > analysis is incorrect, it's logically separate from the rest of the > diff. Prior to r355003 it made more sense, but per that commit it can > be harmful to populate the per-CPU page caches when the system is > severely short on free pages, so I would disagree with it anyway without > more testing. From owner-svn-src-all@freebsd.org Wed Aug 12 00:32:32 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 40FD63BAE90; Wed, 12 Aug 2020 00:32:32 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BR9dX11WVz4G39; Wed, 12 Aug 2020 00:32:32 +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 0677D2397E; Wed, 12 Aug 2020 00:32:32 +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 07C0WV2v006151; Wed, 12 Aug 2020 00:32:31 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07C0WV4h006148; Wed, 12 Aug 2020 00:32:31 GMT (envelope-from cem@FreeBSD.org) Message-Id: <202008120032.07C0WV4h006148@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 12 Aug 2020 00:32:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364135 - in head/sys: fs/devfs kern X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/sys: fs/devfs kern X-SVN-Commit-Revision: 364135 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2020 00:32:32 -0000 Author: cem Date: Wed Aug 12 00:32:31 2020 New Revision: 364135 URL: https://svnweb.freebsd.org/changeset/base/364135 Log: devfs: Abstract locking assertions The conversion was largely mechanical: sed(1) with: -e 's|mtx_assert(&devmtx, MA_OWNED)|dev_lock_assert_locked()|g' -e 's|mtx_assert(&devmtx, MA_NOTOWNED)|dev_lock_assert_unlocked()|g' The definitions of these abstractions in fs/devfs/devfs_int.h are the only non-mechanical change. No functional change. Modified: head/sys/fs/devfs/devfs_devs.c head/sys/fs/devfs/devfs_int.h head/sys/kern/kern_conf.c Modified: head/sys/fs/devfs/devfs_devs.c ============================================================================== --- head/sys/fs/devfs/devfs_devs.c Wed Aug 12 00:21:30 2020 (r364134) +++ head/sys/fs/devfs/devfs_devs.c Wed Aug 12 00:32:31 2020 (r364135) @@ -156,7 +156,7 @@ devfs_dev_exists(const char *name) { struct cdev_priv *cdp; - mtx_assert(&devmtx, MA_OWNED); + dev_lock_assert_locked(); TAILQ_FOREACH(cdp, &cdevp_list, cdp_list) { if ((cdp->cdp_flags & CDP_ACTIVE) == 0) @@ -707,7 +707,7 @@ devfs_create(struct cdev *dev) { struct cdev_priv *cdp; - mtx_assert(&devmtx, MA_OWNED); + dev_lock_assert_locked(); cdp = cdev2priv(dev); cdp->cdp_flags |= CDP_ACTIVE; cdp->cdp_inode = alloc_unrl(devfs_inos); @@ -721,7 +721,7 @@ devfs_destroy(struct cdev *dev) { struct cdev_priv *cdp; - mtx_assert(&devmtx, MA_OWNED); + dev_lock_assert_locked(); cdp = cdev2priv(dev); cdp->cdp_flags &= ~CDP_ACTIVE; devfs_generation++; Modified: head/sys/fs/devfs/devfs_int.h ============================================================================== --- head/sys/fs/devfs/devfs_int.h Wed Aug 12 00:21:30 2020 (r364134) +++ head/sys/fs/devfs/devfs_int.h Wed Aug 12 00:32:31 2020 (r364135) @@ -95,6 +95,9 @@ extern struct sx clone_drain_lock; extern struct mtx cdevpriv_mtx; extern TAILQ_HEAD(cdev_priv_list, cdev_priv) cdevp_list; +#define dev_lock_assert_locked() mtx_assert(&devmtx, MA_OWNED) +#define dev_lock_assert_unlocked() mtx_assert(&devmtx, MA_NOTOWNED) + #endif /* _KERNEL */ #endif /* !_FS_DEVFS_DEVFS_INT_H_ */ Modified: head/sys/kern/kern_conf.c ============================================================================== --- head/sys/kern/kern_conf.c Wed Aug 12 00:21:30 2020 (r364134) +++ head/sys/kern/kern_conf.c Wed Aug 12 00:32:31 2020 (r364135) @@ -88,7 +88,7 @@ dev_unlock_and_free(void) struct cdev_priv *cdp; struct cdevsw *csw; - mtx_assert(&devmtx, MA_OWNED); + dev_lock_assert_locked(); /* * Make the local copy of the list heads while the dev_mtx is @@ -116,7 +116,7 @@ dev_free_devlocked(struct cdev *cdev) { struct cdev_priv *cdp; - mtx_assert(&devmtx, MA_OWNED); + dev_lock_assert_locked(); cdp = cdev2priv(cdev); KASSERT((cdp->cdp_flags & CDP_UNREF_DTR) == 0, ("destroy_dev() was not called after delist_dev(%p)", cdev)); @@ -127,7 +127,7 @@ static void cdevsw_free_devlocked(struct cdevsw *csw) { - mtx_assert(&devmtx, MA_OWNED); + dev_lock_assert_locked(); SLIST_INSERT_HEAD(&cdevsw_gt_post_list, csw, d_postfree_list); } @@ -142,7 +142,7 @@ void dev_ref(struct cdev *dev) { - mtx_assert(&devmtx, MA_NOTOWNED); + dev_lock_assert_unlocked(); mtx_lock(&devmtx); dev->si_refcount++; mtx_unlock(&devmtx); @@ -152,7 +152,7 @@ void dev_refl(struct cdev *dev) { - mtx_assert(&devmtx, MA_OWNED); + dev_lock_assert_locked(); dev->si_refcount++; } @@ -161,7 +161,7 @@ dev_rel(struct cdev *dev) { int flag = 0; - mtx_assert(&devmtx, MA_NOTOWNED); + dev_lock_assert_unlocked(); dev_lock(); dev->si_refcount--; KASSERT(dev->si_refcount >= 0, @@ -181,7 +181,7 @@ dev_refthread(struct cdev *dev, int *ref) struct cdevsw *csw; struct cdev_priv *cdp; - mtx_assert(&devmtx, MA_NOTOWNED); + dev_lock_assert_unlocked(); if ((dev->si_flags & SI_ETERNAL) != 0) { *ref = 0; return (dev->si_devsw); @@ -208,7 +208,7 @@ devvn_refthread(struct vnode *vp, struct cdev **devp, struct cdev_priv *cdp; struct cdev *dev; - mtx_assert(&devmtx, MA_NOTOWNED); + dev_lock_assert_unlocked(); if ((vp->v_vflag & VV_ETERNALDEV) != 0) { dev = vp->v_rdev; if (dev == NULL) @@ -249,7 +249,7 @@ void dev_relthread(struct cdev *dev, int ref) { - mtx_assert(&devmtx, MA_NOTOWNED); + dev_lock_assert_unlocked(); if (!ref) return; KASSERT(dev->si_threadcount > 0, @@ -570,7 +570,7 @@ newdev(struct make_dev_args *args, struct cdev *si) struct cdev *si2; struct cdevsw *csw; - mtx_assert(&devmtx, MA_OWNED); + dev_lock_assert_locked(); csw = args->mda_devsw; si2 = NULL; if (csw->d_flags & D_NEEDMINOR) { @@ -629,7 +629,7 @@ prep_cdevsw(struct cdevsw *devsw, int flags) { struct cdevsw *dsw2; - mtx_assert(&devmtx, MA_OWNED); + dev_lock_assert_locked(); if (devsw->d_flags & D_INIT) return (0); if (devsw->d_flags & D_NEEDGIANT) { @@ -714,7 +714,7 @@ prep_devname(struct cdev *dev, const char *fmt, va_lis int len; char *from, *q, *s, *to; - mtx_assert(&devmtx, MA_OWNED); + dev_lock_assert_locked(); len = vsnrprintf(dev->si_name, sizeof(dev->si_name), 32, fmt, ap); if (len > sizeof(dev->si_name) - 1) @@ -1098,7 +1098,7 @@ destroy_devl(struct cdev *dev) struct cdev_privdata *p; struct cdev_priv *cdp; - mtx_assert(&devmtx, MA_OWNED); + dev_lock_assert_locked(); KASSERT(dev->si_flags & SI_NAMED, ("WARNING: Driver mistake: destroy_dev on %d\n", dev2unit(dev))); KASSERT((dev->si_flags & SI_ETERNAL) == 0, @@ -1200,7 +1200,7 @@ delist_dev_locked(struct cdev *dev) struct cdev_priv *cdp; struct cdev *child; - mtx_assert(&devmtx, MA_OWNED); + dev_lock_assert_locked(); cdp = cdev2priv(dev); if ((cdp->cdp_flags & CDP_UNREF_DTR) != 0) return; @@ -1464,7 +1464,7 @@ destroy_dev_sched_cbl(struct cdev *dev, void (*cb)(voi { struct cdev_priv *cp; - mtx_assert(&devmtx, MA_OWNED); + dev_lock_assert_locked(); cp = cdev2priv(dev); if (cp->cdp_flags & CDP_SCHED_DTR) { dev_unlock(); From owner-svn-src-all@freebsd.org Wed Aug 12 02:05:34 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0A3FD3BC00C; Wed, 12 Aug 2020 02:05:34 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BRChs6GCKz4JRd; Wed, 12 Aug 2020 02:05:33 +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 BA34824A27; Wed, 12 Aug 2020 02:05:33 +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 07C25XF5060821; Wed, 12 Aug 2020 02:05:33 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07C25XJY060820; Wed, 12 Aug 2020 02:05:33 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202008120205.07C25XJY060820@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 12 Aug 2020 02:05: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: r364136 - stable/12/sys/dev/acpica X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/dev/acpica X-SVN-Commit-Revision: 364136 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2020 02:05:34 -0000 Author: mav Date: Wed Aug 12 02:05:33 2020 New Revision: 364136 URL: https://svnweb.freebsd.org/changeset/base/364136 Log: MFC r364037: Add some more checks to make APEI driver more robust. Modified: stable/12/sys/dev/acpica/acpi_apei.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/acpica/acpi_apei.c ============================================================================== --- stable/12/sys/dev/acpica/acpi_apei.c Wed Aug 12 00:32:31 2020 (r364135) +++ stable/12/sys/dev/acpica/acpi_apei.c Wed Aug 12 02:05:33 2020 (r364136) @@ -348,7 +348,7 @@ apei_ge_handler(struct apei_ge *ge, bool copy) uint32_t sev; int i, c, off; - if (ges->BlockStatus == 0) + if (ges == NULL || ges->BlockStatus == 0) return (0); c = (ges->BlockStatus >> 4) & 0x3ff; @@ -363,7 +363,8 @@ apei_ge_handler(struct apei_ge *ge, bool copy) /* Acknowledge the error has been processed. */ ges->BlockStatus = 0; - if (!copy && ge->v1.Header.Type == ACPI_HEST_TYPE_GENERIC_ERROR_V2) { + if (!copy && ge->v1.Header.Type == ACPI_HEST_TYPE_GENERIC_ERROR_V2 && + ge->res2) { uint64_t val = READ8(ge->res2, 0); val &= ge->v2.ReadAckPreserve; val |= ge->v2.ReadAckWrite; @@ -395,7 +396,7 @@ apei_nmi_handler(void) return (0); ges = (ACPI_HEST_GENERIC_STATUS *)ge->buf; - if (ges->BlockStatus == 0) + if (ges == NULL || ges->BlockStatus == 0) return (0); /* If ACPI told the error is fatal -- make it so. */ @@ -409,7 +410,8 @@ apei_nmi_handler(void) /* Acknowledge the error has been processed. */ ges->BlockStatus = 0; - if (ge->v1.Header.Type == ACPI_HEST_TYPE_GENERIC_ERROR_V2) { + if (ge->v1.Header.Type == ACPI_HEST_TYPE_GENERIC_ERROR_V2 && + ge->res2) { uint64_t val = READ8(ge->res2, 0); val &= ge->v2.ReadAckPreserve; val |= ge->v2.ReadAckWrite; @@ -608,13 +610,19 @@ apei_attach(device_t dev) ge->res_rid = rid++; acpi_bus_alloc_gas(dev, &ge->res_type, &ge->res_rid, &ge->v1.ErrorStatusAddress, &ge->res, 0); + if (ge->res) { + ge->buf = pmap_mapdev_attr(READ8(ge->res, 0), + ge->v1.ErrorBlockLength, VM_MEMATTR_WRITE_COMBINING); + } else { + device_printf(dev, "Can't allocate status resource.\n"); + } if (ge->v1.Header.Type == ACPI_HEST_TYPE_GENERIC_ERROR_V2) { ge->res2_rid = rid++; acpi_bus_alloc_gas(dev, &ge->res2_type, &ge->res2_rid, &ge->v2.ReadAckRegister, &ge->res2, 0); + if (ge->res2 == NULL) + device_printf(dev, "Can't allocate ack resource.\n"); } - ge->buf = pmap_mapdev_attr(READ8(ge->res, 0), - ge->v1.ErrorBlockLength, VM_MEMATTR_WRITE_COMBINING); if (ge->v1.Notify.Type == ACPI_HEST_NOTIFY_POLLED) { callout_init(&ge->poll, 1); callout_reset(&ge->poll, @@ -652,7 +660,10 @@ apei_detach(device_t dev) while ((ge = TAILQ_FIRST(&sc->ges)) != NULL) { TAILQ_REMOVE(&sc->ges, ge, link); - bus_release_resource(dev, ge->res_type, ge->res_rid, ge->res); + if (ge->res) { + bus_release_resource(dev, ge->res_type, + ge->res_rid, ge->res); + } if (ge->res2) { bus_release_resource(dev, ge->res2_type, ge->res2_rid, ge->res2); @@ -663,7 +674,10 @@ apei_detach(device_t dev) swi_remove(&ge->swi_ih); free(ge->copybuf, M_DEVBUF); } - pmap_unmapdev((vm_offset_t)ge->buf, ge->v1.ErrorBlockLength); + if (ge->buf) { + pmap_unmapdev((vm_offset_t)ge->buf, + ge->v1.ErrorBlockLength); + } free(ge, M_DEVBUF); } return (0); From owner-svn-src-all@freebsd.org Wed Aug 12 04:35:50 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7D1FB3BD921; Wed, 12 Aug 2020 04:35:50 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BRH2G2Ks4z4Q7F; Wed, 12 Aug 2020 04:35:50 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2E5A526634; Wed, 12 Aug 2020 04:35:50 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07C4Zovd053840; Wed, 12 Aug 2020 04:35:50 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07C4Zorn053839; Wed, 12 Aug 2020 04:35:50 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <202008120435.07C4Zorn053839@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Wed, 12 Aug 2020 04:35:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364138 - head/sys/fs/nfsclient X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/sys/fs/nfsclient X-SVN-Commit-Revision: 364138 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2020 04:35:50 -0000 Author: rmacklem Date: Wed Aug 12 04:35:49 2020 New Revision: 364138 URL: https://svnweb.freebsd.org/changeset/base/364138 Log: Fix a bug introduced by r363001 for the ext_pgs case. r363001 added support for ext_pgs mbufs to nfsm_uiombuf(). By inspection, I noticed that "mlen" was not set non-zero and, as such, there would be an iteration of the loop that did nothing. This patch sets it. This bug would have no effect on the system, since the ext_pgs mbuf code is not yet enabled. Modified: head/sys/fs/nfsclient/nfs_clcomsubs.c Modified: head/sys/fs/nfsclient/nfs_clcomsubs.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clcomsubs.c Wed Aug 12 03:00:17 2020 (r364137) +++ head/sys/fs/nfsclient/nfs_clcomsubs.c Wed Aug 12 04:35:49 2020 (r364138) @@ -92,7 +92,7 @@ nfsm_uiombuf(struct nfsrv_descript *nd, struct uio *ui nd->nd_maxextsiz, &nd->nd_bextpg); mcp = (char *)(void *)PHYS_TO_DMAP( mp->m_epg_pa[nd->nd_bextpg]); - nd->nd_bextpgsiz = PAGE_SIZE; + nd->nd_bextpgsiz = mlen = PAGE_SIZE; } else { if (clflg) NFSMCLGET(mp, M_WAITOK); From owner-svn-src-all@freebsd.org Wed Aug 12 04:52:36 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 15A8E3BDB55; Wed, 12 Aug 2020 04:52: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BRHPb6rHFz4Qm5; Wed, 12 Aug 2020 04:52: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 CE1B7266F2; Wed, 12 Aug 2020 04:52: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 07C4qZlt065702; Wed, 12 Aug 2020 04:52:35 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07C4qZQ1065701; Wed, 12 Aug 2020 04:52:35 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202008120452.07C4qZQ1065701@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 12 Aug 2020 04:52:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364139 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 364139 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2020 04:52:36 -0000 Author: mjg Date: Wed Aug 12 04:52:35 2020 New Revision: 364139 URL: https://svnweb.freebsd.org/changeset/base/364139 Log: vfs: reimplement vref on top of vget No change in generated assembly. Modified: head/sys/kern/vfs_subr.c Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Wed Aug 12 04:35:49 2020 (r364138) +++ head/sys/kern/vfs_subr.c Wed Aug 12 04:52:35 2020 (r364139) @@ -2920,36 +2920,14 @@ vget_finish_ref(struct vnode *vp, enum vgetstate vs) } } -/* - * Increase the reference (use) and hold count of a vnode. - * This will also remove the vnode from the free list if it is presently free. - */ void vref(struct vnode *vp) { - int old; + enum vgetstate vs; CTR2(KTR_VFS, "%s: vp %p", __func__, vp); - if (refcount_acquire_if_not_zero(&vp->v_usecount)) { - VNODE_REFCOUNT_FENCE_ACQ(); - VNASSERT(vp->v_holdcnt > 0, vp, - ("%s: active vnode not held", __func__)); - return; - } - vhold(vp); - /* - * See the comment in vget_finish. - */ - old = atomic_fetchadd_int(&vp->v_usecount, 1); - VNASSERT(old >= 0, vp, ("%s: wrong use count %d", __func__, old)); - if (old != 0) { -#ifdef INVARIANTS - old = atomic_fetchadd_int(&vp->v_holdcnt, -1); - VNASSERT(old > 1, vp, ("%s: wrong hold count %d", __func__, old)); -#else - refcount_release(&vp->v_holdcnt); -#endif - } + vs = vget_prep(vp); + vget_finish_ref(vp, vs); } void From owner-svn-src-all@freebsd.org Wed Aug 12 04:53:03 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C80AC3BD971; Wed, 12 Aug 2020 04:53:03 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BRHQ74w4Sz4Qt4; Wed, 12 Aug 2020 04:53: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 8C14E26B83; Wed, 12 Aug 2020 04:53: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 07C4r3oU065776; Wed, 12 Aug 2020 04:53:03 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07C4r3N1065775; Wed, 12 Aug 2020 04:53:03 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202008120453.07C4r3N1065775@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 12 Aug 2020 04:53:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364140 - 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: 364140 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2020 04:53:03 -0000 Author: mjg Date: Wed Aug 12 04:53:02 2020 New Revision: 364140 URL: https://svnweb.freebsd.org/changeset/base/364140 Log: vfs: garbage collect vrefactn Modified: head/sys/kern/vfs_subr.c head/sys/sys/vnode.h Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Wed Aug 12 04:52:35 2020 (r364139) +++ head/sys/kern/vfs_subr.c Wed Aug 12 04:53:02 2020 (r364140) @@ -2952,19 +2952,6 @@ vrefact(struct vnode *vp) #endif } -void -vrefactn(struct vnode *vp, u_int n) -{ - - CTR2(KTR_VFS, "%s: vp %p", __func__, vp); -#ifdef INVARIANTS - int old = atomic_fetchadd_int(&vp->v_usecount, n); - VNASSERT(old > 0, vp, ("%s: wrong use count %d", __func__, old)); -#else - atomic_add_int(&vp->v_usecount, n); -#endif -} - /* * Return reference count of a vnode. * Modified: head/sys/sys/vnode.h ============================================================================== --- head/sys/sys/vnode.h Wed Aug 12 04:52:35 2020 (r364139) +++ head/sys/sys/vnode.h Wed Aug 12 04:53:02 2020 (r364140) @@ -967,7 +967,6 @@ void vrele(struct vnode *vp); void vref(struct vnode *vp); void vrefl(struct vnode *vp); void vrefact(struct vnode *vp); -void vrefactn(struct vnode *vp, u_int n); int vrefcnt(struct vnode *vp); void v_addpollinfo(struct vnode *vp); From owner-svn-src-all@freebsd.org Wed Aug 12 04:53:21 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5A3C43BDB67; Wed, 12 Aug 2020 04:53:21 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BRHQT1l9wz4R7b; Wed, 12 Aug 2020 04:53:21 +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 1F28F2656D; Wed, 12 Aug 2020 04:53:21 +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 07C4rLg8065835; Wed, 12 Aug 2020 04:53:21 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07C4rKPU065834; Wed, 12 Aug 2020 04:53:20 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202008120453.07C4rKPU065834@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 12 Aug 2020 04:53:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364141 - 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: 364141 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2020 04:53:21 -0000 Author: mjg Date: Wed Aug 12 04:53:20 2020 New Revision: 364141 URL: https://svnweb.freebsd.org/changeset/base/364141 Log: vfs: inline vrefcnt Modified: head/sys/kern/vfs_subr.c head/sys/sys/vnode.h Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Wed Aug 12 04:53:02 2020 (r364140) +++ head/sys/kern/vfs_subr.c Wed Aug 12 04:53:20 2020 (r364141) @@ -2952,22 +2952,6 @@ vrefact(struct vnode *vp) #endif } -/* - * Return reference count of a vnode. - * - * The results of this call are only guaranteed when some mechanism is used to - * stop other processes from gaining references to the vnode. This may be the - * case if the caller holds the only reference. This is also useful when stale - * data is acceptable as race conditions may be accounted for by some other - * means. - */ -int -vrefcnt(struct vnode *vp) -{ - - return (vp->v_usecount); -} - void vlazy(struct vnode *vp) { Modified: head/sys/sys/vnode.h ============================================================================== --- head/sys/sys/vnode.h Wed Aug 12 04:53:02 2020 (r364140) +++ head/sys/sys/vnode.h Wed Aug 12 04:53:20 2020 (r364141) @@ -967,8 +967,13 @@ void vrele(struct vnode *vp); void vref(struct vnode *vp); void vrefl(struct vnode *vp); void vrefact(struct vnode *vp); -int vrefcnt(struct vnode *vp); void v_addpollinfo(struct vnode *vp); +static __inline int +vrefcnt(struct vnode *vp) +{ + + return (vp->v_usecount); +} int vnode_create_vobject(struct vnode *vp, off_t size, struct thread *td); void vnode_destroy_vobject(struct vnode *vp); From owner-svn-src-all@freebsd.org Wed Aug 12 07:00:07 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2579B378184; Wed, 12 Aug 2020 07:00:07 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BRLDl0Fb3z4XVN; Wed, 12 Aug 2020 07:00:07 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DFE0227F67; Wed, 12 Aug 2020 07:00:06 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07C706MV039498; Wed, 12 Aug 2020 07:00:06 GMT (envelope-from gbe@FreeBSD.org) Received: (from gbe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07C7067S039497; Wed, 12 Aug 2020 07:00:06 GMT (envelope-from gbe@FreeBSD.org) Message-Id: <202008120700.07C7067S039497@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gbe set sender to gbe@FreeBSD.org using -f From: Gordon Bergling Date: Wed, 12 Aug 2020 07:00:06 +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: r364142 - stable/12/share/man/man7 X-SVN-Group: stable-12 X-SVN-Commit-Author: gbe X-SVN-Commit-Paths: stable/12/share/man/man7 X-SVN-Commit-Revision: 364142 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2020 07:00:07 -0000 Author: gbe (doc committer) Date: Wed Aug 12 07:00:06 2020 New Revision: 364142 URL: https://svnweb.freebsd.org/changeset/base/364142 Log: MFC r363907: environ(7): Update the description and include some more environment variables - Add a better introduction to the DESCRIPTION section - Add a description for MANPATH and POSIXLY_CORRECT - Asorted improvements for the usage of some macros PR: 43823 Submitted by: Lyndon Nerenberg Reviewed by: 0mp, bcr Approved by: 0mp, bcr Differential Revision: https://reviews.freebsd.org/D25912 Modified: stable/12/share/man/man7/environ.7 Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man7/environ.7 ============================================================================== --- stable/12/share/man/man7/environ.7 Wed Aug 12 04:53:20 2020 (r364141) +++ stable/12/share/man/man7/environ.7 Wed Aug 12 07:00:06 2020 (r364142) @@ -28,7 +28,7 @@ .\" @(#)environ.7 8.3 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" -.Dd February 14, 2020 +.Dd August 5, 2020 .Dt ENVIRON 7 .Os .Sh NAME @@ -37,21 +37,59 @@ .Sh SYNOPSIS .Ar extern char **environ ; .Sh DESCRIPTION -An array of strings called the +An array of strings, called the .Ar environment -is made available by +is made available to each process by .Xr execve 2 when a process begins. By convention these strings have the form -.Dq Ar name=value . -The following names are used by various commands: -.Bl -tag -width LC_MONETARY +.Va name Ns No = Ns Ar value , +and are referred to as +.Dq environment variables . +A process can query, update, and delete these strings using the +.Xr getenv 3 , +.Xr setenv 3 , +and +.Xr unsetenv 3 +functions, respectively. +The shells also provide commands to manipulate the environment; +they are described in the respective shell manual pages. +.Pp +What follows is a list of environment variables typically +seen on a +.Ux +system. +It includes only those variables that a user can expect to see during their +day-to-day use of the system, and is far from complete. +Environment variables specific to a particular program or library function +are documented in the +.Sx ENVIRONMENT +section of the appropriate manual page. +.Sh ENVIRONMENT +.Bl -tag -width LD_LIBRARY_PATH .It Ev BLOCKSIZE -The size of the block units used by several commands, most notably +The size of the block units used by several disk-related commands, +most notably .Xr df 1 , .Xr du 1 and .Xr ls 1 . +.Ev BLOCKSIZE +may be specified in units of a byte by specifying a number, +in units of a kilobyte by specifying a number followed by +.Ql K +or +.Ql k , +in units of a megabyte by specifying a number followed by +.Ql M +or +.Ql m , +and in units of a gigabyte by specifying a number followed +by +.Ql G +or +.Ql g . +Sizes less than 512 bytes or greater than a gigabyte are ignored. This variable is processed by the .Xr getbsize 3 function. @@ -117,6 +155,10 @@ used by .Xr mail 1 , .Xr sh 1 , and many other mail clients. +.It Ev MANPATH +The sequence of directories, separated by colons, searched by +.Xr man 1 +when looking for manual pages. .It Ev NLSPATH List of directories to be searched for the message catalog referred to by .Ev LC_MESSAGES . @@ -139,6 +181,9 @@ etc, when looking for an executable file. .Ev PATH is set to ``/usr/bin:/bin'' initially by .Xr login 1 . +.It Ev POSIXLY_CORRECT +When set to any value, this environment variable modifies the behaviour +of certain commands to (mostly) execute in a strictly POSIX-compliant manner. .It Ev PRINTER The name of the default printer to be used by .Xr lpr 1 , @@ -178,7 +223,7 @@ no is equivalent to a .Ev TERMPATH of -.Dq Pa $HOME/.termcap:/etc/termcap . +.Pa $HOME/.termcap:/etc/termcap . .Ev TERMPATH is ignored if .Ev TERMCAP @@ -186,22 +231,27 @@ contains a full pathname. .It Ev TMPDIR The directory in which to store temporary files. Most applications use either -.Dq /tmp +.Pa /tmp or -.Dq /var/tmp . +.Pa /var/tmp . Setting this variable will make them use another directory. .It Ev TZ The timezone to use when displaying dates. The normal format is a pathname relative to -.Dq Pa /usr/share/zoneinfo . +.Pa /usr/share/zoneinfo . For example, the command -.Dq env TZ=America/Los_Angeles date +.Pp +.Dl env TZ=America/Los_Angeles date +.Pp displays the current time in California. See .Xr tzset 3 for more information. .It Ev USER The login name of the user. +It is recommended that portable applications use +.Ev LOGNAME +instead. .El .Pp Further names may be placed in the environment by the From owner-svn-src-all@freebsd.org Wed Aug 12 09:07:08 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 287B637A476; Wed, 12 Aug 2020 09:07:08 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BRP3J0MBsz4dB6; Wed, 12 Aug 2020 09:07:08 +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 E42CE98BD; Wed, 12 Aug 2020 09:07:07 +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 07C97762018568; Wed, 12 Aug 2020 09:07:07 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07C9772S018567; Wed, 12 Aug 2020 09:07:07 GMT (envelope-from avg@FreeBSD.org) Message-Id: <202008120907.07C9772S018567@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 12 Aug 2020 09:07:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364143 - head/sys/dev/usb/misc X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/dev/usb/misc X-SVN-Commit-Revision: 364143 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2020 09:07:08 -0000 Author: avg Date: Wed Aug 12 09:07:07 2020 New Revision: 364143 URL: https://svnweb.freebsd.org/changeset/base/364143 Log: cp2112: a number of cleanups and improvements - hoist all request / response structures from function level to top level - replace magic numeric literals with constants - regroup types, data and functions - remove setting of the id field in responses as they are completely overwritten with data from the device - centralize setting of the id field as it is always set to the value of request type - fix setting and querying of open-drain vs push-pull configuration of an output pin -- it's always in one of those configurations - detect special pin configurations: a pin in a special configuration is neither general purpose input or output - there is still no support for setting special configurations MFC after: 2 weeks Modified: head/sys/dev/usb/misc/cp2112.c Modified: head/sys/dev/usb/misc/cp2112.c ============================================================================== --- head/sys/dev/usb/misc/cp2112.c Wed Aug 12 07:00:06 2020 (r364142) +++ head/sys/dev/usb/misc/cp2112.c Wed Aug 12 09:07:07 2020 (r364143) @@ -66,6 +66,8 @@ __FBSDID("$FreeBSD$"); #define USB_DEBUG_VAR usb_debug #include +#define SIZEOF_FIELD(_s, _f) sizeof(((struct _s *)NULL)->_f) + #define CP2112GPIO_LOCK(sc) sx_xlock(&sc->gpio_lock) #define CP2112GPIO_UNLOCK(sc) sx_xunlock(&sc->gpio_lock) #define CP2112GPIO_LOCKED(sc) sx_assert(&sc->gpio_lock, SX_XLOCKED) @@ -93,8 +95,13 @@ __FBSDID("$FreeBSD$"); #define CP2112_REQ_LOCK 0x20 #define CP2112_REQ_USB_CFG 0x21 +#define CP2112_IIC_MAX_READ_LEN 512 #define CP2112_IIC_REPSTART_VER 2 /* Erratum CP2112_E10. */ +#define CP2112_GPIO_SPEC_CLK7 1 /* Pin 7 is clock output. */ +#define CP2112_GPIO_SPEC_TX0 2 /* Pin 0 pulses on USB TX. */ +#define CP2112_GPIO_SPEC_RX1 4 /* Pin 1 pulses on USB RX. */ + #define CP2112_IIC_STATUS0_IDLE 0 #define CP2112_IIC_STATUS0_BUSY 1 #define CP2112_IIC_STATUS0_CMP 2 @@ -104,7 +111,112 @@ __FBSDID("$FreeBSD$"); #define CP2112_IIC_STATUS1_TIMEOUT_BUS 1 #define CP2112_IIC_STATUS1_ARB_LOST 2 +/* CP2112_REQ_VERSION */ +struct version_request { + uint8_t id; + uint8_t part_num; + uint8_t version; +} __packed; +/* CP2112_REQ_GPIO_GET */ +struct gpio_get_req { + uint8_t id; + uint8_t state; +} __packed; + +/* CP2112_REQ_GPIO_SET */ +struct gpio_set_req { + uint8_t id; + uint8_t state; + uint8_t mask; +} __packed; + +/* CP2112_REQ_GPIO_CFG */ +struct gpio_config_req { + uint8_t id; + uint8_t output; + uint8_t pushpull; + uint8_t special; + uint8_t divider; +} __packed; + +/* CP2112_REQ_SMB_XFER_STATUS_REQ */ +struct i2c_xfer_status_req { + uint8_t id; + uint8_t request; +} __packed; + +/* CP2112_REQ_SMB_XFER_STATUS_RESP */ +struct i2c_xfer_status_resp { + uint8_t id; + uint8_t status0; + uint8_t status1; + uint16_t status2; + uint16_t status3; +} __packed; + +/* CP2112_REQ_SMB_READ_FORCE_SEND */ +struct i2c_data_read_force_send_req { + uint8_t id; + uint16_t len; +} __packed; + +/* CP2112_REQ_SMB_READ_RESPONSE */ +struct i2c_data_read_resp { + uint8_t id; + uint8_t status; + uint8_t len; + uint8_t data[61]; +} __packed; + +/* CP2112_REQ_SMB_READ */ +struct i2c_write_read_req { + uint8_t id; + uint8_t slave; + uint16_t rlen; + uint8_t wlen; + uint8_t wdata[16]; +} __packed; + +/* CP2112_REQ_SMB_WRITE */ +struct i2c_read_req { + uint8_t id; + uint8_t slave; + uint16_t len; +} __packed; + +/* CP2112_REQ_SMB_WRITE_READ */ +struct i2c_write_req { + uint8_t id; + uint8_t slave; + uint8_t len; + uint8_t data[61]; +} __packed; + +/* CP2112_REQ_SMB_CFG */ +struct i2c_cfg_req { + uint8_t id; + uint32_t speed; /* Hz */ + uint8_t slave_addr; /* ACK only */ + uint8_t auto_send_read; /* boolean */ + uint16_t write_timeout; /* 0-1000 ms, 0 ~ no timeout */ + uint16_t read_timeout; /* 0-1000 ms, 0 ~ no timeout */ + uint8_t scl_low_timeout;/* boolean */ + uint16_t retry_count; /* 1-1000, 0 ~ forever */ +} __packed; + +enum cp2112_out_mode { + OUT_OD, + OUT_PP, + OUT_KEEP +}; + +enum { + CP2112_INTR_OUT = 0, + CP2112_INTR_IN, + CP2112_N_TRANSFER, +}; + struct cp2112_softc { device_t sc_gpio_dev; device_t sc_iic_dev; @@ -120,10 +232,38 @@ struct cp2112gpio_softc { struct gpio_pin pins[CP2112_GPIO_COUNT]; }; +struct cp2112iic_softc { + device_t dev; + device_t iicbus_dev; + struct usb_xfer *xfers[CP2112_N_TRANSFER]; + u_char own_addr; + struct { + struct mtx lock; + struct cv cv; + struct { + uint8_t *data; + int len; + int done; + int error; + } in; + struct { + const uint8_t *data; + int len; + int done; + int error; + } out; + } io; +}; + static int cp2112_detach(device_t dev); static int cp2112gpio_detach(device_t dev); static int cp2112iic_detach(device_t dev); +static const STRUCT_USB_HOST_ID cp2112_devs[] = { + { USB_VP(USB_VENDOR_SILABS, USB_PRODUCT_SILABS_CP2112) }, + { USB_VP(0x1009, USB_PRODUCT_SILABS_CP2112) }, /* XXX */ +}; + static int cp2112_get_report(device_t dev, uint8_t id, void *data, uint16_t len) { @@ -143,25 +283,103 @@ cp2112_set_report(device_t dev, uint8_t id, void *data int err; sc = device_get_softc(dev); + *(uint8_t *)data = id; err = usbd_req_set_report(sc->sc_udev, NULL, data, len, sc->sc_iface_index, UHID_FEATURE_REPORT, id); return (err); } static int +cp2112_probe(device_t dev) +{ + struct usb_attach_arg *uaa; + + uaa = device_get_ivars(dev); + if (uaa->usb_mode != USB_MODE_HOST) + return (ENXIO); + if (uaa->info.bInterfaceClass != UICLASS_HID) + return (ENXIO); + + if (usbd_lookup_id_by_uaa(cp2112_devs, sizeof(cp2112_devs), uaa) == 0) + return (BUS_PROBE_DEFAULT); + return (ENXIO); +} + +static int +cp2112_attach(device_t dev) +{ + struct version_request vdata; + struct usb_attach_arg *uaa; + struct cp2112_softc *sc; + int err; + + uaa = device_get_ivars(dev); + sc = device_get_softc(dev); + + device_set_usb_desc(dev); + + sc->sc_udev = uaa->device; + sc->sc_iface_index = uaa->info.bIfaceIndex; + + err = cp2112_get_report(dev, CP2112_REQ_VERSION, &vdata, sizeof(vdata)); + if (err != 0) + goto detach; + device_printf(dev, "part number 0x%02x, version 0x%02x\n", + vdata.part_num, vdata.version); + if (vdata.part_num != CP2112_PART_NUM) { + device_printf(dev, "unsupported part number\n"); + goto detach; + } + sc->sc_version = vdata.version; + sc->sc_gpio_dev = device_add_child(dev, "gpio", -1); + if (sc->sc_gpio_dev != NULL) { + err = device_probe_and_attach(sc->sc_gpio_dev); + if (err != 0) { + device_printf(dev, "failed to attach gpio child\n"); + } + } else { + device_printf(dev, "failed to create gpio child\n"); + } + + sc->sc_iic_dev = device_add_child(dev, "iichb", -1); + if (sc->sc_iic_dev != NULL) { + err = device_probe_and_attach(sc->sc_iic_dev); + if (err != 0) { + device_printf(dev, "failed to attach iic child\n"); + } + } else { + device_printf(dev, "failed to create iic child\n"); + } + + return (0); + +detach: + cp2112_detach(dev); + return (ENXIO); +} + +static int +cp2112_detach(device_t dev) +{ + int err; + + err = bus_generic_detach(dev); + if (err != 0) + return (err); + device_delete_children(dev); + return (0); +} + +static int cp2112_gpio_read_pin(device_t dev, uint32_t pin_num, bool *on) { - struct { - uint8_t id; - uint8_t state; - } __packed data; + struct gpio_get_req data; struct cp2112gpio_softc *sc; int err; sc = device_get_softc(dev); CP2112GPIO_LOCKED(sc); - data.id = CP2112_REQ_GPIO_GET; err = cp2112_get_report(device_get_parent(dev), CP2112_REQ_GPIO_GET, &data, sizeof(data)); if (err != 0) @@ -174,11 +392,7 @@ cp2112_gpio_read_pin(device_t dev, uint32_t pin_num, b static int cp2112_gpio_write_pin(device_t dev, uint32_t pin_num, bool on) { - struct { - uint8_t id; - uint8_t state; - uint8_t mask; - } __packed data; + struct gpio_set_req data; struct cp2112gpio_softc *sc; int err; bool actual; @@ -186,10 +400,8 @@ cp2112_gpio_write_pin(device_t dev, uint32_t pin_num, sc = device_get_softc(dev); CP2112GPIO_LOCKED(sc); - data.id = CP2112_REQ_GPIO_SET; data.state = (uint8_t)on << pin_num; data.mask = (uint8_t)1 << pin_num; - err = cp2112_set_report(device_get_parent(dev), CP2112_REQ_GPIO_SET, &data, sizeof(data)); if (err != 0) @@ -204,15 +416,9 @@ cp2112_gpio_write_pin(device_t dev, uint32_t pin_num, static int cp2112_gpio_configure_write_pin(device_t dev, uint32_t pin_num, - bool output, bool pushpull) + bool output, enum cp2112_out_mode *mode) { - struct { - uint8_t id; - uint8_t output; - uint8_t pushpull; - uint8_t special; - uint8_t divider; - } __packed data; + struct gpio_config_req data; struct cp2112gpio_softc *sc; int err; uint8_t mask; @@ -220,21 +426,26 @@ cp2112_gpio_configure_write_pin(device_t dev, uint32_t sc = device_get_softc(dev); CP2112GPIO_LOCKED(sc); - mask = (uint8_t)1 << pin_num; - data.id = CP2112_REQ_GPIO_CFG; err = cp2112_get_report(device_get_parent(dev), CP2112_REQ_GPIO_CFG, &data, sizeof(data)); if (err != 0) return (err); + + mask = (uint8_t)1 << pin_num; if (output) { data.output |= mask; - if (pushpull) + switch (*mode) { + case OUT_PP: data.pushpull |= mask; - else + break; + case OUT_OD: data.pushpull &= ~mask; + break; + default: + break; + } } else { data.output &= ~mask; - data.pushpull &= ~mask; } err = cp2112_set_report(device_get_parent(dev), @@ -247,10 +458,25 @@ cp2112_gpio_configure_write_pin(device_t dev, uint32_t CP2112_REQ_GPIO_CFG, &data, sizeof(data)); if (err != 0) return (err); + if (((data.output & mask) != 0) != output) return (EIO); - if (((data.pushpull & mask) != 0) != pushpull) - return (EIO); + if (output) { + switch (*mode) { + case OUT_PP: + if ((data.pushpull & mask) == 0) + return (EIO); + break; + case OUT_OD: + if ((data.pushpull & mask) != 0) + return (EIO); + break; + default: + *mode = (data.pushpull & mask) != 0 ? + OUT_PP : OUT_OD; + break; + } + } return (0); } @@ -381,6 +607,7 @@ cp2112_gpio_pin_setflags(device_t dev, uint32_t pin_nu { struct cp2112gpio_softc *sc; struct gpio_pin *pin; + enum cp2112_out_mode out_mode; int err; if (pin_num >= CP2112_GPIO_COUNT) @@ -405,118 +632,45 @@ cp2112_gpio_pin_setflags(device_t dev, uint32_t pin_nu return (EINVAL); } - CP2112GPIO_LOCK(sc); - pin = &sc->pins[pin_num]; - /* - * If neither push-pull or opendrain is explcitely requested, then + * If neither push-pull or open-drain is explicitly requested, then * preserve the current state. */ - if ((flags & GPIO_PIN_OUTPUT) != 0 && - (flags & (GPIO_PIN_OPENDRAIN | GPIO_PIN_PUSHPULL)) == 0) - flags |= pin->gp_flags & (GPIO_PIN_OPENDRAIN|GPIO_PIN_PUSHPULL); + out_mode = OUT_KEEP; + if ((flags & GPIO_PIN_OUTPUT) != 0) { + if ((flags & GPIO_PIN_OPENDRAIN) != 0) + out_mode = OUT_OD; + if ((flags & GPIO_PIN_PUSHPULL) != 0) + out_mode = OUT_PP; + } + + CP2112GPIO_LOCK(sc); + pin = &sc->pins[pin_num]; err = cp2112_gpio_configure_write_pin(dev, pin_num, - (flags & GPIO_PIN_OUTPUT) != 0, - (flags & GPIO_PIN_PUSHPULL) != 0); - if (err == 0) + (flags & GPIO_PIN_OUTPUT) != 0, &out_mode); + if (err == 0) { + /* + * If neither open-drain or push-pull was requested, then see + * what hardware actually had. Otherwise, it has been + * reconfigured as requested. + */ + if ((flags & GPIO_PIN_OUTPUT) != 0 && + (flags & (GPIO_PIN_OPENDRAIN | GPIO_PIN_PUSHPULL)) == 0) { + KASSERT(out_mode != OUT_KEEP, + ("impossible current output mode")); + if (out_mode == OUT_OD) + flags |= GPIO_PIN_OPENDRAIN; + else + flags |= GPIO_PIN_PUSHPULL; + } pin->gp_flags = flags; + } CP2112GPIO_UNLOCK(sc); return (err); } -static const STRUCT_USB_HOST_ID cp2112_devs[] = { - { USB_VP(USB_VENDOR_SILABS, USB_PRODUCT_SILABS_CP2112) }, - { USB_VP(0x1009, USB_PRODUCT_SILABS_CP2112) }, /* XXX */ -}; - static int -cp2112_probe(device_t dev) -{ - struct usb_attach_arg *uaa; - - uaa = device_get_ivars(dev); - if (uaa->usb_mode != USB_MODE_HOST) - return (ENXIO); - if (uaa->info.bInterfaceClass != UICLASS_HID) - return (ENXIO); - - if (usbd_lookup_id_by_uaa(cp2112_devs, sizeof(cp2112_devs), uaa) == 0) - return (BUS_PROBE_DEFAULT); - return (ENXIO); -} - -static int -cp2112_attach(device_t dev) -{ - struct { - uint8_t id; - uint8_t part_num; - uint8_t version; - } __packed vdata; - struct usb_attach_arg *uaa; - struct cp2112_softc *sc; - int err; - - uaa = device_get_ivars(dev); - sc = device_get_softc(dev); - - device_set_usb_desc(dev); - - sc->sc_udev = uaa->device; - sc->sc_iface_index = uaa->info.bIfaceIndex; - - vdata.id = CP2112_REQ_VERSION; - err = cp2112_get_report(dev, CP2112_REQ_VERSION, &vdata, sizeof(vdata)); - if (err != 0) - goto detach; - device_printf(dev, "part number 0x%02x, version 0x%02x\n", - vdata.part_num, vdata.version); - if (vdata.part_num != CP2112_PART_NUM) { - device_printf(dev, "unsupported part number\n"); - goto detach; - } - sc->sc_version = vdata.version; - sc->sc_gpio_dev = device_add_child(dev, "gpio", -1); - if (sc->sc_gpio_dev != NULL) { - err = device_probe_and_attach(sc->sc_gpio_dev); - if (err != 0) { - device_printf(dev, "failed to attach gpio child\n"); - } - } else { - device_printf(dev, "failed to create gpio child\n"); - } - - sc->sc_iic_dev = device_add_child(dev, "iichb", -1); - if (sc->sc_iic_dev != NULL) { - err = device_probe_and_attach(sc->sc_iic_dev); - if (err != 0) { - device_printf(dev, "failed to attach iic child\n"); - } - } else { - device_printf(dev, "failed to create iic child\n"); - } - - return (0); - -detach: - cp2112_detach(dev); - return (ENXIO); -} - -static int -cp2112_detach(device_t dev) -{ - int err; - - err = bus_generic_detach(dev); - if (err != 0) - return (err); - device_delete_children(dev); - return (0); -} - -static int cp2112gpio_probe(device_t dev) { device_set_desc(dev, "CP2112 GPIO interface"); @@ -526,13 +680,7 @@ cp2112gpio_probe(device_t dev) static int cp2112gpio_attach(device_t dev) { - struct { - uint8_t id; - uint8_t output; - uint8_t pushpull; - uint8_t special; - uint8_t divider; - } __packed data; + struct gpio_config_req data; struct cp2112gpio_softc *sc; device_t cp2112; int err; @@ -546,7 +694,6 @@ cp2112gpio_attach(device_t dev) sc->gpio_caps = GPIO_PIN_INPUT | GPIO_PIN_OUTPUT | GPIO_PIN_OPENDRAIN | GPIO_PIN_PUSHPULL; - data.id = CP2112_REQ_GPIO_CFG; err = cp2112_get_report(cp2112, CP2112_REQ_GPIO_CFG, &data, sizeof(data)); if (err != 0) @@ -562,7 +709,11 @@ cp2112gpio_attach(device_t dev) snprintf(pin->gp_name, GPIOMAXNAME, "GPIO%u", i); pin->gp_name[GPIOMAXNAME - 1] = '\0'; - if ((data.output & mask) != 0) { + if ((i == 0 && (data.special & CP2112_GPIO_SPEC_TX0) != 0) || + (i == 1 && (data.special & CP2112_GPIO_SPEC_RX1) != 0) || + (i == 7 && (data.special & CP2112_GPIO_SPEC_CLK7) != 0)) { + /* Special mode means that a pin is not for GPIO. */ + } else if ((data.output & mask) != 0) { pin->gp_flags |= GPIO_PIN_OUTPUT; if ((data.pushpull & mask) != 0) pin->gp_flags |= GPIO_PIN_PUSHPULL; @@ -597,94 +748,6 @@ cp2112gpio_detach(device_t dev) return (0); } -static device_method_t cp2112hid_methods[] = { - DEVMETHOD(device_probe, cp2112_probe), - DEVMETHOD(device_attach, cp2112_attach), - DEVMETHOD(device_detach, cp2112_detach), - - DEVMETHOD_END -}; - -static device_method_t cp2112gpio_methods[] = { - /* Device */ - DEVMETHOD(device_probe, cp2112gpio_probe), - DEVMETHOD(device_attach, cp2112gpio_attach), - DEVMETHOD(device_detach, cp2112gpio_detach), - - /* GPIO */ - DEVMETHOD(gpio_get_bus, cp2112_gpio_get_bus), - DEVMETHOD(gpio_pin_max, cp2112_gpio_pin_max), - DEVMETHOD(gpio_pin_get, cp2112_gpio_pin_get), - DEVMETHOD(gpio_pin_set, cp2112_gpio_pin_set), - DEVMETHOD(gpio_pin_toggle, cp2112_gpio_pin_toggle), - DEVMETHOD(gpio_pin_getname, cp2112_gpio_pin_getname), - DEVMETHOD(gpio_pin_getcaps, cp2112_gpio_pin_getcaps), - DEVMETHOD(gpio_pin_getflags, cp2112_gpio_pin_getflags), - DEVMETHOD(gpio_pin_setflags, cp2112_gpio_pin_setflags), - - DEVMETHOD_END -}; - -static driver_t cp2112hid_driver = { - .name = "cp2112hid", - .methods = cp2112hid_methods, - .size = sizeof(struct cp2112_softc), -}; - -static devclass_t cp2112hid_devclass; -DRIVER_MODULE(cp2112hid, uhub, cp2112hid_driver, cp2112hid_devclass, - NULL, NULL); -MODULE_DEPEND(cp2112hid, usb, 1, 1, 1); -MODULE_VERSION(cp2112hid, 1); -USB_PNP_HOST_INFO(cp2112_devs); - -static driver_t cp2112gpio_driver = { - .name = "gpio", - .methods = cp2112gpio_methods, - .size = sizeof(struct cp2112gpio_softc), -}; - -static devclass_t cp2112gpio_devclass; -DRIVER_MODULE(cp2112gpio, cp2112hid, cp2112gpio_driver, cp2112gpio_devclass, - NULL, NULL); -MODULE_DEPEND(cp2112gpio, cp2112hid, 1, 1, 1); -MODULE_DEPEND(cp2112gpio, gpiobus, 1, 1, 1); -MODULE_VERSION(cp2112gpio, 1); - - - -/* CP2112 I2C driver code. */ - - -enum { - CP2112_INTR_OUT = 0, - CP2112_INTR_IN, - CP2112_N_TRANSFER, -}; - -struct cp2112iic_softc { - device_t dev; - device_t iicbus_dev; - struct usb_xfer *xfers[CP2112_N_TRANSFER]; - u_char own_addr; - struct { - struct mtx lock; - struct cv cv; - struct { - uint8_t *data; - int len; - int done; - int error; - } in; - struct { - const uint8_t *data; - int len; - int done; - int error; - } out; - } io; -}; - static void cp2112iic_intr_write_callback(struct usb_xfer *xfer, usb_error_t error) { @@ -890,17 +953,8 @@ cp2112iic_req_resp(struct cp2112iic_softc *sc, const v static int cp2112iic_check_req_status(struct cp2112iic_softc *sc) { - struct { - uint8_t id; - uint8_t request; - } __packed xfer_status_req; - struct { - uint8_t id; - uint8_t status0; - uint8_t status1; - uint16_t status2; - uint16_t status3; - } __packed xfer_status_resp; + struct i2c_xfer_status_req xfer_status_req; + struct i2c_xfer_status_resp xfer_status_resp; int err; mtx_assert(&sc->io.lock, MA_OWNED); @@ -971,16 +1025,8 @@ static int cp2112iic_read_data(struct cp2112iic_softc *sc, void *data, uint16_t in_len, uint16_t *out_len) { - struct { - uint8_t id; - uint16_t length; - } __packed data_read_force_send; - struct { - uint8_t id; - uint8_t status; - uint8_t length; - uint8_t data[61]; - } __packed data_read_resp; + struct i2c_data_read_force_send_req data_read_force_send; + struct i2c_data_read_resp data_read_resp; int err; mtx_assert(&sc->io.lock, MA_OWNED); @@ -993,7 +1039,7 @@ cp2112iic_read_data(struct cp2112iic_softc *sc, void * if (in_len > sizeof(data_read_resp.data)) in_len = sizeof(data_read_resp.data); data_read_force_send.id = CP2112_REQ_SMB_READ_FORCE_SEND; - data_read_force_send.length = htobe16(in_len); + data_read_force_send.len = htobe16(in_len); err = cp2112iic_req_resp(sc, &data_read_force_send, sizeof(data_read_force_send), &data_read_resp, sizeof(data_read_resp)); @@ -1009,7 +1055,7 @@ cp2112iic_read_data(struct cp2112iic_softc *sc, void * } DTRACE_PROBE2(read__response, uint8_t, data_read_resp.status, - uint8_t, data_read_resp.length); + uint8_t, data_read_resp.len); /* * We expect either the request completed status or, more typical for @@ -1021,13 +1067,13 @@ cp2112iic_read_data(struct cp2112iic_softc *sc, void * err = IIC_EBUSERR; goto out; } - if (data_read_resp.length > in_len) { + if (data_read_resp.len > in_len) { device_printf(sc->dev, "device returns more data than asked\n"); err = IIC_EOVERFLOW; goto out; } - *out_len = data_read_resp.length; + *out_len = data_read_resp.len; if (*out_len > 0) memcpy(data, data_read_resp.data, *out_len); out: @@ -1070,11 +1116,13 @@ cp2112iic_transfer(device_t dev, struct iic_msg *msgs, reason = "message with no data"; break; } - if ((msgs[i].flags & IIC_M_RD) != 0 && msgs[i].len > 512) { + if ((msgs[i].flags & IIC_M_RD) != 0 && + msgs[i].len > CP2112_IIC_MAX_READ_LEN) { reason = "too long read"; break; } - if ((msgs[i].flags & IIC_M_RD) == 0 && msgs[i].len > 61) { + if ((msgs[i].flags & IIC_M_RD) == 0 && + msgs[i].len > SIZEOF_FIELD(i2c_write_req, data)) { reason = "too long write"; break; } @@ -1092,7 +1140,8 @@ cp2112iic_transfer(device_t dev, struct iic_msg *msgs, reason = "write without stop"; break; } - if ((msgs[i].flags & IIC_M_NOSTOP) != 0 && msgs[i].len > 16) { + if ((msgs[i].flags & IIC_M_NOSTOP) != 0 && + msgs[i].len > SIZEOF_FIELD(i2c_write_read_req, wdata)) { reason = "too long write without stop"; break; } @@ -1120,22 +1169,16 @@ cp2112iic_transfer(device_t dev, struct iic_msg *msgs, for (i = 0; i < nmsgs; i++) { if (i + 1 < nmsgs && (msgs[i].flags & IIC_M_NOSTOP) != 0) { - KASSERT((msgs[i].flags & IIC_M_RD) == 0, - ("read without stop")); - KASSERT((msgs[i + 1].flags & IIC_M_RD) != 0, - ("write after write without stop")); /* * Combine into a single * CP2112 operation. */ - struct { - uint8_t id; - uint8_t slave; - uint16_t rlen; - uint8_t wlen; - uint8_t wdata[16]; - } __packed req; + struct i2c_write_read_req req; + KASSERT((msgs[i].flags & IIC_M_RD) == 0, + ("read without stop")); + KASSERT((msgs[i + 1].flags & IIC_M_RD) != 0, + ("write after write without stop")); req.id = CP2112_REQ_SMB_WRITE_READ; req.slave = msgs[i].slave & ~LSB; to_read = msgs[i + 1].len; @@ -1150,11 +1193,7 @@ cp2112iic_transfer(device_t dev, struct iic_msg *msgs, */ i++; } else if ((msgs[i].flags & IIC_M_RD) != 0) { - struct { - uint8_t id; - uint8_t slave; - uint16_t len; - } __packed req; + struct i2c_read_req req; req.id = CP2112_REQ_SMB_READ; req.slave = msgs[i].slave & ~LSB; @@ -1162,12 +1201,7 @@ cp2112iic_transfer(device_t dev, struct iic_msg *msgs, req.len = htobe16(to_read); err = cp2112iic_send_req(sc, &req, sizeof(req)); } else { - struct { - uint8_t id; - uint8_t slave; - uint8_t len; - uint8_t data[61]; - } __packed req; + struct i2c_write_req req; req.id = CP2112_REQ_SMB_WRITE; req.slave = msgs[i].slave & ~LSB; @@ -1207,16 +1241,7 @@ cp2112iic_transfer(device_t dev, struct iic_msg *msgs, static int cp2112iic_reset(device_t dev, u_char speed, u_char addr, u_char *oldaddr) { - struct { - uint8_t id; - uint32_t speed; /* Hz */ - uint8_t slave_addr; /* ACK only */ - uint8_t auto_send_read; /* boolean */ - uint16_t write_timeout; /* 0-1000 ms, 0 ~ no timeout */ - uint16_t read_timeout; /* 0-1000 ms, 0 ~ no timeout */ - uint8_t scl_low_timeout;/* boolean */ - uint16_t retry_count; /* 1-1000, 0 ~ forever */ - } __packed smb_cfg; + struct i2c_cfg_req i2c_cfg; struct cp2112iic_softc *sc; device_t cp2112; u_int busfreq; @@ -1229,16 +1254,15 @@ cp2112iic_reset(device_t dev, u_char speed, u_char add else busfreq = IICBUS_GET_FREQUENCY(sc->iicbus_dev, speed); - smb_cfg.id = CP2112_REQ_SMB_CFG; err = cp2112_get_report(cp2112, CP2112_REQ_SMB_CFG, - &smb_cfg, sizeof(smb_cfg)); + &i2c_cfg, sizeof(i2c_cfg)); if (err != 0) { device_printf(dev, "failed to get CP2112_REQ_SMB_CFG report\n"); return (err); } if (oldaddr != NULL) - *oldaddr = smb_cfg.slave_addr; + *oldaddr = i2c_cfg.slave_addr; /* * For simplicity we do not enable Auto Send Read * because of erratum CP2112_E101 (fixed in version 3). @@ -1251,28 +1275,28 @@ cp2112iic_reset(device_t dev, u_char speed, u_char add * TODO: should the device reset request (0x01) be sent? * If the device disconnects as a result, then no. */ - smb_cfg.speed = htobe32(busfreq); + i2c_cfg.speed = htobe32(busfreq); if (addr != 0) - smb_cfg.slave_addr = addr; - smb_cfg.auto_send_read = 0; - smb_cfg.retry_count = htobe16(1); - smb_cfg.scl_low_timeout = 0; + i2c_cfg.slave_addr = addr; + i2c_cfg.auto_send_read = 0; + i2c_cfg.retry_count = htobe16(1); + i2c_cfg.scl_low_timeout = 0; if (bootverbose) { - device_printf(dev, "speed %d Hz\n", be32toh(smb_cfg.speed)); - device_printf(dev, "slave addr 0x%02x\n", smb_cfg.slave_addr); + device_printf(dev, "speed %d Hz\n", be32toh(i2c_cfg.speed)); + device_printf(dev, "slave addr 0x%02x\n", i2c_cfg.slave_addr); device_printf(dev, "auto send read %s\n", - smb_cfg.auto_send_read ? "on" : "off"); + i2c_cfg.auto_send_read ? "on" : "off"); device_printf(dev, "write timeout %d ms (0 - disabled)\n", - be16toh(smb_cfg.write_timeout)); + be16toh(i2c_cfg.write_timeout)); device_printf(dev, "read timeout %d ms (0 - disabled)\n", - be16toh(smb_cfg.read_timeout)); + be16toh(i2c_cfg.read_timeout)); device_printf(dev, "scl low timeout %s\n", - smb_cfg.scl_low_timeout ? "on" : "off"); + i2c_cfg.scl_low_timeout ? "on" : "off"); device_printf(dev, "retry count %d (0 - no limit)\n", - be16toh(smb_cfg.retry_count)); + be16toh(i2c_cfg.retry_count)); } err = cp2112_set_report(cp2112, CP2112_REQ_SMB_CFG, - &smb_cfg, sizeof(smb_cfg)); + &i2c_cfg, sizeof(i2c_cfg)); if (err != 0) { device_printf(dev, "failed to set CP2112_REQ_SMB_CFG report\n"); return (err); @@ -1352,6 +1376,60 @@ cp2112iic_detach(device_t dev) return (0); } + +static device_method_t cp2112hid_methods[] = { + DEVMETHOD(device_probe, cp2112_probe), + DEVMETHOD(device_attach, cp2112_attach), + DEVMETHOD(device_detach, cp2112_detach), + + DEVMETHOD_END +}; + +static driver_t cp2112hid_driver = { + .name = "cp2112hid", + .methods = cp2112hid_methods, + .size = sizeof(struct cp2112_softc), +}; + +static devclass_t cp2112hid_devclass; +DRIVER_MODULE(cp2112hid, uhub, cp2112hid_driver, cp2112hid_devclass, + NULL, NULL); +MODULE_DEPEND(cp2112hid, usb, 1, 1, 1); +MODULE_VERSION(cp2112hid, 1); +USB_PNP_HOST_INFO(cp2112_devs); + +static device_method_t cp2112gpio_methods[] = { + /* Device */ + DEVMETHOD(device_probe, cp2112gpio_probe), + DEVMETHOD(device_attach, cp2112gpio_attach), + DEVMETHOD(device_detach, cp2112gpio_detach), + + /* GPIO */ + DEVMETHOD(gpio_get_bus, cp2112_gpio_get_bus), + DEVMETHOD(gpio_pin_max, cp2112_gpio_pin_max), + DEVMETHOD(gpio_pin_get, cp2112_gpio_pin_get), + DEVMETHOD(gpio_pin_set, cp2112_gpio_pin_set), + DEVMETHOD(gpio_pin_toggle, cp2112_gpio_pin_toggle), + DEVMETHOD(gpio_pin_getname, cp2112_gpio_pin_getname), + DEVMETHOD(gpio_pin_getcaps, cp2112_gpio_pin_getcaps), + DEVMETHOD(gpio_pin_getflags, cp2112_gpio_pin_getflags), + DEVMETHOD(gpio_pin_setflags, cp2112_gpio_pin_setflags), + + DEVMETHOD_END +}; + +static driver_t cp2112gpio_driver = { + .name = "gpio", + .methods = cp2112gpio_methods, + .size = sizeof(struct cp2112gpio_softc), +}; + +static devclass_t cp2112gpio_devclass; +DRIVER_MODULE(cp2112gpio, cp2112hid, cp2112gpio_driver, cp2112gpio_devclass, + NULL, NULL); +MODULE_DEPEND(cp2112gpio, cp2112hid, 1, 1, 1); +MODULE_DEPEND(cp2112gpio, gpiobus, 1, 1, 1); +MODULE_VERSION(cp2112gpio, 1); static device_method_t cp2112iic_methods[] = { /* Device interface */ From owner-svn-src-all@freebsd.org Wed Aug 12 09:42:05 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CACE737ADCA; Wed, 12 Aug 2020 09:42:05 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BRPqd55GRz4g3H; Wed, 12 Aug 2020 09:42:05 +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 9202D9D3D; Wed, 12 Aug 2020 09:42:05 +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 07C9g5YN042794; Wed, 12 Aug 2020 09:42:05 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07C9g5kS042793; Wed, 12 Aug 2020 09:42:05 GMT (envelope-from avg@FreeBSD.org) Message-Id: <202008120942.07C9g5kS042793@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 12 Aug 2020 09:42:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364144 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 364144 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2020 09:42:05 -0000 Author: avg Date: Wed Aug 12 09:42:05 2020 New Revision: 364144 URL: https://svnweb.freebsd.org/changeset/base/364144 Log: add a manual page for cp2112 MFC after: 1 week Added: head/share/man/man4/cp2112.4 (contents, props changed) Added: head/share/man/man4/cp2112.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/cp2112.4 Wed Aug 12 09:42:05 2020 (r364144) @@ -0,0 +1,87 @@ +.\" +.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD +.\" +.\" Copyright (c) 2020 Andriy Gapon +.\" +.\" 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 August 12, 2020 +.Dt CP2112 4 +.Os +.Sh NAME +.Nm cp2112 +.Nd driver for a USB GPIO and I2C peripheral device +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device cp2112" +.Cd "device usb" +.Cd "device gpio" +.Cd "device iicbus" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +cp2112_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for Silicon Labs CP2112 device. +The device has 8 general purpose I/O pins and an I2C controller that supports +a subset of the I2C protocol. +.Pp +All pins support both input and output modes. +An output pin can be configured either for open-drain or push-pull operation. +Pins 0, 1 and 7 support special functions: I2C transmit indication, +I2C receive indication and clock output respectively. +At the moment the +.Nm +driver does not provide a way to enable and configure the special functions. +.Pp +The I2C controller supports read transactions with up to 512 bytes of data, +write transactions with up to 61 bytes of data and a write followed by +the repeated start followed by a read transactions where the write can be +up to 16 bytes and the read can be up to 512 bytes. +Zero length transfers are not supported. +The +.Nm +driver creates a +.Xr gpio 4 +and +.Xr iicbus 4 +child buses to expose the respective functions. +.Sh SEE ALSO +.Xr gpio 4 , +.Xr iicbus 4 , +.Xr usb 4 +.Sh HISTORY +The +.Nm +driver and this manual page was written by +.An Andriy Gapon Aq Mt avg@FreeBSD.org . From owner-svn-src-all@freebsd.org Wed Aug 12 09:49:26 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0493037ADED; Wed, 12 Aug 2020 09:49:26 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BRQ056Dqwz3RYp; Wed, 12 Aug 2020 09:49:25 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9C6C29E46; Wed, 12 Aug 2020 09:49:25 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07C9nPTr043314; Wed, 12 Aug 2020 09:49:25 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07C9nPot043313; Wed, 12 Aug 2020 09:49:25 GMT (envelope-from avg@FreeBSD.org) Message-Id: <202008120949.07C9nPot043313@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 12 Aug 2020 09:49:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364145 - head/sys/dev/gpio X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/dev/gpio X-SVN-Commit-Revision: 364145 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2020 09:49:26 -0000 Author: avg Date: Wed Aug 12 09:49:25 2020 New Revision: 364145 URL: https://svnweb.freebsd.org/changeset/base/364145 Log: gpiokeys: add evdev support Only linux,code is supported as it maps 1:1 to evdev key codes. No reverse mapping for freebsd,code yet. Reviewed by: wulf MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D25940 Modified: head/sys/dev/gpio/gpiokeys.c Modified: head/sys/dev/gpio/gpiokeys.c ============================================================================== --- head/sys/dev/gpio/gpiokeys.c Wed Aug 12 09:42:05 2020 (r364144) +++ head/sys/dev/gpio/gpiokeys.c Wed Aug 12 09:49:25 2020 (r364145) @@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$"); #include "opt_platform.h" #include "opt_kbd.h" +#include "opt_evdev.h" #include #include @@ -56,6 +57,11 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef EVDEV_SUPPORT +#include +#include +#endif + #define KBD_DRIVER_NAME "gpiokeys" #define GPIOKEYS_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) @@ -99,6 +105,9 @@ struct gpiokey struct resource *irq_res; void *intr_hl; struct mtx mtx; +#ifdef EVDEV_SUPPORT + uint32_t evcode; +#endif uint32_t keycode; int autorepeat; struct callout debounce_callout; @@ -115,6 +124,9 @@ struct gpiokeys_softc struct gpiokey *sc_keys; int sc_total_keys; +#ifdef EVDEV_SUPPORT + struct evdev_dev *sc_evdev; +#endif keyboard_t sc_kbd; keymap_t sc_keymap; accentmap_t sc_accmap; @@ -171,26 +183,34 @@ gpiokeys_put_key(struct gpiokeys_softc *sc, uint32_t k } static void -gpiokeys_key_event(struct gpiokeys_softc *sc, uint16_t keycode, int pressed) +gpiokeys_key_event(struct gpiokeys_softc *sc, struct gpiokey *key, int pressed) { - uint32_t key; + uint32_t code; - - key = keycode & SCAN_KEYCODE_MASK; - - if (!pressed) - key |= KEY_RELEASE; - GPIOKEYS_LOCK(sc); - if (keycode & SCAN_PREFIX_E0) - gpiokeys_put_key(sc, 0xe0); - else if (keycode & SCAN_PREFIX_E1) - gpiokeys_put_key(sc, 0xe1); +#ifdef EVDEV_SUPPORT + if (key->evcode != GPIOKEY_NONE && + (evdev_rcpt_mask & EVDEV_RCPT_HW_KBD) != 0) { + evdev_push_key(sc->sc_evdev, key->evcode, pressed); + evdev_sync(sc->sc_evdev); + } +#endif + if (key->keycode != GPIOKEY_NONE) { + code = key->keycode & SCAN_KEYCODE_MASK; + if (!pressed) + code |= KEY_RELEASE; - gpiokeys_put_key(sc, key); + if (key->keycode & SCAN_PREFIX_E0) + gpiokeys_put_key(sc, 0xe0); + else if (key->keycode & SCAN_PREFIX_E1) + gpiokeys_put_key(sc, 0xe1); + + gpiokeys_put_key(sc, code); + } GPIOKEYS_UNLOCK(sc); - gpiokeys_event_keyinput(sc); + if (key->keycode != GPIOKEY_NONE) + gpiokeys_event_keyinput(sc); } static void @@ -200,11 +220,8 @@ gpiokey_autorepeat(void *arg) key = arg; - if (key->keycode == GPIOKEY_NONE) - return; + gpiokeys_key_event(key->parent_sc, key, 1); - gpiokeys_key_event(key->parent_sc, key->keycode, 1); - callout_reset(&key->repeat_callout, key->repeat, gpiokey_autorepeat, key); } @@ -217,12 +234,9 @@ gpiokey_debounced_intr(void *arg) key = arg; - if (key->keycode == GPIOKEY_NONE) - return; - gpio_pin_is_active(key->pin, &active); if (active) { - gpiokeys_key_event(key->parent_sc, key->keycode, 1); + gpiokeys_key_event(key->parent_sc, key, 1); if (key->autorepeat) { callout_reset(&key->repeat_callout, key->repeat_delay, gpiokey_autorepeat, key); @@ -232,7 +246,7 @@ gpiokey_debounced_intr(void *arg) if (key->autorepeat && callout_pending(&key->repeat_callout)) callout_stop(&key->repeat_callout); - gpiokeys_key_event(key->parent_sc, key->keycode, 0); + gpiokeys_key_event(key->parent_sc, key, 0); } } @@ -301,6 +315,10 @@ gpiokeys_attach_key(struct gpiokeys_softc *sc, phandle if (key->keycode == GPIOKEY_NONE) device_printf(sc->sc_dev, "<%s> failed to map linux,code value 0x%x\n", key_name, code); +#ifdef EVDEV_SUPPORT + key->evcode = code; + evdev_support_key(sc->sc_evdev, code); +#endif } else device_printf(sc->sc_dev, "<%s> no linux,code or freebsd,code property\n", @@ -365,7 +383,6 @@ gpiokeys_detach_key(struct gpiokeys_softc *sc, struct if (key->pin) gpio_pin_release(key->pin); GPIOKEY_UNLOCK(key); - GPIOKEY_LOCK_DESTROY(key); } @@ -383,11 +400,14 @@ gpiokeys_probe(device_t dev) static int gpiokeys_attach(device_t dev) { - int unit; struct gpiokeys_softc *sc; keyboard_t *kbd; +#ifdef EVDEV_SUPPORT + char *name; +#endif phandle_t keys, child; int total_keys; + int unit; if ((keys = ofw_bus_get_node(dev)) == -1) return (ENXIO); @@ -435,6 +455,19 @@ gpiokeys_attach(device_t dev) kbdd_diag(kbd, 1); } +#ifdef EVDEV_SUPPORT + sc->sc_evdev = evdev_alloc(); + evdev_set_name(sc->sc_evdev, device_get_desc(dev)); + + OF_getprop_alloc(keys, "name", (void **)&name); + evdev_set_phys(sc->sc_evdev, name != NULL ? name : "unknown"); + OF_prop_free(name); + + evdev_set_id(sc->sc_evdev, BUS_VIRTUAL, 0, 0, 0); + evdev_support_event(sc->sc_evdev, EV_SYN); + evdev_support_event(sc->sc_evdev, EV_KEY); +#endif + total_keys = 0; /* Traverse the 'gpio-keys' node and count keys */ @@ -458,6 +491,13 @@ gpiokeys_attach(device_t dev) } } +#ifdef EVDEV_SUPPORT + if (evdev_register_mtx(sc->sc_evdev, &sc->sc_mtx) != 0) { + device_printf(dev, "failed to register evdev device\n"); + goto detach; + } +#endif + return (0); detach: @@ -484,6 +524,10 @@ gpiokeys_detach(device_t dev) kbd_detach(kbd); #endif kbd_unregister(kbd); + +#ifdef EVDEV_SUPPORT + evdev_free(sc->sc_evdev); +#endif GPIOKEYS_LOCK_DESTROY(sc); if (sc->sc_keys) From owner-svn-src-all@freebsd.org Wed Aug 12 09:52:12 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B04D537AC6A; Wed, 12 Aug 2020 09:52:12 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BRQ3J4Dq2z3RmM; Wed, 12 Aug 2020 09:52:12 +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 74C74A3AA; Wed, 12 Aug 2020 09:52:12 +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 07C9qCaF048092; Wed, 12 Aug 2020 09:52:12 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07C9qCnZ048091; Wed, 12 Aug 2020 09:52:12 GMT (envelope-from avg@FreeBSD.org) Message-Id: <202008120952.07C9qCnZ048091@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 12 Aug 2020 09:52:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364146 - head/sys/arm/allwinner X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/arm/allwinner X-SVN-Commit-Revision: 364146 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2020 09:52:12 -0000 Author: avg Date: Wed Aug 12 09:52:12 2020 New Revision: 364146 URL: https://svnweb.freebsd.org/changeset/base/364146 Log: aw_cir: add support for allwinner,sun6i-a31-ir (found, e.g., on h3) MFC after: 1 week Modified: head/sys/arm/allwinner/aw_cir.c Modified: head/sys/arm/allwinner/aw_cir.c ============================================================================== --- head/sys/arm/allwinner/aw_cir.c Wed Aug 12 09:49:25 2020 (r364145) +++ head/sys/arm/allwinner/aw_cir.c Wed Aug 12 09:52:12 2020 (r364146) @@ -134,8 +134,11 @@ __FBSDID("$FreeBSD$"); #define INV_CODE_MASK 0xff00ff00 #define VALID_CODE_MASK 0x00ff0000 -#define A10_IR 1 -#define A13_IR 2 +enum { + A10_IR = 1, + A13_IR, + A31_IR, +}; #define AW_IR_RAW_BUF_SIZE 128 @@ -158,6 +161,7 @@ static struct resource_spec aw_ir_spec[] = { static struct ofw_compat_data compat_data[] = { { "allwinner,sun4i-a10-ir", A10_IR }, { "allwinner,sun5i-a13-ir", A13_IR }, + { "allwinner,sun6i-a31-ir", A31_IR }, { NULL, 0 } }; @@ -414,6 +418,7 @@ aw_ir_attach(device_t dev) sc->fifo_size = 16; break; case A13_IR: + case A31_IR: sc->fifo_size = 64; break; } From owner-svn-src-all@freebsd.org Wed Aug 12 09:52:39 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E1EAF37B444; Wed, 12 Aug 2020 09:52:39 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BRQ3q5jjrz3Rxq; Wed, 12 Aug 2020 09:52: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 A76EF9E6C; Wed, 12 Aug 2020 09:52: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 07C9qdqO049137; Wed, 12 Aug 2020 09:52:39 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07C9qdgb049136; Wed, 12 Aug 2020 09:52:39 GMT (envelope-from avg@FreeBSD.org) Message-Id: <202008120952.07C9qdgb049136@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 12 Aug 2020 09:52:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364147 - head/sys/arm/allwinner X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/arm/allwinner X-SVN-Commit-Revision: 364147 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2020 09:52:39 -0000 Author: avg Date: Wed Aug 12 09:52:39 2020 New Revision: 364147 URL: https://svnweb.freebsd.org/changeset/base/364147 Log: aw_cir: minor cleanups MFC after: 1 week Modified: head/sys/arm/allwinner/aw_cir.c Modified: head/sys/arm/allwinner/aw_cir.c ============================================================================== --- head/sys/arm/allwinner/aw_cir.c Wed Aug 12 09:52:12 2020 (r364146) +++ head/sys/arm/allwinner/aw_cir.c Wed Aug 12 09:52:39 2020 (r364147) @@ -368,7 +368,7 @@ aw_ir_intr(void *arg) device_printf(sc->dev, "IR code status: %d\n", stat); } - sc->dcnt = 0; + aw_ir_buf_reset(sc); } if (val & AW_IR_RXINT_ROI_EN) { /* RX FIFO overflow */ @@ -469,7 +469,8 @@ aw_ir_attach(device_t dev) &sc->intrhand)) { bus_release_resources(dev, aw_ir_spec, sc->res); device_printf(dev, "cannot setup interrupt handler\n"); - return (ENXIO); + err = ENXIO; + goto error; } /* Enable CIR Mode */ From owner-svn-src-all@freebsd.org Wed Aug 12 09:56:21 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D282F37B3CB; Wed, 12 Aug 2020 09:56:21 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BRQ855F6sz3S9d; Wed, 12 Aug 2020 09:56:21 +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 9875BA482; Wed, 12 Aug 2020 09:56:21 +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 07C9uLVg049381; Wed, 12 Aug 2020 09:56:21 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07C9uLDm049380; Wed, 12 Aug 2020 09:56:21 GMT (envelope-from avg@FreeBSD.org) Message-Id: <202008120956.07C9uLDm049380@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 12 Aug 2020 09:56:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364148 - head/sys/arm/allwinner X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/arm/allwinner X-SVN-Commit-Revision: 364148 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2020 09:56:21 -0000 Author: avg Date: Wed Aug 12 09:56:21 2020 New Revision: 364148 URL: https://svnweb.freebsd.org/changeset/base/364148 Log: aw_cir: lower activation threshold to support NECx protocol In NECx the leading mark has length of 8T as opposed to 16T in NEC, where T is 562.5 us. So, 4.5 ms. Our threshold was set to 128 * 42.7 us (derived from the sampling frequency of 3/128 MHz). So, ~5.5 ms. The new threshold is set to AW_IR_L1_MIN. I think that's a good enough lower bound for detecting the leading pulse. Also, calculations of active_delay (which is activation delay) are fixed. Previously they would be wrong if AW_IR_ACTIVE_T was anything but zero, because the value was already bit-shifted. Finally, I am not sure why the activation delay was divided by two when calculating the initial pulse length. I have not found anything that would explain or justify it. So, I removed that division. MFC after: 3 weeks Modified: head/sys/arm/allwinner/aw_cir.c Modified: head/sys/arm/allwinner/aw_cir.c ============================================================================== --- head/sys/arm/allwinner/aw_cir.c Wed Aug 12 09:52:39 2020 (r364147) +++ head/sys/arm/allwinner/aw_cir.c Wed Aug 12 09:56:21 2020 (r364148) @@ -126,8 +126,10 @@ __FBSDID("$FreeBSD$"); #define AW_IR_DMAX 53 /* Active Thresholds */ -#define AW_IR_ACTIVE_T ((0 & 0xff) << 16) -#define AW_IR_ACTIVE_T_C ((1 & 0xff) << 23) +#define AW_IR_ACTIVE_T_VAL AW_IR_L1_MIN +#define AW_IR_ACTIVE_T (((AW_IR_ACTIVE_T_VAL - 1) & 0xff) << 16) +#define AW_IR_ACTIVE_T_C_VAL 0 +#define AW_IR_ACTIVE_T_C ((AW_IR_ACTIVE_T_C_VAL & 0xff) << 23) /* Code masks */ #define CODE_MASK 0x00ff00ff @@ -209,9 +211,9 @@ aw_ir_decode_packets(struct aw_ir_softc *sc) device_printf(sc->dev, "sc->dcnt = %d\n", sc->dcnt); /* Find Lead 1 (bit separator) */ - active_delay = (AW_IR_ACTIVE_T + 1) * (AW_IR_ACTIVE_T_C != 0 ? 128 : 1); - len = 0; - len += (active_delay >> 1); + active_delay = AW_IR_ACTIVE_T_VAL * + (AW_IR_ACTIVE_T_C_VAL != 0 ? 128 : 1); + len = active_delay; if (bootverbose) device_printf(sc->dev, "Initial len: %ld\n", len); for (i = 0; i < sc->dcnt; i++) { From owner-svn-src-all@freebsd.org Wed Aug 12 09:57:29 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4AF7737B625; Wed, 12 Aug 2020 09:57:29 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BRQ9P1F5Rz3SBQ; Wed, 12 Aug 2020 09:57:29 +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 E9E13A503; Wed, 12 Aug 2020 09:57:28 +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 07C9vS68049484; Wed, 12 Aug 2020 09:57:28 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07C9vSaF049483; Wed, 12 Aug 2020 09:57:28 GMT (envelope-from avg@FreeBSD.org) Message-Id: <202008120957.07C9vSaF049483@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 12 Aug 2020 09:57:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364149 - head/sys/arm/allwinner X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/arm/allwinner X-SVN-Commit-Revision: 364149 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2020 09:57:29 -0000 Author: avg Date: Wed Aug 12 09:57:28 2020 New Revision: 364149 URL: https://svnweb.freebsd.org/changeset/base/364149 Log: aw_cir: in the pulse encoding the actual length is one greater than value While here change type of some variables from long to int, it's sufficient. Also, add length reporting to a couple of debug printfs. MFC after: 3 weeks Modified: head/sys/arm/allwinner/aw_cir.c Modified: head/sys/arm/allwinner/aw_cir.c ============================================================================== --- head/sys/arm/allwinner/aw_cir.c Wed Aug 12 09:56:21 2020 (r364148) +++ head/sys/arm/allwinner/aw_cir.c Wed Aug 12 09:57:28 2020 (r364149) @@ -202,9 +202,9 @@ aw_ir_read_data(struct aw_ir_softc *sc) static unsigned long aw_ir_decode_packets(struct aw_ir_softc *sc) { - unsigned long len, code; - unsigned char val, last; + unsigned int len, code; unsigned int active_delay; + unsigned char val, last; int i, bitcount; if (bootverbose) @@ -215,11 +215,11 @@ aw_ir_decode_packets(struct aw_ir_softc *sc) (AW_IR_ACTIVE_T_C_VAL != 0 ? 128 : 1); len = active_delay; if (bootverbose) - device_printf(sc->dev, "Initial len: %ld\n", len); + device_printf(sc->dev, "Initial len: %d\n", len); for (i = 0; i < sc->dcnt; i++) { val = sc->buf[i]; if (val & VAL_MASK) - len += val & PERIOD_MASK; + len += (val & PERIOD_MASK) + 1; else { if (len > AW_IR_L1_MIN) break; @@ -227,7 +227,7 @@ aw_ir_decode_packets(struct aw_ir_softc *sc) } } if (bootverbose) - device_printf(sc->dev, "len = %ld\n", len); + device_printf(sc->dev, "len = %d\n", len); if ((val & VAL_MASK) || (len <= AW_IR_L1_MIN)) { if (bootverbose) device_printf(sc->dev, "Bit separator error\n"); @@ -243,7 +243,7 @@ aw_ir_decode_packets(struct aw_ir_softc *sc) break; len = 0; } else - len += val & PERIOD_MASK; + len += (val & PERIOD_MASK) + 1; } if ((!(val & VAL_MASK)) || (len <= AW_IR_L0_MIN)) { if (bootverbose) @@ -260,23 +260,25 @@ aw_ir_decode_packets(struct aw_ir_softc *sc) val = sc->buf[i]; if (last) { if (val & VAL_MASK) - len += val & PERIOD_MASK; + len += (val & PERIOD_MASK) + 1; else { if (len > AW_IR_PMAX) { if (bootverbose) device_printf(sc->dev, - "Pulse error\n"); + "Pulse error, len=%d\n", + len); goto error_code; } last = 0; - len = val & PERIOD_MASK; + len = (val & PERIOD_MASK) + 1; } } else { if (val & VAL_MASK) { if (len > AW_IR_DMAX) { if (bootverbose) device_printf(sc->dev, - "Distant error\n"); + "Distance error, len=%d\n", + len); goto error_code; } else { if (len > AW_IR_DMID) { @@ -288,9 +290,9 @@ aw_ir_decode_packets(struct aw_ir_softc *sc) break; /* Finish decoding */ } last = 1; - len = val & PERIOD_MASK; + len = (val & PERIOD_MASK) + 1; } else - len += val & PERIOD_MASK; + len += (val & PERIOD_MASK) + 1; } } return (code); From owner-svn-src-all@freebsd.org Wed Aug 12 10:03:11 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9A24637B8DA; Wed, 12 Aug 2020 10:03:11 +0000 (UTC) (envelope-from kaktus@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BRQHz2sQYz3Slp; Wed, 12 Aug 2020 10:03:11 +0000 (UTC) (envelope-from kaktus@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 46D9CA424; Wed, 12 Aug 2020 10:03:11 +0000 (UTC) (envelope-from kaktus@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07CA3Bos055482; Wed, 12 Aug 2020 10:03:11 GMT (envelope-from kaktus@FreeBSD.org) Received: (from kaktus@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07CA3ABs055480; Wed, 12 Aug 2020 10:03:10 GMT (envelope-from kaktus@FreeBSD.org) Message-Id: <202008121003.07CA3ABs055480@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kaktus set sender to kaktus@FreeBSD.org using -f From: Pawel Biernacki Date: Wed, 12 Aug 2020 10:03:10 +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: r364150 - stable/12/lib/libc/gen X-SVN-Group: stable-12 X-SVN-Commit-Author: kaktus X-SVN-Commit-Paths: stable/12/lib/libc/gen X-SVN-Commit-Revision: 364150 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2020 10:03:11 -0000 Author: kaktus Date: Wed Aug 12 10:03:10 2020 New Revision: 364150 URL: https://svnweb.freebsd.org/changeset/base/364150 Log: MFC userland part of r351729 Add sysctlbyname system call Modified: stable/12/lib/libc/gen/Symbol.map stable/12/lib/libc/gen/sysctlbyname.c Modified: stable/12/lib/libc/gen/Symbol.map ============================================================================== --- stable/12/lib/libc/gen/Symbol.map Wed Aug 12 09:57:28 2020 (r364149) +++ stable/12/lib/libc/gen/Symbol.map Wed Aug 12 10:03:10 2020 (r364150) @@ -423,6 +423,7 @@ FBSD_1.5 { }; FBSD_1.6 { + __sysctlbyname; memalign; sigandset; sigisemptyset; Modified: stable/12/lib/libc/gen/sysctlbyname.c ============================================================================== --- stable/12/lib/libc/gen/sysctlbyname.c Wed Aug 12 09:57:28 2020 (r364149) +++ stable/12/lib/libc/gen/sysctlbyname.c Wed Aug 12 10:03:10 2020 (r364150) @@ -1,28 +1,59 @@ -/* - * ---------------------------------------------------------------------------- - * "THE BEER-WARE LICENSE" (Revision 42): - * wrote this file. As long as you retain this notice you - * can do whatever you want with this stuff. If we meet some day, and you think - * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp - * ---------------------------------------------------------------------------- +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright 2019 Pawel Biernacki, Mysterious Code Ltd. * + * 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 "libc_private.h" + +#define SYSCTLBYNAME_OSREL 1201522 + +extern int __sysctlbyname(const char *name, size_t namelen, void *oldp, + size_t *oldlenp, const void *newp, size_t newlen); + int sysctlbyname(const char *name, void *oldp, size_t *oldlenp, const void *newp, size_t newlen) { - int real_oid[CTL_MAXNAME+2]; - size_t oidlen; + int oid[CTL_MAXNAME]; + size_t len; - oidlen = sizeof(real_oid) / sizeof(int); - if (sysctlnametomib(name, real_oid, &oidlen) < 0) + if (__getosreldate() >= SYSCTLBYNAME_OSREL) { + len = strlen(name); + return (__sysctlbyname(name, len, oldp, oldlenp, newp, + newlen)); + } + len = nitems(oid); + if (sysctlnametomib(name, oid, &len) == -1) return (-1); - return (sysctl(real_oid, oidlen, oldp, oldlenp, newp, newlen)); + return (sysctl(oid, len, oldp, oldlenp, newp, newlen)); } From owner-svn-src-all@freebsd.org Wed Aug 12 10:11:35 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 69B7E37B9EA; Wed, 12 Aug 2020 10:11:35 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BRQTg2ClFz3TDy; Wed, 12 Aug 2020 10:11:35 +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 2F67DA3F3; Wed, 12 Aug 2020 10:11:35 +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 07CABZ72059387; Wed, 12 Aug 2020 10:11:35 GMT (envelope-from eugen@FreeBSD.org) Received: (from eugen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07CABZBO059386; Wed, 12 Aug 2020 10:11:35 GMT (envelope-from eugen@FreeBSD.org) Message-Id: <202008121011.07CABZBO059386@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eugen set sender to eugen@FreeBSD.org using -f From: Eugene Grosbein Date: Wed, 12 Aug 2020 10:11: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: r364151 - stable/12/usr.sbin/bsnmpd/tools/libbsnmptools X-SVN-Group: stable-12 X-SVN-Commit-Author: eugen X-SVN-Commit-Paths: stable/12/usr.sbin/bsnmpd/tools/libbsnmptools X-SVN-Commit-Revision: 364151 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2020 10:11:35 -0000 Author: eugen Date: Wed Aug 12 10:11:34 2020 New Revision: 364151 URL: https://svnweb.freebsd.org/changeset/base/364151 Log: MFC r363889: bsnmptools: make it print protocol errors to stderr instead of stdout Reviewed by: syrinx, bz Differential Revision: https://reviews.freebsd.org/D25911 Modified: stable/12/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c ============================================================================== --- stable/12/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c Wed Aug 12 10:03:10 2020 (r364150) +++ stable/12/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c Wed Aug 12 10:11:34 2020 (r364151) @@ -1828,11 +1828,11 @@ snmp_output_numval(struct snmp_toolinfo *snmptoolctx, break; case SNMP_SYNTAX_NOSUCHOBJECT: - fprintf(stdout, "No Such Object\n"); + fprintf(stderr, "No Such Object\n"); return (val->syntax); case SNMP_SYNTAX_NOSUCHINSTANCE: - fprintf(stdout, "No Such Instance\n"); + fprintf(stderr, "No Such Instance\n"); return (val->syntax); case SNMP_SYNTAX_ENDOFMIBVIEW: @@ -1841,12 +1841,12 @@ snmp_output_numval(struct snmp_toolinfo *snmptoolctx, case SNMP_SYNTAX_NULL: /* NOTREACHED */ - fprintf(stdout, "agent returned NULL Syntax\n"); + fprintf(stderr, "agent returned NULL Syntax\n"); return (val->syntax); default: /* NOTREACHED - If here - then all went completely wrong. */ - fprintf(stdout, "agent returned unknown syntax\n"); + fprintf(stderr, "agent returned unknown syntax\n"); return (-1); } From owner-svn-src-all@freebsd.org Wed Aug 12 10:13:38 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A036837BD2D; Wed, 12 Aug 2020 10:13:38 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BRQX23lGXz3TPM; Wed, 12 Aug 2020 10:13:38 +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 63C7DA886; Wed, 12 Aug 2020 10:13:38 +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 07CADc1C061694; Wed, 12 Aug 2020 10:13:38 GMT (envelope-from eugen@FreeBSD.org) Received: (from eugen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07CADcBP061693; Wed, 12 Aug 2020 10:13:38 GMT (envelope-from eugen@FreeBSD.org) Message-Id: <202008121013.07CADcBP061693@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eugen set sender to eugen@FreeBSD.org using -f From: Eugene Grosbein Date: Wed, 12 Aug 2020 10:13: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: r364152 - stable/11/usr.sbin/bsnmpd/tools/libbsnmptools X-SVN-Group: stable-11 X-SVN-Commit-Author: eugen X-SVN-Commit-Paths: stable/11/usr.sbin/bsnmpd/tools/libbsnmptools X-SVN-Commit-Revision: 364152 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2020 10:13:38 -0000 Author: eugen Date: Wed Aug 12 10:13:37 2020 New Revision: 364152 URL: https://svnweb.freebsd.org/changeset/base/364152 Log: MFC r363889: bsnmptools: make it print protocol errors to stderr instead of stdout Reviewed by: syrinx, bz Differential Revision: https://reviews.freebsd.org/D25911 Modified: stable/11/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c ============================================================================== --- stable/11/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c Wed Aug 12 10:11:34 2020 (r364151) +++ stable/11/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c Wed Aug 12 10:13:37 2020 (r364152) @@ -1828,11 +1828,11 @@ snmp_output_numval(struct snmp_toolinfo *snmptoolctx, break; case SNMP_SYNTAX_NOSUCHOBJECT: - fprintf(stdout, "No Such Object\n"); + fprintf(stderr, "No Such Object\n"); return (val->syntax); case SNMP_SYNTAX_NOSUCHINSTANCE: - fprintf(stdout, "No Such Instance\n"); + fprintf(stderr, "No Such Instance\n"); return (val->syntax); case SNMP_SYNTAX_ENDOFMIBVIEW: @@ -1841,12 +1841,12 @@ snmp_output_numval(struct snmp_toolinfo *snmptoolctx, case SNMP_SYNTAX_NULL: /* NOTREACHED */ - fprintf(stdout, "agent returned NULL Syntax\n"); + fprintf(stderr, "agent returned NULL Syntax\n"); return (val->syntax); default: /* NOTREACHED - If here - then all went completely wrong. */ - fprintf(stdout, "agent returned unknown syntax\n"); + fprintf(stderr, "agent returned unknown syntax\n"); return (-1); } From owner-svn-src-all@freebsd.org Wed Aug 12 10:17:19 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1890D37BA0F; Wed, 12 Aug 2020 10:17:19 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BRQcG6v7Hz3TD9; Wed, 12 Aug 2020 10:17:18 +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 CAFDEA4CE; Wed, 12 Aug 2020 10:17:18 +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 07CAHIET061921; Wed, 12 Aug 2020 10:17:18 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07CAHHgn061915; Wed, 12 Aug 2020 10:17:17 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <202008121017.07CAHHgn061915@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 12 Aug 2020 10:17:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364153 - in head: lib/libpmc sys/arm64/include sys/dev/hwpmc sys/sys X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: in head: lib/libpmc sys/arm64/include sys/dev/hwpmc sys/sys X-SVN-Commit-Revision: 364153 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2020 10:17:19 -0000 Author: andrew Date: Wed Aug 12 10:17:17 2020 New Revision: 364153 URL: https://svnweb.freebsd.org/changeset/base/364153 Log: Add support for Cortex-A76/Neoverse-N1 to hwpmc This adds support for the Cortex-A76 and Neoverse-N1 PMU counters to pmc. While here add more PMCR_IDCODE values and check the implementers code is correct before setting the PMU type. Reviewed by: bz, emaste (looks reasonable to me) Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D25959 Modified: head/lib/libpmc/libpmc.c head/sys/arm64/include/armreg.h head/sys/dev/hwpmc/hwpmc_arm64.c head/sys/dev/hwpmc/pmc_events.h head/sys/sys/pmc.h Modified: head/lib/libpmc/libpmc.c ============================================================================== --- head/lib/libpmc/libpmc.c Wed Aug 12 10:13:37 2020 (r364152) +++ head/lib/libpmc/libpmc.c Wed Aug 12 10:17:17 2020 (r364153) @@ -176,6 +176,11 @@ static const struct pmc_event_descr cortex_a57_event_t __PMC_EV_ALIAS_ARMV8_CORTEX_A57() }; +static const struct pmc_event_descr cortex_a76_event_table[] = +{ + __PMC_EV_ALIAS_ARMV8_CORTEX_A76() +}; + /* * PMC_MDEP_TABLE(NAME, PRIMARYCLASS, ADDITIONAL_CLASSES...) * @@ -193,6 +198,7 @@ PMC_MDEP_TABLE(cortex_a8, ARMV7, PMC_CLASS_SOFT, PMC_C PMC_MDEP_TABLE(cortex_a9, ARMV7, PMC_CLASS_SOFT, PMC_CLASS_ARMV7); PMC_MDEP_TABLE(cortex_a53, ARMV8, PMC_CLASS_SOFT, PMC_CLASS_ARMV8); PMC_MDEP_TABLE(cortex_a57, ARMV8, PMC_CLASS_SOFT, PMC_CLASS_ARMV8); +PMC_MDEP_TABLE(cortex_a76, ARMV8, PMC_CLASS_SOFT, PMC_CLASS_ARMV8); PMC_MDEP_TABLE(mips24k, MIPS24K, PMC_CLASS_SOFT, PMC_CLASS_MIPS24K); PMC_MDEP_TABLE(mips74k, MIPS74K, PMC_CLASS_SOFT, PMC_CLASS_MIPS74K); PMC_MDEP_TABLE(octeon, OCTEON, PMC_CLASS_SOFT, PMC_CLASS_OCTEON); @@ -235,6 +241,7 @@ PMC_CLASS_TABLE_DESC(cortex_a9, ARMV7, cortex_a9, armv #if defined(__aarch64__) PMC_CLASS_TABLE_DESC(cortex_a53, ARMV8, cortex_a53, arm64); PMC_CLASS_TABLE_DESC(cortex_a57, ARMV8, cortex_a57, arm64); +PMC_CLASS_TABLE_DESC(cortex_a76, ARMV8, cortex_a76, arm64); #endif #if defined(__mips__) PMC_CLASS_TABLE_DESC(beri, BERI, beri, mips); @@ -817,6 +824,9 @@ static struct pmc_event_alias cortex_a53_aliases[] = { static struct pmc_event_alias cortex_a57_aliases[] = { EV_ALIAS(NULL, NULL) }; +static struct pmc_event_alias cortex_a76_aliases[] = { + EV_ALIAS(NULL, NULL) +}; static int arm64_allocate_pmc(enum pmc_event pe, char *ctrspec __unused, struct pmc_op_pmcallocate *pmc_config __unused) @@ -1273,6 +1283,10 @@ pmc_event_names_of_class(enum pmc_class cl, const char ev = cortex_a57_event_table; count = PMC_EVENT_TABLE_SIZE(cortex_a57); break; + case PMC_CPU_ARMV8_CORTEX_A76: + ev = cortex_a76_event_table; + count = PMC_EVENT_TABLE_SIZE(cortex_a76); + break; } break; case PMC_CLASS_BERI: @@ -1518,6 +1532,10 @@ pmc_init(void) PMC_MDEP_INIT(cortex_a57); pmc_class_table[n] = &cortex_a57_class_table_descr; break; + case PMC_CPU_ARMV8_CORTEX_A76: + PMC_MDEP_INIT(cortex_a76); + pmc_class_table[n] = &cortex_a76_class_table_descr; + break; #endif #if defined(__mips__) case PMC_CPU_MIPS_BERI: @@ -1657,6 +1675,10 @@ _pmc_name_of_event(enum pmc_event pe, enum pmc_cputype case PMC_CPU_ARMV8_CORTEX_A57: ev = cortex_a57_event_table; evfence = cortex_a57_event_table + PMC_EVENT_TABLE_SIZE(cortex_a57); + break; + case PMC_CPU_ARMV8_CORTEX_A76: + ev = cortex_a76_event_table; + evfence = cortex_a76_event_table + PMC_EVENT_TABLE_SIZE(cortex_a76); break; default: /* Unknown CPU type. */ break; Modified: head/sys/arm64/include/armreg.h ============================================================================== --- head/sys/arm64/include/armreg.h Wed Aug 12 10:13:37 2020 (r364152) +++ head/sys/arm64/include/armreg.h Wed Aug 12 10:17:17 2020 (r364153) @@ -857,11 +857,20 @@ #define PMCR_LC (1 << 6) /* Long cycle count enable */ #define PMCR_IMP_SHIFT 24 /* Implementer code */ #define PMCR_IMP_MASK (0xff << PMCR_IMP_SHIFT) +#define PMCR_IMP_ARM 0x41 #define PMCR_IDCODE_SHIFT 16 /* Identification code */ #define PMCR_IDCODE_MASK (0xff << PMCR_IDCODE_SHIFT) -#define PMCR_IDCODE_CORTEX_A57 0x01 -#define PMCR_IDCODE_CORTEX_A72 0x02 -#define PMCR_IDCODE_CORTEX_A53 0x03 +#define PMCR_IDCODE_CORTEX_A57 0x01 +#define PMCR_IDCODE_CORTEX_A72 0x02 +#define PMCR_IDCODE_CORTEX_A53 0x03 +#define PMCR_IDCODE_CORTEX_A73 0x04 +#define PMCR_IDCODE_CORTEX_A35 0x0a +#define PMCR_IDCODE_CORTEX_A76 0x0b +#define PMCR_IDCODE_NEOVERSE_N1 0x0c +#define PMCR_IDCODE_CORTEX_A77 0x10 +#define PMCR_IDCODE_CORTEX_A55 0x45 +#define PMCR_IDCODE_NEOVERSE_E1 0x46 +#define PMCR_IDCODE_CORTEX_A75 0x4a #define PMCR_N_SHIFT 11 /* Number of counters implemented */ #define PMCR_N_MASK (0x1f << PMCR_N_SHIFT) Modified: head/sys/dev/hwpmc/hwpmc_arm64.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_arm64.c Wed Aug 12 10:13:37 2020 (r364152) +++ head/sys/dev/hwpmc/hwpmc_arm64.c Wed Aug 12 10:17:17 2020 (r364153) @@ -479,11 +479,12 @@ pmc_arm64_initialize() { struct pmc_mdep *pmc_mdep; struct pmc_classdep *pcd; - int idcode; + int idcode, impcode; int reg; reg = arm64_pmcr_read(); arm64_npmcs = (reg & PMCR_N_MASK) >> PMCR_N_SHIFT; + impcode = (reg & PMCR_IMP_MASK) >> PMCR_IMP_SHIFT; idcode = (reg & PMCR_IDCODE_MASK) >> PMCR_IDCODE_SHIFT; PMCDBG1(MDP, INI, 1, "arm64-init npmcs=%d", arm64_npmcs); @@ -498,13 +499,24 @@ pmc_arm64_initialize() /* Just one class */ pmc_mdep = pmc_mdep_alloc(1); - switch (idcode) { - case PMCR_IDCODE_CORTEX_A57: - case PMCR_IDCODE_CORTEX_A72: - pmc_mdep->pmd_cputype = PMC_CPU_ARMV8_CORTEX_A57; + switch(impcode) { + case PMCR_IMP_ARM: + switch (idcode) { + case PMCR_IDCODE_CORTEX_A76: + case PMCR_IDCODE_NEOVERSE_N1: + pmc_mdep->pmd_cputype = PMC_CPU_ARMV8_CORTEX_A76; + break; + case PMCR_IDCODE_CORTEX_A57: + case PMCR_IDCODE_CORTEX_A72: + pmc_mdep->pmd_cputype = PMC_CPU_ARMV8_CORTEX_A57; + break; + default: + case PMCR_IDCODE_CORTEX_A53: + pmc_mdep->pmd_cputype = PMC_CPU_ARMV8_CORTEX_A53; + break; + } break; default: - case PMCR_IDCODE_CORTEX_A53: pmc_mdep->pmd_cputype = PMC_CPU_ARMV8_CORTEX_A53; break; } Modified: head/sys/dev/hwpmc/pmc_events.h ============================================================================== --- head/sys/dev/hwpmc/pmc_events.h Wed Aug 12 10:13:37 2020 (r364152) +++ head/sys/dev/hwpmc/pmc_events.h Wed Aug 12 10:17:17 2020 (r364153) @@ -955,7 +955,7 @@ __PMC_EV_ALIAS("unhalted-core-cycles", IAP_ARCH_UNH_C __PMC_EV_ALIAS("BR_RETURN_RETIRED", ARMV8_EVENT_0EH) \ __PMC_EV_ALIAS("UNALIGNED_LDST_RETIRED",ARMV8_EVENT_0FH) -#define __PMC_EV_ALIAS_ARMV8_CORTEX_A57() \ +#define __PMC_EV_ALIAS_ARMV8_CORTEX_A57_A76() \ __PMC_EV_ALIAS_ARMV8_COMMON() \ __PMC_EV_ALIAS("INST_SPEC", ARMV8_EVENT_1BH) \ __PMC_EV_ALIAS("TTBR_WRITE_RETIRED", ARMV8_EVENT_1CH) \ @@ -975,10 +975,6 @@ __PMC_EV_ALIAS("unhalted-core-cycles", IAP_ARCH_UNH_C __PMC_EV_ALIAS("L2D_CACHE_WB_VICTIM", ARMV8_EVENT_56H) \ __PMC_EV_ALIAS("L2D_CACHE_WB_CLEAN", ARMV8_EVENT_57H) \ __PMC_EV_ALIAS("L2D_CACHE_INVAL", ARMV8_EVENT_58H) \ - __PMC_EV_ALIAS("BUS_ACCESS_SHARED", ARMV8_EVENT_62H) \ - __PMC_EV_ALIAS("BUS_ACCESS_NOT_SHARED", ARMV8_EVENT_63H) \ - __PMC_EV_ALIAS("BUS_ACCESS_NORMAL", ARMV8_EVENT_64H) \ - __PMC_EV_ALIAS("BUS_ACCESS_PERIPH", ARMV8_EVENT_65H) \ __PMC_EV_ALIAS("MEM_ACCESS_LD", ARMV8_EVENT_66H) \ __PMC_EV_ALIAS("MEM_ACCESS_ST", ARMV8_EVENT_67H) \ __PMC_EV_ALIAS("UNALIGNED_LD_SPEC", ARMV8_EVENT_68H) \ @@ -1013,6 +1009,43 @@ __PMC_EV_ALIAS("unhalted-core-cycles", IAP_ARCH_UNH_C __PMC_EV_ALIAS("EXC_TRAP_FIQ", ARMV8_EVENT_8FH) \ __PMC_EV_ALIAS("RC_LD_SPEC", ARMV8_EVENT_90H) \ __PMC_EV_ALIAS("RC_ST_SPEC", ARMV8_EVENT_91H) + +#define __PMC_EV_ALIAS_ARMV8_CORTEX_A57() \ + __PMC_EV_ALIAS_ARMV8_CORTEX_A57_A76() \ + __PMC_EV_ALIAS("BUS_ACCESS_SHARED", ARMV8_EVENT_62H) \ + __PMC_EV_ALIAS("BUS_ACCESS_NOT_SHARED", ARMV8_EVENT_63H) \ + __PMC_EV_ALIAS("BUS_ACCESS_NORMAL", ARMV8_EVENT_64H) \ + __PMC_EV_ALIAS("BUS_ACCESS_PERIPH", ARMV8_EVENT_65H) + +#define __PMC_EV_ALIAS_ARMV8_CORTEX_A76() \ + __PMC_EV_ALIAS_ARMV8_CORTEX_A57_A76() \ + __PMC_EV_ALIAS("L2D_CACHE_ALLOCATE", ARMV8_EVENT_20H) \ + __PMC_EV_ALIAS("BR_RETIRED", ARMV8_EVENT_21H) \ + __PMC_EV_ALIAS("BR_MIS_PRED_RETIRED", ARMV8_EVENT_22H) \ + __PMC_EV_ALIAS("STALL_FRONTEND", ARMV8_EVENT_23H) \ + __PMC_EV_ALIAS("STALL_BACKEND", ARMV8_EVENT_24H) \ + __PMC_EV_ALIAS("L1D_TLB", ARMV8_EVENT_25H) \ + __PMC_EV_ALIAS("L1I_TLB", ARMV8_EVENT_26H) \ + __PMC_EV_ALIAS("L3D_CACHE_ALLOCATE", ARMV8_EVENT_29H) \ + __PMC_EV_ALIAS("L3D_CACHE_REFILL", ARMV8_EVENT_2AH) \ + __PMC_EV_ALIAS("L3D_CACHE", ARMV8_EVENT_2BH) \ + __PMC_EV_ALIAS("L2D_TLB_REFILL", ARMV8_EVENT_2DH) \ + __PMC_EV_ALIAS("L2D_TLB", ARMV8_EVENT_2FH) \ + __PMC_EV_ALIAS("REMOTE_ACCESS", ARMV8_EVENT_31H) \ + __PMC_EV_ALIAS("DTLB_WALK", ARMV8_EVENT_34H) \ + __PMC_EV_ALIAS("ITLB_WALK", ARMV8_EVENT_35H) \ + __PMC_EV_ALIAS("LL_CACHE_RD", ARMV8_EVENT_36H) \ + __PMC_EV_ALIAS("LL_CACHE_MISS_RD", ARMV8_EVENT_37H) \ + __PMC_EV_ALIAS("L1D_CACHE_REFILL_INNER", ARMV8_EVENT_44H) \ + __PMC_EV_ALIAS("L1D_CACHE_REFILL_OUTER", ARMV8_EVENT_45H) \ + __PMC_EV_ALIAS("L1D_TLB_RD", ARMV8_EVENT_4EH) \ + __PMC_EV_ALIAS("L1D_TLB_WR", ARMV8_EVENT_4FH) \ + __PMC_EV_ALIAS("L2D_TLB_REFILL_RD", ARMV8_EVENT_5CH) \ + __PMC_EV_ALIAS("L2D_TLB_REFILL_WR", ARMV8_EVENT_5DH) \ + __PMC_EV_ALIAS("L2D_TLB_RD", ARMV8_EVENT_5EH) \ + __PMC_EV_ALIAS("L2D_TLB_WR", ARMV8_EVENT_5FH) \ + __PMC_EV_ALIAS("STREX_SPEC", ARMV8_EVENT_6FH) \ + __PMC_EV_ALIAS("L3_CACHE_RD", ARMV8_EVENT_A0H) /* * MIPS Events from "Programming the MIPS32 24K Core Family", Modified: head/sys/sys/pmc.h ============================================================================== --- head/sys/sys/pmc.h Wed Aug 12 10:13:37 2020 (r364152) +++ head/sys/sys/pmc.h Wed Aug 12 10:17:17 2020 (r364153) @@ -127,7 +127,8 @@ extern char pmc_cpuid[PMC_CPUID_LEN]; __PMC_CPU(ARMV7_CORTEX_A15, 0x504, "ARMv7 Cortex A15") \ __PMC_CPU(ARMV7_CORTEX_A17, 0x505, "ARMv7 Cortex A17") \ __PMC_CPU(ARMV8_CORTEX_A53, 0x600, "ARMv8 Cortex A53") \ - __PMC_CPU(ARMV8_CORTEX_A57, 0x601, "ARMv8 Cortex A57") + __PMC_CPU(ARMV8_CORTEX_A57, 0x601, "ARMv8 Cortex A57") \ + __PMC_CPU(ARMV8_CORTEX_A76, 0x602, "ARMv8 Cortex A76") enum pmc_cputype { #undef __PMC_CPU From owner-svn-src-all@freebsd.org Wed Aug 12 11:36:09 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E9C4A37D48B; Wed, 12 Aug 2020 11:36:09 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BRSMF4wb2z3X7R; Wed, 12 Aug 2020 11:36:09 +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 8C3C4B2E3; Wed, 12 Aug 2020 11:36:09 +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 07CBa9qW011265; Wed, 12 Aug 2020 11:36:09 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07CBa9tO011264; Wed, 12 Aug 2020 11:36:09 GMT (envelope-from avg@FreeBSD.org) Message-Id: <202008121136.07CBa9tO011264@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 12 Aug 2020 11:36:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364154 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 364154 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2020 11:36:10 -0000 Author: avg Date: Wed Aug 12 11:36:09 2020 New Revision: 364154 URL: https://svnweb.freebsd.org/changeset/base/364154 Log: hook gpiokeys.4 to the build Reported by: 0mp MFC after: 3 days X-MFC with: r363905 Modified: head/share/man/man4/Makefile Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Wed Aug 12 10:17:17 2020 (r364153) +++ head/share/man/man4/Makefile Wed Aug 12 11:36:09 2020 (r364154) @@ -171,6 +171,7 @@ MAN= aac.4 \ gif.4 \ gpio.4 \ gpioiic.4 \ + gpiokeys.4 \ gpioled.4 \ gpioths.4 \ gre.4 \ From owner-svn-src-all@freebsd.org Wed Aug 12 11:37:28 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ACC7637D586; Wed, 12 Aug 2020 11:37:28 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BRSNm48xJz3Xmg; Wed, 12 Aug 2020 11:37:28 +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 72FDAADF9; Wed, 12 Aug 2020 11:37:28 +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 07CBbSUK011370; Wed, 12 Aug 2020 11:37:28 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07CBbSVL011369; Wed, 12 Aug 2020 11:37:28 GMT (envelope-from avg@FreeBSD.org) Message-Id: <202008121137.07CBbSVL011369@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 12 Aug 2020 11:37:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364155 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 364155 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2020 11:37:28 -0000 Author: avg Date: Wed Aug 12 11:37:28 2020 New Revision: 364155 URL: https://svnweb.freebsd.org/changeset/base/364155 Log: hook cp2112.4 to the build Reported by: 0mp MFC after: 1 week X-MFC with: r364144 Modified: head/share/man/man4/Makefile Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Wed Aug 12 11:36:09 2020 (r364154) +++ head/share/man/man4/Makefile Wed Aug 12 11:37:28 2020 (r364155) @@ -113,6 +113,7 @@ MAN= aac.4 \ cloudabi.4 \ cmx.4 \ ${_coretemp.4} \ + cp2112.4 \ ${_cpuctl.4} \ cpufreq.4 \ crypto.4 \ From owner-svn-src-all@freebsd.org Wed Aug 12 11:42:37 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4D47B37D812; Wed, 12 Aug 2020 11:42:37 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BRSVj1LY4z3XxH; Wed, 12 Aug 2020 11:42:37 +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 11713B67B; Wed, 12 Aug 2020 11:42:37 +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 07CBgakg016998; Wed, 12 Aug 2020 11:42:36 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07CBga3e016996; Wed, 12 Aug 2020 11:42:36 GMT (envelope-from ae@FreeBSD.org) Message-Id: <202008121142.07CBga3e016996@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Wed, 12 Aug 2020 11:42: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: r364156 - stable/12/sbin/ipfw X-SVN-Group: stable-12 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: stable/12/sbin/ipfw X-SVN-Commit-Revision: 364156 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2020 11:42:37 -0000 Author: ae Date: Wed Aug 12 11:42:36 2020 New Revision: 364156 URL: https://svnweb.freebsd.org/changeset/base/364156 Log: MFC r363904: Fix SIGSEGV in ipfw(8) when NAT64 prefix length is omitted. Modified: stable/12/sbin/ipfw/nat64clat.c stable/12/sbin/ipfw/nat64stl.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/ipfw/nat64clat.c ============================================================================== --- stable/12/sbin/ipfw/nat64clat.c Wed Aug 12 11:37:28 2020 (r364155) +++ stable/12/sbin/ipfw/nat64clat.c Wed Aug 12 11:42:36 2020 (r364156) @@ -303,6 +303,9 @@ nat64clat_config(const char *name, uint8_t set, int ac if ((p = strchr(*av, '/')) != NULL) *p++ = '\0'; + else + errx(EX_USAGE, + "Prefix length required: %s", *av); if (inet_pton(AF_INET6, *av, &prefix) != 1) errx(EX_USAGE, "Bad prefix: %s", *av); Modified: stable/12/sbin/ipfw/nat64stl.c ============================================================================== --- stable/12/sbin/ipfw/nat64stl.c Wed Aug 12 11:37:28 2020 (r364155) +++ stable/12/sbin/ipfw/nat64stl.c Wed Aug 12 11:42:36 2020 (r364156) @@ -249,6 +249,9 @@ nat64stl_create(const char *name, uint8_t set, int ac, NEED1("IPv6 prefix6 required"); if ((p = strchr(*av, '/')) != NULL) *p++ = '\0'; + else + errx(EX_USAGE, + "Prefix length required: %s", *av); if (inet_pton(AF_INET6, *av, &cfg->prefix6) != 1) errx(EX_USAGE, "Bad prefix: %s", *av); From owner-svn-src-all@freebsd.org Wed Aug 12 11:43:44 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7019537DAB2; Wed, 12 Aug 2020 11:43:44 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BRSX02Pccz3YFV; Wed, 12 Aug 2020 11:43: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 36021B813; Wed, 12 Aug 2020 11:43: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 07CBhiOH017103; Wed, 12 Aug 2020 11:43:44 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07CBhi4Q017102; Wed, 12 Aug 2020 11:43:44 GMT (envelope-from ae@FreeBSD.org) Message-Id: <202008121143.07CBhi4Q017102@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Wed, 12 Aug 2020 11:43: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: r364157 - stable/12/sys/netinet6 X-SVN-Group: stable-12 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: stable/12/sys/netinet6 X-SVN-Commit-Revision: 364157 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2020 11:43:44 -0000 Author: ae Date: Wed Aug 12 11:43:43 2020 New Revision: 364157 URL: https://svnweb.freebsd.org/changeset/base/364157 Log: MFC r363900: Fix typo. Modified: stable/12/sys/netinet6/in6_proto.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet6/in6_proto.c ============================================================================== --- stable/12/sys/netinet6/in6_proto.c Wed Aug 12 11:42:36 2020 (r364156) +++ stable/12/sys/netinet6/in6_proto.c Wed Aug 12 11:43:43 2020 (r364157) @@ -587,7 +587,7 @@ SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_USELOOPBACK "Create a loopback route when configuring an IPv6 address"); SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_NODEINFO, nodeinfo, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(icmp6_nodeinfo), 0, - "Mask of enabled RF4620 node information query types"); + "Mask of enabled RFC4620 node information query types"); SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_NODEINFO_OLDMCPREFIX, nodeinfo_oldmcprefix, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(icmp6_nodeinfo_oldmcprefix), 0, From owner-svn-src-all@freebsd.org Wed Aug 12 11:48:20 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A08DD37D6EB; Wed, 12 Aug 2020 11:48:20 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BRSdJ3l7Hz3YT5; Wed, 12 Aug 2020 11:48:20 +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 6005DB441; Wed, 12 Aug 2020 11:48: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 07CBmKIx017390; Wed, 12 Aug 2020 11:48:20 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07CBmK0b017389; Wed, 12 Aug 2020 11:48:20 GMT (envelope-from ae@FreeBSD.org) Message-Id: <202008121148.07CBmK0b017389@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Wed, 12 Aug 2020 11:48: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: r364158 - stable/12/sys/netpfil/ipfw/nat64 X-SVN-Group: stable-12 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: stable/12/sys/netpfil/ipfw/nat64 X-SVN-Commit-Revision: 364158 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2020 11:48:20 -0000 Author: ae Date: Wed Aug 12 11:48:19 2020 New Revision: 364158 URL: https://svnweb.freebsd.org/changeset/base/364158 Log: MFC r363888: Handle delayed checksums if needed in NAT64. Upper level protocols defer checksums calculation in hope we have checksums offloading in a network card. CSUM_DELAY_DATA flag is used to determine that checksum calculation was deferred. And IP output routine checks for this flag before pass mbuf to lower layer. Forwarded packets have not this flag. NAT64 uses checksums adjustment when it translates IP headers. In most cases NAT64 is used for forwarded packets, but in case when it handles locally originated packets we need to finish checksum calculation that was deferred to correctly adjust it. Add check for presence of CSUM_DELAY_DATA flag and finish checksum calculation before adjustment. Modified: stable/12/sys/netpfil/ipfw/nat64/nat64_translate.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netpfil/ipfw/nat64/nat64_translate.c ============================================================================== --- stable/12/sys/netpfil/ipfw/nat64/nat64_translate.c Wed Aug 12 11:43:43 2020 (r364157) +++ stable/12/sys/netpfil/ipfw/nat64/nat64_translate.c Wed Aug 12 11:48:19 2020 (r364158) @@ -1286,6 +1286,12 @@ nat64_do_handle_ip4(struct mbuf *m, struct in6_addr *s ip6.ip6_hlim -= IPTTLDEC; ip6.ip6_plen = htons(plen); ip6.ip6_nxt = (proto == IPPROTO_ICMP) ? IPPROTO_ICMPV6: proto; + + /* Handle delayed checksums if needed. */ + if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) { + in_delayed_cksum(m); + m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; + } /* Convert checksums. */ switch (proto) { case IPPROTO_TCP: @@ -1656,6 +1662,12 @@ nat64_do_handle_ip6(struct mbuf *m, uint32_t aaddr, ui return (NAT64RETURN); } nat64_init_ip4hdr(ip6, frag, plen, proto, &ip); + + /* Handle delayed checksums if needed. */ + if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA_IPV6) { + in6_delayed_cksum(m, plen, hlen); + m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA_IPV6; + } /* Convert checksums. */ switch (proto) { case IPPROTO_TCP: From owner-svn-src-all@freebsd.org Wed Aug 12 11:49:36 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 322DD37D6FF; Wed, 12 Aug 2020 11:49:36 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BRSfm0XjPz3YfY; Wed, 12 Aug 2020 11:49:36 +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 E9CE9B814; Wed, 12 Aug 2020 11:49:35 +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 07CBnZ2I017504; Wed, 12 Aug 2020 11:49:35 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07CBnZ0a017502; Wed, 12 Aug 2020 11:49:35 GMT (envelope-from ae@FreeBSD.org) Message-Id: <202008121149.07CBnZ0a017502@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Wed, 12 Aug 2020 11:49: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: r364159 - in stable/12/sys: kern sys X-SVN-Group: stable-12 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: in stable/12/sys: kern sys X-SVN-Commit-Revision: 364159 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2020 11:49:36 -0000 Author: ae Date: Wed Aug 12 11:49:35 2020 New Revision: 364159 URL: https://svnweb.freebsd.org/changeset/base/364159 Log: MFC r363906: Add m__getjcl SDT probe. Modified: stable/12/sys/kern/kern_mbuf.c stable/12/sys/kern/uipc_mbuf.c stable/12/sys/sys/mbuf.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_mbuf.c ============================================================================== --- stable/12/sys/kern/kern_mbuf.c Wed Aug 12 11:48:19 2020 (r364158) +++ stable/12/sys/kern/kern_mbuf.c Wed Aug 12 11:49:35 2020 (r364159) @@ -1020,6 +1020,7 @@ m_getjcl(int how, short type, int flags, int size) uma_zfree(zone_mbuf, m); return (NULL); } + MBUF_PROBE5(m__getjcl, how, type, flags, size, m); return (m); } Modified: stable/12/sys/kern/uipc_mbuf.c ============================================================================== --- stable/12/sys/kern/uipc_mbuf.c Wed Aug 12 11:48:19 2020 (r364158) +++ stable/12/sys/kern/uipc_mbuf.c Wed Aug 12 11:49:35 2020 (r364159) @@ -74,6 +74,13 @@ SDT_PROBE_DEFINE4_XLATE(sdt, , , m__getcl, "uint32_t", "uint32_t", "struct mbuf *", "mbufinfo_t *"); +SDT_PROBE_DEFINE5_XLATE(sdt, , , m__getjcl, + "uint32_t", "uint32_t", + "uint16_t", "uint16_t", + "uint32_t", "uint32_t", + "uint32_t", "uint32_t", + "struct mbuf *", "mbufinfo_t *"); + SDT_PROBE_DEFINE3_XLATE(sdt, , , m__clget, "struct mbuf *", "mbufinfo_t *", "uint32_t", "uint32_t", Modified: stable/12/sys/sys/mbuf.h ============================================================================== --- stable/12/sys/sys/mbuf.h Wed Aug 12 11:48:19 2020 (r364158) +++ stable/12/sys/sys/mbuf.h Wed Aug 12 11:49:35 2020 (r364159) @@ -64,6 +64,7 @@ SDT_PROBE_DECLARE(sdt, , , m__init); SDT_PROBE_DECLARE(sdt, , , m__gethdr); SDT_PROBE_DECLARE(sdt, , , m__get); SDT_PROBE_DECLARE(sdt, , , m__getcl); +SDT_PROBE_DECLARE(sdt, , , m__getjcl); SDT_PROBE_DECLARE(sdt, , , m__clget); SDT_PROBE_DECLARE(sdt, , , m__cljget); SDT_PROBE_DECLARE(sdt, , , m__cljset); From owner-svn-src-all@freebsd.org Wed Aug 12 12:06:02 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6CD4837EC8B; Wed, 12 Aug 2020 12:06:02 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BRT1k2Ftvz3ZcP; Wed, 12 Aug 2020 12:06:02 +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 3179CBC96; Wed, 12 Aug 2020 12:06:02 +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 07CC61OP029440; Wed, 12 Aug 2020 12:06:01 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07CC61S0029438; Wed, 12 Aug 2020 12:06:01 GMT (envelope-from ae@FreeBSD.org) Message-Id: <202008121206.07CC61S0029438@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Wed, 12 Aug 2020 12:06: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: r364160 - stable/11/sbin/ipfw X-SVN-Group: stable-11 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: stable/11/sbin/ipfw X-SVN-Commit-Revision: 364160 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2020 12:06:02 -0000 Author: ae Date: Wed Aug 12 12:06:01 2020 New Revision: 364160 URL: https://svnweb.freebsd.org/changeset/base/364160 Log: MFC r363904: Fix SIGSEGV in ipfw(8) when NAT64 prefix length is omitted. Modified: stable/11/sbin/ipfw/nat64clat.c stable/11/sbin/ipfw/nat64stl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/ipfw/nat64clat.c ============================================================================== --- stable/11/sbin/ipfw/nat64clat.c Wed Aug 12 11:49:35 2020 (r364159) +++ stable/11/sbin/ipfw/nat64clat.c Wed Aug 12 12:06:01 2020 (r364160) @@ -303,6 +303,9 @@ nat64clat_config(const char *name, uint8_t set, int ac if ((p = strchr(*av, '/')) != NULL) *p++ = '\0'; + else + errx(EX_USAGE, + "Prefix length required: %s", *av); if (inet_pton(AF_INET6, *av, &prefix) != 1) errx(EX_USAGE, "Bad prefix: %s", *av); Modified: stable/11/sbin/ipfw/nat64stl.c ============================================================================== --- stable/11/sbin/ipfw/nat64stl.c Wed Aug 12 11:49:35 2020 (r364159) +++ stable/11/sbin/ipfw/nat64stl.c Wed Aug 12 12:06:01 2020 (r364160) @@ -249,6 +249,9 @@ nat64stl_create(const char *name, uint8_t set, int ac, NEED1("IPv6 prefix6 required"); if ((p = strchr(*av, '/')) != NULL) *p++ = '\0'; + else + errx(EX_USAGE, + "Prefix length required: %s", *av); if (inet_pton(AF_INET6, *av, &cfg->prefix6) != 1) errx(EX_USAGE, "Bad prefix: %s", *av); From owner-svn-src-all@freebsd.org Wed Aug 12 12:07:16 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B60F537E5C7; Wed, 12 Aug 2020 12:07:16 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BRT375lx9z3ZdK; Wed, 12 Aug 2020 12:07:15 +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 A9F44BC97; Wed, 12 Aug 2020 12:07:15 +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 07CC7FWQ029554; Wed, 12 Aug 2020 12:07:15 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07CC7FBA029553; Wed, 12 Aug 2020 12:07:15 GMT (envelope-from ae@FreeBSD.org) Message-Id: <202008121207.07CC7FBA029553@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Wed, 12 Aug 2020 12:07: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: r364161 - stable/11/sys/netinet6 X-SVN-Group: stable-11 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: stable/11/sys/netinet6 X-SVN-Commit-Revision: 364161 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2020 12:07:16 -0000 Author: ae Date: Wed Aug 12 12:07:15 2020 New Revision: 364161 URL: https://svnweb.freebsd.org/changeset/base/364161 Log: MFC r363900: Fix typo. Modified: stable/11/sys/netinet6/in6_proto.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet6/in6_proto.c ============================================================================== --- stable/11/sys/netinet6/in6_proto.c Wed Aug 12 12:06:01 2020 (r364160) +++ stable/11/sys/netinet6/in6_proto.c Wed Aug 12 12:07:15 2020 (r364161) @@ -620,7 +620,7 @@ SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_USELOOPBACK "Create a loopback route when configuring an IPv6 address"); SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_NODEINFO, nodeinfo, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(icmp6_nodeinfo), 0, - "Mask of enabled RF4620 node information query types"); + "Mask of enabled RFC4620 node information query types"); SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_NODEINFO_OLDMCPREFIX, nodeinfo_oldmcprefix, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(icmp6_nodeinfo_oldmcprefix), 0, From owner-svn-src-all@freebsd.org Wed Aug 12 12:08:51 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3291737E5D6; Wed, 12 Aug 2020 12:08:51 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BRT4z0XMjz3ZvH; Wed, 12 Aug 2020 12:08:51 +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 E9EA2B939; Wed, 12 Aug 2020 12:08:50 +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 07CC8od0029676; Wed, 12 Aug 2020 12:08:50 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07CC8o9p029675; Wed, 12 Aug 2020 12:08:50 GMT (envelope-from ae@FreeBSD.org) Message-Id: <202008121208.07CC8o9p029675@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Wed, 12 Aug 2020 12:08:50 +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: r364162 - stable/11/sys/netpfil/ipfw/nat64 X-SVN-Group: stable-11 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: stable/11/sys/netpfil/ipfw/nat64 X-SVN-Commit-Revision: 364162 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2020 12:08:51 -0000 Author: ae Date: Wed Aug 12 12:08:50 2020 New Revision: 364162 URL: https://svnweb.freebsd.org/changeset/base/364162 Log: MFC r363888: Handle delayed checksums if needed in NAT64. Upper level protocols defer checksums calculation in hope we have checksums offloading in a network card. CSUM_DELAY_DATA flag is used to determine that checksum calculation was deferred. And IP output routine checks for this flag before pass mbuf to lower layer. Forwarded packets have not this flag. NAT64 uses checksums adjustment when it translates IP headers. In most cases NAT64 is used for forwarded packets, but in case when it handles locally originated packets we need to finish checksum calculation that was deferred to correctly adjust it. Add check for presence of CSUM_DELAY_DATA flag and finish checksum calculation before adjustment. Modified: stable/11/sys/netpfil/ipfw/nat64/nat64_translate.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netpfil/ipfw/nat64/nat64_translate.c ============================================================================== --- stable/11/sys/netpfil/ipfw/nat64/nat64_translate.c Wed Aug 12 12:07:15 2020 (r364161) +++ stable/11/sys/netpfil/ipfw/nat64/nat64_translate.c Wed Aug 12 12:08:50 2020 (r364162) @@ -1234,6 +1234,12 @@ nat64_do_handle_ip4(struct mbuf *m, struct in6_addr *s ip6.ip6_hlim -= IPTTLDEC; ip6.ip6_plen = htons(plen); ip6.ip6_nxt = (proto == IPPROTO_ICMP) ? IPPROTO_ICMPV6: proto; + + /* Handle delayed checksums if needed. */ + if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) { + in_delayed_cksum(m); + m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; + } /* Convert checksums. */ switch (proto) { case IPPROTO_TCP: @@ -1604,6 +1610,12 @@ nat64_do_handle_ip6(struct mbuf *m, uint32_t aaddr, ui return (NAT64RETURN); } nat64_init_ip4hdr(ip6, frag, plen, proto, &ip); + + /* Handle delayed checksums if needed. */ + if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA_IPV6) { + in6_delayed_cksum(m, plen, hlen); + m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA_IPV6; + } /* Convert checksums. */ switch (proto) { case IPPROTO_TCP: From owner-svn-src-all@freebsd.org Wed Aug 12 12:11:45 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5BEE537EBE8; Wed, 12 Aug 2020 12:11: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BRT8K1nmGz3bFg; Wed, 12 Aug 2020 12:11:45 +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 20E5EBE58; Wed, 12 Aug 2020 12:11:45 +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 07CCBiGP032471; Wed, 12 Aug 2020 12:11:44 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07CCBiHN032468; Wed, 12 Aug 2020 12:11:44 GMT (envelope-from ae@FreeBSD.org) Message-Id: <202008121211.07CCBiHN032468@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Wed, 12 Aug 2020 12:11: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: r364163 - in stable/11/sys: kern sys X-SVN-Group: stable-11 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: in stable/11/sys: kern sys X-SVN-Commit-Revision: 364163 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2020 12:11:45 -0000 Author: ae Date: Wed Aug 12 12:11:44 2020 New Revision: 364163 URL: https://svnweb.freebsd.org/changeset/base/364163 Log: MFC r363906: Add m__getjcl SDT probe. Modified: stable/11/sys/kern/kern_mbuf.c stable/11/sys/kern/uipc_mbuf.c stable/11/sys/sys/mbuf.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_mbuf.c ============================================================================== --- stable/11/sys/kern/kern_mbuf.c Wed Aug 12 12:08:50 2020 (r364162) +++ stable/11/sys/kern/kern_mbuf.c Wed Aug 12 12:11:44 2020 (r364163) @@ -831,6 +831,7 @@ m_getjcl(int how, short type, int flags, int size) uma_zfree(zone_mbuf, m); return (NULL); } + MBUF_PROBE5(m__getjcl, how, type, flags, size, m); return (m); } Modified: stable/11/sys/kern/uipc_mbuf.c ============================================================================== --- stable/11/sys/kern/uipc_mbuf.c Wed Aug 12 12:08:50 2020 (r364162) +++ stable/11/sys/kern/uipc_mbuf.c Wed Aug 12 12:11:44 2020 (r364163) @@ -72,6 +72,13 @@ SDT_PROBE_DEFINE4_XLATE(sdt, , , m__getcl, "uint32_t", "uint32_t", "struct mbuf *", "mbufinfo_t *"); +SDT_PROBE_DEFINE5_XLATE(sdt, , , m__getjcl, + "uint32_t", "uint32_t", + "uint16_t", "uint16_t", + "uint32_t", "uint32_t", + "uint32_t", "uint32_t", + "struct mbuf *", "mbufinfo_t *"); + SDT_PROBE_DEFINE3_XLATE(sdt, , , m__clget, "struct mbuf *", "mbufinfo_t *", "uint32_t", "uint32_t", Modified: stable/11/sys/sys/mbuf.h ============================================================================== --- stable/11/sys/sys/mbuf.h Wed Aug 12 12:08:50 2020 (r364162) +++ stable/11/sys/sys/mbuf.h Wed Aug 12 12:11:44 2020 (r364163) @@ -62,6 +62,7 @@ SDT_PROBE_DECLARE(sdt, , , m__init); SDT_PROBE_DECLARE(sdt, , , m__gethdr); SDT_PROBE_DECLARE(sdt, , , m__get); SDT_PROBE_DECLARE(sdt, , , m__getcl); +SDT_PROBE_DECLARE(sdt, , , m__getjcl); SDT_PROBE_DECLARE(sdt, , , m__clget); SDT_PROBE_DECLARE(sdt, , , m__cljget); SDT_PROBE_DECLARE(sdt, , , m__cljset); From owner-svn-src-all@freebsd.org Wed Aug 12 14:17:39 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5243A3A21B3; Wed, 12 Aug 2020 14:17:39 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BRWxb1V5qz3yK0; Wed, 12 Aug 2020 14:17:39 +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 168A1D391; Wed, 12 Aug 2020 14:17:39 +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 07CEHcXr010429; Wed, 12 Aug 2020 14:17:38 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07CEHcwM010428; Wed, 12 Aug 2020 14:17:38 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <202008121417.07CEHcwM010428@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Wed, 12 Aug 2020 14:17:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364164 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 364164 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2020 14:17:39 -0000 Author: vmaffione Date: Wed Aug 12 14:17:38 2020 New Revision: 364164 URL: https://svnweb.freebsd.org/changeset/base/364164 Log: iflib: refactor netmap_fl_refill and fix off-by-one issue First, fix the initialization of the fl->ifl_rxd_idxs array, which was affected by an off-by-one bug. Once there, refactor the function to use better names for local variables, optimize the variable assignments, and merge the bus_dmamap_sync() inner loop with the outer one. PR: 248494 MFC after: 3 weeks Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Wed Aug 12 12:11:44 2020 (r364163) +++ head/sys/net/iflib.c Wed Aug 12 14:17:38 2020 (r364164) @@ -838,39 +838,41 @@ netmap_fl_refill(iflib_rxq_t rxq, struct netmap_kring struct if_rxd_update iru; if_ctx_t ctx = rxq->ifr_ctx; iflib_fl_t fl = &rxq->ifr_fl[0]; - uint32_t refill_pidx, nic_i; + uint32_t nic_i_first, nic_i; + int i; #if IFLIB_DEBUG_COUNTERS int rf_count = 0; #endif if (nm_i == head && __predict_true(!init)) - return 0; + return (0); + iru_init(&iru, rxq, 0 /* flid */); map = fl->ifl_sds.ifsd_map; - refill_pidx = netmap_idx_k2n(kring, nm_i); + nic_i = netmap_idx_k2n(kring, nm_i); /* * IMPORTANT: we must leave one free slot in the ring, * so move head back by one unit */ head = nm_prev(head, lim); - nic_i = UINT_MAX; DBG_COUNTER_INC(fl_refills); while (nm_i != head) { #if IFLIB_DEBUG_COUNTERS if (++rf_count == 9) DBG_COUNTER_INC(fl_refills_large); #endif - for (int tmp_pidx = 0; tmp_pidx < IFLIB_MAX_RX_REFRESH && nm_i != head; tmp_pidx++) { + nic_i_first = nic_i; + for (i = 0; i < IFLIB_MAX_RX_REFRESH && nm_i != head; i++) { struct netmap_slot *slot = &ring->slot[nm_i]; - void *addr = PNMB(na, slot, &fl->ifl_bus_addrs[tmp_pidx]); - uint32_t nic_i_dma = refill_pidx; - nic_i = netmap_idx_k2n(kring, nm_i); + void *addr = PNMB(na, slot, &fl->ifl_bus_addrs[i]); - MPASS(tmp_pidx < IFLIB_MAX_RX_REFRESH); + MPASS(i < IFLIB_MAX_RX_REFRESH); if (addr == NETMAP_BUF_BASE(na)) /* bad buf */ return netmap_ring_reinit(kring); + fl->ifl_rxd_idxs[i] = nic_i; + if (__predict_false(init)) { netmap_load_map(na, fl->ifl_buf_tag, map[nic_i], addr); @@ -879,33 +881,25 @@ netmap_fl_refill(iflib_rxq_t rxq, struct netmap_kring netmap_reload_map(na, fl->ifl_buf_tag, map[nic_i], addr); } + bus_dmamap_sync(fl->ifl_buf_tag, map[nic_i], + BUS_DMASYNC_PREREAD); slot->flags &= ~NS_BUF_CHANGED; nm_i = nm_next(nm_i, lim); - fl->ifl_rxd_idxs[tmp_pidx] = nic_i = nm_next(nic_i, lim); - if (nm_i != head && tmp_pidx < IFLIB_MAX_RX_REFRESH-1) - continue; - - iru.iru_pidx = refill_pidx; - iru.iru_count = tmp_pidx+1; - ctx->isc_rxd_refill(ctx->ifc_softc, &iru); - refill_pidx = nic_i; - for (int n = 0; n < iru.iru_count; n++) { - bus_dmamap_sync(fl->ifl_buf_tag, map[nic_i_dma], - BUS_DMASYNC_PREREAD); - /* XXX - change this to not use the netmap func*/ - nic_i_dma = nm_next(nic_i_dma, lim); - } + nic_i = nm_next(nic_i, lim); } + + iru.iru_pidx = nic_i_first; + iru.iru_count = i; + ctx->isc_rxd_refill(ctx->ifc_softc, &iru); } kring->nr_hwcur = head; bus_dmamap_sync(fl->ifl_ifdi->idi_tag, fl->ifl_ifdi->idi_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); - if (__predict_true(nic_i != UINT_MAX)) { - ctx->isc_rxd_flush(ctx->ifc_softc, rxq->ifr_id, fl->ifl_id, nic_i); - DBG_COUNTER_INC(rxd_flush); - } + ctx->isc_rxd_flush(ctx->ifc_softc, rxq->ifr_id, fl->ifl_id, nic_i); + DBG_COUNTER_INC(rxd_flush); + return (0); } From owner-svn-src-all@freebsd.org Wed Aug 12 14:45:32 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B44343A2B68; Wed, 12 Aug 2020 14:45:32 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BRXYm4MRfz40yj; Wed, 12 Aug 2020 14:45:32 +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 78D31D3E4; Wed, 12 Aug 2020 14:45:32 +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 07CEjW8B028805; Wed, 12 Aug 2020 14:45:32 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07CEjWi8028804; Wed, 12 Aug 2020 14:45:32 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <202008121445.07CEjWi8028804@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Wed, 12 Aug 2020 14:45:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364165 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 364165 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2020 14:45:32 -0000 Author: vmaffione Date: Wed Aug 12 14:45:31 2020 New Revision: 364165 URL: https://svnweb.freebsd.org/changeset/base/364165 Log: iflib: netmap: improve rxsync to support IFLIB_HAS_RXCQ For drivers with IFLIB_HAS_RXCQ set, there is a separate completion queue. In this case, the netmap rxsync routine needs to update rxq->ifr_cq_cidx in the same way it is updated by iflib_rxeof(). This improves the situation for vmx(4) and bnxt(4) drivers, which use iflib and have the IFLIB_HAS_RXCQ bit set. PR: 248494 MFC after: 3 weeks Modified: head/sys/net/iflib.c head/sys/net/iflib.h Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Wed Aug 12 14:17:38 2020 (r364164) +++ head/sys/net/iflib.c Wed Aug 12 14:45:31 2020 (r364165) @@ -424,7 +424,7 @@ struct iflib_rxq { struct pfil_head *pfil; /* * If there is a separate completion queue (IFLIB_HAS_RXCQ), this is - * the command queue consumer index. Otherwise it's unused. + * the completion queue consumer index. Otherwise it's unused. */ qidx_t ifr_cq_cidx; uint16_t ifr_id; @@ -1077,9 +1077,12 @@ iflib_netmap_rxsync(struct netmap_kring *kring, int fl int force_update = (flags & NAF_FORCE_READ) || kring->nr_kflags & NKR_PENDINTR; if_ctx_t ctx = ifp->if_softc; + if_shared_ctx_t sctx = ctx->ifc_sctx; + if_softc_ctx_t scctx = &ctx->ifc_softc_ctx; iflib_rxq_t rxq = &ctx->ifc_rxqs[kring->ring_id]; iflib_fl_t fl = &rxq->ifr_fl[0]; struct if_rxd_info ri; + qidx_t *cidxp; /* * netmap only uses free list 0, to avoid out of order consumption @@ -1093,40 +1096,56 @@ iflib_netmap_rxsync(struct netmap_kring *kring, int fl * First part: import newly received packets. * * nm_i is the index of the next free slot in the netmap ring, - * nic_i is the index of the next received packet in the NIC ring, - * and they may differ in case if_init() has been called while + * nic_i is the index of the next received packet in the NIC ring + * (or in the free list 0 if IFLIB_HAS_RXCQ is set), and they may + * differ in case if_init() has been called while * in netmap mode. For the receive ring we have * - * nic_i = rxr->next_check; + * nic_i = fl->ifl_cidx; * nm_i = kring->nr_hwtail (previous) * and * nm_i == (nic_i + kring->nkr_hwofs) % ring_size * - * rxr->next_check is set to 0 on a ring reinit + * fl->ifl_cidx is set to 0 on a ring reinit */ if (netmap_no_pendintr || force_update) { uint32_t hwtail_lim = nm_prev(kring->nr_hwcur, lim); + bool have_rxcq = sctx->isc_flags & IFLIB_HAS_RXCQ; int crclen = iflib_crcstrip ? 0 : 4; int error, avail; + /* + * For the free list consumer index, we use the same + * logic as in iflib_rxeof(). + */ + if (have_rxcq) + cidxp = &rxq->ifr_cq_cidx; + else + cidxp = &fl->ifl_cidx; + avail = ctx->isc_rxd_available(ctx->ifc_softc, + rxq->ifr_id, *cidxp, USHRT_MAX); + nic_i = fl->ifl_cidx; nm_i = netmap_idx_n2k(kring, nic_i); - avail = ctx->isc_rxd_available(ctx->ifc_softc, - rxq->ifr_id, nic_i, USHRT_MAX); for (n = 0; avail > 0 && nm_i != hwtail_lim; n++, avail--) { rxd_info_zero(&ri); ri.iri_frags = rxq->ifr_frags; ri.iri_qsidx = kring->ring_id; ri.iri_ifp = ctx->ifc_ifp; - ri.iri_cidx = nic_i; + ri.iri_cidx = *cidxp; error = ctx->isc_rxd_pkt_get(ctx->ifc_softc, &ri); ring->slot[nm_i].len = error ? 0 : ri.iri_len - crclen; ring->slot[nm_i].flags = 0; + if (have_rxcq) { + *cidxp = ri.iri_cidx; + while (*cidxp >= scctx->isc_nrxd[0]) + *cidxp -= scctx->isc_nrxd[0]; + } bus_dmamap_sync(fl->ifl_buf_tag, fl->ifl_sds.ifsd_map[nic_i], BUS_DMASYNC_POSTREAD); nm_i = nm_next(nm_i, lim); - nic_i = nm_next(nic_i, lim); + fl->ifl_cidx = nic_i = nm_next(nic_i, lim); } if (n) { /* update the state variables */ if (netmap_no_pendintr && !force_update) { @@ -1134,7 +1153,6 @@ iflib_netmap_rxsync(struct netmap_kring *kring, int fl iflib_rx_miss ++; iflib_rx_miss_bufs += n; } - fl->ifl_cidx = nic_i; kring->nr_hwtail = nm_i; } kring->nr_kflags &= ~NKR_PENDINTR; Modified: head/sys/net/iflib.h ============================================================================== --- head/sys/net/iflib.h Wed Aug 12 14:17:38 2020 (r364164) +++ head/sys/net/iflib.h Wed Aug 12 14:45:31 2020 (r364165) @@ -297,7 +297,7 @@ typedef enum { } iflib_intr_type_t; /* - * Interface has a separate command queue for RX + * Interface has a separate completion queue for RX */ #define IFLIB_HAS_RXCQ 0x01 /* @@ -309,7 +309,7 @@ typedef enum { */ #define IFLIB_IS_VF 0x04 /* - * Interface has a separate command queue for TX + * Interface has a separate completion queue for TX */ #define IFLIB_HAS_TXCQ 0x08 /* From owner-svn-src-all@freebsd.org Wed Aug 12 15:49:06 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B26993A4047; Wed, 12 Aug 2020 15:49:06 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BRYz64Jthz44V9; Wed, 12 Aug 2020 15:49:06 +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 74088E395; Wed, 12 Aug 2020 15:49:06 +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 07CFn6dC065713; Wed, 12 Aug 2020 15:49:06 GMT (envelope-from arichardson@FreeBSD.org) Received: (from arichardson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07CFn6ED065712; Wed, 12 Aug 2020 15:49:06 GMT (envelope-from arichardson@FreeBSD.org) Message-Id: <202008121549.07CFn6ED065712@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arichardson set sender to arichardson@FreeBSD.org using -f From: Alex Richardson Date: Wed, 12 Aug 2020 15:49:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364166 - head/usr.sbin/crunch/crunchgen X-SVN-Group: head X-SVN-Commit-Author: arichardson X-SVN-Commit-Paths: head/usr.sbin/crunch/crunchgen X-SVN-Commit-Revision: 364166 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2020 15:49:06 -0000 Author: arichardson Date: Wed Aug 12 15:49:06 2020 New Revision: 364166 URL: https://svnweb.freebsd.org/changeset/base/364166 Log: Fix crunchgen usage of mkstemp() On Glibc systems mkstemp can only be used once with the same template string since it will be modified in-place and no longer contain any 'X' chars. It is fine to reuse the same file here but we need to be explicit and use open() instead of mkstemp() on the second use. While touching this file also avoid a hardcoded /bin/pwd since that may not work when building on non-FreeBSD systems. Reviewed By: brooks Differential Revision: https://reviews.freebsd.org/D25990 Modified: head/usr.sbin/crunch/crunchgen/crunchgen.c Modified: head/usr.sbin/crunch/crunchgen/crunchgen.c ============================================================================== --- head/usr.sbin/crunch/crunchgen/crunchgen.c Wed Aug 12 14:45:31 2020 (r364165) +++ head/usr.sbin/crunch/crunchgen/crunchgen.c Wed Aug 12 15:49:06 2020 (r364166) @@ -39,10 +39,13 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include +#include #include #include #include +#include #include #define CRUNCH_VERSION "0.2" @@ -91,6 +94,7 @@ prog_t *progs = NULL; char confname[MAXPATHLEN], infilename[MAXPATHLEN]; char outmkname[MAXPATHLEN], outcfname[MAXPATHLEN], execfname[MAXPATHLEN]; char tempfname[MAXPATHLEN], cachename[MAXPATHLEN], curfilename[MAXPATHLEN]; +bool tempfname_initialized = false; char outhdrname[MAXPATHLEN] ; /* user-supplied header for *.mk */ char *objprefix; /* where are the objects ? */ char *path_make; @@ -216,6 +220,7 @@ main(int argc, char **argv) snprintf(cachename, sizeof(cachename), "%s.cache", confname); snprintf(tempfname, sizeof(tempfname), "%s/crunchgen_%sXXXXXX", getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP, confname); + tempfname_initialized = false; parse_conf_file(); if (list_mode) @@ -648,8 +653,7 @@ fillin_program(prog_t *p) /* Determine the actual srcdir (maybe symlinked). */ if (p->srcdir) { - snprintf(line, MAXLINELEN, "cd %s && echo -n `/bin/pwd`", - p->srcdir); + snprintf(line, MAXLINELEN, "cd %s && pwd", p->srcdir); f = popen(line,"r"); if (!f) errx(1, "Can't execute: %s\n", line); @@ -721,14 +725,26 @@ fillin_program_objs(prog_t *p, char *path) /* discover the objs from the srcdir Makefile */ - if ((fd = mkstemp(tempfname)) == -1) { - perror(tempfname); - exit(1); + /* + * We reuse the same temporary file name for multiple objects. However, + * some libc implementations (such as glibc) return EINVAL if there + * are no XXXXX characters in the template. This happens after the + * first call to mkstemp since the argument is modified in-place. + * To avoid this error we use open() instead of mkstemp() after the + * call to mkstemp(). + */ + if (tempfname_initialized) { + if ((fd = open(tempfname, O_CREAT | O_EXCL | O_RDWR, 0600)) == -1) { + err(EX_OSERR, "open(%s)", tempfname); + } + } else if ((fd = mkstemp(tempfname)) == -1) { + err(EX_OSERR, "mkstemp(%s)", tempfname); } + tempfname_initialized = true; if ((f = fdopen(fd, "w")) == NULL) { - warn("%s", tempfname); + warn("fdopen(%s)", tempfname); goterror = 1; - return; + goto out; } if (p->objvar) objvar = p->objvar; @@ -763,14 +779,14 @@ fillin_program_objs(prog_t *p, char *path) if ((f = popen(line, "r")) == NULL) { warn("submake pipe"); goterror = 1; - return; + goto out; } while(fgets(line, MAXLINELEN, f)) { if (strncmp(line, "OBJS= ", 6)) { warnx("make error: %s", line); goterror = 1; - continue; + goto out; } cp = line + 6; @@ -793,7 +809,7 @@ fillin_program_objs(prog_t *p, char *path) warnx("make error: make returned %d", rc); goterror = 1; } - +out: unlink(tempfname); } From owner-svn-src-all@freebsd.org Wed Aug 12 15:49:12 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D6D983A3FF9; Wed, 12 Aug 2020 15:49:12 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BRYzD3q2Bz44BR; Wed, 12 Aug 2020 15:49:12 +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 5FD95E396; Wed, 12 Aug 2020 15:49:11 +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 07CFnB4b065767; Wed, 12 Aug 2020 15:49:11 GMT (envelope-from arichardson@FreeBSD.org) Received: (from arichardson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07CFnB3s065766; Wed, 12 Aug 2020 15:49:11 GMT (envelope-from arichardson@FreeBSD.org) Message-Id: <202008121549.07CFnB3s065766@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arichardson set sender to arichardson@FreeBSD.org using -f From: Alex Richardson Date: Wed, 12 Aug 2020 15:49:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364167 - head/stand/common X-SVN-Group: head X-SVN-Commit-Author: arichardson X-SVN-Commit-Paths: head/stand/common X-SVN-Commit-Revision: 364167 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2020 15:49:13 -0000 Author: arichardson Date: Wed Aug 12 15:49:10 2020 New Revision: 364167 URL: https://svnweb.freebsd.org/changeset/base/364167 Log: Fix stand/newvers.sh with zsh in sh mode When building on macOS with sh==zsh, newvers.sh was producing an unterminated string literal due to \\n being turned as a newline. Fix this by using a here document instead. Reviewed By: imp Differential Revision: https://reviews.freebsd.org/D26036 Modified: head/stand/common/newvers.sh Modified: head/stand/common/newvers.sh ============================================================================== --- head/stand/common/newvers.sh Wed Aug 12 15:49:06 2020 (r364166) +++ head/stand/common/newvers.sh Wed Aug 12 15:49:10 2020 (r364167) @@ -55,6 +55,8 @@ if [ -n "${include_metadata}" ]; then bootprog_info="$bootprog_info(${t} ${u}@${h})\\n" fi -echo "char bootprog_info[] = \"$bootprog_info\";" > $tempfile -echo "unsigned bootprog_rev = ${r%%.*}${r##*.};" >> $tempfile +cat > $tempfile < Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DBA633A4C8B; Wed, 12 Aug 2020 16:08:45 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BRZPn425jz45Q8; Wed, 12 Aug 2020 16:08:45 +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 6AC2BE920; Wed, 12 Aug 2020 16:08:45 +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 07CG8jqF077770; Wed, 12 Aug 2020 16:08:45 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07CG8jvd077769; Wed, 12 Aug 2020 16:08:45 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202008121608.07CG8jvd077769@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 12 Aug 2020 16:08:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364168 - head/sys/compat/linprocfs X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/compat/linprocfs X-SVN-Commit-Revision: 364168 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2020 16:08:45 -0000 Author: markj Date: Wed Aug 12 16:08:44 2020 New Revision: 364168 URL: https://svnweb.freebsd.org/changeset/base/364168 Log: linprocfs: Fix some inaccuracies in meminfo. - Fill out MemFree correctly. Delete an ancient comment suggesting that we don't want to advertise the true quantity of free memory. - Populate the Buffers field by reading vfs.bufspace. - The page cache consists of all pages in page queues, not just the inactive queue. PR: 248463 Reported and tested by: danfe MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/sys/compat/linprocfs/linprocfs.c Modified: head/sys/compat/linprocfs/linprocfs.c ============================================================================== --- head/sys/compat/linprocfs/linprocfs.c Wed Aug 12 15:49:10 2020 (r364167) +++ head/sys/compat/linprocfs/linprocfs.c Wed Aug 12 16:08:44 2020 (r364168) @@ -145,41 +145,35 @@ static int linprocfs_domeminfo(PFS_FILL_ARGS) { unsigned long memtotal; /* total memory in bytes */ - unsigned long memused; /* used memory in bytes */ unsigned long memfree; /* free memory in bytes */ - unsigned long buffers, cached; /* buffer / cache memory ??? */ + unsigned long cached; /* page cache */ + unsigned long buffers; /* buffer cache */ unsigned long long swaptotal; /* total swap space in bytes */ unsigned long long swapused; /* used swap space in bytes */ unsigned long long swapfree; /* free swap space in bytes */ - int i, j; + size_t sz; + int error, i, j; memtotal = physmem * PAGE_SIZE; - /* - * The correct thing here would be: - * - memfree = vm_free_count() * PAGE_SIZE; - memused = memtotal - memfree; - * - * but it might mislead linux binaries into thinking there - * is very little memory left, so we cheat and tell them that - * all memory that isn't wired down is free. - */ - memused = vm_wire_count() * PAGE_SIZE; - memfree = memtotal - memused; + memfree = (unsigned long)vm_free_count() * PAGE_SIZE; swap_pager_status(&i, &j); swaptotal = (unsigned long long)i * PAGE_SIZE; swapused = (unsigned long long)j * PAGE_SIZE; swapfree = swaptotal - swapused; + /* - * We'd love to be able to write: - * - buffers = bufspace; - * - * but bufspace is internal to vfs_bio.c and we don't feel - * like unstaticizing it just for linprocfs's sake. + * This value may exclude wired pages, but we have no good way of + * accounting for that. */ - buffers = 0; - cached = vm_inactive_count() * PAGE_SIZE; + cached = + (vm_active_count() + vm_inactive_count() + vm_laundry_count()) * + PAGE_SIZE; + + sz = sizeof(buffers); + error = kernel_sysctlbyname(curthread, "vfs.bufspace", &buffers, &sz, + NULL, 0, 0, 0); + if (error != 0) + buffers = 0; sbuf_printf(sb, "MemTotal: %9lu kB\n" From owner-svn-src-all@freebsd.org Wed Aug 12 16:10:40 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 51F6A3A4CA4; Wed, 12 Aug 2020 16:10:40 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4BRZRz6zwnz45gb; Wed, 12 Aug 2020 16:10:39 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id 07CGAcXL038792; Wed, 12 Aug 2020 09:10:38 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id 07CGAcm0038791; Wed, 12 Aug 2020 09:10:38 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <202008121610.07CGAcm0038791@gndrsh.dnsmgr.net> Subject: Re: svn commit: r364166 - head/usr.sbin/crunch/crunchgen In-Reply-To: <202008121549.07CFn6ED065712@repo.freebsd.org> To: Alex Richardson Date: Wed, 12 Aug 2020 09:10:38 -0700 (PDT) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 4BRZRz6zwnz45gb X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; ASN(0.00)[asn:13868, ipnet:69.59.192.0/19, country:US]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2020 16:10:40 -0000 [ Charset UTF-8 unsupported, converting... ] > Author: arichardson > Date: Wed Aug 12 15:49:06 2020 > New Revision: 364166 > URL: https://svnweb.freebsd.org/changeset/base/364166 > > Log: > Fix crunchgen usage of mkstemp() > > On Glibc systems mkstemp can only be used once with the same template > string since it will be modified in-place and no longer contain any 'X' chars. > It is fine to reuse the same file here but we need to be explicit and use > open() instead of mkstemp() on the second use. > > While touching this file also avoid a hardcoded /bin/pwd since that may not > work when building on non-FreeBSD systems. This may cause some grief, as now pwd may use a shell builtin and often shell builtin's return a cwd that is not a true full path, ie it may contain symlink compontents in the path. /bin/sh: # cd /tmp/b # /bin/pwd /tmp/a # pwd /tmp/b # ls -lag /tmp/? lrwxr-xr-x 1 root wheel 1 Aug 12 16:06 /tmp/b -> a /tmp/a: total 17 drwxr-xr-x 2 root wheel 2 Aug 12 16:06 . drwxrwxrwt 18 root wheel 248 Aug 12 16:06 .. > > Reviewed By: brooks > Differential Revision: https://reviews.freebsd.org/D25990 > > Modified: > head/usr.sbin/crunch/crunchgen/crunchgen.c > > Modified: head/usr.sbin/crunch/crunchgen/crunchgen.c > ============================================================================== > --- head/usr.sbin/crunch/crunchgen/crunchgen.c Wed Aug 12 14:45:31 2020 (r364165) > +++ head/usr.sbin/crunch/crunchgen/crunchgen.c Wed Aug 12 15:49:06 2020 (r364166) > @@ -39,10 +39,13 @@ __FBSDID("$FreeBSD$"); > > #include > #include > +#include > #include > +#include > #include > #include > #include > +#include > #include > > #define CRUNCH_VERSION "0.2" > @@ -91,6 +94,7 @@ prog_t *progs = NULL; > char confname[MAXPATHLEN], infilename[MAXPATHLEN]; > char outmkname[MAXPATHLEN], outcfname[MAXPATHLEN], execfname[MAXPATHLEN]; > char tempfname[MAXPATHLEN], cachename[MAXPATHLEN], curfilename[MAXPATHLEN]; > +bool tempfname_initialized = false; > char outhdrname[MAXPATHLEN] ; /* user-supplied header for *.mk */ > char *objprefix; /* where are the objects ? */ > char *path_make; > @@ -216,6 +220,7 @@ main(int argc, char **argv) > snprintf(cachename, sizeof(cachename), "%s.cache", confname); > snprintf(tempfname, sizeof(tempfname), "%s/crunchgen_%sXXXXXX", > getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP, confname); > + tempfname_initialized = false; > > parse_conf_file(); > if (list_mode) > @@ -648,8 +653,7 @@ fillin_program(prog_t *p) > > /* Determine the actual srcdir (maybe symlinked). */ > if (p->srcdir) { > - snprintf(line, MAXLINELEN, "cd %s && echo -n `/bin/pwd`", > - p->srcdir); > + snprintf(line, MAXLINELEN, "cd %s && pwd", p->srcdir); > f = popen(line,"r"); > if (!f) > errx(1, "Can't execute: %s\n", line); > @@ -721,14 +725,26 @@ fillin_program_objs(prog_t *p, char *path) > > /* discover the objs from the srcdir Makefile */ > > - if ((fd = mkstemp(tempfname)) == -1) { > - perror(tempfname); > - exit(1); > + /* > + * We reuse the same temporary file name for multiple objects. However, > + * some libc implementations (such as glibc) return EINVAL if there > + * are no XXXXX characters in the template. This happens after the > + * first call to mkstemp since the argument is modified in-place. > + * To avoid this error we use open() instead of mkstemp() after the > + * call to mkstemp(). > + */ > + if (tempfname_initialized) { > + if ((fd = open(tempfname, O_CREAT | O_EXCL | O_RDWR, 0600)) == -1) { > + err(EX_OSERR, "open(%s)", tempfname); > + } > + } else if ((fd = mkstemp(tempfname)) == -1) { > + err(EX_OSERR, "mkstemp(%s)", tempfname); > } > + tempfname_initialized = true; > if ((f = fdopen(fd, "w")) == NULL) { > - warn("%s", tempfname); > + warn("fdopen(%s)", tempfname); > goterror = 1; > - return; > + goto out; > } > if (p->objvar) > objvar = p->objvar; > @@ -763,14 +779,14 @@ fillin_program_objs(prog_t *p, char *path) > if ((f = popen(line, "r")) == NULL) { > warn("submake pipe"); > goterror = 1; > - return; > + goto out; > } > > while(fgets(line, MAXLINELEN, f)) { > if (strncmp(line, "OBJS= ", 6)) { > warnx("make error: %s", line); > goterror = 1; > - continue; > + goto out; > } > > cp = line + 6; > @@ -793,7 +809,7 @@ fillin_program_objs(prog_t *p, char *path) > warnx("make error: make returned %d", rc); > goterror = 1; > } > - > +out: > unlink(tempfname); > } > > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Wed Aug 12 16:16:18 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7746C3A4947; Wed, 12 Aug 2020 16:16:18 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BRZZV2Wmdz464y; Wed, 12 Aug 2020 16:16:18 +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 35AB8EAA2; Wed, 12 Aug 2020 16:16:18 +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 07CGGI8u084007; Wed, 12 Aug 2020 16:16:18 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07CGGIoU084006; Wed, 12 Aug 2020 16:16:18 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202008121616.07CGGIoU084006@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 12 Aug 2020 16:16: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: r364169 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364169 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2020 16:16:18 -0000 Author: mav Date: Wed Aug 12 16:16:17 2020 New Revision: 364169 URL: https://svnweb.freebsd.org/changeset/base/364169 Log: MFC r356321 (by markj): Take the ifnet's address lock in igmp_v3_cancel_link_timers(). inm_rele_locked() may remove the multicast address associated with inm. Modified: stable/12/sys/netinet/igmp.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/igmp.c ============================================================================== --- stable/12/sys/netinet/igmp.c Wed Aug 12 16:08:44 2020 (r364168) +++ stable/12/sys/netinet/igmp.c Wed Aug 12 16:16:17 2020 (r364169) @@ -1986,7 +1986,7 @@ igmp_set_version(struct igmp_ifsoftc *igi, const int v static void igmp_v3_cancel_link_timers(struct igmp_ifsoftc *igi) { - struct ifmultiaddr *ifma; + struct ifmultiaddr *ifma, *ifmatmp; struct ifnet *ifp; struct in_multi *inm; struct in_multi_head inm_free_tmp; @@ -2010,8 +2010,8 @@ igmp_v3_cancel_link_timers(struct igmp_ifsoftc *igi) * for all memberships scoped to this link. */ ifp = igi->igi_ifp; - IF_ADDR_RLOCK(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + IF_ADDR_WLOCK(ifp); + CK_STAILQ_FOREACH_SAFE(ifma, &ifp->if_multiaddrs, ifma_link, ifmatmp) { if (ifma->ifma_addr->sa_family != AF_INET || ifma->ifma_protospec == NULL) continue; @@ -2055,7 +2055,7 @@ igmp_v3_cancel_link_timers(struct igmp_ifsoftc *igi) inm->inm_timer = 0; mbufq_drain(&inm->inm_scq); } - IF_ADDR_RUNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); inm_release_list_deferred(&inm_free_tmp); } From owner-svn-src-all@freebsd.org Wed Aug 12 16:19:13 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F17413A48F1 for ; Wed, 12 Aug 2020 16:19:13 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BRZdr2zMJz46F3 for ; Wed, 12 Aug 2020 16:19:12 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wm1-f49.google.com with SMTP id g8so2283239wmk.3 for ; Wed, 12 Aug 2020 09:19:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=Oh5LIFHNxMbIWKKM12807jQt1Vox5W2OFYkydDDTJTI=; b=A56sSp59/Jc4TQ3HR/BVZtl8LQFCN1fXE8VJVl1ia66S3bujIpjTz3uShOUkpa4Qxn lVxNY98ZSehWyGf1PhqHaLKp06hvM6oVMDjduSP2uuXXEs5Q+wcHWRvzlh9D2OLfl83K Wh7ardO80feKiCIJuMJVIQuh1VpcJawHByfcVtAZvpJ3d5xmCSfz75SF3hc9Oo9Ohifu UsSau3X1XAWSy2FJnxItCNNGVRLaHapWhYhdU7IozfAl76PPRNjBQ9DeEGFH5zjMVe/8 hhf+cmxpkTtXdCol9sjBZzQhNf+h+3bE/wNbgCe5UIZkOdRmRgVxYmQfjIyoo+O2tWQG AlyQ== X-Gm-Message-State: AOAM533T3YVBaROgqV5pAMFz3RQ45M0Q9HVX43gkECt6pkmCOafprM93 0LQA7mkV1lZbUnip5/30nJAj3/PA+p6d8Q== X-Google-Smtp-Source: ABdhPJwPFEf2EBAaAoZsPVfUPbGIV2hgvsmO3LiCuVy/UajdF+EEkmiiaUE+uJojFm2MOVhWOCwkEw== X-Received: by 2002:a7b:c056:: with SMTP id u22mr451801wmc.188.1597249150795; Wed, 12 Aug 2020 09:19:10 -0700 (PDT) Received: from [192.168.149.251] (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id 6sm4522020wmf.4.2020.08.12.09.19.09 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Aug 2020 09:19:10 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.1\)) Subject: Re: svn commit: r364166 - head/usr.sbin/crunch/crunchgen From: Jessica Clarke In-Reply-To: <202008121610.07CGAcm0038791@gndrsh.dnsmgr.net> Date: Wed, 12 Aug 2020 17:19:02 +0100 Cc: Alex Richardson , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <32E49245-77B0-4E61-A483-9F7B34D939B7@freebsd.org> References: <202008121610.07CGAcm0038791@gndrsh.dnsmgr.net> To: rgrimes@freebsd.org X-Mailer: Apple Mail (2.3608.120.23.2.1) X-Rspamd-Queue-Id: 4BRZdr2zMJz46F3 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of jrtc27@jrtc27.com designates 209.85.128.49 as permitted sender) smtp.mailfrom=jrtc27@jrtc27.com X-Spamd-Result: default: False [-1.61 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; MV_CASE(0.50)[]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-all@freebsd.org]; DMARC_NA(0.00)[freebsd.org]; RCPT_COUNT_FIVE(0.00)[5]; NEURAL_HAM_LONG(-1.02)[-1.020]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-0.05)[-0.047]; RCVD_IN_DNSWL_NONE(0.00)[209.85.128.49:from]; NEURAL_HAM_MEDIUM(-1.04)[-1.039]; FORGED_SENDER(0.30)[jrtc27@freebsd.org,jrtc27@jrtc27.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.128.49:from]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[jrtc27@freebsd.org,jrtc27@jrtc27.com]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2020 16:19:14 -0000 On 12 Aug 2020, at 17:10, Rodney W. Grimes = wrote: >=20 > [ Charset UTF-8 unsupported, converting... ] >> Author: arichardson >> Date: Wed Aug 12 15:49:06 2020 >> New Revision: 364166 >> URL: https://svnweb.freebsd.org/changeset/base/364166 >>=20 >> Log: >> Fix crunchgen usage of mkstemp() >>=20 >> On Glibc systems mkstemp can only be used once with the same = template >> string since it will be modified in-place and no longer contain any = 'X' chars. >> It is fine to reuse the same file here but we need to be explicit = and use >> open() instead of mkstemp() on the second use. >>=20 >> While touching this file also avoid a hardcoded /bin/pwd since that = may not >> work when building on non-FreeBSD systems. >=20 > This may cause some grief, as now pwd may use a shell builtin > and often shell builtin's return a cwd that is not a true > full path, ie it may contain symlink compontents in the > path. >=20 > /bin/sh: >=20 > # cd /tmp/b > # /bin/pwd > /tmp/a > # pwd > /tmp/b > # ls -lag /tmp/? > lrwxr-xr-x 1 root wheel 1 Aug 12 16:06 /tmp/b -> a >=20 > /tmp/a: > total 17 > drwxr-xr-x 2 root wheel 2 Aug 12 16:06 . > drwxrwxrwt 18 root wheel 248 Aug 12 16:06 .. There's the question of whether that really matters; both values are in some sense correct. But if you want to restore the old behaviour, I believe `env pwd` is the portable way to do so? Jess From owner-svn-src-all@freebsd.org Wed Aug 12 16:24:31 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DAB533A4EE1; Wed, 12 Aug 2020 16:24:31 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4BRZlz3FXnz46XB; Wed, 12 Aug 2020 16:24:31 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id 07CGOTAb038879; Wed, 12 Aug 2020 09:24:29 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id 07CGOTnt038878; Wed, 12 Aug 2020 09:24:29 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <202008121624.07CGOTnt038878@gndrsh.dnsmgr.net> Subject: Re: svn commit: r364166 - head/usr.sbin/crunch/crunchgen In-Reply-To: <32E49245-77B0-4E61-A483-9F7B34D939B7@freebsd.org> To: Jessica Clarke Date: Wed, 12 Aug 2020 09:24:29 -0700 (PDT) CC: rgrimes@freebsd.org, Alex Richardson , 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: 4BRZlz3FXnz46XB X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:13868, ipnet:69.59.192.0/19, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2020 16:24:31 -0000 > On 12 Aug 2020, at 17:10, Rodney W. Grimes wrote: > > > >> Author: arichardson > >> Date: Wed Aug 12 15:49:06 2020 > >> New Revision: 364166 > >> URL: https://svnweb.freebsd.org/changeset/base/364166 > >> > >> Log: > >> Fix crunchgen usage of mkstemp() > >> > >> On Glibc systems mkstemp can only be used once with the same template > >> string since it will be modified in-place and no longer contain any 'X' chars. > >> It is fine to reuse the same file here but we need to be explicit and use > >> open() instead of mkstemp() on the second use. > >> > >> While touching this file also avoid a hardcoded /bin/pwd since that may not > >> work when building on non-FreeBSD systems. > > > > This may cause some grief, as now pwd may use a shell builtin > > and often shell builtin's return a cwd that is not a true > > full path, ie it may contain symlink compontents in the > > path. > > > > /bin/sh: > > > > # cd /tmp/b > > # /bin/pwd > > /tmp/a > > # pwd > > /tmp/b > > # ls -lag /tmp/? > > lrwxr-xr-x 1 root wheel 1 Aug 12 16:06 /tmp/b -> a > > > > /tmp/a: > > total 17 > > drwxr-xr-x 2 root wheel 2 Aug 12 16:06 . > > drwxrwxrwt 18 root wheel 248 Aug 12 16:06 .. > > There's the question of whether that really matters; both values are in > some sense correct. But if you want to restore the old behaviour, I > believe `env pwd` is the portable way to do so? You have cut the context, but the code has a comment that states it is doing this to remove symbolic links, so this change infact undoes something that was being done intentionally. I do believe also that a "env pwd" would do the right thing as well. -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Wed Aug 12 16:43:21 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 919973A5AC4; Wed, 12 Aug 2020 16:43:21 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BRb9j3MSDz48FJ; Wed, 12 Aug 2020 16:43:21 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 569A2F011; Wed, 12 Aug 2020 16:43:21 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07CGhLAg002598; Wed, 12 Aug 2020 16:43:21 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07CGhLJ7002597; Wed, 12 Aug 2020 16:43:21 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <202008121643.07CGhLJ7002597@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Wed, 12 Aug 2020 16:43:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364172 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 364172 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2020 16:43:21 -0000 Author: mhorne Date: Wed Aug 12 16:43:20 2020 New Revision: 364172 URL: https://svnweb.freebsd.org/changeset/base/364172 Log: Correctly set error in rt_mpath_unlink It is possible for rn_delete() to return NULL. If this happens, then set *perror to ESRCH, as is done in the rest of the function. Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D25871 Modified: head/sys/net/route.c Modified: head/sys/net/route.c ============================================================================== --- head/sys/net/route.c Wed Aug 12 16:30:33 2020 (r364171) +++ head/sys/net/route.c Wed Aug 12 16:43:20 2020 (r364172) @@ -1107,7 +1107,11 @@ rt_mpath_unlink(struct rib_head *rnh, struct rt_addrin rn = rnh->rnh_deladdr(info->rti_info[RTAX_DST], info->rti_info[RTAX_NETMASK], &rnh->head); - *perror = 0; + if (rn != NULL) { + *perror = 0; + } else { + *perror = ESRCH; + } return (rn); } From owner-svn-src-all@freebsd.org Wed Aug 12 17:27:25 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 13F0F3A6C1B; Wed, 12 Aug 2020 17:27:25 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BRc8X6h5Zz4Blw; Wed, 12 Aug 2020 17:27:24 +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 C89CBF818; Wed, 12 Aug 2020 17:27:24 +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 07CHROnd027745; Wed, 12 Aug 2020 17:27:24 GMT (envelope-from arichardson@FreeBSD.org) Received: (from arichardson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07CHRO1c027744; Wed, 12 Aug 2020 17:27:24 GMT (envelope-from arichardson@FreeBSD.org) Message-Id: <202008121727.07CHRO1c027744@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arichardson set sender to arichardson@FreeBSD.org using -f From: Alex Richardson Date: Wed, 12 Aug 2020 17:27:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364174 - head/usr.sbin/crunch/crunchgen X-SVN-Group: head X-SVN-Commit-Author: arichardson X-SVN-Commit-Paths: head/usr.sbin/crunch/crunchgen X-SVN-Commit-Revision: 364174 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2020 17:27:25 -0000 Author: arichardson Date: Wed Aug 12 17:27:24 2020 New Revision: 364174 URL: https://svnweb.freebsd.org/changeset/base/364174 Log: Use env pwd instead of pwd in crunchgen.c In r364166 I changed /bin/pwd to pwd, but pwd can be shell builtin that may not correctly return a real path. To ensure that all symlinks are resolved use `env pwd -P` instead (the -P flag is part of POSIX so should be supported everywhere). Reported By: rgrimes Suggested By: jrtc27 Modified: head/usr.sbin/crunch/crunchgen/crunchgen.c Modified: head/usr.sbin/crunch/crunchgen/crunchgen.c ============================================================================== --- head/usr.sbin/crunch/crunchgen/crunchgen.c Wed Aug 12 17:16:26 2020 (r364173) +++ head/usr.sbin/crunch/crunchgen/crunchgen.c Wed Aug 12 17:27:24 2020 (r364174) @@ -653,7 +653,7 @@ fillin_program(prog_t *p) /* Determine the actual srcdir (maybe symlinked). */ if (p->srcdir) { - snprintf(line, MAXLINELEN, "cd %s && pwd", p->srcdir); + snprintf(line, MAXLINELEN, "cd %s && env pwd -P", p->srcdir); f = popen(line,"r"); if (!f) errx(1, "Can't execute: %s\n", line); From owner-svn-src-all@freebsd.org Wed Aug 12 18:35:22 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 05AD23A7CFC; Wed, 12 Aug 2020 18:35:22 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BRdfx6TJTz4Fxv; Wed, 12 Aug 2020 18:35:21 +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 C2B07106AC; Wed, 12 Aug 2020 18:35:21 +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 07CIZLMn072707; Wed, 12 Aug 2020 18:35:21 GMT (envelope-from gnn@FreeBSD.org) Received: (from gnn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07CIZLUR072706; Wed, 12 Aug 2020 18:35:21 GMT (envelope-from gnn@FreeBSD.org) Message-Id: <202008121835.07CIZLUR072706@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gnn set sender to gnn@FreeBSD.org using -f From: "George V. Neville-Neil" Date: Wed, 12 Aug 2020 18:35:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org Subject: svn commit: r364175 - svnadmin/conf X-SVN-Group: svnadmin X-SVN-Commit-Author: gnn X-SVN-Commit-Paths: svnadmin/conf X-SVN-Commit-Revision: 364175 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2020 18:35:22 -0000 Author: gnn Date: Wed Aug 12 18:35:21 2020 New Revision: 364175 URL: https://svnweb.freebsd.org/changeset/base/364175 Log: Restore Qing Li's commit bit gnn to rementor Approved by: core@ Modified: svnadmin/conf/access Modified: svnadmin/conf/access ============================================================================== --- svnadmin/conf/access Wed Aug 12 17:27:24 2020 (r364174) +++ svnadmin/conf/access Wed Aug 12 18:35:21 2020 (r364175) @@ -162,6 +162,7 @@ pjd pkelsey pluknet pstef +qingli ram ray rew From owner-svn-src-all@freebsd.org Wed Aug 12 18:45:37 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C94203A7DB5; Wed, 12 Aug 2020 18:45:37 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BRdtn4hV9z4GXt; Wed, 12 Aug 2020 18:45:37 +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 8088D104C4; Wed, 12 Aug 2020 18:45:37 +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 07CIjbPn078575; Wed, 12 Aug 2020 18:45:37 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07CIjbvT078573; Wed, 12 Aug 2020 18:45:37 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202008121845.07CIjbvT078573@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 12 Aug 2020 18:45:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364176 - head/sys/riscv/include X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/riscv/include X-SVN-Commit-Revision: 364176 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2020 18:45:37 -0000 Author: jhb Date: Wed Aug 12 18:45:36 2020 New Revision: 364176 URL: https://svnweb.freebsd.org/changeset/base/364176 Log: Correct padding length for RISC-V PCPU data. There was an additional 7 bytes of compiler-inserted padding at the end of the structure visible via 'ptype /o' in gdb. Reviewed by: mhorne Obtained from: CheriBSD Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D25867 Modified: head/sys/riscv/include/pcpu.h head/sys/riscv/include/pcpu_aux.h Modified: head/sys/riscv/include/pcpu.h ============================================================================== --- head/sys/riscv/include/pcpu.h Wed Aug 12 18:35:21 2020 (r364175) +++ head/sys/riscv/include/pcpu.h Wed Aug 12 18:45:36 2020 (r364176) @@ -48,7 +48,7 @@ struct pmap *pc_curpmap; /* Currently active pmap */ \ uint32_t pc_pending_ipis; /* IPIs pending to this CPU */ \ uint32_t pc_hart; /* Hart ID */ \ - char __pad[49] + char __pad[56] /* Pad to factor of PAGE_SIZE */ #ifdef _KERNEL Modified: head/sys/riscv/include/pcpu_aux.h ============================================================================== --- head/sys/riscv/include/pcpu_aux.h Wed Aug 12 18:35:21 2020 (r364175) +++ head/sys/riscv/include/pcpu_aux.h Wed Aug 12 18:45:36 2020 (r364176) @@ -46,6 +46,9 @@ * be a multiple of the size of struct pcpu. */ _Static_assert(PAGE_SIZE % sizeof(struct pcpu) == 0, "fix pcpu size"); +_Static_assert(offsetof(struct pcpu, __pad) + + sizeof(((struct pcpu *)0)->__pad) == sizeof(struct pcpu), + "fix pcpu padding"); extern struct pcpu __pcpu[]; From owner-svn-src-all@freebsd.org Wed Aug 12 19:11:54 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 293FB3A847A; Wed, 12 Aug 2020 19:11:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BRfT60DVvz4HPd; Wed, 12 Aug 2020 19:11:54 +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 E003B108D5; Wed, 12 Aug 2020 19:11:53 +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 07CJBrYH094653; Wed, 12 Aug 2020 19:11:53 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07CJBri1094652; Wed, 12 Aug 2020 19:11:53 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202008121911.07CJBri1094652@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 12 Aug 2020 19:11:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364177 - head/sys/dev/nvd X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/dev/nvd X-SVN-Commit-Revision: 364177 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2020 19:11:54 -0000 Author: mav Date: Wed Aug 12 19:11:53 2020 New Revision: 364177 URL: https://svnweb.freebsd.org/changeset/base/364177 Log: Report attachment for nvd same as reported for nda. MFC after: 1 week Modified: head/sys/dev/nvd/nvd.c Modified: head/sys/dev/nvd/nvd.c ============================================================================== --- head/sys/dev/nvd/nvd.c Wed Aug 12 18:45:36 2020 (r364176) +++ head/sys/dev/nvd/nvd.c Wed Aug 12 19:11:53 2020 (r364177) @@ -3,7 +3,7 @@ * * Copyright (C) 2012-2016 Intel Corporation * All rights reserved. - * Copyright (C) 2018 Alexander Motin + * Copyright (C) 2018-2020 Alexander Motin * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -45,7 +45,10 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include + #define NVD_STR "nvd" struct nvd_disk; @@ -92,7 +95,7 @@ struct nvd_disk { }; struct nvd_controller { - + struct nvme_controller *ctrlr; TAILQ_ENTRY(nvd_controller) tailq; TAILQ_HEAD(, nvd_disk) disk_head; }; @@ -401,6 +404,7 @@ nvd_new_controller(struct nvme_controller *ctrlr) nvd_ctrlr = malloc(sizeof(struct nvd_controller), M_NVD, M_ZERO | M_WAITOK); + nvd_ctrlr->ctrlr = ctrlr; TAILQ_INIT(&nvd_ctrlr->disk_head); mtx_lock(&nvd_lock); TAILQ_INSERT_TAIL(&ctrlr_head, nvd_ctrlr, tailq); @@ -416,6 +420,7 @@ nvd_new_disk(struct nvme_namespace *ns, void *ctrlr_ar struct nvd_disk *ndisk, *tnd; struct disk *disk; struct nvd_controller *ctrlr = ctrlr_arg; + device_t dev = ctrlr->ctrlr->dev; int unit; ndisk = malloc(sizeof(struct nvd_disk), M_NVD, M_ZERO | M_WAITOK); @@ -479,7 +484,13 @@ nvd_new_disk(struct nvme_namespace *ns, void *ctrlr_ar NVME_MODEL_NUMBER_LENGTH); strlcpy(disk->d_descr, descr, sizeof(descr)); + disk->d_hba_vendor = pci_get_vendor(dev); + disk->d_hba_device = pci_get_device(dev); + disk->d_hba_subvendor = pci_get_subvendor(dev); + disk->d_hba_subdevice = pci_get_subdevice(dev); disk->d_rotation_rate = DISK_RR_NON_ROTATING; + strlcpy(disk->d_attachment, device_get_nameunit(dev), + sizeof(disk->d_attachment)); disk_create(disk, DISK_VERSION); From owner-svn-src-all@freebsd.org Wed Aug 12 19:37:58 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 822123A9044; Wed, 12 Aug 2020 19:37:58 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BRg3B2vPlz4JgP; Wed, 12 Aug 2020 19:37:58 +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 47A7910F30; Wed, 12 Aug 2020 19:37:58 +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 07CJbwSu009712; Wed, 12 Aug 2020 19:37:58 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07CJbwp4009711; Wed, 12 Aug 2020 19:37:58 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202008121937.07CJbwp4009711@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 12 Aug 2020 19:37:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364178 - head/sys/cam/nvme X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/cam/nvme X-SVN-Commit-Revision: 364178 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2020 19:37:58 -0000 Author: mav Date: Wed Aug 12 19:37:57 2020 New Revision: 364178 URL: https://svnweb.freebsd.org/changeset/base/364178 Log: Report proper stripesize for nda(4). Same as for nvd(4) report NPWG if present, otherise NOIOB. MFC after: 1 week Modified: head/sys/cam/nvme/nvme_da.c Modified: head/sys/cam/nvme/nvme_da.c ============================================================================== --- head/sys/cam/nvme/nvme_da.c Wed Aug 12 19:11:53 2020 (r364177) +++ head/sys/cam/nvme/nvme_da.c Wed Aug 12 19:37:57 2020 (r364178) @@ -943,7 +943,11 @@ ndaregister(struct cam_periph *periph, void *arg) disk->d_hba_subdevice = cpi.hba_subdevice; snprintf(disk->d_attachment, sizeof(disk->d_attachment), "%s%d", cpi.dev_name, cpi.unit_number); - disk->d_stripesize = disk->d_sectorsize; + if (((nsd->nsfeat >> NVME_NS_DATA_NSFEAT_NPVALID_SHIFT) & + NVME_NS_DATA_NSFEAT_NPVALID_MASK) != 0 && nsd->npwg != 0) + disk->d_stripesize = ((nsd->npwg + 1) * disk->d_sectorsize); + else + disk->d_stripesize = nsd->noiob * disk->d_sectorsize; disk->d_stripeoffset = 0; disk->d_devstat = devstat_new_entry(periph->periph_name, periph->unit_number, disk->d_sectorsize, From owner-svn-src-all@freebsd.org Wed Aug 12 20:05:43 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E760F3A99A7; Wed, 12 Aug 2020 20:05:43 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BRggC5xCJz4L9J; Wed, 12 Aug 2020 20:05:43 +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 AF33C1161C; Wed, 12 Aug 2020 20:05:43 +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 07CK5hgF028150; Wed, 12 Aug 2020 20:05:43 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07CK5hW3028149; Wed, 12 Aug 2020 20:05:43 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202008122005.07CK5hW3028149@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 12 Aug 2020 20:05:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364179 - head/sys/dev/nvme X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/dev/nvme X-SVN-Commit-Revision: 364179 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2020 20:05:44 -0000 Author: mav Date: Wed Aug 12 20:05:43 2020 New Revision: 364179 URL: https://svnweb.freebsd.org/changeset/base/364179 Log: Report cpi->hba_* for nda(4) because why not. MFC after: 1 week Modified: head/sys/dev/nvme/nvme_sim.c Modified: head/sys/dev/nvme/nvme_sim.c ============================================================================== --- head/sys/dev/nvme/nvme_sim.c Wed Aug 12 19:37:57 2020 (r364178) +++ head/sys/dev/nvme/nvme_sim.c Wed Aug 12 20:05:43 2020 (r364179) @@ -197,8 +197,12 @@ nvme_sim_action(struct cam_sim *sim, union ccb *ccb) cpi->xport_specific.nvme.slot = pci_get_slot(dev); cpi->xport_specific.nvme.function = pci_get_function(dev); cpi->xport_specific.nvme.extra = 0; - strncpy(cpi->xport_specific.nvme.dev_name, device_get_nameunit(ctrlr->dev), + strncpy(cpi->xport_specific.nvme.dev_name, device_get_nameunit(dev), sizeof(cpi->xport_specific.nvme.dev_name)); + cpi->hba_vendor = pci_get_vendor(dev); + cpi->hba_device = pci_get_device(dev); + cpi->hba_subvendor = pci_get_subvendor(dev); + cpi->hba_subdevice = pci_get_subdevice(dev); cpi->ccb_h.status = CAM_REQ_CMP; break; } From owner-svn-src-all@freebsd.org Wed Aug 12 20:29:51 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 361933AA275; Wed, 12 Aug 2020 20:29:51 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BRhC30g28z4M7Y; Wed, 12 Aug 2020 20:29:51 +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 EEE60115D6; Wed, 12 Aug 2020 20:29:50 +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 07CKToC4040613; Wed, 12 Aug 2020 20:29:50 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07CKToG4040610; Wed, 12 Aug 2020 20:29:50 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202008122029.07CKToG4040610@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 12 Aug 2020 20:29:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364180 - in head/sys/riscv: include riscv X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/sys/riscv: include riscv X-SVN-Commit-Revision: 364180 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2020 20:29:51 -0000 Author: jhb Date: Wed Aug 12 20:29:49 2020 New Revision: 364180 URL: https://svnweb.freebsd.org/changeset/base/364180 Log: Use uintptr_t instead of uint64_t for pointers in stack frames. Reviewed by: mhorne Obtained from: CheriBSD Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D25995 Modified: head/sys/riscv/include/stack.h head/sys/riscv/riscv/db_trace.c head/sys/riscv/riscv/stack_machdep.c head/sys/riscv/riscv/unwind.c Modified: head/sys/riscv/include/stack.h ============================================================================== --- head/sys/riscv/include/stack.h Wed Aug 12 20:05:43 2020 (r364179) +++ head/sys/riscv/include/stack.h Wed Aug 12 20:29:49 2020 (r364180) @@ -41,9 +41,9 @@ (va) <= VM_MAX_KERNEL_ADDRESS) struct unwind_state { - uint64_t fp; - uint64_t sp; - uint64_t pc; + uintptr_t fp; + uintptr_t sp; + uintptr_t pc; }; int unwind_frame(struct unwind_state *); Modified: head/sys/riscv/riscv/db_trace.c ============================================================================== --- head/sys/riscv/riscv/db_trace.c Wed Aug 12 20:05:43 2020 (r364179) +++ head/sys/riscv/riscv/db_trace.c Wed Aug 12 20:29:49 2020 (r364180) @@ -108,9 +108,9 @@ db_stack_trace_cmd(struct unwind_state *frame) db_printf("--- exception %ld, tval = %#lx\n", tf->tf_scause & EXCP_MASK, tf->tf_stval); - frame->sp = (uint64_t)tf->tf_sp; - frame->fp = (uint64_t)tf->tf_s[0]; - frame->pc = (uint64_t)tf->tf_sepc; + frame->sp = tf->tf_sp; + frame->fp = tf->tf_s[0]; + frame->pc = tf->tf_sepc; if (!INKERNEL(frame->fp)) break; continue; @@ -132,9 +132,9 @@ db_trace_thread(struct thread *thr, int count) ctx = kdb_thr_ctx(thr); - frame.sp = (uint64_t)ctx->pcb_sp; - frame.fp = (uint64_t)ctx->pcb_s[0]; - frame.pc = (uint64_t)ctx->pcb_ra; + frame.sp = ctx->pcb_sp; + frame.fp = ctx->pcb_s[0]; + frame.pc = ctx->pcb_ra; db_stack_trace_cmd(&frame); return (0); } @@ -143,12 +143,12 @@ void db_trace_self(void) { struct unwind_state frame; - uint64_t sp; + uintptr_t sp; __asm __volatile("mv %0, sp" : "=&r" (sp)); frame.sp = sp; - frame.fp = (uint64_t)__builtin_frame_address(0); - frame.pc = (uint64_t)db_trace_self; + frame.fp = (uintptr_t)__builtin_frame_address(0); + frame.pc = (uintptr_t)db_trace_self; db_stack_trace_cmd(&frame); } Modified: head/sys/riscv/riscv/stack_machdep.c ============================================================================== --- head/sys/riscv/riscv/stack_machdep.c Wed Aug 12 20:05:43 2020 (r364179) +++ head/sys/riscv/riscv/stack_machdep.c Wed Aug 12 20:29:49 2020 (r364180) @@ -86,13 +86,13 @@ void stack_save(struct stack *st) { struct unwind_state frame; - uint64_t sp; + uintptr_t sp; __asm __volatile("mv %0, sp" : "=&r" (sp)); frame.sp = sp; - frame.fp = (uint64_t)__builtin_frame_address(0); - frame.pc = (uint64_t)stack_save; + frame.fp = (uintptr_t)__builtin_frame_address(0); + frame.pc = (uintptr_t)stack_save; stack_capture(st, &frame); } Modified: head/sys/riscv/riscv/unwind.c ============================================================================== --- head/sys/riscv/riscv/unwind.c Wed Aug 12 20:05:43 2020 (r364179) +++ head/sys/riscv/riscv/unwind.c Wed Aug 12 20:29:49 2020 (r364180) @@ -42,7 +42,7 @@ __FBSDID("$FreeBSD$"); int unwind_frame(struct unwind_state *frame) { - uint64_t fp; + uintptr_t fp; fp = frame->fp; @@ -50,8 +50,8 @@ unwind_frame(struct unwind_state *frame) return (-1); frame->sp = fp; - frame->fp = *(uint64_t *)(fp - 16); - frame->pc = *(uint64_t *)(fp - 8) - 4; + frame->fp = ((uintptr_t *)fp)[-2]; + frame->pc = ((uintptr_t *)fp)[-1] - 4; return (0); } From owner-svn-src-all@freebsd.org Wed Aug 12 20:33:29 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CF1D23AA060; Wed, 12 Aug 2020 20:33:29 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BRhHF54n2z4MxC; Wed, 12 Aug 2020 20:33:29 +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 925B711C17; Wed, 12 Aug 2020 20:33:29 +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 07CKXTP4046820; Wed, 12 Aug 2020 20:33:29 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07CKXTIm046819; Wed, 12 Aug 2020 20:33:29 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202008122033.07CKXTIm046819@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 12 Aug 2020 20:33:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364181 - head/sys/riscv/riscv X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/riscv/riscv X-SVN-Commit-Revision: 364181 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2020 20:33:29 -0000 Author: jhb Date: Wed Aug 12 20:33:29 2020 New Revision: 364181 URL: https://svnweb.freebsd.org/changeset/base/364181 Log: Check that the frame pointer is within the current stack. This same check is used on other architectures. Previously this would permit a stack frame to unwind into any arbitrary kernel address (including unmapped addresses). Reviewed by: mhorne Obtained from: CheriBSD Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D25996 Modified: head/sys/riscv/riscv/stack_machdep.c Modified: head/sys/riscv/riscv/stack_machdep.c ============================================================================== --- head/sys/riscv/riscv/stack_machdep.c Wed Aug 12 20:29:49 2020 (r364180) +++ head/sys/riscv/riscv/stack_machdep.c Wed Aug 12 20:33:29 2020 (r364181) @@ -47,15 +47,18 @@ __FBSDID("$FreeBSD$"); #include static void -stack_capture(struct stack *st, struct unwind_state *frame) +stack_capture(struct thread *td, struct stack *st, struct unwind_state *frame) { stack_zero(st); while (1) { + if ((vm_offset_t)frame->fp < td->td_kstack || + (vm_offset_t)frame->fp >= td->td_kstack + + td->td_kstack_pages * PAGE_SIZE) + break; unwind_frame(frame); - if (!INKERNEL((vm_offset_t)frame->fp) || - !INKERNEL((vm_offset_t)frame->pc)) + if (!INKERNEL((vm_offset_t)frame->pc)) break; if (stack_put(st, frame->pc) == -1) break; @@ -78,7 +81,7 @@ stack_save_td(struct stack *st, struct thread *td) frame.fp = td->td_pcb->pcb_s[0]; frame.pc = td->td_pcb->pcb_ra; - stack_capture(st, &frame); + stack_capture(td, st, &frame); return (0); } @@ -94,5 +97,5 @@ stack_save(struct stack *st) frame.fp = (uintptr_t)__builtin_frame_address(0); frame.pc = (uintptr_t)stack_save; - stack_capture(st, &frame); + stack_capture(curthread, st, &frame); } From owner-svn-src-all@freebsd.org Thu Aug 13 00:19:06 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3714B3AEE3D; Thu, 13 Aug 2020 00:19:06 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BRnHZ0hpHz4Xhh; Thu, 13 Aug 2020 00:19:06 +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 EEEB31456F; Thu, 13 Aug 2020 00:19:05 +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 07D0J5h0082767; Thu, 13 Aug 2020 00:19:05 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07D0J5LG082766; Thu, 13 Aug 2020 00:19:05 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <202008130019.07D0J5LG082766@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 13 Aug 2020 00:19:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364182 - in head: etc/mtree lib/liblua X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head: etc/mtree lib/liblua X-SVN-Commit-Revision: 364182 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 13 Aug 2020 00:19:06 -0000 Author: emaste Date: Thu Aug 13 00:19:05 2020 New Revision: 364182 URL: https://svnweb.freebsd.org/changeset/base/364182 Log: flua: initial support for "require" in the base system Use /usr not /usr/local for base system components. Use /usr/lib/flua and /usr/share/flua (not lua) for consistency and to avoid the possibility that other software accidentally finds our base system modules. Also drop the version from the path, as flua represents an unspecified lua version that corresponds to the FreeBSD version it comes with. LUA_USE_DLOPEN is not yet enabled because some additional changes are needed wrt symbol visibility. Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D24605 Modified: head/etc/mtree/BSD.usr.dist head/lib/liblua/luaconf.h Modified: head/etc/mtree/BSD.usr.dist ============================================================================== --- head/etc/mtree/BSD.usr.dist Wed Aug 12 20:33:29 2020 (r364181) +++ head/etc/mtree/BSD.usr.dist Thu Aug 13 00:19:05 2020 (r364182) @@ -68,6 +68,8 @@ .. engines .. + flua + .. i18n .. libxo @@ -369,6 +371,8 @@ .. .. firmware + .. + flua .. games fortune Modified: head/lib/liblua/luaconf.h ============================================================================== --- head/lib/liblua/luaconf.h Wed Aug 12 20:33:29 2020 (r364181) +++ head/lib/liblua/luaconf.h Thu Aug 13 00:19:05 2020 (r364182) @@ -205,9 +205,9 @@ #else /* }{ */ -#define LUA_ROOT "/usr/local/" -#define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR "/" -#define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR "/" +#define LUA_ROOT "/usr/" +#define LUA_LDIR LUA_ROOT "share/flua/" +#define LUA_CDIR LUA_ROOT "lib/flua/" #if !defined(LUA_PATH_DEFAULT) #define LUA_PATH_DEFAULT \ LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \ From owner-svn-src-all@freebsd.org Thu Aug 13 00:40:41 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B0DE33AF0C6; Thu, 13 Aug 2020 00:40:41 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BRnmT4Fpcz4Ywn; Thu, 13 Aug 2020 00:40:41 +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 7595E14962; Thu, 13 Aug 2020 00:40:41 +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 07D0efk0095241; Thu, 13 Aug 2020 00:40:41 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07D0ef9A095240; Thu, 13 Aug 2020 00:40:41 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202008130040.07D0ef9A095240@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 13 Aug 2020 00:40: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: r364183 - stable/12/sys/dev/ahci X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/dev/ahci X-SVN-Commit-Revision: 364183 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 13 Aug 2020 00:40:41 -0000 Author: mav Date: Thu Aug 13 00:40:40 2020 New Revision: 364183 URL: https://svnweb.freebsd.org/changeset/base/364183 Log: MFC r363955: Add Intel Apollo Lake AHCI ID. Modified: stable/12/sys/dev/ahci/ahci_pci.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ahci/ahci_pci.c ============================================================================== --- stable/12/sys/dev/ahci/ahci_pci.c Thu Aug 13 00:19:05 2020 (r364182) +++ stable/12/sys/dev/ahci/ahci_pci.c Thu Aug 13 00:40:40 2020 (r364183) @@ -180,6 +180,7 @@ static const struct { {0x1f3e8086, 0x00, "Intel Avoton (RAID)", 0}, {0x1f3f8086, 0x00, "Intel Avoton (RAID)", 0}, {0x23a38086, 0x00, "Intel Coleto Creek", 0}, + {0x5ae38086, 0x00, "Intel Apollo Lake", 0}, {0x8c028086, 0x00, "Intel Lynx Point", 0}, {0x8c038086, 0x00, "Intel Lynx Point", 0}, {0x8c048086, 0x00, "Intel Lynx Point (RAID)", 0}, From owner-svn-src-all@freebsd.org Thu Aug 13 00:42:10 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C75A53AF0E7; Thu, 13 Aug 2020 00:42:10 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BRnpB3kMbz4Ysb; Thu, 13 Aug 2020 00:42:10 +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 64A0E14D0C; Thu, 13 Aug 2020 00:42:10 +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 07D0gAL6097713; Thu, 13 Aug 2020 00:42:10 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07D0g98T097708; Thu, 13 Aug 2020 00:42:09 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202008130042.07D0g98T097708@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 13 Aug 2020 00:42: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: r364184 - in stable/12: sys/cam/ctl sys/cam/scsi usr.sbin/ctladm X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/12: sys/cam/ctl sys/cam/scsi usr.sbin/ctladm X-SVN-Commit-Revision: 364184 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 13 Aug 2020 00:42:10 -0000 Author: mav Date: Thu Aug 13 00:42:09 2020 New Revision: 364184 URL: https://svnweb.freebsd.org/changeset/base/364184 Log: MFC r363979: Add CTL support for REPORT IDENTIFYING INFORMATION command. It allows to report to initiator LU identifying information, preset via "ident_info" and "text_ident_info" options. Unfortunately it is impossible to implement SET IDENTIFYING INFORMATION, since we have no persistent storage it requires, so the information is read-only for initiator and has to be set out-of-band. Modified: stable/12/sys/cam/ctl/ctl.c stable/12/sys/cam/ctl/ctl_cmd_table.c stable/12/sys/cam/ctl/ctl_private.h stable/12/sys/cam/scsi/scsi_all.h stable/12/usr.sbin/ctladm/ctladm.8 Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cam/ctl/ctl.c ============================================================================== --- stable/12/sys/cam/ctl/ctl.c Thu Aug 13 00:40:40 2020 (r364183) +++ stable/12/sys/cam/ctl/ctl.c Thu Aug 13 00:42:09 2020 (r364184) @@ -7128,6 +7128,88 @@ ctl_read_defect(struct ctl_scsiio *ctsio) } int +ctl_report_ident_info(struct ctl_scsiio *ctsio) +{ + struct ctl_lun *lun = CTL_LUN(ctsio); + struct scsi_report_ident_info *cdb; + struct scsi_report_ident_info_data *rii_ptr; + struct scsi_report_ident_info_descr *riid_ptr; + const char *oii, *otii; + int retval, alloc_len, total_len = 0, len = 0; + + CTL_DEBUG_PRINT(("ctl_report_ident_info\n")); + + cdb = (struct scsi_report_ident_info *)ctsio->cdb; + retval = CTL_RETVAL_COMPLETE; + + total_len = sizeof(struct scsi_report_ident_info_data); + switch (cdb->type) { + case RII_LUII: + oii = dnvlist_get_string(lun->be_lun->options, + "ident_info", NULL); + if (oii) + len = strlen(oii); /* Approximately */ + break; + case RII_LUTII: + otii = dnvlist_get_string(lun->be_lun->options, + "text_ident_info", NULL); + if (otii) + len = strlen(otii) + 1; /* NULL-terminated */ + break; + case RII_IIS: + len = 2 * sizeof(struct scsi_report_ident_info_descr); + break; + default: + ctl_set_invalid_field(/*ctsio*/ ctsio, + /*sks_valid*/ 1, + /*command*/ 1, + /*field*/ 11, + /*bit_valid*/ 1, + /*bit*/ 2); + ctl_done((union ctl_io *)ctsio); + return(retval); + } + total_len += len; + alloc_len = scsi_4btoul(cdb->length); + + ctsio->kern_data_ptr = malloc(total_len, M_CTL, M_WAITOK | M_ZERO); + ctsio->kern_sg_entries = 0; + ctsio->kern_rel_offset = 0; + ctsio->kern_data_len = min(total_len, alloc_len); + ctsio->kern_total_len = ctsio->kern_data_len; + + rii_ptr = (struct scsi_report_ident_info_data *)ctsio->kern_data_ptr; + switch (cdb->type) { + case RII_LUII: + if (oii) { + if (oii[0] == '0' && oii[1] == 'x') + len = hex2bin(oii, (uint8_t *)(rii_ptr + 1), len); + else + strncpy((uint8_t *)(rii_ptr + 1), oii, len); + } + break; + case RII_LUTII: + if (otii) + strlcpy((uint8_t *)(rii_ptr + 1), otii, len); + break; + case RII_IIS: + riid_ptr = (struct scsi_report_ident_info_descr *)(rii_ptr + 1); + riid_ptr->type = RII_LUII; + scsi_ulto2b(0xffff, riid_ptr->length); + riid_ptr++; + riid_ptr->type = RII_LUTII; + scsi_ulto2b(0xffff, riid_ptr->length); + } + scsi_ulto2b(len, rii_ptr->length); + + ctl_set_success(ctsio); + ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; + ctsio->be_move_done = ctl_config_move_done; + ctl_datamove((union ctl_io *)ctsio); + return(retval); +} + +int ctl_report_tagret_port_groups(struct ctl_scsiio *ctsio) { struct ctl_softc *softc = CTL_SOFTC(ctsio); Modified: stable/12/sys/cam/ctl/ctl_cmd_table.c ============================================================================== --- stable/12/sys/cam/ctl/ctl_cmd_table.c Thu Aug 13 00:40:40 2020 (r364183) +++ stable/12/sys/cam/ctl/ctl_cmd_table.c Thu Aug 13 00:42:09 2020 (r364184) @@ -829,8 +829,15 @@ const struct ctl_cmd_entry ctl_cmd_table_a3[32] = /* 04 */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, -/* 05 */ -{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, +/* 05 REPORT IDENTIFYING INFORMATION */ +{ctl_report_ident_info, CTL_SERIDX_INQ, CTL_CMD_FLAG_OK_ON_BOTH | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | + CTL_CMD_FLAG_OK_ON_STANDBY | + CTL_CMD_FLAG_OK_ON_UNAVAIL | + CTL_FLAG_DATA_IN | + CTL_CMD_FLAG_ALLOW_ON_PR_RESV, + CTL_LUN_PAT_NONE, + 12, {0x0f, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x07}}, /* 06 */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, @@ -854,7 +861,7 @@ const struct ctl_cmd_entry ctl_cmd_table_a3[32] = CTL_LUN_PAT_NONE, 12, {0xea, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, -/* 0B */ +/* 0B REPORT ALIASES */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, /* 0C REPORT SUPPORTED_OPCODES */ @@ -877,7 +884,7 @@ const struct ctl_cmd_entry ctl_cmd_table_a3[32] = CTL_LUN_PAT_NONE, 12, {0x0d, 0x80, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, -/* 0E */ +/* 0E REPORT PRIORITY */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, /* 0F REPORT TIMESTAMP */ @@ -890,7 +897,10 @@ const struct ctl_cmd_entry ctl_cmd_table_a3[32] = CTL_LUN_PAT_NONE, 12, {0x0f, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, -/* 10-1f */ +/* 10 MANAGEMENT PROTOCOL IN */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 11-1f */ }; const struct ctl_cmd_entry ctl_cmd_table[256] = Modified: stable/12/sys/cam/ctl/ctl_private.h ============================================================================== --- stable/12/sys/cam/ctl/ctl_private.h Thu Aug 13 00:40:40 2020 (r364183) +++ stable/12/sys/cam/ctl/ctl_private.h Thu Aug 13 00:42:09 2020 (r364184) @@ -517,6 +517,7 @@ int ctl_get_event_status(struct ctl_scsiio *ctsio); int ctl_mechanism_status(struct ctl_scsiio *ctsio); int ctl_persistent_reserve_in(struct ctl_scsiio *ctsio); int ctl_persistent_reserve_out(struct ctl_scsiio *ctsio); +int ctl_report_ident_info(struct ctl_scsiio *ctsio); int ctl_report_tagret_port_groups(struct ctl_scsiio *ctsio); int ctl_report_supported_opcodes(struct ctl_scsiio *ctsio); int ctl_report_supported_tmf(struct ctl_scsiio *ctsio); Modified: stable/12/sys/cam/scsi/scsi_all.h ============================================================================== --- stable/12/sys/cam/scsi/scsi_all.h Thu Aug 13 00:40:40 2020 (r364183) +++ stable/12/sys/cam/scsi/scsi_all.h Thu Aug 13 00:42:09 2020 (r364184) @@ -1484,6 +1484,32 @@ struct scsi_maintenance_in uint8_t control; }; +struct scsi_report_ident_info +{ + uint8_t opcode; + uint8_t service_action; + uint8_t reserved[4]; + uint8_t length[4]; + uint8_t type; +#define RII_LUII 0x00 +#define RII_LUTII 0x04 +#define RII_IIS 0xfc + uint8_t control; +}; + +struct scsi_report_ident_info_data +{ + uint8_t reserved[2]; + uint8_t length[2]; +}; + +struct scsi_report_ident_info_descr +{ + uint8_t type; + uint8_t reserved; + uint8_t length[2]; +}; + struct scsi_report_supported_opcodes { uint8_t opcode; Modified: stable/12/usr.sbin/ctladm/ctladm.8 ============================================================================== --- stable/12/usr.sbin/ctladm/ctladm.8 Thu Aug 13 00:40:40 2020 (r364183) +++ stable/12/usr.sbin/ctladm/ctladm.8 Thu Aug 13 00:42:09 2020 (r364184) @@ -1,6 +1,6 @@ .\" .\" Copyright (c) 2003 Silicon Graphics International Corp. -.\" Copyright (c) 2015 Alexander Motin +.\" Copyright (c) 2015-2020 Alexander Motin .\" Copyright (c) 2018 Marcelo Araujo .\" All rights reserved. .\" @@ -36,7 +36,7 @@ .\" $Id: //depot/users/kenm/FreeBSD-test2/usr.sbin/ctladm/ctladm.8#3 $ .\" $FreeBSD$ .\" -.Dd July 25, 2019 +.Dd August 6, 2020 .Dt CTLADM 8 .Os .Sh NAME @@ -877,6 +877,10 @@ EUI, NAA or UUID identifier should be set to UNIQUE va EXTENDED COPY command access the LUN. Non-unique LUN identifiers may lead to data corruption. Some initiators may not support later introduced UUID identifiers. +.It Va ident_info +Specified LUN identification information (string or 0x + hex). +.It Va text_ident_info +Specified LUN text identification information (UTF-8 string). .It Va ha_role Setting to "primary" or "secondary" overrides default role of the node in HA cluster, set by kern.cam.ctl.ha_role sysctl. From owner-svn-src-all@freebsd.org Thu Aug 13 02:32:47 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 085533B2298; Thu, 13 Aug 2020 02:32:47 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BRrFp6Gnxz4gBF; Thu, 13 Aug 2020 02:32:46 +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 BAF0D15B6C; Thu, 13 Aug 2020 02:32:46 +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 07D2WkYP069083; Thu, 13 Aug 2020 02:32:46 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07D2Wk4t069082; Thu, 13 Aug 2020 02:32:46 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202008130232.07D2Wk4t069082@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 13 Aug 2020 02:32:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364185 - head/sys/cam/nvme X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/cam/nvme X-SVN-Commit-Revision: 364185 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 13 Aug 2020 02:32:47 -0000 Author: mav Date: Thu Aug 13 02:32:46 2020 New Revision: 364185 URL: https://svnweb.freebsd.org/changeset/base/364185 Log: Fill device serial_num and device_id in NVMe XPT. It allows to report GEOM::lunid for nda(4) same as for nvd(4). Since NVMe now allows multiple LUs (namespaces) with multiple paths unique LU identification is important. The serial_num field is filled same as before with the controller serial number, while device_id is based on namespace GUID and/or EUI64 fields as recommended by "NVM Express: SCSI Translation Reference" and matching nvd(4) at the end. MFC after: 1 week Modified: head/sys/cam/nvme/nvme_xpt.c Modified: head/sys/cam/nvme/nvme_xpt.c ============================================================================== --- head/sys/cam/nvme/nvme_xpt.c Thu Aug 13 00:42:09 2020 (r364184) +++ head/sys/cam/nvme/nvme_xpt.c Thu Aug 13 02:32:46 2020 (r364185) @@ -310,9 +310,11 @@ nvme_probe_done(struct cam_periph *periph, union ccb * struct nvme_controller_data *nvme_cdata; nvme_probe_softc *softc; struct cam_path *path; + struct scsi_vpd_device_id *did; + struct scsi_vpd_id_descriptor *idd; cam_status status; u_int32_t priority; - int found = 1; + int found = 1, e, g, len; CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_TRACE, ("nvme_probe_done\n")); @@ -369,6 +371,21 @@ device_fail: if ((path->device->flags & CAM_DEV_UNCONF bcopy(&softc->cd, nvme_cdata, sizeof(*nvme_cdata)); path->device->nvme_cdata = nvme_cdata; + /* Save/update serial number. */ + if (path->device->serial_num != NULL) { + free(path->device->serial_num, M_CAMXPT); + path->device->serial_num = NULL; + path->device->serial_num_len = 0; + } + path->device->serial_num = (u_int8_t *) + malloc(NVME_SERIAL_NUMBER_LENGTH + 1, M_CAMXPT, M_NOWAIT); + if (path->device->serial_num != NULL) { + cam_strvis(path->device->serial_num, nvme_cdata->sn, + NVME_SERIAL_NUMBER_LENGTH, NVME_SERIAL_NUMBER_LENGTH + 1); + path->device->serial_num_len = + strlen(path->device->serial_num); + } + // nvme_find_quirk(path->device); nvme_device_transport(path); NVME_PROBE_SET_ACTION(softc, NVME_PROBE_IDENTIFY_NS); @@ -394,6 +411,53 @@ device_fail: if ((path->device->flags & CAM_DEV_UNCONF bcopy(&softc->ns, nvme_data, sizeof(*nvme_data)); path->device->nvme_data = nvme_data; + /* Save/update device_id based on NGUID and/or EUI64. */ + if (path->device->device_id != NULL) { + free(path->device->device_id, M_CAMXPT); + path->device->device_id = NULL; + path->device->device_id_len = 0; + } + len = 0; + for (g = 0; g < sizeof(nvme_data->nguid); g++) { + if (nvme_data->nguid[g] != 0) + break; + } + if (g < sizeof(nvme_data->nguid)) + len += sizeof(struct scsi_vpd_id_descriptor) + 16; + for (e = 0; e < sizeof(nvme_data->eui64); e++) { + if (nvme_data->eui64[e] != 0) + break; + } + if (e < sizeof(nvme_data->eui64)) + len += sizeof(struct scsi_vpd_id_descriptor) + 8; + if (len > 0) { + path->device->device_id = (u_int8_t *) + malloc(SVPD_DEVICE_ID_HDR_LEN + len, + M_CAMXPT, M_NOWAIT); + } + if (path->device->device_id != NULL) { + did = (struct scsi_vpd_device_id *)path->device->device_id; + did->device = SID_QUAL_LU_CONNECTED | T_DIRECT; + did->page_code = SVPD_DEVICE_ID; + scsi_ulto2b(len, did->length); + idd = (struct scsi_vpd_id_descriptor *)(did + 1); + if (g < sizeof(nvme_data->nguid)) { + idd->proto_codeset = SVPD_ID_CODESET_BINARY; + idd->id_type = SVPD_ID_ASSOC_LUN | SVPD_ID_TYPE_EUI64; + idd->length = 16; + bcopy(nvme_data->nguid, idd->identifier, 16); + idd = (struct scsi_vpd_id_descriptor *) + &idd->identifier[16]; + } + if (e < sizeof(nvme_data->eui64)) { + idd->proto_codeset = SVPD_ID_CODESET_BINARY; + idd->id_type = SVPD_ID_ASSOC_LUN | SVPD_ID_TYPE_EUI64; + idd->length = 8; + bcopy(nvme_data->eui64, idd->identifier, 8); + } + path->device->device_id_len = SVPD_DEVICE_ID_HDR_LEN + len; + } + if (periph->path->device->flags & CAM_DEV_UNCONFIGURED) { path->device->flags &= ~CAM_DEV_UNCONFIGURED; xpt_acquire_device(path->device); @@ -546,9 +610,9 @@ nvme_alloc_device(struct cam_eb *bus, struct cam_et *t device->maxtags = 0; device->inq_flags = 0; device->queue_flags = 0; - device->device_id = NULL; /* XXX Need to set this somewhere */ + device->device_id = NULL; device->device_id_len = 0; - device->serial_num = NULL; /* XXX Need to set this somewhere */ + device->serial_num = NULL; device->serial_num_len = 0; return (device); } From owner-svn-src-all@freebsd.org Thu Aug 13 06:32:40 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 485403B8B53; Thu, 13 Aug 2020 06:32:40 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BRxZc147Cz3fDd; Thu, 13 Aug 2020 06:32:40 +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 0885419209; Thu, 13 Aug 2020 06:32:40 +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 07D6Wd6o017403; Thu, 13 Aug 2020 06:32:39 GMT (envelope-from eugen@FreeBSD.org) Received: (from eugen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07D6WdVQ017402; Thu, 13 Aug 2020 06:32:39 GMT (envelope-from eugen@FreeBSD.org) Message-Id: <202008130632.07D6WdVQ017402@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eugen set sender to eugen@FreeBSD.org using -f From: Eugene Grosbein Date: Thu, 13 Aug 2020 06:32:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364186 - head/sbin/ifconfig X-SVN-Group: head X-SVN-Commit-Author: eugen X-SVN-Commit-Paths: head/sbin/ifconfig X-SVN-Commit-Revision: 364186 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 13 Aug 2020 06:32:40 -0000 Author: eugen Date: Thu Aug 13 06:32:39 2020 New Revision: 364186 URL: https://svnweb.freebsd.org/changeset/base/364186 Log: ifconfig(8): plug memory leak after r361790 by me. MFC after: 3 days Modified: head/sbin/ifconfig/ifconfig.c Modified: head/sbin/ifconfig/ifconfig.c ============================================================================== --- head/sbin/ifconfig/ifconfig.c Thu Aug 13 02:32:46 2020 (r364185) +++ head/sbin/ifconfig/ifconfig.c Thu Aug 13 06:32:39 2020 (r364186) @@ -748,6 +748,7 @@ group_member(const char *ifname, const char *match, co if (nomatch) nomatched &= fnmatch(nomatch, ifg->ifgrq_group, 0); } + free(ifgr.ifgr_groups); if (match && !nomatch) return (matched); From owner-svn-src-all@freebsd.org Thu Aug 13 10:24:45 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EB2A83BD3D3; Thu, 13 Aug 2020 10:24:45 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BS2kP5qYVz47NF; Thu, 13 Aug 2020 10:24:45 +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 AB94F1BA31; Thu, 13 Aug 2020 10:24:45 +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 07DAOjh1059177; Thu, 13 Aug 2020 10:24:45 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07DAOjLV059176; Thu, 13 Aug 2020 10:24:45 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202008131024.07DAOjLV059176@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Thu, 13 Aug 2020 10:24:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364187 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 364187 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 13 Aug 2020 10:24:46 -0000 Author: mjg Date: Thu Aug 13 10:24:45 2020 New Revision: 364187 URL: https://svnweb.freebsd.org/changeset/base/364187 Log: vfs: add missing pwd_drop on error in namei_setup Reported by: pho Modified: head/sys/kern/vfs_lookup.c Modified: head/sys/kern/vfs_lookup.c ============================================================================== --- head/sys/kern/vfs_lookup.c Thu Aug 13 06:32:39 2020 (r364186) +++ head/sys/kern/vfs_lookup.c Thu Aug 13 10:24:45 2020 (r364187) @@ -431,6 +431,7 @@ namei_setup(struct nameidata *ndp, struct vnode **dpp, if (error != 0) { if (*dpp != NULL) vrele(*dpp); + pwd_drop(pwd); return (error); } MPASS((ndp->ni_lcf & (NI_LCF_BENEATH_ABS | NI_LCF_LATCH)) != From owner-svn-src-all@freebsd.org Thu Aug 13 13:58:22 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 439AC37AA98; Thu, 13 Aug 2020 13:58:22 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BS7St14Fgz4KkZ; Thu, 13 Aug 2020 13:58:22 +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 034041E331; Thu, 13 Aug 2020 13:58:22 +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 07DDwLaL090925; Thu, 13 Aug 2020 13:58:21 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07DDwLBn090924; Thu, 13 Aug 2020 13:58:21 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202008131358.07DDwLBn090924@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 13 Aug 2020 13:58: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: r364188 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 364188 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 13 Aug 2020 13:58:22 -0000 Author: markj Date: Thu Aug 13 13:58:21 2020 New Revision: 364188 URL: https://svnweb.freebsd.org/changeset/base/364188 Log: MFC r363959: Remove the vfs.reassignbufcalls counter and sysctl. Modified: stable/12/sys/kern/vfs_subr.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/vfs_subr.c ============================================================================== --- stable/12/sys/kern/vfs_subr.c Thu Aug 13 10:24:45 2020 (r364187) +++ stable/12/sys/kern/vfs_subr.c Thu Aug 13 13:58:21 2020 (r364188) @@ -205,15 +205,6 @@ static counter_u64_t recycles_count; SYSCTL_COUNTER_U64(_vfs, OID_AUTO, recycles, CTLFLAG_RD, &recycles_count, "Number of vnodes recycled to meet vnode cache targets"); -/* - * Various variables used for debugging the new implementation of - * reassignbuf(). - * XXX these are probably of (very) limited utility now. - */ -static int reassignbufcalls; -SYSCTL_INT(_vfs, OID_AUTO, reassignbufcalls, CTLFLAG_RW, &reassignbufcalls, 0, - "Number of calls to reassignbuf"); - static counter_u64_t free_owe_inact; SYSCTL_COUNTER_U64(_vfs, OID_AUTO, free_owe_inact, CTLFLAG_RD, &free_owe_inact, "Number of times free vnodes kept on active list due to VFS " @@ -2544,7 +2535,6 @@ reassignbuf(struct buf *bp) vp = bp->b_vp; bo = bp->b_bufobj; - ++reassignbufcalls; CTR3(KTR_BUF, "reassignbuf(%p) vp %p flags %X", bp, bp->b_vp, bp->b_flags); From owner-svn-src-all@freebsd.org Thu Aug 13 13:59:32 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7F0D837A941; Thu, 13 Aug 2020 13:59:32 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BS7VD2rPsz4Kqf; Thu, 13 Aug 2020 13:59:32 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 450591E0B5; Thu, 13 Aug 2020 13:59:32 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07DDxW86091025; Thu, 13 Aug 2020 13:59:32 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07DDxWsZ091023; Thu, 13 Aug 2020 13:59:32 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202008131359.07DDxWsZ091023@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 13 Aug 2020 13:59:32 +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: r364189 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 364189 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 13 Aug 2020 13:59:32 -0000 Author: markj Date: Thu Aug 13 13:59:31 2020 New Revision: 364189 URL: https://svnweb.freebsd.org/changeset/base/364189 Log: MFC r363960: Clean up reassignbuf() and buf_vlist_remove() a bit. Modified: stable/12/sys/kern/vfs_subr.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/vfs_subr.c ============================================================================== --- stable/12/sys/kern/vfs_subr.c Thu Aug 13 13:58:21 2020 (r364188) +++ stable/12/sys/kern/vfs_subr.c Thu Aug 13 13:59:31 2020 (r364189) @@ -2089,13 +2089,17 @@ static void buf_vlist_remove(struct buf *bp) { struct bufv *bv; + b_xflags_t flags; + flags = bp->b_xflags; + KASSERT(bp->b_bufobj != NULL, ("No b_bufobj %p", bp)); ASSERT_BO_WLOCKED(bp->b_bufobj); - KASSERT((bp->b_xflags & (BX_VNDIRTY|BX_VNCLEAN)) != - (BX_VNDIRTY|BX_VNCLEAN), - ("buf_vlist_remove: Buf %p is on two lists", bp)); - if (bp->b_xflags & BX_VNDIRTY) + KASSERT((flags & (BX_VNDIRTY | BX_VNCLEAN)) != 0 && + (flags & (BX_VNDIRTY | BX_VNCLEAN)) != (BX_VNDIRTY | BX_VNCLEAN), + ("%s: buffer %p has invalid queue state", __func__, bp)); + + if ((flags & BX_VNDIRTY) != 0) bv = &bp->b_bufobj->bo_dirty; else bv = &bp->b_bufobj->bo_clean; @@ -2204,10 +2208,7 @@ brelvp(struct buf *bp) vp = bp->b_vp; /* XXX */ bo = bp->b_bufobj; BO_LOCK(bo); - if (bp->b_xflags & (BX_VNDIRTY | BX_VNCLEAN)) - buf_vlist_remove(bp); - else - panic("brelvp: Buffer %p not on queue.", bp); + buf_vlist_remove(bp); if ((bo->bo_flag & BO_ONWORKLST) && bo->bo_dirty.bv_cnt == 0) { bo->bo_flag &= ~BO_ONWORKLST; mtx_lock(&sync_mtx); @@ -2519,9 +2520,7 @@ syncer_resume(void) } /* - * Reassign a buffer from one vnode to another. - * Used to assign file specific control information - * (indirect blocks) to the vnode to which they belong. + * Move the buffer between the clean and dirty lists of its vnode. */ void reassignbuf(struct buf *bp) @@ -2536,23 +2535,15 @@ reassignbuf(struct buf *bp) vp = bp->b_vp; bo = bp->b_bufobj; + KASSERT((bp->b_flags & B_PAGING) == 0, + ("%s: cannot reassign paging buffer %p", __func__, bp)); + CTR3(KTR_BUF, "reassignbuf(%p) vp %p flags %X", bp, bp->b_vp, bp->b_flags); - /* - * B_PAGING flagged buffers cannot be reassigned because their vp - * is not fully linked in. - */ - if (bp->b_flags & B_PAGING) - panic("cannot reassign paging buffer"); - /* - * Delete from old vnode list, if on one. - */ BO_LOCK(bo); - if (bp->b_xflags & (BX_VNDIRTY | BX_VNCLEAN)) - buf_vlist_remove(bp); - else - panic("reassignbuf: Buffer %p not on queue.", bp); + buf_vlist_remove(bp); + /* * If dirty, put on list of dirty buffers; otherwise insert onto list * of clean buffers. From owner-svn-src-all@freebsd.org Thu Aug 13 14:14:46 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F23A237B092; Thu, 13 Aug 2020 14:14:46 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BS7qp67CLz4Lm6; Thu, 13 Aug 2020 14:14:46 +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 B58311E81C; Thu, 13 Aug 2020 14:14:46 +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 07DEEkes002798; Thu, 13 Aug 2020 14:14:46 GMT (envelope-from arichardson@FreeBSD.org) Received: (from arichardson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07DEEkeT002797; Thu, 13 Aug 2020 14:14:46 GMT (envelope-from arichardson@FreeBSD.org) Message-Id: <202008131414.07DEEkeT002797@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arichardson set sender to arichardson@FreeBSD.org using -f From: Alex Richardson Date: Thu, 13 Aug 2020 14:14:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364190 - head/tools/build X-SVN-Group: head X-SVN-Commit-Author: arichardson X-SVN-Commit-Paths: head/tools/build X-SVN-Commit-Revision: 364190 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 13 Aug 2020 14:14:47 -0000 Author: arichardson Date: Thu Aug 13 14:14:46 2020 New Revision: 364190 URL: https://svnweb.freebsd.org/changeset/base/364190 Log: Add pwd to the list of tools that are linked to $WORLDTMP/legacy After r364166 and r364174, crunchgen needs a pwd binary in $PATH instead of using a hardcoded absolute path. This commit is needed for BUILD_WITH_STRICT_TMPPATH builds (currently not on by default). Modified: head/tools/build/Makefile Modified: head/tools/build/Makefile ============================================================================== --- head/tools/build/Makefile Thu Aug 13 13:59:31 2020 (r364189) +++ head/tools/build/Makefile Thu Aug 13 14:14:46 2020 (r364190) @@ -113,8 +113,8 @@ SYSINCS+= ${SRCTOP}/sys/sys/font.h # Linux/MacOS since we only use flags that are supported by all of them. _host_tools_to_symlink= basename bzip2 bunzip2 chmod chown cmp comm cp date dd \ dirname echo env false find fmt gzip gunzip head hostname id ln ls \ - mkdir mv nice patch rm realpath sh sleep stat tee touch tr true uname \ - uniq wc which + mkdir mv nice patch pwd rm realpath sh sleep stat tee touch tr true \ + uname uniq wc which # We also need a symlink to the absolute path to the make binary used for # the toplevel makefile. This is not necessarily the same as `which make` From owner-svn-src-all@freebsd.org Thu Aug 13 14:14:53 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0B5E837B098; Thu, 13 Aug 2020 14:14:53 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BS7qw0v0vz4LPV; Thu, 13 Aug 2020 14:14:52 +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 A24111E536; Thu, 13 Aug 2020 14:14:51 +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 07DEEp7F002852; Thu, 13 Aug 2020 14:14:51 GMT (envelope-from arichardson@FreeBSD.org) Received: (from arichardson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07DEEpeo002851; Thu, 13 Aug 2020 14:14:51 GMT (envelope-from arichardson@FreeBSD.org) Message-Id: <202008131414.07DEEpeo002851@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arichardson set sender to arichardson@FreeBSD.org using -f From: Alex Richardson Date: Thu, 13 Aug 2020 14:14:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364191 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: arichardson X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 364191 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 13 Aug 2020 14:14:54 -0000 Author: arichardson Date: Thu Aug 13 14:14:51 2020 New Revision: 364191 URL: https://svnweb.freebsd.org/changeset/base/364191 Log: Make bsd.linker.mk work with the MacOS linker This is not strictly required for crossbuilding but having lots of warnings from bsd.linker.mk in the output was making it hard to see the actual warning messages. Reviewed By: imp Differential Revision: https://reviews.freebsd.org/D14318 Modified: head/share/mk/bsd.linker.mk Modified: head/share/mk/bsd.linker.mk ============================================================================== --- head/share/mk/bsd.linker.mk Thu Aug 13 14:14:46 2020 (r364190) +++ head/share/mk/bsd.linker.mk Thu Aug 13 14:14:51 2020 (r364191) @@ -58,7 +58,7 @@ ${var}= ${${var}__${${X_}_ld_hash}} .if ${ld} == "LD" || (${ld} == "XLD" && ${XLD} != ${LD}) .if !defined(${X_}LINKER_TYPE) || !defined(${X_}LINKER_VERSION) -_ld_version!= (${${ld}} --version || echo none) | sed -n 1p +_ld_version!= (${${ld}} -v 2>&1 || echo none) | sed -n 1p .if ${_ld_version} == "none" .warning Unable to determine linker type from ${ld}=${${ld}} .endif @@ -73,6 +73,17 @@ _v= ${_ld_version:[2]} ${X_}LINKER_FREEBSD_VERSION:= ${_ld_version:[4]:C/.*-([^-]*)\)/\1/} .else ${X_}LINKER_FREEBSD_VERSION= 0 +.endif +.elif ${_ld_version:[1]} == "@(\#)PROGRAM:ld" +# bootstrap linker on MacOS +${X_}LINKER_TYPE= mac +_v= ${_ld_version:[2]:S/PROJECT:ld64-//} +# Convert version 409.12 to 409.12.0 so that the echo + awk below works +.if empty(_v:M[1-9]*.[0-9]*.[0-9]*) && !empty(_v:M[1-9]*.[0-9]*) +_v:=${_v}.0 +.else +# Some versions do not contain a minor version so we need to append .0.0 there +_v:=${_v}.0.0 .endif .else .warning Unknown linker from ${ld}=${${ld}}: ${_ld_version}, defaulting to bfd From owner-svn-src-all@freebsd.org Thu Aug 13 14:17:36 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B4BC537B312; Thu, 13 Aug 2020 14:17:36 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BS7v44Kypz4Lnf; Thu, 13 Aug 2020 14:17:36 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7730A1E4CA; Thu, 13 Aug 2020 14:17:36 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07DEHabI003028; Thu, 13 Aug 2020 14:17:36 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07DEHaLn003027; Thu, 13 Aug 2020 14:17:36 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <202008131417.07DEHaLn003027@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Thu, 13 Aug 2020 14:17:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364192 - head/sys/riscv/riscv X-SVN-Group: head X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: head/sys/riscv/riscv X-SVN-Commit-Revision: 364192 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 13 Aug 2020 14:17:36 -0000 Author: mhorne Date: Thu Aug 13 14:17:36 2020 New Revision: 364192 URL: https://svnweb.freebsd.org/changeset/base/364192 Log: Small fixes in locore.S - Properly set up the frame pointer - Hang if we return from mi_startup - Whitespace Clearing the frame pointer marks the end of the backtrace. This fixes "bt 0" in ddb, which previously would unwind one frame too far. Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D26016 Modified: head/sys/riscv/riscv/locore.S Modified: head/sys/riscv/riscv/locore.S ============================================================================== --- head/sys/riscv/riscv/locore.S Thu Aug 13 14:14:51 2020 (r364191) +++ head/sys/riscv/riscv/locore.S Thu Aug 13 14:17:36 2020 (r364192) @@ -223,19 +223,21 @@ va: csrw sscratch, t0 /* Initialize stack pointer */ - la s3, initstack_end - mv sp, s3 + la sp, initstack_end + /* Clear frame pointer */ + mv s0, zero + /* Allocate space for thread0 PCB and riscv_bootparams */ addi sp, sp, -(PCB_SIZE + RISCV_BOOTPARAMS_SIZE) & ~STACKALIGNBYTES /* Clear BSS */ - la s0, _C_LABEL(__bss_start) - la s1, _C_LABEL(_end) + la t0, _C_LABEL(__bss_start) + la t1, _C_LABEL(_end) 1: - sd zero, 0(s0) - addi s0, s0, 8 - bltu s0, s1, 1b + sd zero, 0(t0) + addi t0, t0, 8 + bltu t0, t1, 1b /* Fill riscv_bootparams */ la t0, pagetable_l1 @@ -259,6 +261,11 @@ va: call _C_LABEL(initriscv) /* Off we go */ call _C_LABEL(mi_startup) + /* We should never reach here, but if so just hang. */ +2: + wfi + j 2b + /* * Get the physical address the kernel is loaded to. Returned in s9. */ @@ -350,7 +357,7 @@ ENTRY(mpentry) ld sp, 0(t0) /* Get the kernel's load address */ - jal get_physmem + jal get_physmem /* Setup supervisor trap vector */ lla t0, mpva From owner-svn-src-all@freebsd.org Thu Aug 13 14:21:06 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0E6CA37B24E; Thu, 13 Aug 2020 14:21:06 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BS7z56YSqz4M9k; Thu, 13 Aug 2020 14:21:05 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C53801E748; Thu, 13 Aug 2020 14:21:05 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07DEL547003304; Thu, 13 Aug 2020 14:21:05 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07DEL5K5003303; Thu, 13 Aug 2020 14:21:05 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <202008131421.07DEL5K5003303@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Thu, 13 Aug 2020 14:21:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364193 - head/sys/riscv/riscv X-SVN-Group: head X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: head/sys/riscv/riscv X-SVN-Commit-Revision: 364193 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 13 Aug 2020 14:21:06 -0000 Author: mhorne Date: Thu Aug 13 14:21:05 2020 New Revision: 364193 URL: https://svnweb.freebsd.org/changeset/base/364193 Log: Enable interrupts while handling traps I observed hangs post-r362977 in QEMU with -smp 2, in which one thread would acquire write access to an rm_lock (sysctllock) and get stuck waiting in smp_rendezvous_cpus while the other CPU was servicing a trap. The other thread was waiting for read access to the same lock, thus causing deadlock. It's clear that this is just one symptom of a larger problem. The general expectation of MI kernel code is that interrupts are enabled. Violating this assumption will at best create some additional latency, but otherwise might cause locking or other unforeseen issues. All other architectures do so for some subset of trap values, but this somehow got missed in the RISC-V port. Enable interrupts now during kernel page faults and for all user trap types. The code in exception.S already knows to disable interrupts while handling the return from exception, so there are no changes required there. Reviewed by: jhb, markj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D26017 Modified: head/sys/riscv/riscv/trap.c Modified: head/sys/riscv/riscv/trap.c ============================================================================== --- head/sys/riscv/riscv/trap.c Thu Aug 13 14:17:36 2020 (r364192) +++ head/sys/riscv/riscv/trap.c Thu Aug 13 14:21:05 2020 (r364193) @@ -198,14 +198,22 @@ data_abort(struct trapframe *frame, int usermode) "Kernel page fault") != 0) goto fatal; - if (usermode) + if (usermode) { map = &td->td_proc->p_vmspace->vm_map; - else if (stval >= VM_MAX_USER_ADDRESS) - map = kernel_map; - else { - if (pcb->pcb_onfault == 0) - goto fatal; - map = &td->td_proc->p_vmspace->vm_map; + } else { + /* + * Enable interrupts for the duration of the page fault. For + * user faults this was done already in do_trap_user(). + */ + intr_enable(); + + if (stval >= VM_MAX_USER_ADDRESS) { + map = kernel_map; + } else { + if (pcb->pcb_onfault == 0) + goto fatal; + map = &td->td_proc->p_vmspace->vm_map; + } } va = trunc_page(stval); @@ -324,6 +332,7 @@ do_trap_user(struct trapframe *frame) riscv_cpu_intr(frame); return; } + intr_enable(); CTR3(KTR_TRAP, "do_trap_user: curthread: %p, sepc: %lx, frame: %p", curthread, frame->tf_sepc, frame); From owner-svn-src-all@freebsd.org Thu Aug 13 14:26:26 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5712E37B6C8; Thu, 13 Aug 2020 14:26:26 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BS85G1dNzz4Mhn; Thu, 13 Aug 2020 14:26:26 +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 1BB9D1E3EF; Thu, 13 Aug 2020 14:26:26 +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 07DEQPdu009444; Thu, 13 Aug 2020 14:26:25 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07DEQPYK009443; Thu, 13 Aug 2020 14:26:25 GMT (envelope-from cy@FreeBSD.org) Message-Id: <202008131426.07DEQPYK009443@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Thu, 13 Aug 2020 14:26: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: r364194 - in stable: 11/contrib/ipfilter/iplang 12/contrib/ipfilter/iplang X-SVN-Group: stable-12 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/contrib/ipfilter/iplang 12/contrib/ipfilter/iplang X-SVN-Commit-Revision: 364194 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 13 Aug 2020 14:26:26 -0000 Author: cy Date: Thu Aug 13 14:26:25 2020 New Revision: 364194 URL: https://svnweb.freebsd.org/changeset/base/364194 Log: MFC r363916: Continued ipfilter #ifdef cleanup. The r343701 log entry contains a complete description. Modified: stable/12/contrib/ipfilter/iplang/iplang_y.y Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/contrib/ipfilter/iplang/iplang_y.y Directory Properties: stable/11/ (props changed) Modified: stable/12/contrib/ipfilter/iplang/iplang_y.y ============================================================================== --- stable/12/contrib/ipfilter/iplang/iplang_y.y Thu Aug 13 14:21:05 2020 (r364193) +++ stable/12/contrib/ipfilter/iplang/iplang_y.y Thu Aug 13 14:26:25 2020 (r364194) @@ -30,11 +30,9 @@ #include #include #include -#ifndef linux # include # include # include -#endif #include #include #include @@ -589,29 +587,7 @@ struct statetoopt tosecopts[] = { { 0, 0 } }; -#ifdef bsdi -struct ether_addr * -ether_aton(s) - char *s; -{ - static struct ether_addr n; - u_int i[6]; - if (sscanf(s, " %x:%x:%x:%x:%x:%x ", &i[0], &i[1], - &i[2], &i[3], &i[4], &i[5]) == 6) { - n.ether_addr_octet[0] = (u_char)i[0]; - n.ether_addr_octet[1] = (u_char)i[1]; - n.ether_addr_octet[2] = (u_char)i[2]; - n.ether_addr_octet[3] = (u_char)i[3]; - n.ether_addr_octet[4] = (u_char)i[4]; - n.ether_addr_octet[5] = (u_char)i[5]; - return &n; - } - return NULL; -} -#endif - - struct in_addr getipv4addr(arg) char *arg; { @@ -645,7 +621,6 @@ struct ether_addr *buf; { struct ether_addr *e; -#if !defined(hpux) && !defined(linux) e = ether_aton(arg); if (!e) fprintf(stderr, "Invalid ethernet address: %s\n", arg); @@ -657,9 +632,6 @@ struct ether_addr *buf; sizeof(e->ether_addr_octet)); # endif return e; -#else - return NULL; -#endif } @@ -1584,9 +1556,7 @@ int arg; void set_icmpmtu(arg) int arg; { -#if BSD >= 199306 icmp->icmp_nextmtu = htons(arg); -#endif } From owner-svn-src-all@freebsd.org Thu Aug 13 14:26:26 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0334837B705; Thu, 13 Aug 2020 14:26:26 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BS85F6JT0z4Mb0; Thu, 13 Aug 2020 14:26:25 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BBBEF1E3EE; Thu, 13 Aug 2020 14:26:25 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07DEQPwr009436; Thu, 13 Aug 2020 14:26:25 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07DEQPku009435; Thu, 13 Aug 2020 14:26:25 GMT (envelope-from cy@FreeBSD.org) Message-Id: <202008131426.07DEQPku009435@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Thu, 13 Aug 2020 14:26:25 +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: r364194 - in stable: 11/contrib/ipfilter/iplang 12/contrib/ipfilter/iplang X-SVN-Group: stable-11 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/contrib/ipfilter/iplang 12/contrib/ipfilter/iplang X-SVN-Commit-Revision: 364194 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 13 Aug 2020 14:26:26 -0000 Author: cy Date: Thu Aug 13 14:26:25 2020 New Revision: 364194 URL: https://svnweb.freebsd.org/changeset/base/364194 Log: MFC r363916: Continued ipfilter #ifdef cleanup. The r343701 log entry contains a complete description. Modified: stable/11/contrib/ipfilter/iplang/iplang_y.y Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/contrib/ipfilter/iplang/iplang_y.y Directory Properties: stable/12/ (props changed) Modified: stable/11/contrib/ipfilter/iplang/iplang_y.y ============================================================================== --- stable/11/contrib/ipfilter/iplang/iplang_y.y Thu Aug 13 14:21:05 2020 (r364193) +++ stable/11/contrib/ipfilter/iplang/iplang_y.y Thu Aug 13 14:26:25 2020 (r364194) @@ -30,11 +30,9 @@ #include #include #include -#ifndef linux # include # include # include -#endif #include #include #include @@ -589,29 +587,7 @@ struct statetoopt tosecopts[] = { { 0, 0 } }; -#ifdef bsdi -struct ether_addr * -ether_aton(s) - char *s; -{ - static struct ether_addr n; - u_int i[6]; - if (sscanf(s, " %x:%x:%x:%x:%x:%x ", &i[0], &i[1], - &i[2], &i[3], &i[4], &i[5]) == 6) { - n.ether_addr_octet[0] = (u_char)i[0]; - n.ether_addr_octet[1] = (u_char)i[1]; - n.ether_addr_octet[2] = (u_char)i[2]; - n.ether_addr_octet[3] = (u_char)i[3]; - n.ether_addr_octet[4] = (u_char)i[4]; - n.ether_addr_octet[5] = (u_char)i[5]; - return &n; - } - return NULL; -} -#endif - - struct in_addr getipv4addr(arg) char *arg; { @@ -645,7 +621,6 @@ struct ether_addr *buf; { struct ether_addr *e; -#if !defined(hpux) && !defined(linux) e = ether_aton(arg); if (!e) fprintf(stderr, "Invalid ethernet address: %s\n", arg); @@ -657,9 +632,6 @@ struct ether_addr *buf; sizeof(e->ether_addr_octet)); # endif return e; -#else - return NULL; -#endif } @@ -1584,9 +1556,7 @@ int arg; void set_icmpmtu(arg) int arg; { -#if BSD >= 199306 icmp->icmp_nextmtu = htons(arg); -#endif } From owner-svn-src-all@freebsd.org Thu Aug 13 15:33:59 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C70C737CBB3 for ; Thu, 13 Aug 2020 15:33:59 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound5a.ore.mailhop.org (outbound5a.ore.mailhop.org [44.233.67.66]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4BS9bB6Grnz4QhC for ; Thu, 13 Aug 2020 15:33:58 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1597332831; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=SnZpwowMwHYors7RMijZnvuuQ16lJtKPOlVYsowcTaq8FGvwJZA+yS7haBJXmOCiqPxNZI4H0toyI 5D8vqDYT26ik177eVPZeBFwdlDHekgsyK2vWBwxc9WlzvTqhILI1CEwdQiTnMJrzO1rO1uhsWfNCjK hlxNfkJEYVh+OU/sWQjb1+rgW/iHlSiyUmxcjuDhF1tJo2NdPrflfoFsEO0cuDcwF5xBLYuvgtyCEb Yi+Y5LaQcvWbqeTmXEEHi126wQAUfQE0u7Uzne/iuX3+RB822skuX9cMKoiqXlkzAWbeY4yreS/2oI jQsS9ix0Wny2eaT5KovGmi7C9Y7xHVw== 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=QDMBQp/f9Xuh4iUvmLLU6HLRxzzkVhq5FLW+7BZIK3U=; b=DlbRqzDF/Zn1dk1kGPMajfI9ZlL2l6reCQr7UKErWiqS09X0TDImt1CGAUUxCVTErp6Z+T/RlnJ/d 9nr6QFzIw1JPTYFiDuftWUno/UeeVFYT7cCa4NPgAvcrSQ7C+NgS4KBsFB824R40TFHIXLAMAxVqCh dSiLJzuK7SxUQsDv2k4tvnmHlkW91nee31J/QSr50l4ojOWKsecuUTe4npUJLXD9qcb22vYCmJbyiB plpPKhTZ8qlU4HgKqid05J4mk1NC2NsgQUYGsn477SIyFOta0mNKgqFwX5T8tqrACGBKSfzEDL44dU TPKRhQg3Iotes/kuIK4OhNu6c0p1r7w== ARC-Authentication-Results: i=1; outbound3.ore.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=QDMBQp/f9Xuh4iUvmLLU6HLRxzzkVhq5FLW+7BZIK3U=; b=iqC/4Ef2MliLyfjpe+w2pGGMV1u4o00mbWAtOl04apFAcq3hjAVtNAi2bsH+cX1Ekwpphxdn5Epto cTSo+9zb1lLQjw0t6Gxx7IzcfX5TY3SWWNqBh/CtePjVaAIVcJysTz/Ea4HZEK2AKdbedvuv+N3KIp np/H3B/w0Qgm5g5UhR35TRue/q6TfASkRwZNbaTPON03k+leN5b7I0oIbe3ENR6OuBuZ8EER941dbF euA0dxtDtHBk2x+tWzLXTesZpRhbm6+crVlQBY4fSH111zVmXyqI4kCbxtbAlOt4/gZKv2irppN6lD wuQGDL3G0mAHXfGIYbfYiyD3nHR3n+Q== X-MHO-RoutePath: aGlwcGll X-MHO-User: 61d6d522-dd7a-11ea-a2bb-9f0c275c2f69 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 (c-67-177-211-60.hsd1.co.comcast.net [67.177.211.60]) by outbound3.ore.mailhop.org (Halon) with ESMTPSA id 61d6d522-dd7a-11ea-a2bb-9f0c275c2f69; Thu, 13 Aug 2020 15:33:49 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id 07DFXmZA065831; Thu, 13 Aug 2020 09:33:48 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1f724b1b9e0c230f793a49c948c778d3def045b9.camel@freebsd.org> Subject: Re: svn commit: r364166 - head/usr.sbin/crunch/crunchgen From: Ian Lepore To: rgrimes@freebsd.org, Jessica Clarke Cc: Alex Richardson , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Thu, 13 Aug 2020 09:33:48 -0600 In-Reply-To: <202008121624.07CGOTnt038878@gndrsh.dnsmgr.net> References: <202008121624.07CGOTnt038878@gndrsh.dnsmgr.net> Content-Type: text/plain; charset="ASCII" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4BS9bB6Grnz4QhC X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [0.00 / 15.00]; ASN(0.00)[asn:16509, ipnet:44.224.0.0/11, country:US]; local_wl_from(0.00)[freebsd.org] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 13 Aug 2020 15:33:59 -0000 On Wed, 2020-08-12 at 09:24 -0700, Rodney W. Grimes wrote: > > On 12 Aug 2020, at 17:10, Rodney W. Grimes < > > freebsd@gndrsh.dnsmgr.net> wrote: > > > > > > > Author: arichardson > > > > Date: Wed Aug 12 15:49:06 2020 > > > > New Revision: 364166 > > > > URL: https://svnweb.freebsd.org/changeset/base/364166 > > > > > > > > Log: > > > > Fix crunchgen usage of mkstemp() > > > > > > > > On Glibc systems mkstemp can only be used once with the same > > > > template > > > > string since it will be modified in-place and no longer > > > > contain any 'X' chars. > > > > It is fine to reuse the same file here but we need to be > > > > explicit and use > > > > open() instead of mkstemp() on the second use. > > > > > > > > While touching this file also avoid a hardcoded /bin/pwd since > > > > that may not > > > > work when building on non-FreeBSD systems. > > > > > > This may cause some grief, as now pwd may use a shell builtin > > > and often shell builtin's return a cwd that is not a true > > > full path, ie it may contain symlink compontents in the > > > path. > > > > > > /bin/sh: > > > > > > # cd /tmp/b > > > # /bin/pwd > > > /tmp/a > > > # pwd > > > /tmp/b > > > # ls -lag /tmp/? > > > lrwxr-xr-x 1 root wheel 1 Aug 12 16:06 /tmp/b -> a > > > > > > /tmp/a: > > > total 17 > > > drwxr-xr-x 2 root wheel 2 Aug 12 16:06 . > > > drwxrwxrwt 18 root wheel 248 Aug 12 16:06 .. > > > > There's the question of whether that really matters; both values > > are in > > some sense correct. But if you want to restore the old behaviour, I > > believe `env pwd` is the portable way to do so? > > You have cut the context, but the code has a comment that > states it is doing this to remove symbolic links, so this > change infact undoes something that was being done intentionally. > > I do believe also that a "env pwd" would do the right thing > as well. > Or just use "pwd -P" and avoid invoking multiple programs when the shell can do all the work. -- Ian From owner-svn-src-all@freebsd.org Thu Aug 13 15:37:50 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E11BE37C6DB for ; Thu, 13 Aug 2020 15:37:50 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BS9gd4yytz4RCn for ; Thu, 13 Aug 2020 15:37:49 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wr1-f65.google.com with SMTP id a14so5699421wra.5 for ; Thu, 13 Aug 2020 08:37:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=qXnz4UyDCK7WBByqbh4flcZfZJw8RdMJJtU3n5KFBOQ=; b=sALb7p3nmX1qhNRb+o6pDdEPgENuTwUwnyxam0Fe467HjcSM8sn1QtBb089lF0nYJ7 KFUmNjk8l6ry52GeayhvxBpQRkzPbGj/V1jlcVwZbzZx1lEYKYI76K31QhY9ZWtbNLg/ ZyvSynxtSx0Cs1j3P5/cH0eMS6YAXLSaDZUvpxMU23HPKgVwup3eO1y4xle+VXTWYTZo SuUetHPRmWhk4xURqBWbqbJEaLfFUWXSySBYwVdWxy/WpRngAaGpVh9JMTZMKyrgKudX B36uYLF0Fhgta2v2eVneLJ/ldPKGDnFZ4zVrWNReyPQkrTu7Sxrmu/HLV84LLNtkpbDh Hmkg== X-Gm-Message-State: AOAM530lisqW11wdvmurMn3iOqCGHw7a2XqovN/LggS78zY3qm23zw6A AqY2KP0fLXRW/4KWAiN/FGPx4g== X-Google-Smtp-Source: ABdhPJxZYjYdnp9YGrAnZqkTZZFPzGn/gbXKNL52teJ1RWFDvF0QdeYg414jcvxZVm2wjzHUN3N70g== X-Received: by 2002:adf:ba83:: with SMTP id p3mr4758227wrg.246.1597333068043; Thu, 13 Aug 2020 08:37:48 -0700 (PDT) Received: from [192.168.149.251] (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id 33sm11256770wri.16.2020.08.13.08.37.47 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Aug 2020 08:37:47 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.1\)) Subject: Re: svn commit: r364166 - head/usr.sbin/crunch/crunchgen From: Jessica Clarke In-Reply-To: <1f724b1b9e0c230f793a49c948c778d3def045b9.camel@freebsd.org> Date: Thu, 13 Aug 2020 16:37:46 +0100 Cc: rgrimes@freebsd.org, Alex Richardson , src-committers , svn-src-all , svn-src-head@freebsd.org Content-Transfer-Encoding: 7bit Message-Id: <7DF33D5E-A867-4C33-957D-74A6B8D72ED2@freebsd.org> References: <202008121624.07CGOTnt038878@gndrsh.dnsmgr.net> <1f724b1b9e0c230f793a49c948c778d3def045b9.camel@freebsd.org> To: Ian Lepore X-Mailer: Apple Mail (2.3608.120.23.2.1) X-Rspamd-Queue-Id: 4BS9gd4yytz4RCn X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of jrtc27@jrtc27.com designates 209.85.221.65 as permitted sender) smtp.mailfrom=jrtc27@jrtc27.com X-Spamd-Result: default: False [-2.07 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-all@freebsd.org]; DMARC_NA(0.00)[freebsd.org]; RCPT_COUNT_FIVE(0.00)[6]; NEURAL_HAM_LONG(-1.02)[-1.021]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-0.57)[-0.566]; RCVD_IN_DNSWL_NONE(0.00)[209.85.221.65:from]; NEURAL_HAM_MEDIUM(-0.99)[-0.987]; FORGED_SENDER(0.30)[jrtc27@freebsd.org,jrtc27@jrtc27.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.221.65:from]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[jrtc27@freebsd.org,jrtc27@jrtc27.com]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 13 Aug 2020 15:37:50 -0000 On 13 Aug 2020, at 16:33, Ian Lepore wrote: > On Wed, 2020-08-12 at 09:24 -0700, Rodney W. Grimes wrote: >>> On 12 Aug 2020, at 17:10, Rodney W. Grimes < >>> freebsd@gndrsh.dnsmgr.net> wrote: >>>> >>>>> Author: arichardson >>>>> Date: Wed Aug 12 15:49:06 2020 >>>>> New Revision: 364166 >>>>> URL: https://svnweb.freebsd.org/changeset/base/364166 >>>>> >>>>> Log: >>>>> Fix crunchgen usage of mkstemp() >>>>> >>>>> On Glibc systems mkstemp can only be used once with the same >>>>> template >>>>> string since it will be modified in-place and no longer >>>>> contain any 'X' chars. >>>>> It is fine to reuse the same file here but we need to be >>>>> explicit and use >>>>> open() instead of mkstemp() on the second use. >>>>> >>>>> While touching this file also avoid a hardcoded /bin/pwd since >>>>> that may not >>>>> work when building on non-FreeBSD systems. >>>> >>>> This may cause some grief, as now pwd may use a shell builtin >>>> and often shell builtin's return a cwd that is not a true >>>> full path, ie it may contain symlink compontents in the >>>> path. >>>> >>>> /bin/sh: >>>> >>>> # cd /tmp/b >>>> # /bin/pwd >>>> /tmp/a >>>> # pwd >>>> /tmp/b >>>> # ls -lag /tmp/? >>>> lrwxr-xr-x 1 root wheel 1 Aug 12 16:06 /tmp/b -> a >>>> >>>> /tmp/a: >>>> total 17 >>>> drwxr-xr-x 2 root wheel 2 Aug 12 16:06 . >>>> drwxrwxrwt 18 root wheel 248 Aug 12 16:06 .. >>> >>> There's the question of whether that really matters; both values >>> are in >>> some sense correct. But if you want to restore the old behaviour, I >>> believe `env pwd` is the portable way to do so? >> >> You have cut the context, but the code has a comment that >> states it is doing this to remove symbolic links, so this >> change infact undoes something that was being done intentionally. >> >> I do believe also that a "env pwd" would do the right thing >> as well. >> > > Or just use "pwd -P" and avoid invoking multiple programs when the > shell can do all the work. Indeed, my suggestion was solving the wrong problem. r364174 added the -P but also needlessly added env too; -P is part of POSIX so any conforming pwd will support it, builtin or not. Jess From owner-svn-src-all@freebsd.org Thu Aug 13 16:22:52 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2439437DE0E; Thu, 13 Aug 2020 16:22:52 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4BSBgb6bDWz4TcW; Thu, 13 Aug 2020 16:22:51 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id 07DGMoQG043410; Thu, 13 Aug 2020 09:22:50 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id 07DGMoMw043409; Thu, 13 Aug 2020 09:22:50 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <202008131622.07DGMoMw043409@gndrsh.dnsmgr.net> Subject: Re: svn commit: r364190 - head/tools/build In-Reply-To: <202008131414.07DEEkeT002797@repo.freebsd.org> To: Alex Richardson Date: Thu, 13 Aug 2020 09:22:50 -0700 (PDT) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 4BSBgb6bDWz4TcW X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:13868, ipnet:69.59.192.0/19, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 13 Aug 2020 16:22:52 -0000 > Author: arichardson > Date: Thu Aug 13 14:14:46 2020 > New Revision: 364190 > URL: https://svnweb.freebsd.org/changeset/base/364190 > > Log: > Add pwd to the list of tools that are linked to $WORLDTMP/legacy Since "sh" is already in this list, and our "sh" has a builtin pwd that does the correct thing with pwd -P this should not be needed. Or are we contininue to use the host "sh" for far too long? For me from ancient days of hand bootstrapping BSD sources onto another system sh(1) and make(1) are the first 2 tools to get working. > After r364166 and r364174, crunchgen needs a pwd binary in $PATH instead > of using a hardcoded absolute path. This commit is needed for > BUILD_WITH_STRICT_TMPPATH builds (currently not on by default). > > Modified: > head/tools/build/Makefile > > Modified: head/tools/build/Makefile > ============================================================================== > --- head/tools/build/Makefile Thu Aug 13 13:59:31 2020 (r364189) > +++ head/tools/build/Makefile Thu Aug 13 14:14:46 2020 (r364190) > @@ -113,8 +113,8 @@ SYSINCS+= ${SRCTOP}/sys/sys/font.h > # Linux/MacOS since we only use flags that are supported by all of them. > _host_tools_to_symlink= basename bzip2 bunzip2 chmod chown cmp comm cp date dd \ > dirname echo env false find fmt gzip gunzip head hostname id ln ls \ > - mkdir mv nice patch rm realpath sh sleep stat tee touch tr true uname \ > - uniq wc which > + mkdir mv nice patch pwd rm realpath sh sleep stat tee touch tr true \ > + uname uniq wc which > > # We also need a symlink to the absolute path to the make binary used for > # the toplevel makefile. This is not necessarily the same as `which make` > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Thu Aug 13 16:28:26 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4774837DD65 for ; Thu, 13 Aug 2020 16:28:26 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BSBp06Cspz4Tmw for ; Thu, 13 Aug 2020 16:28:24 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wr1-f67.google.com with SMTP id f12so5818311wru.13 for ; Thu, 13 Aug 2020 09:28:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=C5Ip2FOgYoYhZuzTjd8zJhymMg2fSB5i5gKLktVF45I=; b=c/ESid1uYQ+44O2L+zLsmf49wyAhA49X1dGkMyrFDyjHlW/wl1W/0ZiHiD+m16eOXW XJgS/I5ovvrEVIS1c0iAzdM3tZY79sDNQyPI2EjA16Wu83KVERD8GEaLjcfpMaxpt106 xc/slZ2WIxNXo3aFL1+HzOeglLW396qGdjet5l5OPbO+17DM3E8aMeDFwfpybUSEiVRy H05MBcsP4bsbIwR5Ol5NritemfCSdOg01qBM4oWmPLCsaOcZAWmEM8jMTXU3thwSkxHF lygG5sBwL1w5XcTSsaGp3FXKTNHYhpj/J32Y+t+4/ICE7tVQHpcpa6DTa7rnYyQkIhAG B0CQ== X-Gm-Message-State: AOAM530eSgiRaBXNPusJybydwP8GnTz0O3ostaYuKcWwHECuHIxqVhX9 b5YfGMxZ1cJmvHLqOwVt5ufOnQ== X-Google-Smtp-Source: ABdhPJwlZb7ypEeY2KKZYbOsae0w6W67uzXFPAwHCVcC5CRHseIXdmplFukeS+y8MEP4YeITsHvOgA== X-Received: by 2002:a5d:63d1:: with SMTP id c17mr4942661wrw.241.1597336103508; Thu, 13 Aug 2020 09:28:23 -0700 (PDT) Received: from [192.168.149.251] (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id y142sm10981945wmd.3.2020.08.13.09.28.22 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Aug 2020 09:28:22 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.1\)) Subject: Re: svn commit: r364190 - head/tools/build From: Jessica Clarke In-Reply-To: <202008131622.07DGMoMw043409@gndrsh.dnsmgr.net> Date: Thu, 13 Aug 2020 17:28:22 +0100 Cc: Alex Richardson , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <84875FF7-A833-4FA1-9BB0-B75D607C4183@freebsd.org> References: <202008131622.07DGMoMw043409@gndrsh.dnsmgr.net> To: rgrimes@freebsd.org X-Mailer: Apple Mail (2.3608.120.23.2.1) X-Rspamd-Queue-Id: 4BSBp06Cspz4Tmw X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of jrtc27@jrtc27.com designates 209.85.221.67 as permitted sender) smtp.mailfrom=jrtc27@jrtc27.com X-Spamd-Result: default: False [-2.51 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-all@freebsd.org]; DMARC_NA(0.00)[freebsd.org]; RCPT_COUNT_FIVE(0.00)[5]; NEURAL_HAM_LONG(-1.02)[-1.021]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-1.00)[-0.999]; RCVD_IN_DNSWL_NONE(0.00)[209.85.221.67:from]; NEURAL_HAM_MEDIUM(-0.99)[-0.987]; FORGED_SENDER(0.30)[jrtc27@freebsd.org,jrtc27@jrtc27.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.221.67:from]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[jrtc27@freebsd.org,jrtc27@jrtc27.com]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 13 Aug 2020 16:28:26 -0000 On 13 Aug 2020, at 17:22, Rodney W. Grimes = wrote: >=20 >> Author: arichardson >> Date: Thu Aug 13 14:14:46 2020 >> New Revision: 364190 >> URL: https://svnweb.freebsd.org/changeset/base/364190 >>=20 >> Log: >> Add pwd to the list of tools that are linked to $WORLDTMP/legacy >=20 > Since "sh" is already in this list, and our "sh" has a builtin pwd > that does the correct thing with pwd -P this should not be needed. >=20 > Or are we contininue to use the host "sh" for far too long? >=20 > For me from ancient days of hand bootstrapping BSD sources onto > another system sh(1) and make(1) are the first 2 tools to get > working. The issue is that r364174 used `env pwd -P` rather than just `pwd -P`. = With that fixed, this should be revertible; even if the bootstrap sh isn't = being used at this point, I don't know of any contemporary sh-compatible shell = that doesn't implement pwd as a builtin (but surely we are using the = bootstrap sh by this point otherwise BUILD_WITH_STRICT_TMPPATH would have complained = about sh). Jess >> After r364166 and r364174, crunchgen needs a pwd binary in $PATH = instead >> of using a hardcoded absolute path. This commit is needed for >> BUILD_WITH_STRICT_TMPPATH builds (currently not on by default). >>=20 >> Modified: >> head/tools/build/Makefile >>=20 >> Modified: head/tools/build/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/tools/build/Makefile Thu Aug 13 13:59:31 2020 = (r364189) >> +++ head/tools/build/Makefile Thu Aug 13 14:14:46 2020 = (r364190) >> @@ -113,8 +113,8 @@ SYSINCS+=3D ${SRCTOP}/sys/sys/font.h >> # Linux/MacOS since we only use flags that are supported by all of = them. >> _host_tools_to_symlink=3D basename bzip2 bunzip2 chmod chown cmp = comm cp date dd \ >> dirname echo env false find fmt gzip gunzip head hostname id ln = ls \ >> - mkdir mv nice patch rm realpath sh sleep stat tee touch tr true = uname \ >> - uniq wc which >> + mkdir mv nice patch pwd rm realpath sh sleep stat tee touch tr = true \ >> + uname uniq wc which >>=20 >> # We also need a symlink to the absolute path to the make binary used = for >> # the toplevel makefile. This is not necessarily the same as `which = make` >>=20 >=20 > --=20 > Rod Grimes = rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Thu Aug 13 16:30:10 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4C84F37E0B4; Thu, 13 Aug 2020 16:30:10 +0000 (UTC) (envelope-from rscheff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BSBr21Mvtz4TwZ; Thu, 13 Aug 2020 16:30:10 +0000 (UTC) (envelope-from rscheff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0F4642011A; Thu, 13 Aug 2020 16:30:10 +0000 (UTC) (envelope-from rscheff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07DGU9gC083787; Thu, 13 Aug 2020 16:30:09 GMT (envelope-from rscheff@FreeBSD.org) Received: (from rscheff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07DGU9ee083785; Thu, 13 Aug 2020 16:30:09 GMT (envelope-from rscheff@FreeBSD.org) Message-Id: <202008131630.07DGU9ee083785@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rscheff set sender to rscheff@FreeBSD.org using -f From: Richard Scheffenegger Date: Thu, 13 Aug 2020 16:30:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364195 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: rscheff X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 364195 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 13 Aug 2020 16:30:10 -0000 Author: rscheff Date: Thu Aug 13 16:30:09 2020 New Revision: 364195 URL: https://svnweb.freebsd.org/changeset/base/364195 Log: Improve SACK support code for RFC6675 and PRR Adding proper accounting of sacked_bytes and (per-ACK) delivered data to the SACK scoreboard. This will allow more aspects of RFC6675 to be implemented as well as Proportional Rate Reduction (RFC6937). Prior to this change, the pipe calculation controlled with net.inet.tcp.rfc6675_pipe was also susceptible to incorrect results when more than 3 (or 4) holes in the sequence space were present, which can no longer all fit into a single ACK's SACK option. Reviewed by: kbowling, rgrimes (mentor) Approved by: rgrimes (mentor, blanket) MFC after: 3 weeks Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D18624 Modified: head/sys/netinet/tcp_input.c head/sys/netinet/tcp_sack.c head/sys/netinet/tcp_var.h Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Thu Aug 13 14:26:25 2020 (r364194) +++ head/sys/netinet/tcp_input.c Thu Aug 13 16:30:09 2020 (r364195) @@ -2673,9 +2673,16 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, stru tp->t_dupacks = 0; /* * If this ack also has new SACK info, increment the - * counter as per rfc6675. + * counter as per rfc6675. The variable + * sack_changed tracks all changes to the SACK + * scoreboard, including when partial ACKs without + * SACK options are received, and clear the scoreboard + * from the left side. Such partial ACKs should not be + * counted as dupacks here. */ - if ((tp->t_flags & TF_SACK_PERMIT) && sack_changed) + if ((tp->t_flags & TF_SACK_PERMIT) && + (to.to_flags & TOF_SACK) && + sack_changed) tp->t_dupacks++; } Modified: head/sys/netinet/tcp_sack.c ============================================================================== --- head/sys/netinet/tcp_sack.c Thu Aug 13 14:26:25 2020 (r364194) +++ head/sys/netinet/tcp_sack.c Thu Aug 13 16:30:09 2020 (r364195) @@ -535,9 +535,7 @@ tcp_sackhole_remove(struct tcpcb *tp, struct sackhole * tp->snd_holes is an ordered list of holes (oldest to newest, in terms of * the sequence space). * Returns 1 if incoming ACK has previously unknown SACK information, - * 0 otherwise. Note: We treat (snd_una, th_ack) as a sack block so any changes - * to that (i.e. left edge moving) would also be considered a change in SACK - * information which is slightly different than rfc6675. + * 0 otherwise. */ int tcp_sack_doack(struct tcpcb *tp, struct tcpopt *to, tcp_seq th_ack) @@ -545,16 +543,21 @@ tcp_sack_doack(struct tcpcb *tp, struct tcpopt *to, tc struct sackhole *cur, *temp; struct sackblk sack, sack_blocks[TCP_MAX_SACK + 1], *sblkp; int i, j, num_sack_blks, sack_changed; + int delivered_data, left_edge_delta; INP_WLOCK_ASSERT(tp->t_inpcb); num_sack_blks = 0; sack_changed = 0; + delivered_data = 0; + left_edge_delta = 0; /* * If SND.UNA will be advanced by SEG.ACK, and if SACK holes exist, * treat [SND.UNA, SEG.ACK) as if it is a SACK block. + * Account changes to SND.UNA always in delivered data. */ if (SEQ_LT(tp->snd_una, th_ack) && !TAILQ_EMPTY(&tp->snd_holes)) { + left_edge_delta = th_ack - tp->snd_una; sack_blocks[num_sack_blks].start = tp->snd_una; sack_blocks[num_sack_blks++].end = th_ack; } @@ -563,7 +566,6 @@ tcp_sack_doack(struct tcpcb *tp, struct tcpopt *to, tc * received new blocks from the other side. */ if (to->to_flags & TOF_SACK) { - tp->sackhint.sacked_bytes = 0; /* reset */ for (i = 0; i < to->to_nsacks; i++) { bcopy((to->to_sacks + i * TCPOLEN_SACK), &sack, sizeof(sack)); @@ -576,8 +578,6 @@ tcp_sack_doack(struct tcpcb *tp, struct tcpopt *to, tc SEQ_GT(sack.end, tp->snd_una) && SEQ_LEQ(sack.end, tp->snd_max)) { sack_blocks[num_sack_blks++] = sack; - tp->sackhint.sacked_bytes += - (sack.end-sack.start); } } } @@ -602,7 +602,7 @@ tcp_sack_doack(struct tcpcb *tp, struct tcpopt *to, tc } } } - if (TAILQ_EMPTY(&tp->snd_holes)) + if (TAILQ_EMPTY(&tp->snd_holes)) { /* * Empty scoreboard. Need to initialize snd_fack (it may be * uninitialized or have a bogus value). Scoreboard holes @@ -611,6 +611,8 @@ tcp_sack_doack(struct tcpcb *tp, struct tcpopt *to, tc * scoreboard). */ tp->snd_fack = SEQ_MAX(tp->snd_una, th_ack); + tp->sackhint.sacked_bytes = 0; /* reset */ + } /* * In the while-loop below, incoming SACK blocks (sack_blocks[]) and * SACK holes (snd_holes) are traversed from their tails with just @@ -634,6 +636,7 @@ tcp_sack_doack(struct tcpcb *tp, struct tcpopt *to, tc */ temp = tcp_sackhole_insert(tp, tp->snd_fack,sblkp->start,NULL); if (temp != NULL) { + delivered_data += sblkp->end - sblkp->start; tp->snd_fack = sblkp->end; /* Go to the previous sack block. */ sblkp--; @@ -651,11 +654,15 @@ tcp_sack_doack(struct tcpcb *tp, struct tcpopt *to, tc SEQ_LT(tp->snd_fack, sblkp->start)) sblkp--; if (sblkp >= sack_blocks && - SEQ_LT(tp->snd_fack, sblkp->end)) + SEQ_LT(tp->snd_fack, sblkp->end)) { + delivered_data += sblkp->end - tp->snd_fack; tp->snd_fack = sblkp->end; + sack_changed = 1; + } } } else if (SEQ_LT(tp->snd_fack, sblkp->end)) { /* fack is advanced. */ + delivered_data += sblkp->end - tp->snd_fack; tp->snd_fack = sblkp->end; sack_changed = 1; } @@ -689,6 +696,7 @@ tcp_sack_doack(struct tcpcb *tp, struct tcpopt *to, tc /* Data acks at least the beginning of hole. */ if (SEQ_GEQ(sblkp->end, cur->end)) { /* Acks entire hole, so delete hole. */ + delivered_data += (cur->end - cur->start); temp = cur; cur = TAILQ_PREV(cur, sackhole_head, scblink); tcp_sackhole_remove(tp, temp); @@ -700,6 +708,7 @@ tcp_sack_doack(struct tcpcb *tp, struct tcpopt *to, tc continue; } else { /* Move start of hole forward. */ + delivered_data += (sblkp->end - cur->start); cur->start = sblkp->end; cur->rxmit = SEQ_MAX(cur->rxmit, cur->start); } @@ -707,6 +716,7 @@ tcp_sack_doack(struct tcpcb *tp, struct tcpopt *to, tc /* Data acks at least the end of hole. */ if (SEQ_GEQ(sblkp->end, cur->end)) { /* Move end of hole backward. */ + delivered_data += (cur->end - sblkp->start); cur->end = sblkp->start; cur->rxmit = SEQ_MIN(cur->rxmit, cur->end); } else { @@ -726,6 +736,7 @@ tcp_sack_doack(struct tcpcb *tp, struct tcpopt *to, tc cur->end = sblkp->start; cur->rxmit = SEQ_MIN(cur->rxmit, cur->end); + delivered_data += (sblkp->end - sblkp->start); } } } @@ -740,6 +751,10 @@ tcp_sack_doack(struct tcpcb *tp, struct tcpopt *to, tc else sblkp--; } + tp->sackhint.delivered_data = delivered_data; + tp->sackhint.sacked_bytes += delivered_data - left_edge_delta; + KASSERT((delivered_data >= 0), ("delivered_data < 0")); + KASSERT((tp->sackhint.sacked_bytes >= 0), ("sacked_bytes < 0")); return (sack_changed); } Modified: head/sys/netinet/tcp_var.h ============================================================================== --- head/sys/netinet/tcp_var.h Thu Aug 13 14:26:25 2020 (r364194) +++ head/sys/netinet/tcp_var.h Thu Aug 13 16:30:09 2020 (r364195) @@ -105,12 +105,12 @@ struct sackhole { struct sackhint { struct sackhole *nexthole; - int sack_bytes_rexmit; + int32_t sack_bytes_rexmit; tcp_seq last_sack_ack; /* Most recent/largest sacked ack */ - int ispare; /* explicit pad for 64bit alignment */ - int sacked_bytes; /* - * Total sacked bytes reported by the + int32_t delivered_data; /* Newly acked data from last SACK */ + + int32_t sacked_bytes; /* Total sacked bytes reported by the * receiver via sack option */ uint32_t _pad1[1]; /* TBD */ From owner-svn-src-all@freebsd.org Thu Aug 13 16:34:21 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0C8CE37E2DD; Thu, 13 Aug 2020 16:34:21 +0000 (UTC) (envelope-from arichardson.kde@gmail.com) Received: from mail-ej1-f67.google.com (mail-ej1-f67.google.com [209.85.218.67]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BSBwr51xTz4Vf6; Thu, 13 Aug 2020 16:34:20 +0000 (UTC) (envelope-from arichardson.kde@gmail.com) Received: by mail-ej1-f67.google.com with SMTP id t10so6855695ejs.8; Thu, 13 Aug 2020 09:34:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=bNvVVzbpahudbFnvWds05xIv8LI2EmF0LIaWX15twqI=; b=RQ5aTG1rP5WrbEGP+smgWLsbnz5ICoXLmYsiGOjzE25+63MjIaOC58V8UtHwL6ot+v U/kWGONyvJncqZBwDZ/Cyaiy7mG4348YNph1tspjn9laF2rwxNp1ZadLQ/Uxi0FyQAY/ tESJ5PvGLB0XO+YF5RXvXf74e3qQSC80nRg0sh0oF6L8jop7afHg9tpKJYMRSeqKNfe1 pGz3Van8VHo2mgSh/Ms1Lbs57BDRDUDjjFy/ZMWoF232kDeUckHt5sn5NmPJZu+ljI15 tj1k/FIkiYw+8nGyadV0v3M0wl741WHEvNE51omLFbkTxUE4UIDJXqXfKaGRav4glhjZ p23w== X-Gm-Message-State: AOAM533QkOLhLl+G9STh3lpSoi7drz/eg8h4EY56MgkKsCikXrOGYa5/ nbqLz2lonvBphiDHk48CxgGKpPKI7jwBEQ== X-Google-Smtp-Source: ABdhPJwd3t/OfZNulMVW0SBp7I1H+aEKlaLPTRvmOFhJwfq3I88EmtKO1M5UTVTul3HFwLAHyo5p+w== X-Received: by 2002:a17:906:3790:: with SMTP id n16mr5521440ejc.256.1597336459031; Thu, 13 Aug 2020 09:34:19 -0700 (PDT) Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com. [209.85.128.43]) by smtp.gmail.com with ESMTPSA id g25sm4214530edp.22.2020.08.13.09.34.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 13 Aug 2020 09:34:18 -0700 (PDT) Received: by mail-wm1-f43.google.com with SMTP id p14so5232761wmg.1; Thu, 13 Aug 2020 09:34:18 -0700 (PDT) X-Received: by 2002:a7b:cc8e:: with SMTP id p14mr5005271wma.111.1597336458490; Thu, 13 Aug 2020 09:34:18 -0700 (PDT) MIME-Version: 1.0 References: <202008131622.07DGMoMw043409@gndrsh.dnsmgr.net> <84875FF7-A833-4FA1-9BB0-B75D607C4183@freebsd.org> In-Reply-To: <84875FF7-A833-4FA1-9BB0-B75D607C4183@freebsd.org> From: Alexander Richardson Date: Thu, 13 Aug 2020 17:34:07 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r364190 - head/tools/build To: Jessica Clarke Cc: rgrimes@freebsd.org, src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4BSBwr51xTz4Vf6 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; TAGGED_FROM(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 13 Aug 2020 16:34:21 -0000 On Thu, 13 Aug 2020 at 17:28, Jessica Clarke wrote: > > On 13 Aug 2020, at 17:22, Rodney W. Grimes wrote: > > > >> Author: arichardson > >> Date: Thu Aug 13 14:14:46 2020 > >> New Revision: 364190 > >> URL: https://svnweb.freebsd.org/changeset/base/364190 > >> > >> Log: > >> Add pwd to the list of tools that are linked to $WORLDTMP/legacy > > > > Since "sh" is already in this list, and our "sh" has a builtin pwd > > that does the correct thing with pwd -P this should not be needed. > > > > Or are we contininue to use the host "sh" for far too long? > > > > For me from ancient days of hand bootstrapping BSD sources onto > > another system sh(1) and make(1) are the first 2 tools to get > > working. > > The issue is that r364174 used `env pwd -P` rather than just `pwd -P`. With > that fixed, this should be revertible; even if the bootstrap sh isn't being > used at this point, I don't know of any contemporary sh-compatible shell that > doesn't implement pwd as a builtin (but surely we are using the bootstrap sh by > this point otherwise BUILD_WITH_STRICT_TMPPATH would have complained about sh). > > Jess I'll change it to use pwd instead of env pwd shortly and also revert the change that added pwd to the linked tools since using the shell builtin with -P is fine. We are not bootstrapping sh yet, but instead copying it from /usr/bin since it is not (yet) possible to bootstrap the base system sh on macOS&Linux. Alex > > >> After r364166 and r364174, crunchgen needs a pwd binary in $PATH instead > >> of using a hardcoded absolute path. This commit is needed for > >> BUILD_WITH_STRICT_TMPPATH builds (currently not on by default). > >> > >> Modified: > >> head/tools/build/Makefile > >> > >> Modified: head/tools/build/Makefile > >> ============================================================================== > >> --- head/tools/build/Makefile Thu Aug 13 13:59:31 2020 (r364189) > >> +++ head/tools/build/Makefile Thu Aug 13 14:14:46 2020 (r364190) > >> @@ -113,8 +113,8 @@ SYSINCS+= ${SRCTOP}/sys/sys/font.h > >> # Linux/MacOS since we only use flags that are supported by all of them. > >> _host_tools_to_symlink= basename bzip2 bunzip2 chmod chown cmp comm cp date dd \ > >> dirname echo env false find fmt gzip gunzip head hostname id ln ls \ > >> - mkdir mv nice patch rm realpath sh sleep stat tee touch tr true uname \ > >> - uniq wc which > >> + mkdir mv nice patch pwd rm realpath sh sleep stat tee touch tr true \ > >> + uname uniq wc which > >> > >> # We also need a symlink to the absolute path to the make binary used for > >> # the toplevel makefile. This is not necessarily the same as `which make` > >> > > > > -- > > Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Thu Aug 13 16:38:52 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3C4D037E349; Thu, 13 Aug 2020 16:38:52 +0000 (UTC) (envelope-from rscheff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BSC240nBgz4VmP; Thu, 13 Aug 2020 16:38:52 +0000 (UTC) (envelope-from rscheff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F26001FF7F; Thu, 13 Aug 2020 16:38:51 +0000 (UTC) (envelope-from rscheff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07DGcpAj090332; Thu, 13 Aug 2020 16:38:51 GMT (envelope-from rscheff@FreeBSD.org) Received: (from rscheff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07DGcpXZ090331; Thu, 13 Aug 2020 16:38:51 GMT (envelope-from rscheff@FreeBSD.org) Message-Id: <202008131638.07DGcpXZ090331@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rscheff set sender to rscheff@FreeBSD.org using -f From: Richard Scheffenegger Date: Thu, 13 Aug 2020 16:38:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364196 - head/sys/netinet/cc X-SVN-Group: head X-SVN-Commit-Author: rscheff X-SVN-Commit-Paths: head/sys/netinet/cc X-SVN-Commit-Revision: 364196 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 13 Aug 2020 16:38:52 -0000 Author: rscheff Date: Thu Aug 13 16:38:51 2020 New Revision: 364196 URL: https://svnweb.freebsd.org/changeset/base/364196 Log: TCP Cubic: After leaving slowstart fix unintended cwnd jump. Initializing K to zero in D23655 introduced a miscalculation, where cwnd would suddenly jump to cwnd_max instead of gradually increasing, after leaving slow-start. Properly calculating K instead of resetting it to zero resolves this issue. Also making sure, that cwnd is recalculated at the earliest opportunity once slow-start is over. Reported by: chengc_netapp.com Reviewed by: chengc_netapp.com, tuexen (mentor), rgrimes (mentor) Approved by: tuexen (mentor), rgrimes (mentor) MFC after: 3 weeks Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D25746 Modified: head/sys/netinet/cc/cc_cubic.c Modified: head/sys/netinet/cc/cc_cubic.c ============================================================================== --- head/sys/netinet/cc/cc_cubic.c Thu Aug 13 16:30:09 2020 (r364195) +++ head/sys/netinet/cc/cc_cubic.c Thu Aug 13 16:38:51 2020 (r364196) @@ -132,19 +132,29 @@ cubic_ack_received(struct cc_var *ccv, uint16_t type) /* * Regular ACK and we're not in cong/fast recovery and we're cwnd - * limited and we're either not doing ABC or are slow starting or are - * doing ABC and we've sent a cwnd's worth of bytes. + * limited and we're either not doing ABC or are just coming out + * from slow-start or were application limited or are slow starting + * or are doing ABC and we've sent a cwnd's worth of bytes. */ if (type == CC_ACK && !IN_RECOVERY(CCV(ccv, t_flags)) && (ccv->flags & CCF_CWND_LIMITED) && (!V_tcp_do_rfc3465 || + (cubic_data->flags & (CUBICFLAG_IN_SLOWSTART | CUBICFLAG_IN_APPLIMIT)) || CCV(ccv, snd_cwnd) <= CCV(ccv, snd_ssthresh) || - (V_tcp_do_rfc3465 && ccv->flags & CCF_ABC_SENTAWND))) { + (V_tcp_do_rfc3465 && (ccv->flags & CCF_ABC_SENTAWND)))) { /* Use the logic in NewReno ack_received() for slow start. */ if (CCV(ccv, snd_cwnd) <= CCV(ccv, snd_ssthresh) || cubic_data->min_rtt_ticks == TCPTV_SRTTBASE) { cubic_data->flags |= CUBICFLAG_IN_SLOWSTART; newreno_cc_algo.ack_received(ccv, type); } else { + if (cubic_data->flags & (CUBICFLAG_IN_SLOWSTART | + CUBICFLAG_IN_APPLIMIT)) { + cubic_data->flags &= ~(CUBICFLAG_IN_SLOWSTART | + CUBICFLAG_IN_APPLIMIT); + cubic_data->t_last_cong = ticks; + cubic_data->K = cubic_k(cubic_data->max_cwnd / + CCV(ccv, t_maxseg)); + } if ((ticks_since_cong = ticks - cubic_data->t_last_cong) < 0) { /* @@ -152,14 +162,6 @@ cubic_ack_received(struct cc_var *ccv, uint16_t type) */ ticks_since_cong = INT_MAX; cubic_data->t_last_cong = ticks - INT_MAX; - } - - if (cubic_data->flags & (CUBICFLAG_IN_SLOWSTART | - CUBICFLAG_IN_APPLIMIT)) { - cubic_data->flags &= ~(CUBICFLAG_IN_SLOWSTART | - CUBICFLAG_IN_APPLIMIT); - cubic_data->t_last_cong = ticks; - cubic_data->K = 0; } /* * The mean RTT is used to best reflect the equations in From owner-svn-src-all@freebsd.org Thu Aug 13 16:45:55 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E8B3E37E5DA; Thu, 13 Aug 2020 16:45:55 +0000 (UTC) (envelope-from rscheff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BSCBC5qM4z4WGd; Thu, 13 Aug 2020 16:45:55 +0000 (UTC) (envelope-from rscheff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AC14920335; Thu, 13 Aug 2020 16:45:55 +0000 (UTC) (envelope-from rscheff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07DGjto8096158; Thu, 13 Aug 2020 16:45:55 GMT (envelope-from rscheff@FreeBSD.org) Received: (from rscheff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07DGjtMn096157; Thu, 13 Aug 2020 16:45:55 GMT (envelope-from rscheff@FreeBSD.org) Message-Id: <202008131645.07DGjtMn096157@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rscheff set sender to rscheff@FreeBSD.org using -f From: Richard Scheffenegger Date: Thu, 13 Aug 2020 16:45:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364197 - head/sys/netinet/cc X-SVN-Group: head X-SVN-Commit-Author: rscheff X-SVN-Commit-Paths: head/sys/netinet/cc X-SVN-Commit-Revision: 364197 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 13 Aug 2020 16:45:56 -0000 Author: rscheff Date: Thu Aug 13 16:45:55 2020 New Revision: 364197 URL: https://svnweb.freebsd.org/changeset/base/364197 Log: TCP Cubic: Have Fast Convergence Heuristic work for ECN, and align concave region The Cubic concave region was not aligned nicely for the very first exit from slow start, where a 50% cwnd reduction is done instead of the normal 30%. This addresses an issue, where a short line-rate burst could result from that sudden jump of cwnd. In addition, the Fast Convergence Heuristic has been expanded to work also with ECN induced congestion response. Submitted by: chengc_netapp.com Reported by: chengc_netapp.com Reviewed by: tuexen (mentor), rgrimes (mentor) Approved by: tuexen (mentor), rgrimes (mentor) MFC after: 3 weeks Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D25976 Modified: head/sys/netinet/cc/cc_cubic.c Modified: head/sys/netinet/cc/cc_cubic.c ============================================================================== --- head/sys/netinet/cc/cc_cubic.c Thu Aug 13 16:38:51 2020 (r364196) +++ head/sys/netinet/cc/cc_cubic.c Thu Aug 13 16:45:55 2020 (r364197) @@ -286,8 +286,7 @@ cubic_cong_signal(struct cc_var *ccv, uint32_t type) if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { cubic_ssthresh_update(ccv); cubic_data->flags |= CUBICFLAG_CONG_EVENT; - cubic_data->prev_max_cwnd = cubic_data->max_cwnd; - cubic_data->max_cwnd = CCV(ccv, snd_cwnd); + cubic_data->t_last_cong = ticks; cubic_data->K = cubic_k(cubic_data->max_cwnd / CCV(ccv, t_maxseg)); } ENTER_RECOVERY(CCV(ccv, t_flags)); @@ -298,8 +297,6 @@ cubic_cong_signal(struct cc_var *ccv, uint32_t type) if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { cubic_ssthresh_update(ccv); cubic_data->flags |= CUBICFLAG_CONG_EVENT; - cubic_data->prev_max_cwnd = cubic_data->max_cwnd; - cubic_data->max_cwnd = CCV(ccv, snd_cwnd); cubic_data->t_last_cong = ticks; cubic_data->K = cubic_k(cubic_data->max_cwnd / CCV(ccv, t_maxseg)); CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh); @@ -361,11 +358,6 @@ cubic_post_recovery(struct cc_var *ccv) cubic_data = ccv->cc_data; pipe = 0; - /* Fast convergence heuristic. */ - if (cubic_data->max_cwnd < cubic_data->prev_max_cwnd) - cubic_data->max_cwnd = (cubic_data->max_cwnd * CUBIC_FC_FACTOR) - >> CUBIC_SHIFT; - if (IN_FASTRECOVERY(CCV(ccv, t_flags))) { /* * If inflight data is less than ssthresh, set cwnd @@ -392,7 +384,6 @@ cubic_post_recovery(struct cc_var *ccv) CUBIC_BETA) >> CUBIC_SHIFT, 2 * CCV(ccv, t_maxseg)); } - cubic_data->t_last_cong = ticks; /* Calculate the average RTT between congestion epochs. */ if (cubic_data->epoch_ack_count > 0 && @@ -403,7 +394,6 @@ cubic_post_recovery(struct cc_var *ccv) cubic_data->epoch_ack_count = 0; cubic_data->sum_rtt_ticks = 0; - cubic_data->K = cubic_k(cubic_data->max_cwnd / CCV(ccv, t_maxseg)); } /* @@ -457,18 +447,32 @@ cubic_ssthresh_update(struct cc_var *ccv) { struct cubic *cubic_data; uint32_t ssthresh; + uint32_t cwnd; cubic_data = ccv->cc_data; + cwnd = CCV(ccv, snd_cwnd); + /* Fast convergence heuristic. */ + if (cwnd < cubic_data->max_cwnd) { + cwnd = ((uint64_t)cwnd * CUBIC_FC_FACTOR) >> CUBIC_SHIFT; + } + cubic_data->prev_max_cwnd = cubic_data->max_cwnd; + cubic_data->max_cwnd = cwnd; + /* - * On the first congestion event, set ssthresh to cwnd * 0.5, on - * subsequent congestion events, set it to cwnd * beta. + * On the first congestion event, set ssthresh to cwnd * 0.5 + * and reduce max_cwnd to cwnd * beta. This aligns the cubic concave + * region appropriately. On subsequent congestion events, set + * ssthresh to cwnd * beta. */ - if ((cubic_data->flags & CUBICFLAG_CONG_EVENT) == 0) - ssthresh = CCV(ccv, snd_cwnd) >> 1; - else - ssthresh = ((uint64_t)CCV(ccv, snd_cwnd) * + if ((cubic_data->flags & CUBICFLAG_CONG_EVENT) == 0) { + ssthresh = cwnd >> 1; + cubic_data->max_cwnd = ((uint64_t)cwnd * CUBIC_BETA) >> CUBIC_SHIFT; + } else { + ssthresh = ((uint64_t)cwnd * + CUBIC_BETA) >> CUBIC_SHIFT; + } CCV(ccv, snd_ssthresh) = max(ssthresh, 2 * CCV(ccv, t_maxseg)); } From owner-svn-src-all@freebsd.org Thu Aug 13 17:36:53 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B4BF537F451; Thu, 13 Aug 2020 17:36:53 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BSDK14KDnz4Yb0; Thu, 13 Aug 2020 17:36:53 +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 7356120C34; Thu, 13 Aug 2020 17:36:53 +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 07DHarJo050177; Thu, 13 Aug 2020 17:36:53 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07DHarbx050176; Thu, 13 Aug 2020 17:36:53 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008131736.07DHarbx050176@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 13 Aug 2020 17:36: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: r364198 - stable/12/usr.sbin/nscd X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/usr.sbin/nscd X-SVN-Commit-Revision: 364198 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 13 Aug 2020 17:36:53 -0000 Author: trasz Date: Thu Aug 13 17:36:52 2020 New Revision: 364198 URL: https://svnweb.freebsd.org/changeset/base/364198 Log: MFC r339919: Make "nscd -t" work. Modified: stable/12/usr.sbin/nscd/debug.c stable/12/usr.sbin/nscd/debug.h Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/nscd/debug.c ============================================================================== --- stable/12/usr.sbin/nscd/debug.c Thu Aug 13 16:45:55 2020 (r364197) +++ stable/12/usr.sbin/nscd/debug.c Thu Aug 13 17:36:52 2020 (r364198) @@ -131,7 +131,7 @@ nscd_trace_out(const char *s, const char *f, int l) for (i = 0; i < trace_level; ++i) printf("\t"); - printf("<= %s\n", s); + printf("<= %s, %s: %d\n", s, f, l); } } Modified: stable/12/usr.sbin/nscd/debug.h ============================================================================== --- stable/12/usr.sbin/nscd/debug.h Thu Aug 13 16:45:55 2020 (r364197) +++ stable/12/usr.sbin/nscd/debug.h Thu Aug 13 17:36:52 2020 (r364198) @@ -31,8 +31,7 @@ #define TRACE_WANTED 32 -/* #ifndef NDEBUG */ -#if 0 +#ifndef NDEBUG #define TRACE_IN(x) nscd_trace_in(#x, __FILE__, __LINE__) #define TRACE_POINT() nscd_trace_point(__FILE__, __LINE__) #define TRACE_MSG(x) nscd_trace_msg(x, __FILE__, __LINE__) From owner-svn-src-all@freebsd.org Thu Aug 13 17:37:55 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BD12037F6DF; Thu, 13 Aug 2020 17:37: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BSDLC4Xm0z4YvL; Thu, 13 Aug 2020 17:37: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 7F16520DAE; Thu, 13 Aug 2020 17:37: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 07DHbtaa050290; Thu, 13 Aug 2020 17:37:55 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07DHbt6G050288; Thu, 13 Aug 2020 17:37:55 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008131737.07DHbt6G050288@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 13 Aug 2020 17:37:55 +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: r364199 - stable/12/usr.sbin/nscd X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/usr.sbin/nscd X-SVN-Commit-Revision: 364199 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 13 Aug 2020 17:37:55 -0000 Author: trasz Date: Thu Aug 13 17:37:54 2020 New Revision: 364199 URL: https://svnweb.freebsd.org/changeset/base/364199 Log: MFC r340015: Unbreak nscd(8). Without this change the CMSG gets truncated. Modified: stable/12/usr.sbin/nscd/nscdcli.c stable/12/usr.sbin/nscd/query.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/nscd/nscdcli.c ============================================================================== --- stable/12/usr.sbin/nscd/nscdcli.c Thu Aug 13 17:36:52 2020 (r364198) +++ stable/12/usr.sbin/nscd/nscdcli.c Thu Aug 13 17:37:54 2020 (r364199) @@ -138,14 +138,14 @@ send_credentials(struct nscd_connection_ *connection, struct msghdr cred_hdr; struct iovec iov; - struct { + union { struct cmsghdr hdr; - struct cmsgcred creds; + char cred[CMSG_SPACE(sizeof(struct cmsgcred))]; } cmsg; TRACE_IN(send_credentials); memset(&cmsg, 0, sizeof(cmsg)); - cmsg.hdr.cmsg_len = sizeof(cmsg); + cmsg.hdr.cmsg_len = CMSG_LEN(sizeof(struct cmsgcred)); cmsg.hdr.cmsg_level = SOL_SOCKET; cmsg.hdr.cmsg_type = SCM_CREDS; @@ -153,7 +153,7 @@ send_credentials(struct nscd_connection_ *connection, cred_hdr.msg_iov = &iov; cred_hdr.msg_iovlen = 1; cred_hdr.msg_control = &cmsg; - cred_hdr.msg_controllen = sizeof(cmsg); + cred_hdr.msg_controllen = CMSG_SPACE(sizeof(struct cmsgcred)); iov.iov_base = &type; iov.iov_len = sizeof(int); Modified: stable/12/usr.sbin/nscd/query.c ============================================================================== --- stable/12/usr.sbin/nscd/query.c Thu Aug 13 17:36:52 2020 (r364198) +++ stable/12/usr.sbin/nscd/query.c Thu Aug 13 17:37:54 2020 (r364199) @@ -160,7 +160,7 @@ on_query_startup(struct query_state *qstate) struct cmsgcred *cred; int elem_type; - struct { + union { struct cmsghdr hdr; char cred[CMSG_SPACE(sizeof(struct cmsgcred))]; } cmsg; @@ -171,8 +171,8 @@ on_query_startup(struct query_state *qstate) memset(&cred_hdr, 0, sizeof(struct msghdr)); cred_hdr.msg_iov = &iov; cred_hdr.msg_iovlen = 1; - cred_hdr.msg_control = (caddr_t)&cmsg; - cred_hdr.msg_controllen = CMSG_LEN(sizeof(struct cmsgcred)); + cred_hdr.msg_control = &cmsg; + cred_hdr.msg_controllen = CMSG_SPACE(sizeof(struct cmsgcred)); memset(&iov, 0, sizeof(struct iovec)); iov.iov_base = &elem_type; @@ -183,7 +183,8 @@ on_query_startup(struct query_state *qstate) return (-1); } - if (cmsg.hdr.cmsg_len < CMSG_LEN(sizeof(struct cmsgcred)) + if (cred_hdr.msg_controllen < CMSG_LEN(sizeof(struct cmsgcred)) + || cmsg.hdr.cmsg_len < CMSG_LEN(sizeof(struct cmsgcred)) || cmsg.hdr.cmsg_level != SOL_SOCKET || cmsg.hdr.cmsg_type != SCM_CREDS) { TRACE_OUT(on_query_startup); From owner-svn-src-all@freebsd.org Thu Aug 13 17:41:30 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F2EC937F6F7; Thu, 13 Aug 2020 17:41:30 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BSDQL6DJ1z4YwL; Thu, 13 Aug 2020 17:41:30 +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 BA74E20BF8; Thu, 13 Aug 2020 17:41:30 +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 07DHfUxG051453; Thu, 13 Aug 2020 17:41:30 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07DHfUoa051450; Thu, 13 Aug 2020 17:41:30 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008131741.07DHfUoa051450@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 13 Aug 2020 17:41: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: r364200 - in stable/12: lib/libc/net usr.sbin/nscd X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in stable/12: lib/libc/net usr.sbin/nscd X-SVN-Commit-Revision: 364200 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 13 Aug 2020 17:41:31 -0000 Author: trasz Date: Thu Aug 13 17:41:29 2020 New Revision: 364200 URL: https://svnweb.freebsd.org/changeset/base/364200 Log: MFC r341009 by des: Style cleanup. Modified: stable/12/lib/libc/net/nscachedcli.c stable/12/usr.sbin/nscd/nscdcli.c stable/12/usr.sbin/nscd/query.c Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libc/net/nscachedcli.c ============================================================================== --- stable/12/lib/libc/net/nscachedcli.c Thu Aug 13 17:37:54 2020 (r364199) +++ stable/12/lib/libc/net/nscachedcli.c Thu Aug 13 17:41:29 2020 (r364200) @@ -144,29 +144,27 @@ safe_read(struct cached_connection_ *connection, void static int send_credentials(struct cached_connection_ *connection, int type) { + union { + struct cmsghdr hdr; + char pad[CMSG_SPACE(sizeof(struct cmsgcred))]; + } cmsg; + struct msghdr mhdr; + struct iovec iov; struct kevent eventlist; int nevents; ssize_t result; int res; - struct msghdr cred_hdr; - struct iovec iov; - - struct { - struct cmsghdr hdr; - char cred[CMSG_SPACE(sizeof(struct cmsgcred))]; - } cmsg; - memset(&cmsg, 0, sizeof(cmsg)); - cmsg.hdr.cmsg_len = CMSG_LEN(sizeof(struct cmsgcred)); + cmsg.hdr.cmsg_len = CMSG_LEN(sizeof(struct cmsgcred)); cmsg.hdr.cmsg_level = SOL_SOCKET; cmsg.hdr.cmsg_type = SCM_CREDS; - memset(&cred_hdr, 0, sizeof(struct msghdr)); - cred_hdr.msg_iov = &iov; - cred_hdr.msg_iovlen = 1; - cred_hdr.msg_control = (caddr_t)&cmsg; - cred_hdr.msg_controllen = CMSG_SPACE(sizeof(struct cmsgcred)); + memset(&mhdr, 0, sizeof(mhdr)); + mhdr.msg_iov = &iov; + mhdr.msg_iovlen = 1; + mhdr.msg_control = &cmsg; + mhdr.msg_controllen = CMSG_SPACE(sizeof(struct cmsgcred)); iov.iov_base = &type; iov.iov_len = sizeof(int); @@ -178,8 +176,8 @@ send_credentials(struct cached_connection_ *connection nevents = _kevent(connection->write_queue, NULL, 0, &eventlist, 1, NULL); if (nevents == 1 && eventlist.filter == EVFILT_WRITE) { - result = (_sendmsg(connection->sockfd, &cred_hdr, - MSG_NOSIGNAL) == -1) ? -1 : 0; + result = _sendmsg(connection->sockfd, &mhdr, + MSG_NOSIGNAL) == -1 ? -1 : 0; EV_SET(&eventlist, connection->sockfd, EVFILT_WRITE, EV_ADD, 0, 0, NULL); _kevent(connection->write_queue, &eventlist, 1, NULL, 0, NULL); Modified: stable/12/usr.sbin/nscd/nscdcli.c ============================================================================== --- stable/12/usr.sbin/nscd/nscdcli.c Thu Aug 13 17:37:54 2020 (r364199) +++ stable/12/usr.sbin/nscd/nscdcli.c Thu Aug 13 17:41:29 2020 (r364200) @@ -130,44 +130,41 @@ safe_read(struct nscd_connection_ *connection, void *d static int send_credentials(struct nscd_connection_ *connection, int type) { + union { + struct cmsghdr hdr; + char pad[CMSG_SPACE(sizeof(struct cmsgcred))]; + } cmsg; + struct msghdr mhdr; + struct iovec iov; struct kevent eventlist; int nevents; ssize_t result; int res; - struct msghdr cred_hdr; - struct iovec iov; - - union { - struct cmsghdr hdr; - char cred[CMSG_SPACE(sizeof(struct cmsgcred))]; - } cmsg; - TRACE_IN(send_credentials); memset(&cmsg, 0, sizeof(cmsg)); cmsg.hdr.cmsg_len = CMSG_LEN(sizeof(struct cmsgcred)); cmsg.hdr.cmsg_level = SOL_SOCKET; cmsg.hdr.cmsg_type = SCM_CREDS; - memset(&cred_hdr, 0, sizeof(struct msghdr)); - cred_hdr.msg_iov = &iov; - cred_hdr.msg_iovlen = 1; - cred_hdr.msg_control = &cmsg; - cred_hdr.msg_controllen = CMSG_SPACE(sizeof(struct cmsgcred)); + memset(&mhdr, 0, sizeof(mhdr)); + mhdr.msg_iov = &iov; + mhdr.msg_iovlen = 1; + mhdr.msg_control = &cmsg; + mhdr.msg_controllen = CMSG_SPACE(sizeof(struct cmsgcred)); iov.iov_base = &type; iov.iov_len = sizeof(int); EV_SET(&eventlist, connection->sockfd, EVFILT_WRITE, EV_ADD, - NOTE_LOWAT, sizeof(int), NULL); + NOTE_LOWAT, sizeof(int), NULL); res = kevent(connection->write_queue, &eventlist, 1, NULL, 0, NULL); nevents = kevent(connection->write_queue, NULL, 0, &eventlist, 1, NULL); if ((nevents == 1) && (eventlist.filter == EVFILT_WRITE)) { - result = (sendmsg(connection->sockfd, &cred_hdr, 0) == -1) ? -1 - : 0; + result = sendmsg(connection->sockfd, &mhdr, 0) == -1 ? -1 : 0; EV_SET(&eventlist, connection->sockfd, EVFILT_WRITE, EV_ADD, - 0, 0, NULL); + 0, 0, NULL); kevent(connection->write_queue, &eventlist, 1, NULL, 0, NULL); TRACE_OUT(send_credentials); return (result); Modified: stable/12/usr.sbin/nscd/query.c ============================================================================== --- stable/12/usr.sbin/nscd/query.c Thu Aug 13 17:37:54 2020 (r364199) +++ stable/12/usr.sbin/nscd/query.c Thu Aug 13 17:41:29 2020 (r364200) @@ -155,38 +155,37 @@ clear_config_entry_part(struct configuration_entry *co static int on_query_startup(struct query_state *qstate) { - struct msghdr cred_hdr; - struct iovec iov; + union { + struct cmsghdr hdr; + char pad[CMSG_SPACE(sizeof(struct cmsgcred))]; + } cmsg; + struct msghdr mhdr; + struct iovec iov; struct cmsgcred *cred; int elem_type; - union { - struct cmsghdr hdr; - char cred[CMSG_SPACE(sizeof(struct cmsgcred))]; - } cmsg; - TRACE_IN(on_query_startup); assert(qstate != NULL); - memset(&cred_hdr, 0, sizeof(struct msghdr)); - cred_hdr.msg_iov = &iov; - cred_hdr.msg_iovlen = 1; - cred_hdr.msg_control = &cmsg; - cred_hdr.msg_controllen = CMSG_SPACE(sizeof(struct cmsgcred)); + memset(&mhdr, 0, sizeof(mhdr)); + mhdr.msg_iov = &iov; + mhdr.msg_iovlen = 1; + mhdr.msg_control = &cmsg; + mhdr.msg_controllen = sizeof(cmsg); - memset(&iov, 0, sizeof(struct iovec)); + memset(&iov, 0, sizeof(iov)); iov.iov_base = &elem_type; - iov.iov_len = sizeof(int); + iov.iov_len = sizeof(elem_type); - if (recvmsg(qstate->sockfd, &cred_hdr, 0) == -1) { + if (recvmsg(qstate->sockfd, &mhdr, 0) == -1) { TRACE_OUT(on_query_startup); return (-1); } - if (cred_hdr.msg_controllen < CMSG_LEN(sizeof(struct cmsgcred)) - || cmsg.hdr.cmsg_len < CMSG_LEN(sizeof(struct cmsgcred)) - || cmsg.hdr.cmsg_level != SOL_SOCKET - || cmsg.hdr.cmsg_type != SCM_CREDS) { + if (mhdr.msg_controllen != CMSG_SPACE(sizeof(struct cmsgcred)) || + cmsg.hdr.cmsg_len != CMSG_LEN(sizeof(struct cmsgcred)) || + cmsg.hdr.cmsg_level != SOL_SOCKET || + cmsg.hdr.cmsg_type != SCM_CREDS) { TRACE_OUT(on_query_startup); return (-1); } @@ -206,9 +205,9 @@ on_query_startup(struct query_state *qstate) return (-1); #else if ((elem_type != CET_READ_REQUEST) && - (elem_type != CET_MP_READ_SESSION_REQUEST) && - (elem_type != CET_WRITE_REQUEST) && - (elem_type != CET_MP_WRITE_SESSION_REQUEST)) { + (elem_type != CET_MP_READ_SESSION_REQUEST) && + (elem_type != CET_WRITE_REQUEST) && + (elem_type != CET_MP_WRITE_SESSION_REQUEST)) { TRACE_OUT(on_query_startup); return (-1); } From owner-svn-src-all@freebsd.org Thu Aug 13 17:42:51 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 441FB37FE00; Thu, 13 Aug 2020 17:42:51 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BSDRv14Nzz4ZgK; Thu, 13 Aug 2020 17:42:51 +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 088B82100A; Thu, 13 Aug 2020 17:42:51 +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 07DHgogj056515; Thu, 13 Aug 2020 17:42:50 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07DHgoTh056514; Thu, 13 Aug 2020 17:42:50 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008131742.07DHgoTh056514@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 13 Aug 2020 17:42:50 +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: r364201 - stable/12/usr.sbin/nscd X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/usr.sbin/nscd X-SVN-Commit-Revision: 364201 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 13 Aug 2020 17:42:51 -0000 Author: trasz Date: Thu Aug 13 17:42:50 2020 New Revision: 364201 URL: https://svnweb.freebsd.org/changeset/base/364201 Log: MFC r343121: Workaround for nscd(8) failure with large entries. It fixes a case where eg a 2KB group entry would take several seconds to complete with cache enabled in nsswitch.conf. Modified: stable/12/usr.sbin/nscd/nscd.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/nscd/nscd.c ============================================================================== --- stable/12/usr.sbin/nscd/nscd.c Thu Aug 13 17:41:29 2020 (r364200) +++ stable/12/usr.sbin/nscd/nscd.c Thu Aug 13 17:42:50 2020 (r364201) @@ -405,6 +405,12 @@ process_socket_event(struct kevent *event_data, struct * process_socket_event). */ if (qstate->kevent_watermark > MAX_SOCKET_IO_SIZE) { +#if 0 + /* + * XXX: Uncommenting this code makes nscd(8) fail for + * entries larger than a few kB, causing few second + * worth of delay for each call to retrieve them. + */ if (qstate->io_buffer != NULL) free(qstate->io_buffer); @@ -421,6 +427,7 @@ process_socket_event(struct kevent *event_data, struct if (qstate->kevent_filter == EVFILT_READ) qstate->use_alternate_io = 1; +#endif qstate->io_buffer_watermark = MAX_SOCKET_IO_SIZE; EV_SET(&eventlist[1], event_data->ident, From owner-svn-src-all@freebsd.org Thu Aug 13 18:35:31 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1EDE93A8B0B; Thu, 13 Aug 2020 18:35:31 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BSFcf74LNz4cXD; Thu, 13 Aug 2020 18:35:30 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D5FB3213F7; Thu, 13 Aug 2020 18:35:30 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07DIZUHX087325; Thu, 13 Aug 2020 18:35:30 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07DIZTYf087321; Thu, 13 Aug 2020 18:35:29 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <202008131835.07DIZTYf087321@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Thu, 13 Aug 2020 18:35:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364202 - in head/sys/net: . route X-SVN-Group: head X-SVN-Commit-Author: melifaro X-SVN-Commit-Paths: in head/sys/net: . route X-SVN-Commit-Revision: 364202 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 13 Aug 2020 18:35:31 -0000 Author: melifaro Date: Thu Aug 13 18:35:29 2020 New Revision: 364202 URL: https://svnweb.freebsd.org/changeset/base/364202 Log: Move rtzone handling code to net/route_ctl.c After moving the route control plane code from net/route.c, all rtzone users ended up being in net/route_ctl.c. Move uma(9) rtzone setup/teardown code to net/route_ctl.c as well to have everything in a single place. While here, remove custom initializers from the zone. It was added originally to avoid setup/teardown of costy per-cpu couters. With these counters removed, the only remaining job was avoiding rte mutex setup/teardown. Mutex setup is relatively cheap. Additionally, this mutex will soon be removed. With that in mind, there is no sense in keeping custom zone callbacks. Differential Revision: https://reviews.freebsd.org/D26051 Modified: head/sys/net/route.c head/sys/net/route.h head/sys/net/route/route_ctl.c head/sys/net/route/route_var.h head/sys/net/route/shared.h Modified: head/sys/net/route.c ============================================================================== --- head/sys/net/route.c Thu Aug 13 17:42:50 2020 (r364201) +++ head/sys/net/route.c Thu Aug 13 18:35:29 2020 (r364202) @@ -122,14 +122,10 @@ VNET_DEFINE(struct rib_head *, rt_tables); #define V_rt_tables VNET(rt_tables) -VNET_DEFINE(uma_zone_t, rtzone); /* Routing table UMA zone. */ -#define V_rtzone VNET(rtzone) - EVENTHANDLER_LIST_DEFINE(rt_addrmsg); static int rt_ifdelroute(const struct rtentry *rt, const struct nhop_object *, void *arg); -static void destroy_rtentry_epoch(epoch_context_t ctx); static int rt_exportinfo(struct rtentry *rt, struct rt_addrinfo *info, int flags); @@ -207,44 +203,7 @@ route_init(void) } SYSINIT(route_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, route_init, NULL); -static int -rtentry_zinit(void *mem, int size, int how) -{ - struct rtentry *rt = mem; - - RT_LOCK_INIT(rt); - - return (0); -} - static void -rtentry_zfini(void *mem, int size) -{ - struct rtentry *rt = mem; - - RT_LOCK_DESTROY(rt); -} - -static int -rtentry_ctor(void *mem, int size, void *arg, int how) -{ - struct rtentry *rt = mem; - - bzero(rt, offsetof(struct rtentry, rt_endzero)); - rt->rt_chain = NULL; - - return (0); -} - -static void -rtentry_dtor(void *mem, int size, void *arg) -{ - struct rtentry *rt = mem; - - RT_UNLOCK_COND(rt); -} - -static void vnet_route_init(const void *unused __unused) { struct domain *dom; @@ -255,9 +214,7 @@ vnet_route_init(const void *unused __unused) V_rt_tables = malloc(rt_numfibs * (AF_MAX+1) * sizeof(struct rib_head *), M_RTABLE, M_WAITOK|M_ZERO); - V_rtzone = uma_zcreate("rtentry", sizeof(struct rtentry), - rtentry_ctor, rtentry_dtor, - rtentry_zinit, rtentry_zfini, UMA_ALIGN_PTR, 0); + vnet_rtzone_init(); for (dom = domains; dom; dom = dom->dom_next) { if (dom->dom_rtattach == NULL) continue; @@ -314,7 +271,7 @@ vnet_route_uninit(const void *unused __unused) epoch_drain_callbacks(net_epoch_preempt); free(V_rt_tables, M_RTABLE); - uma_zdestroy(V_rtzone); + vnet_rtzone_destroy(); } VNET_SYSUNINIT(vnet_route_uninit, SI_SUB_PROTO_DOMAIN, SI_ORDER_FIRST, vnet_route_uninit, 0); @@ -403,55 +360,6 @@ sys_setfib(struct thread *td, struct setfib_args *uap) return EINVAL; td->td_proc->p_fibnum = uap->fibnum; return (0); -} - -/* - * Remove a reference count from an rtentry. - * If the count gets low enough, take it out of the routing table - */ -void -rtfree(struct rtentry *rt) -{ - - KASSERT(rt != NULL,("%s: NULL rt", __func__)); - - RT_LOCK_ASSERT(rt); - - RT_UNLOCK(rt); - epoch_call(net_epoch_preempt, destroy_rtentry_epoch, - &rt->rt_epoch_ctx); -} - -static void -destroy_rtentry(struct rtentry *rt) -{ - - /* - * At this moment rnh, nh_control may be already freed. - * nhop interface may have been migrated to a different vnet. - * Use vnet stored in the nexthop to delete the entry. - */ - CURVNET_SET(nhop_get_vnet(rt->rt_nhop)); - - /* Unreference nexthop */ - nhop_free(rt->rt_nhop); - - uma_zfree(V_rtzone, rt); - - CURVNET_RESTORE(); -} - -/* - * Epoch callback indicating rtentry is safe to destroy - */ -static void -destroy_rtentry_epoch(epoch_context_t ctx) -{ - struct rtentry *rt; - - rt = __containerof(ctx, struct rtentry, rt_epoch_ctx); - - destroy_rtentry(rt); } /* Modified: head/sys/net/route.h ============================================================================== --- head/sys/net/route.h Thu Aug 13 17:42:50 2020 (r364201) +++ head/sys/net/route.h Thu Aug 13 18:35:29 2020 (r364202) @@ -387,16 +387,7 @@ int rtsock_routemsg_info(int, struct rt_addrinfo *, in struct sockaddr *rtsock_fix_netmask(const struct sockaddr *dst, const struct sockaddr *smask, struct sockaddr_storage *dmask); -/* - * Note the following locking behavior: - * - * rtfree() and RTFREE_LOCKED() require a locked rtentry - * - * RTFREE() uses an unlocked entry. - */ -void rtfree(struct rtentry *); -void rtfree_func(struct rtentry *); void rt_updatemtu(struct ifnet *); void rt_flushifroutes_af(struct ifnet *, int); Modified: head/sys/net/route/route_ctl.c ============================================================================== --- head/sys/net/route/route_ctl.c Thu Aug 13 17:42:50 2020 (r364201) +++ head/sys/net/route/route_ctl.c Thu Aug 13 18:35:29 2020 (r364202) @@ -87,6 +87,77 @@ static void rib_notify(struct rib_head *rnh, enum rib_ static void destroy_subscription_epoch(epoch_context_t ctx); +/* Routing table UMA zone */ +VNET_DEFINE_STATIC(uma_zone_t, rtzone); +#define V_rtzone VNET(rtzone) + +void +vnet_rtzone_init() +{ + + V_rtzone = uma_zcreate("rtentry", sizeof(struct rtentry), + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); +} + +#ifdef VIMAGE +void +vnet_rtzone_destroy() +{ + + uma_zdestroy(V_rtzone); +} +#endif + +static void +destroy_rtentry(struct rtentry *rt) +{ + + /* + * At this moment rnh, nh_control may be already freed. + * nhop interface may have been migrated to a different vnet. + * Use vnet stored in the nexthop to delete the entry. + */ + CURVNET_SET(nhop_get_vnet(rt->rt_nhop)); + + /* Unreference nexthop */ + nhop_free(rt->rt_nhop); + + uma_zfree(V_rtzone, rt); + + CURVNET_RESTORE(); +} + +/* + * Epoch callback indicating rtentry is safe to destroy + */ +static void +destroy_rtentry_epoch(epoch_context_t ctx) +{ + struct rtentry *rt; + + rt = __containerof(ctx, struct rtentry, rt_epoch_ctx); + + destroy_rtentry(rt); +} + +/* + * Schedule rtentry deletion + */ +static void +rtfree(struct rtentry *rt) +{ + + KASSERT(rt != NULL, ("%s: NULL rt", __func__)); + + RT_LOCK_ASSERT(rt); + + RT_UNLOCK(rt); + epoch_call(net_epoch_preempt, destroy_rtentry_epoch, + &rt->rt_epoch_ctx); +} + + + static struct rib_head * get_rnh(uint32_t fibnum, const struct rt_addrinfo *info) { @@ -173,12 +244,13 @@ add_route(struct rib_head *rnh, struct rt_addrinfo *in return (error); } - rt = uma_zalloc(V_rtzone, M_NOWAIT); + rt = uma_zalloc(V_rtzone, M_NOWAIT | M_ZERO); if (rt == NULL) { ifa_free(info->rti_ifa); nhop_free(nh); return (ENOBUFS); } + RT_LOCK_INIT(rt); rt->rt_flags = RTF_UP | flags; rt->rt_nhop = nh; @@ -219,6 +291,7 @@ add_route(struct rib_head *rnh, struct rt_addrinfo *in RIB_WUNLOCK(rnh); nhop_free(nh); + RT_LOCK_DESTROY(rt); uma_zfree(V_rtzone, rt); return (EEXIST); } @@ -286,6 +359,7 @@ add_route(struct rib_head *rnh, struct rt_addrinfo *in */ if (rn == NULL) { nhop_free(nh); + RT_LOCK_DESTROY(rt); uma_zfree(V_rtzone, rt); return (EEXIST); } Modified: head/sys/net/route/route_var.h ============================================================================== --- head/sys/net/route/route_var.h Thu Aug 13 17:42:50 2020 (r364201) +++ head/sys/net/route/route_var.h Thu Aug 13 18:35:29 2020 (r364202) @@ -237,4 +237,8 @@ void tmproutes_update(struct rib_head *rnh, struct rte void tmproutes_init(struct rib_head *rh); void tmproutes_destroy(struct rib_head *rh); +/* route_ctl.c */ +void vnet_rtzone_init(void); +void vnet_rtzone_destroy(void); + #endif Modified: head/sys/net/route/shared.h ============================================================================== --- head/sys/net/route/shared.h Thu Aug 13 17:42:50 2020 (r364201) +++ head/sys/net/route/shared.h Thu Aug 13 18:35:29 2020 (r364202) @@ -72,9 +72,6 @@ void rib_init_subscriptions(struct rib_head *rnh); void rib_destroy_subscriptions(struct rib_head *rnh); /* route */ -VNET_DECLARE(uma_zone_t, rtzone); /* Routing table UMA zone. */ -#define V_rtzone VNET(rtzone) - struct rtentry *rt_unlinkrte(struct rib_head *rnh, struct rt_addrinfo *info, int *perror); From owner-svn-src-all@freebsd.org Thu Aug 13 18:42:11 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3F4F53A8BDB; Thu, 13 Aug 2020 18:42:11 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BSFmM10VDz4d6n; Thu, 13 Aug 2020 18:42:11 +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 06CC2217FC; Thu, 13 Aug 2020 18:42:11 +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 07DIgA4A093436; Thu, 13 Aug 2020 18:42:10 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07DIgAt5093435; Thu, 13 Aug 2020 18:42:10 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008131842.07DIgAt5093435@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 13 Aug 2020 18:42:10 +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: r364203 - stable/12/sys/compat/linsysfs X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linsysfs X-SVN-Commit-Revision: 364203 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 13 Aug 2020 18:42:11 -0000 Author: trasz Date: Thu Aug 13 18:42:10 2020 New Revision: 364203 URL: https://svnweb.freebsd.org/changeset/base/364203 Log: MFC r347015: Add sys/devices/system/cpu/{possible,present} to linsysfs(5). That makes Linux lscpu(1) work. Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/compat/linsysfs/linsysfs.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linsysfs/linsysfs.c ============================================================================== --- stable/12/sys/compat/linsysfs/linsysfs.c Thu Aug 13 18:35:29 2020 (r364202) +++ stable/12/sys/compat/linsysfs/linsysfs.c Thu Aug 13 18:42:10 2020 (r364203) @@ -561,7 +561,7 @@ linsysfs_run_bus(device_t dev, struct pfs_node *dir, s } /* - * Filler function for sys/devices/system/cpu/online + * Filler function for sys/devices/system/cpu/{online,possible,present} */ static int linsysfs_cpuonline(PFS_FILL_ARGS) @@ -661,6 +661,10 @@ linsysfs_init(PFS_INIT_ARGS) cpu = pfs_create_dir(sys, "cpu", NULL, NULL, NULL, 0); pfs_create_file(cpu, "online", &linsysfs_cpuonline, + NULL, NULL, NULL, PFS_RD); + pfs_create_file(cpu, "possible", &linsysfs_cpuonline, + NULL, NULL, NULL, PFS_RD); + pfs_create_file(cpu, "present", &linsysfs_cpuonline, NULL, NULL, NULL, PFS_RD); linsysfs_listcpus(cpu); From owner-svn-src-all@freebsd.org Thu Aug 13 18:46:32 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4596E3A8774; Thu, 13 Aug 2020 18:46:32 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BSFsN109hz4dWy; Thu, 13 Aug 2020 18:46:32 +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 00C9A217FE; Thu, 13 Aug 2020 18:46:31 +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 07DIkVk0093713; Thu, 13 Aug 2020 18:46:31 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07DIkVZT093712; Thu, 13 Aug 2020 18:46:31 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008131846.07DIkVZT093712@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 13 Aug 2020 18:46:31 +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: r364204 - stable/12/sys/compat/linprocfs X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linprocfs X-SVN-Commit-Revision: 364204 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 13 Aug 2020 18:46:32 -0000 Author: trasz Date: Thu Aug 13 18:46:31 2020 New Revision: 364204 URL: https://svnweb.freebsd.org/changeset/base/364204 Log: MFC r347030: Fix flags in cpuinfo. Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/compat/linprocfs/linprocfs.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linprocfs/linprocfs.c ============================================================================== --- stable/12/sys/compat/linprocfs/linprocfs.c Thu Aug 13 18:42:10 2020 (r364203) +++ stable/12/sys/compat/linprocfs/linprocfs.c Thu Aug 13 18:46:31 2020 (r364204) @@ -215,11 +215,11 @@ linprocfs_docpuinfo(PFS_FILL_ARGS) static char *flags[] = { "fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce", "cx8", "apic", - "sep", "sep", "mtrr", "pge", "mca", - "cmov", "pat", "pse36", "pn", "b19", - "b20", "b21", "mmxext", "mmx", "fxsr", - "xmm", "sse2", "b27", "b28", "b29", - "3dnowext", "3dnow" + "", "sep", "mtrr", "pge", "mca", + "cmov", "pat", "pse36", "pn", "clflush", + "", "dts", "acpi", "mmx", "fxsr", + "sse", "sse2", "ss", "ht", "tm", + "ia64", "pbe" }; static char *power_flags[] = { @@ -287,7 +287,7 @@ linprocfs_docpuinfo(PFS_FILL_ARGS) CPUID_TO_FAMILY(cpu_id), "yes"); sbuf_cat(sb, "flags\t\t:"); for (j = 0; j < nitems(flags); j++) - if (cpu_feature & (1 << j)) + if (cpu_feature & (1 << j) && flags[j][0] != '\0') sbuf_printf(sb, " %s", flags[j]); sbuf_cat(sb, "\n"); sbuf_printf(sb, From owner-svn-src-all@freebsd.org Thu Aug 13 18:48:01 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C5B903A8EB3; Thu, 13 Aug 2020 18:48:01 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BSFv54q54z4dRy; Thu, 13 Aug 2020 18:48:01 +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 889B321AC8; Thu, 13 Aug 2020 18:48:01 +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 07DIm1Kn093837; Thu, 13 Aug 2020 18:48:01 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07DIm1To093836; Thu, 13 Aug 2020 18:48:01 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008131848.07DIm1To093836@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 13 Aug 2020 18:48: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: r364205 - stable/12/sys/compat/linprocfs X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linprocfs X-SVN-Commit-Revision: 364205 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 13 Aug 2020 18:48:01 -0000 Author: trasz Date: Thu Aug 13 18:48:01 2020 New Revision: 364205 URL: https://svnweb.freebsd.org/changeset/base/364205 Log: MFC r347051: Decode more CPU flags in cpuinfo. Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/compat/linprocfs/linprocfs.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linprocfs/linprocfs.c ============================================================================== --- stable/12/sys/compat/linprocfs/linprocfs.c Thu Aug 13 18:46:31 2020 (r364204) +++ stable/12/sys/compat/linprocfs/linprocfs.c Thu Aug 13 18:48:01 2020 (r364205) @@ -212,16 +212,61 @@ linprocfs_docpuinfo(PFS_FILL_ARGS) * We default the flags to include all non-conflicting flags, * and the Intel versions of conflicting flags. */ - static char *flags[] = { - "fpu", "vme", "de", "pse", "tsc", - "msr", "pae", "mce", "cx8", "apic", - "", "sep", "mtrr", "pge", "mca", - "cmov", "pat", "pse36", "pn", "clflush", - "", "dts", "acpi", "mmx", "fxsr", - "sse", "sse2", "ss", "ht", "tm", - "ia64", "pbe" + static char *cpu_feature_names[] = { + /* 0 */ "fpu", "vme", "de", "pse", + /* 4 */ "tsc", "msr", "pae", "mce", + /* 8 */ "cx8", "apic", "", "sep", + /* 12 */ "mtrr", "pge", "mca", "cmov", + /* 16 */ "pat", "pse36", "pn", "clflush", + /* 20 */ "", "dts", "acpi", "mmx", + /* 24 */ "fxsr", "sse", "sse2", "ss", + /* 28 */ "ht", "tm", "ia64", "pbe" }; + static char *amd_feature_names[] = { + /* 0 */ "", "", "", "", + /* 4 */ "", "", "", "", + /* 8 */ "", "", "", "syscall", + /* 12 */ "", "", "", "", + /* 16 */ "", "", "", "mp", + /* 20 */ "nx", "", "mmxext", "", + /* 24 */ "", "fxsr_opt", "pdpe1gb", "rdtscp", + /* 28 */ "", "lm", "3dnowext", "3dnow" + }; + + static char *cpu_feature2_names[] = { + /* 0 */ "pni", "pclmulqdq", "dtes3", "monitor", + /* 4 */ "ds_cpl", "vmx", "smx", "est", + /* 8 */ "tm2", "ssse3", "cid", "sdbg", + /* 12 */ "fma", "cx16", "xptr", "pdcm", + /* 16 */ "", "pcid", "dca", "sse4_1", + /* 20 */ "sse4_2", "x2apic", "movbe", "popcnt", + /* 24 */ "tsc_deadline_timer", "aes", "xsave", "", + /* 28 */ "avx", "f16c", "rdrand", "hypervisor" + }; + + static char *amd_feature2_names[] = { + /* 0 */ "lahf_lm", "cmp_legacy", "svm", "extapic", + /* 4 */ "cr8_legacy", "abm", "sse4a", "misalignsse", + /* 8 */ "3dnowprefetch", "osvw", "ibs", "xop", + /* 12 */ "skinit", "wdt", "", "lwp", + /* 16 */ "fma4", "tce", "", "nodeid_msr", + /* 20 */ "", "tbm", "topoext", "perfctr_core", + /* 24 */ "perfctr_nb", "", "bpext", "ptsc", + /* 28 */ "perfctr_llc", "mwaitx", "", "" + }; + + static char *cpu_stdext_feature_names[] = { + /* 0 */ "fsgsbase", "tsc_adjust", "", "bmi1", + /* 4 */ "hle", "avx2", "", "smep", + /* 8 */ "bmi2", "erms", "invpcid", "rtm", + /* 12 */ "cqm", "", "mpx", "rdt_a", + /* 16 */ "avx512f", "avx512dq", "rdseed", "adx", + /* 20 */ "smap", "avx512ifma", "", "clflushopt", + /* 24 */ "clwb", "intel_pt", "avx512pf", "avx512er", + /* 28 */ "avx512cd", "sha_ni", "avx512bw", "avx512vl" + }; + static char *power_flags[] = { "ts", "fid", "vid", "ttp", "tm", "stc", @@ -240,10 +285,10 @@ linprocfs_docpuinfo(PFS_FILL_ARGS) switch (cpu_vendor_id) { case CPU_VENDOR_AMD: if (cpu_class < CPUCLASS_686) - flags[16] = "fcmov"; + cpu_feature_names[16] = "fcmov"; break; case CPU_VENDOR_CYRIX: - flags[24] = "cxmmx"; + cpu_feature_names[24] = "cxmmx"; break; } #endif @@ -286,9 +331,27 @@ linprocfs_docpuinfo(PFS_FILL_ARGS) (cpu_feature & CPUID_FPU) ? "yes" : "no", "yes", CPUID_TO_FAMILY(cpu_id), "yes"); sbuf_cat(sb, "flags\t\t:"); - for (j = 0; j < nitems(flags); j++) - if (cpu_feature & (1 << j) && flags[j][0] != '\0') - sbuf_printf(sb, " %s", flags[j]); + for (j = 0; j < nitems(cpu_feature_names); j++) + if (cpu_feature & (1 << j) && + cpu_feature_names[j][0] != '\0') + sbuf_printf(sb, " %s", cpu_feature_names[j]); + for (j = 0; j < nitems(amd_feature_names); j++) + if (amd_feature & (1 << j) && + amd_feature_names[j][0] != '\0') + sbuf_printf(sb, " %s", amd_feature_names[j]); + for (j = 0; j < nitems(cpu_feature2_names); j++) + if (cpu_feature2 & (1 << j) && + cpu_feature2_names[j][0] != '\0') + sbuf_printf(sb, " %s", cpu_feature2_names[j]); + for (j = 0; j < nitems(amd_feature2_names); j++) + if (amd_feature2 & (1 << j) && + amd_feature2_names[j][0] != '\0') + sbuf_printf(sb, " %s", amd_feature2_names[j]); + for (j = 0; j < nitems(cpu_stdext_feature_names); j++) + if (cpu_stdext_feature & (1 << j) && + cpu_stdext_feature_names[j][0] != '\0') + sbuf_printf(sb, " %s", + cpu_stdext_feature_names[j]); sbuf_cat(sb, "\n"); sbuf_printf(sb, "bugs\t\t: %s\n" From owner-svn-src-all@freebsd.org Thu Aug 13 18:49:12 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CC1753A900A; Thu, 13 Aug 2020 18:49:12 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BSFwS557Zz4dSl; Thu, 13 Aug 2020 18:49:12 +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 9233421B3F; Thu, 13 Aug 2020 18:49:12 +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 07DInCbs093941; Thu, 13 Aug 2020 18:49:12 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07DInC4X093940; Thu, 13 Aug 2020 18:49:12 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008131849.07DInC4X093940@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 13 Aug 2020 18:49: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: r364206 - stable/12/sys/compat/linprocfs X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linprocfs X-SVN-Commit-Revision: 364206 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 13 Aug 2020 18:49:12 -0000 Author: trasz Date: Thu Aug 13 18:49:12 2020 New Revision: 364206 URL: https://svnweb.freebsd.org/changeset/base/364206 Log: MFC r351758: Make linprocfs(4) report Tgid, Linux ltrace(1) needs it. Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/compat/linprocfs/linprocfs.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linprocfs/linprocfs.c ============================================================================== --- stable/12/sys/compat/linprocfs/linprocfs.c Thu Aug 13 18:48:01 2020 (r364205) +++ stable/12/sys/compat/linprocfs/linprocfs.c Thu Aug 13 18:49:12 2020 (r364206) @@ -938,6 +938,7 @@ linprocfs_doprocstatus(PFS_FILL_ARGS) /* * Credentials */ + sbuf_printf(sb, "Tgid:\t%d\n", p->p_pid); sbuf_printf(sb, "Pid:\t%d\n", p->p_pid); sbuf_printf(sb, "PPid:\t%d\n", kp.ki_ppid ); sbuf_printf(sb, "TracerPid:\t%d\n", kp.ki_tracer ); From owner-svn-src-all@freebsd.org Thu Aug 13 18:50:32 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E8B013A8C6D; Thu, 13 Aug 2020 18:50:32 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BSFy05rLFz4dfj; Thu, 13 Aug 2020 18:50:32 +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 AC6AD21BA8; Thu, 13 Aug 2020 18:50:32 +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 07DIoWa8094088; Thu, 13 Aug 2020 18:50:32 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07DIoWle094087; Thu, 13 Aug 2020 18:50:32 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008131850.07DIoWle094087@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 13 Aug 2020 18:50:32 +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: r364207 - stable/12/sys/compat/linprocfs X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linprocfs X-SVN-Commit-Revision: 364207 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 13 Aug 2020 18:50:33 -0000 Author: trasz Date: Thu Aug 13 18:50:32 2020 New Revision: 364207 URL: https://svnweb.freebsd.org/changeset/base/364207 Log: MFC r351822: Fix /proc/mounts for autofs(5) mounts. Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/compat/linprocfs/linprocfs.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linprocfs/linprocfs.c ============================================================================== --- stable/12/sys/compat/linprocfs/linprocfs.c Thu Aug 13 18:49:12 2020 (r364206) +++ stable/12/sys/compat/linprocfs/linprocfs.c Thu Aug 13 18:50:32 2020 (r364207) @@ -462,6 +462,15 @@ linprocfs_domtab(PFS_FILL_ARGS) else if (strcmp(fstype, "procfs") == 0) continue; + if (strcmp(fstype, "autofs") == 0) { + /* + * FreeBSD uses eg "map -hosts", whereas Linux + * expects just "-hosts". + */ + if (strncmp(mntfrom, "map ", 4) == 0) + mntfrom += 4; + } + if (strcmp(fstype, "linsysfs") == 0) { sbuf_printf(sb, "/sys %s sysfs %s", mntto, sp->f_flags & MNT_RDONLY ? "ro" : "rw"); From owner-svn-src-all@freebsd.org Thu Aug 13 18:51:58 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 820493A8CF9; Thu, 13 Aug 2020 18:51:58 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BSFzf2vYfz4dxF; Thu, 13 Aug 2020 18:51:58 +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 4671921B56; Thu, 13 Aug 2020 18:51:58 +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 07DIpwLn098923; Thu, 13 Aug 2020 18:51:58 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07DIpwMp098922; Thu, 13 Aug 2020 18:51:58 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008131851.07DIpwMp098922@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 13 Aug 2020 18:51:58 +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: r364208 - stable/12/sys/compat/linprocfs X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linprocfs X-SVN-Commit-Revision: 364208 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 13 Aug 2020 18:51:58 -0000 Author: trasz Date: Thu Aug 13 18:51:57 2020 New Revision: 364208 URL: https://svnweb.freebsd.org/changeset/base/364208 Log: MFC r356175: Make linprocfs(5) provide an empty /proc/modules. This should silence some warnings. Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/compat/linprocfs/linprocfs.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linprocfs/linprocfs.c ============================================================================== --- stable/12/sys/compat/linprocfs/linprocfs.c Thu Aug 13 18:50:32 2020 (r364207) +++ stable/12/sys/compat/linprocfs/linprocfs.c Thu Aug 13 18:51:57 2020 (r364208) @@ -1510,22 +1510,22 @@ linprocfs_dofilesystems(PFS_FILL_ARGS) return(0); } -#if 0 /* * Filler function for proc/modules */ static int linprocfs_domodules(PFS_FILL_ARGS) { +#if 0 struct linker_file *lf; TAILQ_FOREACH(lf, &linker_files, link) { sbuf_printf(sb, "%-20s%8lu%4d\n", lf->filename, (unsigned long)lf->size, lf->refs); } +#endif return (0); } -#endif /* * Filler function for proc/pid/fd @@ -1719,10 +1719,8 @@ linprocfs_init(PFS_INIT_ARGS) NULL, NULL, NULL, PFS_RD); pfs_create_file(root, "meminfo", &linprocfs_domeminfo, NULL, NULL, NULL, PFS_RD); -#if 0 pfs_create_file(root, "modules", &linprocfs_domodules, NULL, NULL, NULL, PFS_RD); -#endif pfs_create_file(root, "mounts", &linprocfs_domtab, NULL, NULL, NULL, PFS_RD); pfs_create_file(root, "mtab", &linprocfs_domtab, From owner-svn-src-all@freebsd.org Thu Aug 13 18:54:02 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8B2253A9304; Thu, 13 Aug 2020 18:54:02 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BSG2236QSz4f5p; Thu, 13 Aug 2020 18:54:02 +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 4EFCB21B5F; Thu, 13 Aug 2020 18:54:02 +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 07DIs2Bt099922; Thu, 13 Aug 2020 18:54:02 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07DIs2mk099921; Thu, 13 Aug 2020 18:54:02 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008131854.07DIs2mk099921@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 13 Aug 2020 18:54: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: r364209 - stable/12/sys/compat/linprocfs X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linprocfs X-SVN-Commit-Revision: 364209 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 13 Aug 2020 18:54:02 -0000 Author: trasz Date: Thu Aug 13 18:54:01 2020 New Revision: 364209 URL: https://svnweb.freebsd.org/changeset/base/364209 Log: MFC r362806: Make linprocfs(5) create the /proc//task/ directores. This is to silence down some Chromium assertions. PR: kern/240991 Analyzed by: Alex S Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/compat/linprocfs/linprocfs.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linprocfs/linprocfs.c ============================================================================== --- stable/12/sys/compat/linprocfs/linprocfs.c Thu Aug 13 18:51:57 2020 (r364208) +++ stable/12/sys/compat/linprocfs/linprocfs.c Thu Aug 13 18:54:01 2020 (r364209) @@ -1634,6 +1634,28 @@ out: } /* + * The point of the following two functions is to work around + * an assertion in Chromium; see kern/240991 for details. + */ +static int +linprocfs_dotaskattr(PFS_ATTR_ARGS) +{ + + vap->va_nlink = 3; + return (0); +} + +/* + * Filler function for proc//task/.dummy + */ +static int +linprocfs_dotaskdummy(PFS_FILL_ARGS) +{ + + return (0); +} + +/* * Filler function for proc/sys/kernel/random/uuid */ static int @@ -1772,6 +1794,11 @@ linprocfs_init(PFS_INIT_ARGS) pfs_create_file(dir, "auxv", &linprocfs_doauxv, NULL, &procfs_candebug, NULL, PFS_RD|PFS_RAWRD); pfs_create_file(dir, "limits", &linprocfs_doproclimits, + NULL, NULL, NULL, PFS_RD); + + /* /proc//task/... */ + dir = pfs_create_dir(dir, "task", linprocfs_dotaskattr, NULL, NULL, 0); + pfs_create_file(dir, ".dummy", &linprocfs_dotaskdummy, NULL, NULL, NULL, PFS_RD); /* /proc/scsi/... */ From owner-svn-src-all@freebsd.org Thu Aug 13 18:55:37 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DCB0D3A92CD; Thu, 13 Aug 2020 18:55:37 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BSG3s4M47z4fNq; Thu, 13 Aug 2020 18:55:37 +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 78E8B219EA; Thu, 13 Aug 2020 18:55:37 +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 07DItbVN000196; Thu, 13 Aug 2020 18:55:37 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07DItb87000194; Thu, 13 Aug 2020 18:55:37 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008131855.07DItb87000194@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 13 Aug 2020 18:55:37 +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: r364210 - in stable/12/sys/compat: linprocfs linsysfs X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in stable/12/sys/compat: linprocfs linsysfs X-SVN-Commit-Revision: 364210 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 13 Aug 2020 18:55:37 -0000 Author: trasz Date: Thu Aug 13 18:55:36 2020 New Revision: 364210 URL: https://svnweb.freebsd.org/changeset/base/364210 Log: MFC r362929: Make linprocfs(5) create /proc/bus/pci/devices/, and linsysfs(5) create /sys/class/power_supply/. This silences some warnings from biology/linux-foldingathome. Reported by: 0mp Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/compat/linprocfs/linprocfs.c stable/12/sys/compat/linsysfs/linsysfs.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linprocfs/linprocfs.c ============================================================================== --- stable/12/sys/compat/linprocfs/linprocfs.c Thu Aug 13 18:54:01 2020 (r364209) +++ stable/12/sys/compat/linprocfs/linprocfs.c Thu Aug 13 18:55:36 2020 (r364210) @@ -1760,6 +1760,11 @@ linprocfs_init(PFS_INIT_ARGS) pfs_create_file(root, "version", &linprocfs_doversion, NULL, NULL, NULL, PFS_RD); + /* /proc/bus/... */ + dir = pfs_create_dir(root, "bus", NULL, NULL, NULL, 0); + dir = pfs_create_dir(dir, "pci", NULL, NULL, NULL, 0); + dir = pfs_create_dir(dir, "devices", NULL, NULL, NULL, 0); + /* /proc/net/... */ dir = pfs_create_dir(root, "net", NULL, NULL, NULL, 0); pfs_create_file(dir, "dev", &linprocfs_donetdev, Modified: stable/12/sys/compat/linsysfs/linsysfs.c ============================================================================== --- stable/12/sys/compat/linsysfs/linsysfs.c Thu Aug 13 18:54:01 2020 (r364209) +++ stable/12/sys/compat/linsysfs/linsysfs.c Thu Aug 13 18:55:36 2020 (r364210) @@ -622,6 +622,7 @@ linsysfs_init(PFS_INIT_ARGS) struct pfs_node *pci; struct pfs_node *scsi; struct pfs_node *net; + struct pfs_node *power_supply; struct pfs_node *devdir, *chardev; devclass_t devclass; device_t dev; @@ -634,6 +635,7 @@ linsysfs_init(PFS_INIT_ARGS) class = pfs_create_dir(root, "class", NULL, NULL, NULL, 0); scsi = pfs_create_dir(class, "scsi_host", NULL, NULL, NULL, 0); drm = pfs_create_dir(class, "drm", NULL, NULL, NULL, 0); + power_supply = pfs_create_dir(class, "power_supply", NULL, NULL, NULL, 0); /* /sys/class/net/.. */ net = pfs_create_dir(class, "net", NULL, NULL, NULL, 0); From owner-svn-src-all@freebsd.org Thu Aug 13 18:57:07 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0B7D13A9327; Thu, 13 Aug 2020 18:57:07 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BSG5Z6c61z4fML; Thu, 13 Aug 2020 18:57:06 +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 C7AED21AE3; Thu, 13 Aug 2020 18:57:06 +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 07DIv60Y000320; Thu, 13 Aug 2020 18:57:06 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07DIv6Nv000319; Thu, 13 Aug 2020 18:57:06 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008131857.07DIv6Nv000319@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 13 Aug 2020 18:57:06 +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: r364211 - stable/12/sys/compat/linprocfs X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linprocfs X-SVN-Commit-Revision: 364211 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 13 Aug 2020 18:57:07 -0000 Author: trasz Date: Thu Aug 13 18:57:06 2020 New Revision: 364211 URL: https://svnweb.freebsd.org/changeset/base/364211 Log: MFC r362930: Add /proc/sys/kernel/tainted to linprocfs(5). Helps LTP. Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/compat/linprocfs/linprocfs.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linprocfs/linprocfs.c ============================================================================== --- stable/12/sys/compat/linprocfs/linprocfs.c Thu Aug 13 18:55:36 2020 (r364210) +++ stable/12/sys/compat/linprocfs/linprocfs.c Thu Aug 13 18:57:06 2020 (r364211) @@ -1428,6 +1428,17 @@ linprocfs_dosem(PFS_FILL_ARGS) } /* + * Filler function for proc/sys/kernel/tainted + */ +static int +linprocfs_dotainted(PFS_FILL_ARGS) +{ + + sbuf_printf(sb, "0\n"); + return (0); +} + +/* * Filler function for proc/sys/vm/min_free_kbytes * * This mirrors the approach in illumos to return zero for reads. Effectively, @@ -1828,6 +1839,8 @@ linprocfs_init(PFS_INIT_ARGS) pfs_create_file(dir, "pid_max", &linprocfs_dopid_max, NULL, NULL, NULL, PFS_RD); pfs_create_file(dir, "sem", &linprocfs_dosem, + NULL, NULL, NULL, PFS_RD); + pfs_create_file(dir, "tainted", &linprocfs_dotainted, NULL, NULL, NULL, PFS_RD); /* /proc/sys/kernel/random/... */ From owner-svn-src-all@freebsd.org Thu Aug 13 18:59:35 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DEED93A8D54; Thu, 13 Aug 2020 18:59:35 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BSG8R5hYdz4fkn; Thu, 13 Aug 2020 18:59:35 +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 A7151219EB; Thu, 13 Aug 2020 18:59:35 +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 07DIxZHm000489; Thu, 13 Aug 2020 18:59:35 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07DIxZD7000488; Thu, 13 Aug 2020 18:59:35 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008131859.07DIxZD7000488@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 13 Aug 2020 18:59: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: r364212 - stable/12/sys/compat/linprocfs X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linprocfs X-SVN-Commit-Revision: 364212 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 13 Aug 2020 18:59:35 -0000 Author: trasz Date: Thu Aug 13 18:59:35 2020 New Revision: 364212 URL: https://svnweb.freebsd.org/changeset/base/364212 Log: MFC r363094: Make linprocfs(5) report correct tty number in /proc//stat. Fixes sudo (sudo-1.8.21p2-3ubuntu1.2); previously would fail with "sudo: no tty present and no askpass program specified". Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/compat/linprocfs/linprocfs.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linprocfs/linprocfs.c ============================================================================== --- stable/12/sys/compat/linprocfs/linprocfs.c Thu Aug 13 18:57:06 2020 (r364211) +++ stable/12/sys/compat/linprocfs/linprocfs.c Thu Aug 13 18:59:35 2020 (r364212) @@ -767,6 +767,32 @@ linprocfs_doloadavg(PFS_FILL_ARGS) return (0); } +static int +linprocfs_get_tty_nr(struct proc *p) +{ + struct session *sp; + const char *ttyname; + int error, major, minor, nr; + + PROC_LOCK_ASSERT(p, MA_OWNED); + sx_assert(&proctree_lock, SX_LOCKED); + + if ((p->p_flag & P_CONTROLT) == 0) + return (-1); + + sp = p->p_pgrp->pg_session; + if (sp == NULL) + return (-1); + + ttyname = devtoname(sp->s_ttyp->t_dev); + error = linux_driver_get_major_minor(ttyname, &major, &minor); + if (error != 0) + return (-1); + + nr = makedev(major, minor); + return (nr); +} + /* * Filler function for proc/pid/stat */ @@ -777,12 +803,14 @@ linprocfs_doprocstat(PFS_FILL_ARGS) struct timeval boottime; char state; static int ratelimit = 0; + int tty_nr; vm_offset_t startcode, startdata; getboottime(&boottime); sx_slock(&proctree_lock); PROC_LOCK(p); fill_kinfo_proc(p, &kp); + tty_nr = linprocfs_get_tty_nr(p); sx_sunlock(&proctree_lock); if (p->p_vmspace) { startcode = (vm_offset_t)p->p_vmspace->vm_taddr; @@ -809,10 +837,7 @@ linprocfs_doprocstat(PFS_FILL_ARGS) PS_ADD("pgrp", "%d", p->p_pgid); PS_ADD("session", "%d", p->p_session->s_sid); PROC_UNLOCK(p); - if (kp.ki_tdev == NODEV) - PS_ADD("tty", "%s", "-1"); - else - PS_ADD("tty", "%ju", (uintmax_t)kp.ki_tdev); + PS_ADD("tty", "%d", tty_nr); PS_ADD("tpgid", "%d", kp.ki_tpgid); PS_ADD("flags", "%u", 0); /* XXX */ PS_ADD("minflt", "%lu", kp.ki_rusage.ru_minflt); From owner-svn-src-all@freebsd.org Thu Aug 13 19:00:56 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2FD563A953B; Thu, 13 Aug 2020 19:00:56 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BSGB00SK3z4g4F; Thu, 13 Aug 2020 19:00:56 +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 E736E21CBB; Thu, 13 Aug 2020 19:00: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 07DJ0tln001428; Thu, 13 Aug 2020 19:00:55 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07DJ0tNj001427; Thu, 13 Aug 2020 19:00:55 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008131900.07DJ0tNj001427@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 13 Aug 2020 19:00:55 +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: r364213 - stable/12/sys/compat/linprocfs X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linprocfs X-SVN-Commit-Revision: 364213 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 13 Aug 2020 19:00:56 -0000 Author: trasz Date: Thu Aug 13 19:00:55 2020 New Revision: 364213 URL: https://svnweb.freebsd.org/changeset/base/364213 Log: MFC r363301: Fix two typos in flag names in /proc/cpuinfo. Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/compat/linprocfs/linprocfs.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linprocfs/linprocfs.c ============================================================================== --- stable/12/sys/compat/linprocfs/linprocfs.c Thu Aug 13 18:59:35 2020 (r364212) +++ stable/12/sys/compat/linprocfs/linprocfs.c Thu Aug 13 19:00:55 2020 (r364213) @@ -235,10 +235,10 @@ linprocfs_docpuinfo(PFS_FILL_ARGS) }; static char *cpu_feature2_names[] = { - /* 0 */ "pni", "pclmulqdq", "dtes3", "monitor", + /* 0 */ "pni", "pclmulqdq", "dtes64", "monitor", /* 4 */ "ds_cpl", "vmx", "smx", "est", /* 8 */ "tm2", "ssse3", "cid", "sdbg", - /* 12 */ "fma", "cx16", "xptr", "pdcm", + /* 12 */ "fma", "cx16", "xtpr", "pdcm", /* 16 */ "", "pcid", "dca", "sse4_1", /* 20 */ "sse4_2", "x2apic", "movbe", "popcnt", /* 24 */ "tsc_deadline_timer", "aes", "xsave", "", From owner-svn-src-all@freebsd.org Thu Aug 13 19:02:12 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3EE923A970B; Thu, 13 Aug 2020 19:02:12 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BSGCS0yJrz4gCv; Thu, 13 Aug 2020 19:02:12 +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 054AB21E34; Thu, 13 Aug 2020 19:02:12 +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 07DJ2Bbc006328; Thu, 13 Aug 2020 19:02:11 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07DJ2BL1006248; Thu, 13 Aug 2020 19:02:11 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008131902.07DJ2BL1006248@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 13 Aug 2020 19:02: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: r364214 - stable/12/sys/compat/linprocfs X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linprocfs X-SVN-Commit-Revision: 364214 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 13 Aug 2020 19:02:12 -0000 Author: trasz Date: Thu Aug 13 19:02:11 2020 New Revision: 364214 URL: https://svnweb.freebsd.org/changeset/base/364214 Log: MFC r363302: Fix bogomips calculation. Previously it was off by half. This was verified under VMWare Fusion, comparing to what's reported under CentOS, and by comparing numbers reported by linuxulator on T420 with a googled up Linux cpuinfo (https://lkml.org/lkml/2011/11/29/116). Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/compat/linprocfs/linprocfs.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linprocfs/linprocfs.c ============================================================================== --- stable/12/sys/compat/linprocfs/linprocfs.c Thu Aug 13 19:00:55 2020 (r364213) +++ stable/12/sys/compat/linprocfs/linprocfs.c Thu Aug 13 19:02:11 2020 (r364214) @@ -364,7 +364,7 @@ linprocfs_docpuinfo(PFS_FILL_ARGS) #else "", #endif - fqmhz, fqkhz, + fqmhz * 2, fqkhz, cpu_clflush_line_size, cpu_clflush_line_size, cpu_maxphyaddr, (cpu_maxphyaddr > 32) ? 48 : 0); From owner-svn-src-all@freebsd.org Thu Aug 13 19:03:33 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 554163A96C1; Thu, 13 Aug 2020 19:03:33 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BSGF11d3Lz4gDg; Thu, 13 Aug 2020 19:03:33 +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 1AE6822191; Thu, 13 Aug 2020 19:03:33 +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 07DJ3WAH006482; Thu, 13 Aug 2020 19:03:32 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07DJ3WsI006481; Thu, 13 Aug 2020 19:03:32 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008131903.07DJ3WsI006481@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 13 Aug 2020 19:03:32 +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: r364215 - stable/12/sys/compat/linprocfs X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linprocfs X-SVN-Commit-Revision: 364215 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 13 Aug 2020 19:03:33 -0000 Author: trasz Date: Thu Aug 13 19:03:32 2020 New Revision: 364215 URL: https://svnweb.freebsd.org/changeset/base/364215 Log: MFC r363303: Add missing SysV IPC stats to linprocfs(4). Fixes 'ipcs -l', and also helps Oracle. Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/compat/linprocfs/linprocfs.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linprocfs/linprocfs.c ============================================================================== --- stable/12/sys/compat/linprocfs/linprocfs.c Thu Aug 13 19:02:11 2020 (r364214) +++ stable/12/sys/compat/linprocfs/linprocfs.c Thu Aug 13 19:03:32 2020 (r364215) @@ -66,6 +66,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1419,6 +1420,17 @@ linprocfs_doosbuild(PFS_FILL_ARGS) } /* + * Filler function for proc/sys/kernel/msgmax + */ +static int +linprocfs_domsgmax(PFS_FILL_ARGS) +{ + + sbuf_printf(sb, "%d\n", msginfo.msgmax); + return (0); +} + +/* * Filler function for proc/sys/kernel/msgmni */ static int @@ -1430,6 +1442,17 @@ linprocfs_domsgmni(PFS_FILL_ARGS) } /* + * Filler function for proc/sys/kernel/msgmnb + */ +static int +linprocfs_domsgmnb(PFS_FILL_ARGS) +{ + + sbuf_printf(sb, "%d\n", msginfo.msgmnb); + return (0); +} + +/* * Filler function for proc/sys/kernel/pid_max */ static int @@ -1453,6 +1476,39 @@ linprocfs_dosem(PFS_FILL_ARGS) } /* + * Filler function for proc/sys/kernel/shmall + */ +static int +linprocfs_doshmall(PFS_FILL_ARGS) +{ + + sbuf_printf(sb, "%lu\n", shminfo.shmall); + return (0); +} + +/* + * Filler function for proc/sys/kernel/shmmax + */ +static int +linprocfs_doshmmax(PFS_FILL_ARGS) +{ + + sbuf_printf(sb, "%lu\n", shminfo.shmmax); + return (0); +} + +/* + * Filler function for proc/sys/kernel/shmmni + */ +static int +linprocfs_doshmmni(PFS_FILL_ARGS) +{ + + sbuf_printf(sb, "%lu\n", shminfo.shmmni); + return (0); +} + +/* * Filler function for proc/sys/kernel/tainted */ static int @@ -1851,6 +1907,7 @@ linprocfs_init(PFS_INIT_ARGS) /* /proc/sys/... */ sys = pfs_create_dir(root, "sys", NULL, NULL, NULL, 0); + /* /proc/sys/kernel/... */ dir = pfs_create_dir(sys, "kernel", NULL, NULL, NULL, 0); pfs_create_file(dir, "osrelease", &linprocfs_doosrelease, @@ -1859,12 +1916,22 @@ linprocfs_init(PFS_INIT_ARGS) NULL, NULL, NULL, PFS_RD); pfs_create_file(dir, "version", &linprocfs_doosbuild, NULL, NULL, NULL, PFS_RD); + pfs_create_file(dir, "msgmax", &linprocfs_domsgmax, + NULL, NULL, NULL, PFS_RD); pfs_create_file(dir, "msgmni", &linprocfs_domsgmni, NULL, NULL, NULL, PFS_RD); + pfs_create_file(dir, "msgmnb", &linprocfs_domsgmnb, + NULL, NULL, NULL, PFS_RD); pfs_create_file(dir, "pid_max", &linprocfs_dopid_max, NULL, NULL, NULL, PFS_RD); pfs_create_file(dir, "sem", &linprocfs_dosem, NULL, NULL, NULL, PFS_RD); + pfs_create_file(dir, "shmall", &linprocfs_doshmall, + NULL, NULL, NULL, PFS_RD); + pfs_create_file(dir, "shmmax", &linprocfs_doshmmax, + NULL, NULL, NULL, PFS_RD); + pfs_create_file(dir, "shmmni", &linprocfs_doshmmni, + NULL, NULL, NULL, PFS_RD); pfs_create_file(dir, "tainted", &linprocfs_dotainted, NULL, NULL, NULL, PFS_RD); @@ -1901,3 +1968,4 @@ MODULE_DEPEND(linprocfs, linux, 1, 1, 1); MODULE_DEPEND(linprocfs, procfs, 1, 1, 1); MODULE_DEPEND(linprocfs, sysvmsg, 1, 1, 1); MODULE_DEPEND(linprocfs, sysvsem, 1, 1, 1); +MODULE_DEPEND(linprocfs, sysvshm, 1, 1, 1); From owner-svn-src-all@freebsd.org Thu Aug 13 19:05:51 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E96523A97E9; Thu, 13 Aug 2020 19:05:51 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BSGHg5vmnz3Rb4; Thu, 13 Aug 2020 19:05:51 +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 AAD7B220F9; Thu, 13 Aug 2020 19:05:51 +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 07DJ5pJP006666; Thu, 13 Aug 2020 19:05:51 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07DJ5pCM006665; Thu, 13 Aug 2020 19:05:51 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008131905.07DJ5pCM006665@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 13 Aug 2020 19:05:51 +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: r364216 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 364216 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 13 Aug 2020 19:05:52 -0000 Author: trasz Date: Thu Aug 13 19:05:51 2020 New Revision: 364216 URL: https://svnweb.freebsd.org/changeset/base/364216 Log: MFC r351723: Bump Linux version to 3.2.0. Without it, binaries linked against glibc 2.24 and up (eg Ubuntu 19.04) fail with "FATAL: kernel too old". Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/compat/linux/linux_mib.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_mib.h ============================================================================== --- stable/12/sys/compat/linux/linux_mib.h Thu Aug 13 19:03:32 2020 (r364215) +++ stable/12/sys/compat/linux/linux_mib.h Thu Aug 13 19:05:51 2020 (r364216) @@ -46,9 +46,9 @@ int linux_get_oss_version(struct thread *td); int linux_kernver(struct thread *td); -#define LINUX_KVERSION 2 -#define LINUX_KPATCHLEVEL 6 -#define LINUX_KSUBLEVEL 36 +#define LINUX_KVERSION 3 +#define LINUX_KPATCHLEVEL 2 +#define LINUX_KSUBLEVEL 0 #define LINUX_KERNVER(a,b,c) (((a) << 16) + ((b) << 8) + (c)) #define LINUX_VERSION_CODE LINUX_KERNVER(LINUX_KVERSION, \ From owner-svn-src-all@freebsd.org Thu Aug 13 19:07:07 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D19BA3A9AD7; Thu, 13 Aug 2020 19:07:07 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BSGK74zGZz3RmS; Thu, 13 Aug 2020 19:07:07 +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 8EADD220FC; Thu, 13 Aug 2020 19:07:07 +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 07DJ77Sp006786; Thu, 13 Aug 2020 19:07:07 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07DJ77RN006785; Thu, 13 Aug 2020 19:07:07 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008131907.07DJ77RN006785@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 13 Aug 2020 19:07: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: r364217 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 364217 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 13 Aug 2020 19:07:07 -0000 Author: trasz Date: Thu Aug 13 19:07:07 2020 New Revision: 364217 URL: https://svnweb.freebsd.org/changeset/base/364217 Log: MFC r351703: Relax compat.linux.osrelease checks. This way one can do eg 'compat.linux.osrelease=3.10.0-957.12.1.el7.x86_64', which corresponds to CentOS 7. Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/compat/linux/linux_mib.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_mib.c ============================================================================== --- stable/12/sys/compat/linux/linux_mib.c Thu Aug 13 19:05:51 2020 (r364216) +++ stable/12/sys/compat/linux/linux_mib.c Thu Aug 13 19:07:07 2020 (r364217) @@ -146,7 +146,8 @@ linux_map_osrel(char *osrelease, int *osrel) return (EINVAL); osrelease = sep + 1; v2 = strtol(osrelease, &sep, 10); - if (osrelease == sep || sep != eosrelease) + if (osrelease == sep || + (sep != eosrelease && (sep + 1 >= eosrelease || *sep != '-'))) return (EINVAL); v = LINUX_KERNVER(v0, v1, v2); From owner-svn-src-all@freebsd.org Thu Aug 13 20:28:36 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 891203ABFF5; Thu, 13 Aug 2020 20:28:36 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BSJ7821Xfz3Xv5; Thu, 13 Aug 2020 20:28:36 +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 293C222CE2; Thu, 13 Aug 2020 20:28:36 +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 07DKSa2m056869; Thu, 13 Aug 2020 20:28:36 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07DKSaoZ056868; Thu, 13 Aug 2020 20:28:36 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202008132028.07DKSaoZ056868@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 13 Aug 2020 20:28:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364218 - head/secure/lib/libssl X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/secure/lib/libssl X-SVN-Commit-Revision: 364218 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 13 Aug 2020 20:28:36 -0000 Author: jhb Date: Thu Aug 13 20:28:35 2020 New Revision: 364218 URL: https://svnweb.freebsd.org/changeset/base/364218 Log: Fix a typo in the cpp macro defined for PIC. In practice this isn't used in OpenSSL outside of some sparc-specific code. Reviewed by: delphij Differential Revision: https://reviews.freebsd.org/D26058 Modified: head/secure/lib/libssl/Makefile Modified: head/secure/lib/libssl/Makefile ============================================================================== --- head/secure/lib/libssl/Makefile Thu Aug 13 19:07:07 2020 (r364217) +++ head/secure/lib/libssl/Makefile Thu Aug 13 20:28:35 2020 (r364218) @@ -31,7 +31,7 @@ CFLAGS+= -I${.OBJDIR:H}/libcrypto .include -PICFLAG+= -DOPENSS_PIC +PICFLAG+= -DOPENSSL_PIC .PATH: ${LCRYPTO_SRC}/ssl \ ${LCRYPTO_SRC}/ssl/record \ From owner-svn-src-all@freebsd.org Thu Aug 13 20:48:16 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0092D3AC7EC; Thu, 13 Aug 2020 20:48:16 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BSJYq6f95z3Ywm; Thu, 13 Aug 2020 20:48:15 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C7CAD232B5; Thu, 13 Aug 2020 20:48:15 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07DKmFqa069061; Thu, 13 Aug 2020 20:48:15 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07DKmEO9069055; Thu, 13 Aug 2020 20:48:14 GMT (envelope-from cem@FreeBSD.org) Message-Id: <202008132048.07DKmEO9069055@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Thu, 13 Aug 2020 20:48:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364219 - in head: share/man/man9 sys/conf sys/contrib/pcg-c/include sys/kern sys/libkern sys/sys X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head: share/man/man9 sys/conf sys/contrib/pcg-c/include sys/kern sys/libkern sys/sys X-SVN-Commit-Revision: 364219 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 13 Aug 2020 20:48:16 -0000 Author: cem Date: Thu Aug 13 20:48:14 2020 New Revision: 364219 URL: https://svnweb.freebsd.org/changeset/base/364219 Log: Add prng(9) API Add prng(9) as a replacement for random(9) in the kernel. There are two major differences from random(9) and random(3): - General prng(9) APIs (prng32(9), etc) do not guarantee an implementation or particular sequence; they should not be used for repeatable simulations. - However, specific named API families are also exposed (for now: PCG), and those are expected to be repeatable (when so-guaranteed by the named algorithm). Some minor differences from random(3) and earlier random(9): - PRNG state for the general prng(9) APIs is per-CPU; this eliminates contention on PRNG state in SMP workloads. Each PCPU generator in an SMP system produces a unique sequence. - Better statistical properties than the Park-Miller ("minstd") PRNG (longer period, uniform distribution in all bits, passes BigCrush/PractRand analysis). - Faster than Park-Miller ("minstd") PRNG -- no division is required to step PCG-family PRNGs. For now, random(9) becomes a thin shim around prng32(). Eventually I would like to mechanically switch consumers over to the explicit API. Reviewed by: kib, markj (previous version both) Discussed with: markm Differential Revision: https://reviews.freebsd.org/D25916 Added: head/share/man/man9/prng.9 (contents, props changed) head/sys/kern/subr_prng.c (contents, props changed) head/sys/sys/prng.h (contents, props changed) Modified: head/share/man/man9/Makefile head/sys/conf/files head/sys/contrib/pcg-c/include/pcg_variants.h head/sys/libkern/random.c Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Thu Aug 13 20:28:35 2020 (r364218) +++ head/share/man/man9/Makefile Thu Aug 13 20:48:14 2020 (r364219) @@ -272,6 +272,7 @@ MAN= accept_filter.9 \ printf.9 \ prison_check.9 \ priv.9 \ + prng.9 \ proc_rwmem.9 \ pseudofs.9 \ psignal.9 \ @@ -1745,6 +1746,10 @@ MLINKS+=printf.9 log.9 \ printf.9 uprintf.9 MLINKS+=priv.9 priv_check.9 \ priv.9 priv_check_cred.9 +MLINKS+=prng.9 prng32.9 \ + prng.9 prng32_bounded.9 \ + prng.9 prng64.9 \ + prng.9 prng64_bounded.9 MLINKS+=proc_rwmem.9 proc_readmem.9 \ proc_rwmem.9 proc_writemem.9 MLINKS+=psignal.9 gsignal.9 \ Added: head/share/man/man9/prng.9 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man9/prng.9 Thu Aug 13 20:48:14 2020 (r364219) @@ -0,0 +1,99 @@ +.\"- +.\" Copyright 2020 Conrad Meyer . 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 August 5, 2020 +.Dt PRNG 9 +.Os +.Sh NAME +.Nm prng +.Nd "Kernel pseudo-random number generators" +.Sh SYNOPSIS +.In sys/prng.h +.Ft uint32_t +.Fn prng32 void +.Ft uint32_t +.Fn prng32_bounded "uint32_t bound" +.Ft uint64_t +.Fn prng64 void +.Ft uint64_t +.Fn prng64_bounded "uint64_t bound" +.Sh DESCRIPTION +.Ss GENERIC PRNG ROUTINES +.Nm +is a family of fast, +.Em non-cryptographic +pseudo-random number generators. +Unlike +.Xr random 9 , +.Fn prng32 , +.Fn prng32_bounded , +.Fn prng64 , +and +.Fn prng64_bounded +avoid shared global state, removing unnecessary contention on SMP +systems. +The routines are not explicitly tied to any specific implementation, and +may produce different specific sequences on different hosts, reboots, or +versions of +.Fx . +Different CPUs in SMP systems are guaranteed to produce different sequences of +integers. +.Pp +For +.Em cryptographically secure +random numbers generated by the +.Xr random 4 +kernel cryptographically secure random number generator subsystem, see +.Xr arc4random 9 . +.Pp +.Bl -tag -width indent +.It Fn prng32 +Generate a 32-bit integer uniformly distributed in [0, 2^32-1]. +.It Fn prng32_bounded bound +Generate an integer uniformly in the range [0, bound-1]. +.It Fn prng64 +Generate a 64-bit integer uniformly distributed in [0, 2^64-1]. +.It Fn prng64_bounded bound +Generate an integer uniformly in the range [0, bound-1]. +.El +.Pp +These routines are not reentrant; they are not safe to use in interrupt +handlers ("interrupt filters" in +.Xr bus_setup_intr 9 +terminology). +They are safe to use in all other kernel contexts, including interrupt threads +("ithreads"). +.Ss REPRODUCIBLE PRNG APIS +In addition to these per-CPU helpers, the +.In sys/prng.h +header also exposes the entire API of the PCG family of PRNGs as inline +functions. +The PCG-C API is described in full at +.Lk https://www.pcg-random.org/using-pcg-c.html . +.Sh HISTORY +.Nm +was introduced in +.Fx 13 . Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Thu Aug 13 20:28:35 2020 (r364218) +++ head/sys/conf/files Thu Aug 13 20:48:14 2020 (r364219) @@ -3834,6 +3834,7 @@ kern/subr_pctrie.c standard kern/subr_pidctrl.c standard kern/subr_power.c standard kern/subr_prf.c standard +kern/subr_prng.c standard kern/subr_prof.c standard kern/subr_rangeset.c standard kern/subr_rman.c standard Modified: head/sys/contrib/pcg-c/include/pcg_variants.h ============================================================================== --- head/sys/contrib/pcg-c/include/pcg_variants.h Thu Aug 13 20:28:35 2020 (r364218) +++ head/sys/contrib/pcg-c/include/pcg_variants.h Thu Aug 13 20:48:14 2020 (r364219) @@ -36,22 +36,16 @@ #ifndef PCG_VARIANTS_H_INCLUDED #define PCG_VARIANTS_H_INCLUDED 1 -#include - -#if __SIZEOF_INT128__ +#if defined(__SIZEOF_INT128__) && __SIZEOF_INT128__ typedef __uint128_t pcg128_t; #define PCG_128BIT_CONSTANT(high,low) \ ((((pcg128_t)high) << 64) + low) #define PCG_HAS_128BIT_OPS 1 +#else + #define PCG_HAS_128BIT_OPS 0 #endif -#if __GNUC_GNU_INLINE__ && !defined(__cplusplus) - #error Nonstandard GNU inlining semantics. Compile with -std=c99 or better. - /* We could instead use macros PCG_INLINE and PCG_EXTERN_INLINE - but better to just reject ancient C code. */ -#endif - -#if __cplusplus +#ifdef __cplusplus extern "C" { #endif @@ -65,8 +59,8 @@ inline uint8_t pcg_rotr_8(uint8_t value, unsigned int * recognizing idiomatic rotate code, so for clang we actually provide * assembler directives (enabled with PCG_USE_INLINE_ASM). Boo, hiss. */ -#if PCG_USE_INLINE_ASM && __clang__ && (__x86_64__ || __i386__) - asm ("rorb %%cl, %0" : "=r" (value) : "0" (value), "c" (rot)); +#if PCG_USE_INLINE_ASM && defined(__clang__) && (defined(__x86_64__) || defined(__i386__)) + __asm__ ("rorb %%cl, %0" : "=r" (value) : "0" (value), "c" (rot)); return value; #else return (value >> rot) | (value << ((- rot) & 7)); @@ -75,8 +69,8 @@ inline uint8_t pcg_rotr_8(uint8_t value, unsigned int inline uint16_t pcg_rotr_16(uint16_t value, unsigned int rot) { -#if PCG_USE_INLINE_ASM && __clang__ && (__x86_64__ || __i386__) - asm ("rorw %%cl, %0" : "=r" (value) : "0" (value), "c" (rot)); +#if PCG_USE_INLINE_ASM && defined(__clang__) && (defined(__x86_64__) || defined(__i386__)) + __asm__ ("rorw %%cl, %0" : "=r" (value) : "0" (value), "c" (rot)); return value; #else return (value >> rot) | (value << ((- rot) & 15)); @@ -85,8 +79,8 @@ inline uint16_t pcg_rotr_16(uint16_t value, unsigned i inline uint32_t pcg_rotr_32(uint32_t value, unsigned int rot) { -#if PCG_USE_INLINE_ASM && __clang__ && (__x86_64__ || __i386__) - asm ("rorl %%cl, %0" : "=r" (value) : "0" (value), "c" (rot)); +#if PCG_USE_INLINE_ASM && defined(__clang__) && (defined(__x86_64__) || defined(__i386__)) + __asm__ ("rorl %%cl, %0" : "=r" (value) : "0" (value), "c" (rot)); return value; #else return (value >> rot) | (value << ((- rot) & 31)); @@ -95,10 +89,10 @@ inline uint32_t pcg_rotr_32(uint32_t value, unsigned i inline uint64_t pcg_rotr_64(uint64_t value, unsigned int rot) { -#if 0 && PCG_USE_INLINE_ASM && __clang__ && __x86_64__ +#if 0 && PCG_USE_INLINE_ASM && defined(__clang__) && (defined(__x86_64__) || defined(__i386__)) /* For whatever reason, clang actually *does* generate rotq by itself, so we don't need this code. */ - asm ("rorq %%cl, %0" : "=r" (value) : "0" (value), "c" (rot)); + __asm__ ("rorq %%cl, %0" : "=r" (value) : "0" (value), "c" (rot)); return value; #else return (value >> rot) | (value << ((- rot) & 63)); @@ -2491,18 +2485,6 @@ typedef struct pcg_state_setseq_128 pcg128i_random_t #define pcg128i_advance_r pcg_setseq_128_advance_r #endif -extern uint32_t pcg32_random(void); -extern uint32_t pcg32_boundedrand(uint32_t bound); -extern void pcg32_srandom(uint64_t seed, uint64_t seq); -extern void pcg32_advance(uint64_t delta); - -#if PCG_HAS_128BIT_OPS -extern uint64_t pcg64_random(void); -extern uint64_t pcg64_boundedrand(uint64_t bound); -extern void pcg64_srandom(pcg128_t seed, pcg128_t seq); -extern void pcg64_advance(pcg128_t delta); -#endif - /* * Static initialization constants (if you can't call srandom for some * bizarre reason). @@ -2536,7 +2518,7 @@ extern void pcg64_advance(pcg128_t delta); #define PCG128I_INITIALIZER PCG_STATE_SETSEQ_128_INITIALIZER #endif -#if __cplusplus +#ifdef __cplusplus } #endif Added: head/sys/kern/subr_prng.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/kern/subr_prng.c Thu Aug 13 20:48:14 2020 (r364219) @@ -0,0 +1,131 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright 2020 Conrad Meyer . 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 + +#if !PCG_HAS_128BIT_OPS +/* On 32-bit platforms, gang together two 32-bit generators. */ +typedef struct { + pcg32u_random_t states[2]; +} pcg64u_random_t; + +static inline void +pcg64u_srandom_r(pcg64u_random_t *state64, uint64_t seed) +{ + pcg32u_srandom_r(&state64->states[0], seed); + pcg32u_srandom_r(&state64->states[1], seed); +} + +static inline uint64_t +pcg64u_random_r(pcg64u_random_t *state64) +{ + return ((((uint64_t)pcg32u_random_r(&state64->states[0])) << 32) | + pcg32u_random_r(&state64->states[1])); +} + +static inline uint64_t +pcg64u_boundedrand_r(pcg64u_random_t *state64, uint64_t bound) +{ + uint64_t threshold = -bound % bound; + for (;;) { + uint64_t r = pcg64u_random_r(state64); + if (r >= threshold) + return (r % bound); + } +} +#endif + +DPCPU_DEFINE_STATIC(pcg32u_random_t, pcpu_prng32_state); +DPCPU_DEFINE_STATIC(pcg64u_random_t, pcpu_prng64_state); + +static void +prng_init(void *dummy __unused) +{ + pcg32u_random_t *state; + pcg64u_random_t *state64; + int i; + + CPU_FOREACH(i) { + state = DPCPU_ID_PTR(i, pcpu_prng32_state); + pcg32u_srandom_r(state, 1); + state64 = DPCPU_ID_PTR(i, pcpu_prng64_state); + pcg64u_srandom_r(state64, 1); + } +} +SYSINIT(prng_init, SI_SUB_CPU, SI_ORDER_ANY, prng_init, NULL); + +uint32_t +prng32(void) +{ + uint32_t r; + + critical_enter(); + r = pcg32u_random_r(DPCPU_PTR(pcpu_prng32_state)); + critical_exit(); + return (r); +} + +uint32_t +prng32_bounded(uint32_t bound) +{ + uint32_t r; + + critical_enter(); + r = pcg32u_boundedrand_r(DPCPU_PTR(pcpu_prng32_state), bound); + critical_exit(); + return (r); +} + +uint64_t +prng64(void) +{ + uint64_t r; + + critical_enter(); + r = pcg64u_random_r(DPCPU_PTR(pcpu_prng64_state)); + critical_exit(); + return (r); +} + +uint64_t +prng64_bounded(uint64_t bound) +{ + uint64_t r; + + critical_enter(); + r = pcg64u_boundedrand_r(DPCPU_PTR(pcpu_prng64_state), bound); + critical_exit(); + return (r); +} Modified: head/sys/libkern/random.c ============================================================================== --- head/sys/libkern/random.c Thu Aug 13 20:28:35 2020 (r364218) +++ head/sys/libkern/random.c Thu Aug 13 20:48:14 2020 (r364219) @@ -36,43 +36,14 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include -static u_long randseed = 937186357; /* after srandom(1), NSHUFF counted */ - /* - * Pseudo-random number generator for perturbing the profiling clock, - * and whatever else we might use it for. The result is uniform on - * [0, 2^31 - 1]. + * Pseudo-random number generator. The result is uniform in [0, 2^31 - 1]. */ u_long random(void) { - static bool warned = false; - - long x, hi, lo, t; - - /* Warn only once, or it gets very spammy. */ - if (!warned) { - gone_in(13, - "random(9) is the obsolete Park-Miller LCG from 1988"); - warned = true; - } - - /* - * Compute x[n + 1] = (7^5 * x[n]) mod (2^31 - 1). - * From "Random number generators: good ones are hard to find", - * Park and Miller, Communications of the ACM, vol. 31, no. 10, - * October 1988, p. 1195. - */ - /* Can't be initialized with 0, so use another value. */ - if ((x = randseed) == 0) - x = 123459876; - hi = x / 127773; - lo = x % 127773; - t = 16807 * lo - 2836 * hi; - if (t < 0) - t += 0x7fffffff; - randseed = t; - return (t); + return (prng32()); } Added: head/sys/sys/prng.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/sys/prng.h Thu Aug 13 20:48:14 2020 (r364219) @@ -0,0 +1,20 @@ +/*- + * This file is in the public domain. + * + * $FreeBSD$ + */ + +#ifndef _SYS_PRNG_H_ +#define _SYS_PRNG_H_ + +#define PCG_USE_INLINE_ASM 1 +#include + +#ifdef _KERNEL +__uint32_t prng32(void); +__uint32_t prng32_bounded(__uint32_t bound); +__uint64_t prng64(void); +__uint64_t prng64_bounded(__uint64_t bound); +#endif + +#endif From owner-svn-src-all@freebsd.org Thu Aug 13 21:06:44 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E29CC3AD08C; Thu, 13 Aug 2020 21:06:44 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BSJz81QJ3z3ZsL; Thu, 13 Aug 2020 21:06:44 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wr1-x435.google.com with SMTP id f12so6499569wru.13; Thu, 13 Aug 2020 14:06:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=vVSgphJx6NsEfZodVf94ov/VN/+xdyqkyiKjlbF3t6g=; b=psroPzwzOjwDKLXLN8N+DjLxtW2PArNJDUnO2D4REjpd4pyaB99wXiA67aN8SgtNQS 9QeIqtbIsQtq2Dmn7Bq5dNpFyULYjKUwX9ZTBijgcS6UDLMDPAWob3ofoV7jAIxrJX7j yTw2/Glr0fvhm73J9+adgFL0brWgedSZY6G5NIcvbCE5bQGBLzxk5ZEvhpBuGtl6k3D5 GGO8oj8oC30pPDhrjTEAvAXdrOPihxvZgskrmKAm7JHvLowbmH+X6IyuYsrTsXDZxvWz +hlY+IiZ969pl/RZnJJu3UxM3Yj1aJj63aDU35bpIB483/STPja0C4LHIbd7LIu2zn8+ 8ulw== 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=vVSgphJx6NsEfZodVf94ov/VN/+xdyqkyiKjlbF3t6g=; b=Cjn4yA4PagAY8+qHuFlb1unkUSZ3bDeD8hvWjpuXpa+gqMaA/RuNNisG5++ZA7GtD5 hi4aauYVU3SjeD8VkoOQT6gICONeDpvpyHxlRiyhhv6YBq2f+n6ZJ6MzYQ99Npmq1s4I NFJZ+s9l0+evzz9qSuaEDTbiMFBuRQoAZ5G8KBje9lz+6o5hQI56W8XsoPFEkfkVUDcj bjM+N+jE48xpyc3Yfj4nFPU6d075h2QLlkee/yaIdOVwB0v1KV3uUI1zKis6vw/gne+8 9hHdnRp52Yk//Rl2+t/3nZwKyGyht1AWM5y9NTKyH7FqkBqcKCaNUpOixQSUx2xj8EZc HW5Q== X-Gm-Message-State: AOAM531kbfEk7Tsia0yTjY8r3A2yfgVNR9A+0Zq2LQlLY1dGICuJJWq7 jGt+HSRsaYSojmfDKQiZWW5IrJmaM4NKcMj4UiYFiA== X-Google-Smtp-Source: ABdhPJyoXl11RMILpyz9GHnwDu4BDrnqZK7zkFUba7tBWeknFUxSLWGvZuVhdihIq7D7qUPvqJOhmDrdEtgQ90cUsV8= X-Received: by 2002:adf:82b2:: with SMTP id 47mr5502001wrc.17.1597352802017; Thu, 13 Aug 2020 14:06:42 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a5d:614c:0:0:0:0:0 with HTTP; Thu, 13 Aug 2020 14:06:41 -0700 (PDT) In-Reply-To: <202008132048.07DKmEO9069055@repo.freebsd.org> References: <202008132048.07DKmEO9069055@repo.freebsd.org> From: Mateusz Guzik Date: Thu, 13 Aug 2020 23:06:41 +0200 Message-ID: Subject: Re: svn commit: r364219 - in head: share/man/man9 sys/conf sys/contrib/pcg-c/include sys/kern sys/libkern sys/sys To: Conrad Meyer 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: 4BSJz81QJ3z3ZsL X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 13 Aug 2020 21:06:44 -0000 I have trouble deciphering. Is this callable from interrupt context? If not, the code should assert it's not executing in one. If yes, it should probably just sched_pin. On 8/13/20, Conrad Meyer wrote: > Author: cem > Date: Thu Aug 13 20:48:14 2020 > New Revision: 364219 > URL: https://svnweb.freebsd.org/changeset/base/364219 > > Log: > Add prng(9) API > > Add prng(9) as a replacement for random(9) in the kernel. > > There are two major differences from random(9) and random(3): > > - General prng(9) APIs (prng32(9), etc) do not guarantee an > implementation or particular sequence; they should not be used for > repeatable simulations. > > - However, specific named API families are also exposed (for now: PCG), > and those are expected to be repeatable (when so-guaranteed by the > named > algorithm). > > Some minor differences from random(3) and earlier random(9): > > - PRNG state for the general prng(9) APIs is per-CPU; this eliminates > contention on PRNG state in SMP workloads. Each PCPU generator in an > SMP system produces a unique sequence. > > - Better statistical properties than the Park-Miller ("minstd") PRNG > (longer period, uniform distribution in all bits, passes > BigCrush/PractRand analysis). > > - Faster than Park-Miller ("minstd") PRNG -- no division is required to > step PCG-family PRNGs. > > For now, random(9) becomes a thin shim around prng32(). Eventually I > would like to mechanically switch consumers over to the explicit API. > > Reviewed by: kib, markj (previous version both) > Discussed with: markm > Differential Revision: https://reviews.freebsd.org/D25916 > > Added: > head/share/man/man9/prng.9 (contents, props changed) > head/sys/kern/subr_prng.c (contents, props changed) > head/sys/sys/prng.h (contents, props changed) > Modified: > head/share/man/man9/Makefile > head/sys/conf/files > head/sys/contrib/pcg-c/include/pcg_variants.h > head/sys/libkern/random.c > > Modified: head/share/man/man9/Makefile > ============================================================================== > --- head/share/man/man9/Makefile Thu Aug 13 20:28:35 2020 (r364218) > +++ head/share/man/man9/Makefile Thu Aug 13 20:48:14 2020 (r364219) > @@ -272,6 +272,7 @@ MAN= accept_filter.9 \ > printf.9 \ > prison_check.9 \ > priv.9 \ > + prng.9 \ > proc_rwmem.9 \ > pseudofs.9 \ > psignal.9 \ > @@ -1745,6 +1746,10 @@ MLINKS+=printf.9 log.9 \ > printf.9 uprintf.9 > MLINKS+=priv.9 priv_check.9 \ > priv.9 priv_check_cred.9 > +MLINKS+=prng.9 prng32.9 \ > + prng.9 prng32_bounded.9 \ > + prng.9 prng64.9 \ > + prng.9 prng64_bounded.9 > MLINKS+=proc_rwmem.9 proc_readmem.9 \ > proc_rwmem.9 proc_writemem.9 > MLINKS+=psignal.9 gsignal.9 \ > > Added: head/share/man/man9/prng.9 > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/share/man/man9/prng.9 Thu Aug 13 20:48:14 2020 (r364219) > @@ -0,0 +1,99 @@ > +.\"- > +.\" Copyright 2020 Conrad Meyer . 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 August 5, 2020 > +.Dt PRNG 9 > +.Os > +.Sh NAME > +.Nm prng > +.Nd "Kernel pseudo-random number generators" > +.Sh SYNOPSIS > +.In sys/prng.h > +.Ft uint32_t > +.Fn prng32 void > +.Ft uint32_t > +.Fn prng32_bounded "uint32_t bound" > +.Ft uint64_t > +.Fn prng64 void > +.Ft uint64_t > +.Fn prng64_bounded "uint64_t bound" > +.Sh DESCRIPTION > +.Ss GENERIC PRNG ROUTINES > +.Nm > +is a family of fast, > +.Em non-cryptographic > +pseudo-random number generators. > +Unlike > +.Xr random 9 , > +.Fn prng32 , > +.Fn prng32_bounded , > +.Fn prng64 , > +and > +.Fn prng64_bounded > +avoid shared global state, removing unnecessary contention on SMP > +systems. > +The routines are not explicitly tied to any specific implementation, and > +may produce different specific sequences on different hosts, reboots, or > +versions of > +.Fx . > +Different CPUs in SMP systems are guaranteed to produce different sequences > of > +integers. > +.Pp > +For > +.Em cryptographically secure > +random numbers generated by the > +.Xr random 4 > +kernel cryptographically secure random number generator subsystem, see > +.Xr arc4random 9 . > +.Pp > +.Bl -tag -width indent > +.It Fn prng32 > +Generate a 32-bit integer uniformly distributed in [0, 2^32-1]. > +.It Fn prng32_bounded bound > +Generate an integer uniformly in the range [0, bound-1]. > +.It Fn prng64 > +Generate a 64-bit integer uniformly distributed in [0, 2^64-1]. > +.It Fn prng64_bounded bound > +Generate an integer uniformly in the range [0, bound-1]. > +.El > +.Pp > +These routines are not reentrant; they are not safe to use in interrupt > +handlers ("interrupt filters" in > +.Xr bus_setup_intr 9 > +terminology). > +They are safe to use in all other kernel contexts, including interrupt > threads > +("ithreads"). > +.Ss REPRODUCIBLE PRNG APIS > +In addition to these per-CPU helpers, the > +.In sys/prng.h > +header also exposes the entire API of the PCG family of PRNGs as inline > +functions. > +The PCG-C API is described in full at > +.Lk https://www.pcg-random.org/using-pcg-c.html . > +.Sh HISTORY > +.Nm > +was introduced in > +.Fx 13 . > > Modified: head/sys/conf/files > ============================================================================== > --- head/sys/conf/files Thu Aug 13 20:28:35 2020 (r364218) > +++ head/sys/conf/files Thu Aug 13 20:48:14 2020 (r364219) > @@ -3834,6 +3834,7 @@ kern/subr_pctrie.c standard > kern/subr_pidctrl.c standard > kern/subr_power.c standard > kern/subr_prf.c standard > +kern/subr_prng.c standard > kern/subr_prof.c standard > kern/subr_rangeset.c standard > kern/subr_rman.c standard > > Modified: head/sys/contrib/pcg-c/include/pcg_variants.h > ============================================================================== > --- head/sys/contrib/pcg-c/include/pcg_variants.h Thu Aug 13 20:28:35 > 2020 (r364218) > +++ head/sys/contrib/pcg-c/include/pcg_variants.h Thu Aug 13 20:48:14 > 2020 (r364219) > @@ -36,22 +36,16 @@ > #ifndef PCG_VARIANTS_H_INCLUDED > #define PCG_VARIANTS_H_INCLUDED 1 > > -#include > - > -#if __SIZEOF_INT128__ > +#if defined(__SIZEOF_INT128__) && __SIZEOF_INT128__ > typedef __uint128_t pcg128_t; > #define PCG_128BIT_CONSTANT(high,low) \ > ((((pcg128_t)high) << 64) + low) > #define PCG_HAS_128BIT_OPS 1 > +#else > + #define PCG_HAS_128BIT_OPS 0 > #endif > > -#if __GNUC_GNU_INLINE__ && !defined(__cplusplus) > - #error Nonstandard GNU inlining semantics. Compile with -std=c99 or > better. > - /* We could instead use macros PCG_INLINE and PCG_EXTERN_INLINE > - but better to just reject ancient C code. */ > -#endif > - > -#if __cplusplus > +#ifdef __cplusplus > extern "C" { > #endif > > @@ -65,8 +59,8 @@ inline uint8_t pcg_rotr_8(uint8_t value, unsigned int > * recognizing idiomatic rotate code, so for clang we actually provide > * assembler directives (enabled with PCG_USE_INLINE_ASM). Boo, hiss. > */ > -#if PCG_USE_INLINE_ASM && __clang__ && (__x86_64__ || __i386__) > - asm ("rorb %%cl, %0" : "=r" (value) : "0" (value), "c" (rot)); > +#if PCG_USE_INLINE_ASM && defined(__clang__) && (defined(__x86_64__) || > defined(__i386__)) > + __asm__ ("rorb %%cl, %0" : "=r" (value) : "0" (value), "c" (rot)); > return value; > #else > return (value >> rot) | (value << ((- rot) & 7)); > @@ -75,8 +69,8 @@ inline uint8_t pcg_rotr_8(uint8_t value, unsigned int > > inline uint16_t pcg_rotr_16(uint16_t value, unsigned int rot) > { > -#if PCG_USE_INLINE_ASM && __clang__ && (__x86_64__ || __i386__) > - asm ("rorw %%cl, %0" : "=r" (value) : "0" (value), "c" (rot)); > +#if PCG_USE_INLINE_ASM && defined(__clang__) && (defined(__x86_64__) || > defined(__i386__)) > + __asm__ ("rorw %%cl, %0" : "=r" (value) : "0" (value), "c" (rot)); > return value; > #else > return (value >> rot) | (value << ((- rot) & 15)); > @@ -85,8 +79,8 @@ inline uint16_t pcg_rotr_16(uint16_t value, unsigned i > > inline uint32_t pcg_rotr_32(uint32_t value, unsigned int rot) > { > -#if PCG_USE_INLINE_ASM && __clang__ && (__x86_64__ || __i386__) > - asm ("rorl %%cl, %0" : "=r" (value) : "0" (value), "c" (rot)); > +#if PCG_USE_INLINE_ASM && defined(__clang__) && (defined(__x86_64__) || > defined(__i386__)) > + __asm__ ("rorl %%cl, %0" : "=r" (value) : "0" (value), "c" (rot)); > return value; > #else > return (value >> rot) | (value << ((- rot) & 31)); > @@ -95,10 +89,10 @@ inline uint32_t pcg_rotr_32(uint32_t value, unsigned i > > inline uint64_t pcg_rotr_64(uint64_t value, unsigned int rot) > { > -#if 0 && PCG_USE_INLINE_ASM && __clang__ && __x86_64__ > +#if 0 && PCG_USE_INLINE_ASM && defined(__clang__) && (defined(__x86_64__) > || defined(__i386__)) > /* For whatever reason, clang actually *does* generate rotq by > itself, so we don't need this code. */ > - asm ("rorq %%cl, %0" : "=r" (value) : "0" (value), "c" (rot)); > + __asm__ ("rorq %%cl, %0" : "=r" (value) : "0" (value), "c" (rot)); > return value; > #else > return (value >> rot) | (value << ((- rot) & 63)); > @@ -2491,18 +2485,6 @@ typedef struct pcg_state_setseq_128 > pcg128i_random_t > #define pcg128i_advance_r pcg_setseq_128_advance_r > #endif > > -extern uint32_t pcg32_random(void); > -extern uint32_t pcg32_boundedrand(uint32_t bound); > -extern void pcg32_srandom(uint64_t seed, uint64_t seq); > -extern void pcg32_advance(uint64_t delta); > - > -#if PCG_HAS_128BIT_OPS > -extern uint64_t pcg64_random(void); > -extern uint64_t pcg64_boundedrand(uint64_t bound); > -extern void pcg64_srandom(pcg128_t seed, pcg128_t seq); > -extern void pcg64_advance(pcg128_t delta); > -#endif > - > /* > * Static initialization constants (if you can't call srandom for some > * bizarre reason). > @@ -2536,7 +2518,7 @@ extern void pcg64_advance(pcg128_t delta); > #define PCG128I_INITIALIZER PCG_STATE_SETSEQ_128_INITIALIZER > #endif > > -#if __cplusplus > +#ifdef __cplusplus > } > #endif > > > Added: head/sys/kern/subr_prng.c > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/kern/subr_prng.c Thu Aug 13 20:48:14 2020 (r364219) > @@ -0,0 +1,131 @@ > +/*- > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > + * > + * Copyright 2020 Conrad Meyer . 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 > + > +#if !PCG_HAS_128BIT_OPS > +/* On 32-bit platforms, gang together two 32-bit generators. */ > +typedef struct { > + pcg32u_random_t states[2]; > +} pcg64u_random_t; > + > +static inline void > +pcg64u_srandom_r(pcg64u_random_t *state64, uint64_t seed) > +{ > + pcg32u_srandom_r(&state64->states[0], seed); > + pcg32u_srandom_r(&state64->states[1], seed); > +} > + > +static inline uint64_t > +pcg64u_random_r(pcg64u_random_t *state64) > +{ > + return ((((uint64_t)pcg32u_random_r(&state64->states[0])) << 32) | > + pcg32u_random_r(&state64->states[1])); > +} > + > +static inline uint64_t > +pcg64u_boundedrand_r(pcg64u_random_t *state64, uint64_t bound) > +{ > + uint64_t threshold = -bound % bound; > + for (;;) { > + uint64_t r = pcg64u_random_r(state64); > + if (r >= threshold) > + return (r % bound); > + } > +} > +#endif > + > +DPCPU_DEFINE_STATIC(pcg32u_random_t, pcpu_prng32_state); > +DPCPU_DEFINE_STATIC(pcg64u_random_t, pcpu_prng64_state); > + > +static void > +prng_init(void *dummy __unused) > +{ > + pcg32u_random_t *state; > + pcg64u_random_t *state64; > + int i; > + > + CPU_FOREACH(i) { > + state = DPCPU_ID_PTR(i, pcpu_prng32_state); > + pcg32u_srandom_r(state, 1); > + state64 = DPCPU_ID_PTR(i, pcpu_prng64_state); > + pcg64u_srandom_r(state64, 1); > + } > +} > +SYSINIT(prng_init, SI_SUB_CPU, SI_ORDER_ANY, prng_init, NULL); > + > +uint32_t > +prng32(void) > +{ > + uint32_t r; > + > + critical_enter(); > + r = pcg32u_random_r(DPCPU_PTR(pcpu_prng32_state)); > + critical_exit(); > + return (r); > +} > + > +uint32_t > +prng32_bounded(uint32_t bound) > +{ > + uint32_t r; > + > + critical_enter(); > + r = pcg32u_boundedrand_r(DPCPU_PTR(pcpu_prng32_state), bound); > + critical_exit(); > + return (r); > +} > + > +uint64_t > +prng64(void) > +{ > + uint64_t r; > + > + critical_enter(); > + r = pcg64u_random_r(DPCPU_PTR(pcpu_prng64_state)); > + critical_exit(); > + return (r); > +} > + > +uint64_t > +prng64_bounded(uint64_t bound) > +{ > + uint64_t r; > + > + critical_enter(); > + r = pcg64u_boundedrand_r(DPCPU_PTR(pcpu_prng64_state), bound); > + critical_exit(); > + return (r); > +} > > Modified: head/sys/libkern/random.c > ============================================================================== > --- head/sys/libkern/random.c Thu Aug 13 20:28:35 2020 (r364218) > +++ head/sys/libkern/random.c Thu Aug 13 20:48:14 2020 (r364219) > @@ -36,43 +36,14 @@ __FBSDID("$FreeBSD$"); > > #include > #include > +#include > #include > > -static u_long randseed = 937186357; /* after srandom(1), NSHUFF counted */ > - > /* > - * Pseudo-random number generator for perturbing the profiling clock, > - * and whatever else we might use it for. The result is uniform on > - * [0, 2^31 - 1]. > + * Pseudo-random number generator. The result is uniform in [0, 2^31 - > 1]. > */ > u_long > random(void) > { > - static bool warned = false; > - > - long x, hi, lo, t; > - > - /* Warn only once, or it gets very spammy. */ > - if (!warned) { > - gone_in(13, > - "random(9) is the obsolete Park-Miller LCG from 1988"); > - warned = true; > - } > - > - /* > - * Compute x[n + 1] = (7^5 * x[n]) mod (2^31 - 1). > - * From "Random number generators: good ones are hard to find", > - * Park and Miller, Communications of the ACM, vol. 31, no. 10, > - * October 1988, p. 1195. > - */ > - /* Can't be initialized with 0, so use another value. */ > - if ((x = randseed) == 0) > - x = 123459876; > - hi = x / 127773; > - lo = x % 127773; > - t = 16807 * lo - 2836 * hi; > - if (t < 0) > - t += 0x7fffffff; > - randseed = t; > - return (t); > + return (prng32()); > } > > Added: head/sys/sys/prng.h > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/sys/prng.h Thu Aug 13 20:48:14 2020 (r364219) > @@ -0,0 +1,20 @@ > +/*- > + * This file is in the public domain. > + * > + * $FreeBSD$ > + */ > + > +#ifndef _SYS_PRNG_H_ > +#define _SYS_PRNG_H_ > + > +#define PCG_USE_INLINE_ASM 1 > +#include > + > +#ifdef _KERNEL > +__uint32_t prng32(void); > +__uint32_t prng32_bounded(__uint32_t bound); > +__uint64_t prng64(void); > +__uint64_t prng64_bounded(__uint64_t bound); > +#endif > + > +#endif > -- Mateusz Guzik From owner-svn-src-all@freebsd.org Thu Aug 13 21:28:56 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E4C113AD342; Thu, 13 Aug 2020 21:28:56 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-oi1-f180.google.com (mail-oi1-f180.google.com [209.85.167.180]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BSKSl60NTz3c51; Thu, 13 Aug 2020 21:28:55 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-oi1-f180.google.com with SMTP id u63so6386921oie.5; Thu, 13 Aug 2020 14:28:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=3h8HrF2e3Q2taC9Ktiy0JLRuJjPDAY4uHbED/tJHOPI=; b=INMfRMHgZbgB28d2j/r7RM9+C73IWZLlApPRxxhu9PTO4zul4CHUiGp6iCOGp0HOdr fEr8whumOH7itvnYFEBBSGMyq8J4s26yTnRc4iMusT9RJna9hgl3ICaGe0/0JNaie2uy AU6hefeFxCuA2I0px9T0Ud1vqCQXo9VdjA+sx9xlkhyFtl5vvZq90bYx80wQqPkzsl3D I4p/WIMTruvu/EEPHbpIVooxntUZh0lBMnpUigPOdT64goVldhPkN3xO3X0esHc76OTL yceANy+LfpIKcKH5JiQAV6L7gkePpsZ4ZGO2GPcmoCvTzq2hg7RJQWlaziDNHp3un9DP EBUw== X-Gm-Message-State: AOAM531msu8GJs01o3D4jN28DzvWd4+Rlrn0sczwquTEelHsGHCdGofr GCYPwaCVuNcTjtlaUX2K5rmTCj5N X-Google-Smtp-Source: ABdhPJxra7n/W21O/hn82ze+jqFuTqXAxarXiWT8SJNiJ31wspsUdOUozDDnpO1oJiVLSmlzRdIUlw== X-Received: by 2002:aca:d6c8:: with SMTP id n191mr5125870oig.81.1597354134167; Thu, 13 Aug 2020 14:28:54 -0700 (PDT) Received: from mail-oi1-f171.google.com (mail-oi1-f171.google.com. [209.85.167.171]) by smtp.gmail.com with ESMTPSA id h11sm1355177otj.42.2020.08.13.14.28.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 13 Aug 2020 14:28:53 -0700 (PDT) Received: by mail-oi1-f171.google.com with SMTP id v13so6354521oiv.13; Thu, 13 Aug 2020 14:28:53 -0700 (PDT) X-Received: by 2002:aca:5703:: with SMTP id l3mr4678077oib.48.1597354133533; Thu, 13 Aug 2020 14:28:53 -0700 (PDT) MIME-Version: 1.0 References: <202008132048.07DKmEO9069055@repo.freebsd.org> In-Reply-To: Reply-To: cem@freebsd.org From: Conrad Meyer Date: Thu, 13 Aug 2020 14:28:42 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r364219 - in head: share/man/man9 sys/conf sys/contrib/pcg-c/include sys/kern sys/libkern sys/sys To: Mateusz Guzik Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4BSKSl60NTz3c51 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of csecem@gmail.com designates 209.85.167.180 as permitted sender) smtp.mailfrom=csecem@gmail.com X-Spamd-Result: default: False [-1.81 / 15.00]; HAS_REPLYTO(0.00)[cem@freebsd.org]; RCVD_VIA_SMTP_AUTH(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]; TO_DN_ALL(0.00)[]; NEURAL_HAM_SHORT(-0.40)[-0.397]; FREEMAIL_TO(0.00)[gmail.com]; FORGED_SENDER(0.30)[cem@freebsd.org,csecem@gmail.com]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; R_DKIM_NA(0.00)[]; TAGGED_FROM(0.00)[]; FROM_NEQ_ENVFROM(0.00)[cem@freebsd.org,csecem@gmail.com]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.50)[-0.500]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; NEURAL_HAM_LONG(-0.91)[-0.910]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[209.85.167.180:from]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.167.180:from]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 13 Aug 2020 21:28:57 -0000 On Thu, Aug 13, 2020 at 2:06 PM Mateusz Guzik wrote: > > I have trouble deciphering. Is this callable from interrupt context? > If not, the code should assert it's not executing in one. If yes, it > should probably just sched_pin. It is not callable from interrupt context. If you know a way to assert that, I'd love to add it. I was unable to find a way in MI code to assert on that condition, which is predominantly in MD code Best, Conrad > On 8/13/20, Conrad Meyer wrote: > > Author: cem > > Date: Thu Aug 13 20:48:14 2020 > > New Revision: 364219 > > URL: https://svnweb.freebsd.org/changeset/base/364219 > > > > Log: > > Add prng(9) API From owner-svn-src-all@freebsd.org Thu Aug 13 22:06:27 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D141E3ADEC1; Thu, 13 Aug 2020 22:06:27 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BSLJ359kSz3fBv; Thu, 13 Aug 2020 22:06:27 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 95F8923FDE; Thu, 13 Aug 2020 22:06:27 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07DM6RYd018725; Thu, 13 Aug 2020 22:06:27 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07DM6R5O018724; Thu, 13 Aug 2020 22:06:27 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <202008132206.07DM6R5O018724@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Thu, 13 Aug 2020 22:06:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364220 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 364220 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 13 Aug 2020 22:06:27 -0000 Author: bdrewery Date: Thu Aug 13 22:06:27 2020 New Revision: 364220 URL: https://svnweb.freebsd.org/changeset/base/364220 Log: lagg: Avoid adding a port to a lagg device being destroyed. The lagg_clone_destroy() handles detach and waiting for ifconfig callers to drain already. This narrows the race for 2 panics that the tests triggered. Both were a consequence of adding a port to the lagg device after it had already detached from all of its ports. The link state task would run after lagg_clone_destroy() free'd the lagg softc. kernel:trap_fatal+0xa4 kernel:trap_pfault+0x61 kernel:trap+0x316 kernel:witness_checkorder+0x6d kernel:_sx_xlock+0x72 if_lagg.ko:lagg_port_state+0x3b kernel:if_down+0x144 kernel:if_detach+0x659 if_tap.ko:tap_destroy+0x46 kernel:if_clone_destroyif+0x1b7 kernel:if_clone_destroy+0x8d kernel:ifioctl+0x29c kernel:kern_ioctl+0x2bd kernel:sys_ioctl+0x16d kernel:amd64_syscall+0x337 kernel:trap_fatal+0xa4 kernel:trap_pfault+0x61 kernel:trap+0x316 kernel:witness_checkorder+0x6d kernel:_sx_xlock+0x72 if_lagg.ko:lagg_port_state+0x3b kernel:do_link_state_change+0x9b kernel:taskqueue_run_locked+0x10b kernel:taskqueue_run+0x49 kernel:ithread_loop+0x19c kernel:fork_exit+0x83 PR: 244168 Reviewed by: markj MFC after: 2 weeks Sponsored by: Dell EMC Differential Revision: https://reviews.freebsd.org/D25284 Modified: head/sys/net/if_lagg.c Modified: head/sys/net/if_lagg.c ============================================================================== --- head/sys/net/if_lagg.c Thu Aug 13 20:48:14 2020 (r364219) +++ head/sys/net/if_lagg.c Thu Aug 13 22:06:27 2020 (r364220) @@ -679,6 +679,9 @@ lagg_port_create(struct lagg_softc *sc, struct ifnet * return (EINVAL); } + if (sc->sc_destroying == 1) + return (ENXIO); + /* Limit the maximal number of lagg ports */ if (sc->sc_count >= LAGG_MAX_PORTS) return (ENOSPC); @@ -1190,6 +1193,8 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data int count, buflen, len, error = 0, oldmtu; bzero(&rpbuf, sizeof(rpbuf)); + + /* XXX: This can race with lagg_clone_destroy. */ switch (cmd) { case SIOCGLAGG: From owner-svn-src-all@freebsd.org Thu Aug 13 22:42:26 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 097203AEA20; Thu, 13 Aug 2020 22:42:26 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BSM5Y6WLlz3wkD; Thu, 13 Aug 2020 22:42:25 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C3A8F24A19; Thu, 13 Aug 2020 22:42:25 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07DMgPT0045425; Thu, 13 Aug 2020 22:42:25 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07DMgPn0045423; Thu, 13 Aug 2020 22:42:25 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <202008132242.07DMgPn0045423@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Thu, 13 Aug 2020 22:42:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364221 - in head/lib/libbsnmp: . tests X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: in head/lib/libbsnmp: . tests X-SVN-Commit-Revision: 364221 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 13 Aug 2020 22:42:26 -0000 Author: bdrewery Date: Thu Aug 13 22:42:24 2020 New Revision: 364221 URL: https://svnweb.freebsd.org/changeset/base/364221 Log: Add test to for FreeBSD-SA-19:20.bsnmp Submitted by: Darrick Lew Reviewed by: cem Sponsored by: Dell EMC Differential Revision: https://reviews.freebsd.org/D26037 Added: head/lib/libbsnmp/tests/ head/lib/libbsnmp/tests/Makefile (contents, props changed) head/lib/libbsnmp/tests/bsnmpd_test.c (contents, props changed) Modified: head/lib/libbsnmp/Makefile Modified: head/lib/libbsnmp/Makefile ============================================================================== --- head/lib/libbsnmp/Makefile Thu Aug 13 22:06:27 2020 (r364220) +++ head/lib/libbsnmp/Makefile Thu Aug 13 22:42:24 2020 (r364221) @@ -1,5 +1,6 @@ # $FreeBSD$ SUBDIR= libbsnmp +SUBDIR.${MK_TESTS}+= tests .include Added: head/lib/libbsnmp/tests/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libbsnmp/tests/Makefile Thu Aug 13 22:42:24 2020 (r364221) @@ -0,0 +1,11 @@ +# $FreeBSD$ + +.include + +ATF_TESTS_C+= bsnmpd_test + +SRCS.bsmpd_test= bsnmpd_test.c + +LIBADD+= bsnmp + +.include Added: head/lib/libbsnmp/tests/bsnmpd_test.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libbsnmp/tests/bsnmpd_test.c Thu Aug 13 22:42:24 2020 (r364221) @@ -0,0 +1,53 @@ +/*- + * Copyright (c) 2020 Dell EMC + * 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 + +ATF_TC_WITHOUT_HEAD(sa_19_20_bsnmp_test); +ATF_TC_BODY(sa_19_20_bsnmp_test, tc) +{ + struct asn_buf b = {}; + char test_buf[] = { 0x25, 0x7f }; + enum asn_err err; + asn_len_t len; + u_char type; + + b.asn_cptr = test_buf; + b.asn_len = sizeof(test_buf); + + err = asn_get_header(&b, &type, &len); + ATF_CHECK_EQ(ASN_ERR_EOBUF, err); +} + +ATF_TP_ADD_TCS(tp) +{ + ATF_TP_ADD_TC(tp, sa_19_20_bsnmp_test); + return (atf_no_error()); +} From owner-svn-src-all@freebsd.org Thu Aug 13 22:57:57 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AA1173AF10E; Thu, 13 Aug 2020 22:57:57 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4BSMRS6NhXz3yP1; Thu, 13 Aug 2020 22:57:56 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id 07DMvs9f045019; Thu, 13 Aug 2020 15:57:54 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id 07DMvsde045018; Thu, 13 Aug 2020 15:57:54 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <202008132257.07DMvsde045018@gndrsh.dnsmgr.net> Subject: Re: svn commit: r364221 - in head/lib/libbsnmp: . tests In-Reply-To: <202008132242.07DMgPn0045423@repo.freebsd.org> To: Bryan Drewery Date: Thu, 13 Aug 2020 15:57:54 -0700 (PDT) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 4BSMRS6NhXz3yP1 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:13868, ipnet:69.59.192.0/19, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 13 Aug 2020 22:57:57 -0000 > Author: bdrewery > Date: Thu Aug 13 22:42:24 2020 > New Revision: 364221 > URL: https://svnweb.freebsd.org/changeset/base/364221 > > Log: > Add test to for FreeBSD-SA-19:20.bsnmp > > Submitted by: Darrick Lew > Reviewed by: cem > Sponsored by: Dell EMC > Differential Revision: https://reviews.freebsd.org/D26037 > > Added: > head/lib/libbsnmp/tests/ > head/lib/libbsnmp/tests/Makefile (contents, props changed) > head/lib/libbsnmp/tests/bsnmpd_test.c (contents, props changed) > Modified: > head/lib/libbsnmp/Makefile > > Modified: head/lib/libbsnmp/Makefile > ============================================================================== > --- head/lib/libbsnmp/Makefile Thu Aug 13 22:06:27 2020 (r364220) > +++ head/lib/libbsnmp/Makefile Thu Aug 13 22:42:24 2020 (r364221) > @@ -1,5 +1,6 @@ > # $FreeBSD$ > > SUBDIR= libbsnmp > +SUBDIR.${MK_TESTS}+= tests > > .include > > Added: head/lib/libbsnmp/tests/Makefile > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/lib/libbsnmp/tests/Makefile Thu Aug 13 22:42:24 2020 (r364221) > @@ -0,0 +1,11 @@ > +# $FreeBSD$ > + > +.include > + > +ATF_TESTS_C+= bsnmpd_test > + > +SRCS.bsmpd_test= bsnmpd_test.c > + > +LIBADD+= bsnmp > + > +.include > > Added: head/lib/libbsnmp/tests/bsnmpd_test.c > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/lib/libbsnmp/tests/bsnmpd_test.c Thu Aug 13 22:42:24 2020 (r364221) > @@ -0,0 +1,53 @@ > +/*- > + * Copyright (c) 2020 Dell EMC > + * All rights reserved. I am not sure where your copying the copyright from, but in all known in tree templates the "All rights reserved." line has been removed. Your probably just copying it from another file perhaps? Or is this something Dell/Emc is requireing? > + * > + * 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 > + > +ATF_TC_WITHOUT_HEAD(sa_19_20_bsnmp_test); > +ATF_TC_BODY(sa_19_20_bsnmp_test, tc) > +{ > + struct asn_buf b = {}; > + char test_buf[] = { 0x25, 0x7f }; > + enum asn_err err; > + asn_len_t len; > + u_char type; > + > + b.asn_cptr = test_buf; > + b.asn_len = sizeof(test_buf); > + > + err = asn_get_header(&b, &type, &len); > + ATF_CHECK_EQ(ASN_ERR_EOBUF, err); > +} > + > +ATF_TP_ADD_TCS(tp) > +{ > + ATF_TP_ADD_TC(tp, sa_19_20_bsnmp_test); > + return (atf_no_error()); > +} > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Thu Aug 13 23:13:06 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1C2033AF438; Thu, 13 Aug 2020 23:13:06 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BSMmx6tfzz40Sq; Thu, 13 Aug 2020 23:13:05 +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 CFDDA24EB5; Thu, 13 Aug 2020 23:13:05 +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 07DND5FT064096; Thu, 13 Aug 2020 23:13:05 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07DND57i064095; Thu, 13 Aug 2020 23:13:05 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <202008132313.07DND57i064095@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 13 Aug 2020 23:13:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364222 - in head: lib/liblua libexec/flua X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head: lib/liblua libexec/flua X-SVN-Commit-Revision: 364222 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 13 Aug 2020 23:13:06 -0000 Author: emaste Date: Thu Aug 13 23:13:05 2020 New Revision: 364222 URL: https://svnweb.freebsd.org/changeset/base/364222 Log: flua: support "require" for binary objects in the base system Export symbols from flua, and enable dlopen. Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D26059 Modified: head/lib/liblua/luaconf.h head/libexec/flua/Makefile Modified: head/lib/liblua/luaconf.h ============================================================================== --- head/lib/liblua/luaconf.h Thu Aug 13 22:42:24 2020 (r364221) +++ head/lib/liblua/luaconf.h Thu Aug 13 23:13:05 2020 (r364222) @@ -75,6 +75,7 @@ /* Local modifications: need io.popen */ #ifdef __FreeBSD__ #define LUA_USE_POSIX +#define LUA_USE_DLOPEN #endif /* Modified: head/libexec/flua/Makefile ============================================================================== --- head/libexec/flua/Makefile Thu Aug 13 22:42:24 2020 (r364221) +++ head/libexec/flua/Makefile Thu Aug 13 23:13:05 2020 (r364222) @@ -38,4 +38,6 @@ SRCS+= lua_ucl.c CFLAGS+= -I${UCLSRC}/include -I${UCLSRC}/src -I${UCLSRC}/uthash LIBADD+= ucl +LDFLAGS+= -Wl,-E + .include From owner-svn-src-all@freebsd.org Fri Aug 14 00:18:18 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E08E73B02E4; Fri, 14 Aug 2020 00:18:18 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BSPDB5cqrz42Mw; Fri, 14 Aug 2020 00:18:18 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A39A425C8B; Fri, 14 Aug 2020 00:18:18 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07E0IITh001195; Fri, 14 Aug 2020 00:18:18 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07E0IIES001194; Fri, 14 Aug 2020 00:18:18 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <202008140018.07E0IIES001194@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Fri, 14 Aug 2020 00:18:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364223 - head/lib/libc/gen X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: head/lib/libc/gen X-SVN-Commit-Revision: 364223 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 14 Aug 2020 00:18:18 -0000 Author: bdrewery Date: Fri Aug 14 00:18:18 2020 New Revision: 364223 URL: https://svnweb.freebsd.org/changeset/base/364223 Log: syslog(3): Send proper NILVALUE if gethostname(3) fails. RFC5424 defines NILVALUE as '-'. Replace its usage with a macro and separate out the fields to be more clear. fputs(3) is used in some places to avoid hiding possible format string problems in a macro. Reviewed by: cem, vangyzen (earlier version) Sponsored by: Dell EMC Modified: head/lib/libc/gen/syslog.c Modified: head/lib/libc/gen/syslog.c ============================================================================== --- head/lib/libc/gen/syslog.c Thu Aug 13 23:13:05 2020 (r364222) +++ head/lib/libc/gen/syslog.c Fri Aug 14 00:18:18 2020 (r364223) @@ -75,6 +75,9 @@ static pthread_mutex_t syslog_mutex = PTHREAD_MUTEX_IN if (__isthreaded) _pthread_mutex_unlock(&syslog_mutex); \ } while(0) +/* RFC5424 defined value. */ +#define NILVALUE "-" + static void disconnectlog(void); /* disconnect from syslogd */ static void connectlog(void); /* (re)connect to syslogd */ static void openlog_unlocked(const char *, int, int); @@ -190,25 +193,30 @@ vsyslog1(int pri, const char *fmt, va_list ap) tm.tm_hour, tm.tm_min, tm.tm_sec, now.tv_usec, tz_sign, tz_offset / 3600, (tz_offset % 3600) / 60); } else - (void)fprintf(fp, "- "); + (void)fputs(NILVALUE " ", fp); /* Hostname. */ (void)gethostname(hostname, sizeof(hostname)); - (void)fprintf(fp, "%s ", hostname); + (void)fprintf(fp, "%s ", + hostname[0] == '\0' ? NILVALUE : hostname); if (LogStat & LOG_PERROR) { /* Transfer to string buffer */ (void)fflush(fp); stdp = tbuf + (sizeof(tbuf) - tbuf_cookie.left); } + /* Application name. */ + if (LogTag == NULL) + LogTag = _getprogname(); + (void)fprintf(fp, "%s ", LogTag == NULL ? NILVALUE : LogTag); /* - * Application name, process ID, message ID and structured data. * Provide the process ID regardless of whether LOG_PID has been * specified, as it provides valuable information. Many * applications tend not to use this, even though they should. */ - if (LogTag == NULL) - LogTag = _getprogname(); - (void)fprintf(fp, "%s %d - - ", - LogTag == NULL ? "-" : LogTag, getpid()); + (void)fprintf(fp, "%d ", getpid()); + /* Message ID. */ + (void)fputs(NILVALUE " ", fp); + /* Structured data. */ + (void)fputs(NILVALUE " ", fp); /* Check to see if we can skip expanding the %m */ if (strstr(fmt, "%m")) { @@ -251,6 +259,7 @@ vsyslog1(int pri, const char *fmt, va_list ap) fmt = fmt_cpy; } + /* Message. */ (void)vfprintf(fp, fmt, ap); (void)fclose(fp); From owner-svn-src-all@freebsd.org Fri Aug 14 00:39:47 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DFD533B08AD; Fri, 14 Aug 2020 00:39:47 +0000 (UTC) (envelope-from gonzo@bluezbox.com) Received: from id.bluezbox.com (id.bluezbox.com [45.55.20.155]) (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 4BSPhx2lvyz43GG; Fri, 14 Aug 2020 00:39:44 +0000 (UTC) (envelope-from gonzo@bluezbox.com) Received: from localhost ([127.0.0.1] helo=id.bluezbox.com) by id.bluezbox.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94 (FreeBSD)) (envelope-from ) id 1k6Nl1-000JLQ-00; Thu, 13 Aug 2020 17:39:43 -0700 Received: (from gonzo@localhost) by id.bluezbox.com (8.15.2/8.15.2/Submit) id 07E0dgmK074363; Thu, 13 Aug 2020 17:39:42 -0700 (PDT) (envelope-from gonzo@bluezbox.com) X-Authentication-Warning: id.bluezbox.com: gonzo set sender to gonzo@bluezbox.com using -f Date: Thu, 13 Aug 2020 17:39:42 -0700 From: Oleksandr Tymoshenko To: Ed Maste Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r364222 - in head: lib/liblua libexec/flua Message-ID: <20200814003942.GA74291@bluezbox.com> References: <202008132313.07DND57i064095@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202008132313.07DND57i064095@repo.freebsd.org> X-Operating-System: FreeBSD/11.2-RELEASE-p10 (amd64) X-Spam-Level: -- X-Spam-Report: Spam detection software, running on the system "id.bluezbox.com", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see The administrator of that system for details. Content preview: Ed Maste (emaste@FreeBSD.org) wrote: > Author: emaste > Date: Thu Aug 13 23:13:05 2020 > New Revision: 364222 > URL: https://svnweb.freebsd.org/changeset/base/364222 > > Log: > flua: support "require" [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Rspamd-Queue-Id: 4BSPhx2lvyz43GG X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of gonzo@bluezbox.com designates 45.55.20.155 as permitted sender) smtp.mailfrom=gonzo@bluezbox.com X-Spamd-Result: default: False [-2.19 / 15.00]; MID_RHS_MATCH_FROM(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.78)[-0.782]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; DMARC_NA(0.00)[bluezbox.com]; R_SPF_ALLOW(-0.20)[+mx]; NEURAL_HAM_LONG(-1.00)[-0.998]; NEURAL_HAM_SHORT(-0.11)[-0.109]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:14061, ipnet:45.55.0.0/19, country:US]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 14 Aug 2020 00:39:48 -0000 Ed Maste (emaste@FreeBSD.org) wrote: > Author: emaste > Date: Thu Aug 13 23:13:05 2020 > New Revision: 364222 > URL: https://svnweb.freebsd.org/changeset/base/364222 > > Log: > flua: support "require" for binary objects in the base system > > Export symbols from flua, and enable dlopen. > > Sponsored by: The FreeBSD Foundation > Differential Revision: https://reviews.freebsd.org/D26059 > > Modified: > head/lib/liblua/luaconf.h > head/libexec/flua/Makefile Hi Ed, This change breaks the build. flua segfaults when it is called during libifconfig build. Backtrace: * thread #1, name = 'flua', stop reason = signal SIGSEGV * frame #0: 0x00000000002e166c flua.full`__je_malloc_tsd_boot0 [inlined] tsd_fetch_impl(init=true, minimal=false) at tsd.h:265:6 frame #1: 0x00000000002e166c flua.full`__je_malloc_tsd_boot0 [inlined] tsd_fetch at tsd.h:292 frame #2: 0x00000000002e166c flua.full`__je_malloc_tsd_boot0 at jemalloc_tsd.c:266 frame #3: 0x00000000002c30d5 flua.full`__malloc [inlined] malloc_init_hard at jemalloc_jemalloc.c:1527:8 frame #4: 0x00000000002c30bd flua.full`__malloc [inlined] malloc_init at jemalloc_jemalloc.c:221 frame #5: 0x00000000002c30bd flua.full`__malloc [inlined] imalloc(sopts=, dopts=) at jemalloc_jemalloc.c:1990 frame #6: 0x00000000002c2d10 flua.full`__malloc(size=1560) at jemalloc_jemalloc.c:2042 frame #7: 0x000000000027e742 flua.full`lua_newstate(f=(flua.full`l_alloc at lauxlib.c:1008), ud=0x0000000000000000) at lstate.c:299:11 frame #8: 0x000000000027e0d2 flua.full`luaL_newstate at lauxlib.c:1027:18 frame #9: 0x000000000026d316 flua.full`main(argc=3, argv=0x00007fffffffc458) at lua.c:598:18 frame #10: 0x000000000026d10f flua.full`_start(ap=, cleanup=) at crt1.c:76:7 Host build system: 12.1-RELEASE-p7 Target: arm64 -- gonzo From owner-svn-src-all@freebsd.org Fri Aug 14 00:55:23 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E15E53B0EDF; Fri, 14 Aug 2020 00:55:23 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BSQ2z5RSvz43td; Fri, 14 Aug 2020 00:55:23 +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 99C582637B; Fri, 14 Aug 2020 00:55:23 +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 07E0tNqW025992; Fri, 14 Aug 2020 00:55:23 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07E0tN0Q025991; Fri, 14 Aug 2020 00:55:23 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202008140055.07E0tN0Q025991@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 14 Aug 2020 00:55:23 +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: r364224 - stable/12/usr.bin/script X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/usr.bin/script X-SVN-Commit-Revision: 364224 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 14 Aug 2020 00:55:23 -0000 Author: markj Date: Fri Aug 14 00:55:23 2020 New Revision: 364224 URL: https://svnweb.freebsd.org/changeset/base/364224 Log: MFC r364039: script: Put the terminal in raw mode when playing back a session. PR: 248377 Modified: stable/12/usr.bin/script/script.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.bin/script/script.c ============================================================================== --- stable/12/usr.bin/script/script.c Fri Aug 14 00:18:18 2020 (r364223) +++ stable/12/usr.bin/script/script.c Fri Aug 14 00:55:23 2020 (r364224) @@ -428,6 +428,33 @@ consume(FILE *fp, off_t len, char *buf, int reg) } while (0/*CONSTCOND*/) static void +termset(void) +{ + struct termios traw; + + if (tcgetattr(STDOUT_FILENO, &tt) == -1) { + if (errno == EBADF) + err(1, "%d not valid fd", STDOUT_FILENO); + /* errno == ENOTTY */ + return; + } + ttyflg = 1; + traw = tt; + cfmakeraw(&traw); + traw.c_lflag |= ISIG; + (void)tcsetattr(STDOUT_FILENO, TCSANOW, &traw); +} + +static void +termreset(void) +{ + if (ttyflg) { + tcsetattr(STDOUT_FILENO, TCSADRAIN, &tt); + ttyflg = 0; + } +} + +static void playback(FILE *fp) { struct timespec tsi, tso; @@ -470,8 +497,11 @@ playback(FILE *fp) ctime(&tclock)); tsi = tso; (void)consume(fp, stamp.scr_len, buf, reg); + termset(); + atexit(termreset); break; case 'e': + termreset(); if (!qflg) (void)printf("\nScript done on %s", ctime(&tclock)); From owner-svn-src-all@freebsd.org Fri Aug 14 00:55:49 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A23FB3B093F; Fri, 14 Aug 2020 00:55:49 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BSQ3T3prqz449v; Fri, 14 Aug 2020 00:55:49 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 675C526380; Fri, 14 Aug 2020 00:55:49 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07E0tnv9026100; Fri, 14 Aug 2020 00:55:49 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07E0tnLv026099; Fri, 14 Aug 2020 00:55:49 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202008140055.07E0tnLv026099@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 14 Aug 2020 00:55: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: r364225 - stable/12/usr.bin/script X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/usr.bin/script X-SVN-Commit-Revision: 364225 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 14 Aug 2020 00:55:49 -0000 Author: markj Date: Fri Aug 14 00:55:48 2020 New Revision: 364225 URL: https://svnweb.freebsd.org/changeset/base/364225 Log: MFC r364112: script: Minor cleanups. PR: 248377 Modified: stable/12/usr.bin/script/script.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.bin/script/script.c ============================================================================== --- stable/12/usr.bin/script/script.c Fri Aug 14 00:55:23 2020 (r364224) +++ stable/12/usr.bin/script/script.c Fri Aug 14 00:55:48 2020 (r364225) @@ -176,16 +176,16 @@ main(int argc, char *argv[]) if (pflg) playback(fscript); - if ((ttyflg = isatty(STDIN_FILENO)) != 0) { - if (tcgetattr(STDIN_FILENO, &tt) == -1) - err(1, "tcgetattr"); - if (ioctl(STDIN_FILENO, TIOCGWINSZ, &win) == -1) - err(1, "ioctl"); - if (openpty(&master, &slave, NULL, &tt, &win) == -1) + if (tcgetattr(STDIN_FILENO, &tt) == -1 || + ioctl(STDIN_FILENO, TIOCGWINSZ, &win) == -1) { + if (errno != ENOTTY) /* For debugger. */ + err(1, "tcgetattr/ioctl"); + if (openpty(&master, &slave, NULL, NULL, NULL) == -1) err(1, "openpty"); } else { - if (openpty(&master, &slave, NULL, NULL, NULL) == -1) + if (openpty(&master, &slave, NULL, &tt, &win) == -1) err(1, "openpty"); + ttyflg = 1; } if (rawout) @@ -433,9 +433,8 @@ termset(void) struct termios traw; if (tcgetattr(STDOUT_FILENO, &tt) == -1) { - if (errno == EBADF) - err(1, "%d not valid fd", STDOUT_FILENO); - /* errno == ENOTTY */ + if (errno != ENOTTY) /* For debugger. */ + err(1, "tcgetattr"); return; } ttyflg = 1; From owner-svn-src-all@freebsd.org Fri Aug 14 02:22:20 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7F9E83B2043; Fri, 14 Aug 2020 02:22:20 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BSRzJ2pnGz475M; Fri, 14 Aug 2020 02:22:20 +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 3FED726CE6; Fri, 14 Aug 2020 02:22:20 +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 07E2MKf6080916; Fri, 14 Aug 2020 02:22:20 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07E2MJu5080914; Fri, 14 Aug 2020 02:22:19 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202008140222.07E2MJu5080914@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 14 Aug 2020 02:22:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364226 - in head: lib/liblua libexec/flua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head: lib/liblua libexec/flua X-SVN-Commit-Revision: 364226 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 14 Aug 2020 02:22:20 -0000 Author: kevans Date: Fri Aug 14 02:22:19 2020 New Revision: 364226 URL: https://svnweb.freebsd.org/changeset/base/364226 Log: flua: don't allow dlopen, et al., for bootstrap flua There are some logistics issues that need to be sorted out here before we can actually allow this to work. Modified: head/lib/liblua/luaconf.h head/libexec/flua/Makefile Modified: head/lib/liblua/luaconf.h ============================================================================== --- head/lib/liblua/luaconf.h Fri Aug 14 00:55:48 2020 (r364225) +++ head/lib/liblua/luaconf.h Fri Aug 14 02:22:19 2020 (r364226) @@ -75,7 +75,9 @@ /* Local modifications: need io.popen */ #ifdef __FreeBSD__ #define LUA_USE_POSIX +#ifndef BOOTSTRAPPING #define LUA_USE_DLOPEN +#endif #endif /* Modified: head/libexec/flua/Makefile ============================================================================== --- head/libexec/flua/Makefile Fri Aug 14 00:55:48 2020 (r364225) +++ head/libexec/flua/Makefile Fri Aug 14 02:22:19 2020 (r364226) @@ -30,6 +30,10 @@ CFLAGS+= -DLUA_PROGNAME="\"${PROG}\"" CFLAGS+= -DLUA_USE_READLINE CFLAGS+= -I${SRCTOP}/lib/libedit -I${SRCTOP}/contrib/libedit LIBADD+= edit +LDFLAGS+= -Wl,-E +.else +# We don't support dynamic libs on bootstrap builds. +CFLAGS+= -DBOOTSTRAPPING .endif UCLSRC?= ${SRCTOP}/contrib/libucl @@ -37,7 +41,5 @@ UCLSRC?= ${SRCTOP}/contrib/libucl SRCS+= lua_ucl.c CFLAGS+= -I${UCLSRC}/include -I${UCLSRC}/src -I${UCLSRC}/uthash LIBADD+= ucl - -LDFLAGS+= -Wl,-E .include From owner-svn-src-all@freebsd.org Fri Aug 14 02:40:18 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C9D483B273B; Fri, 14 Aug 2020 02:40:18 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BSSN250Gjz47rn; Fri, 14 Aug 2020 02:40:18 +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 8A6C827175; Fri, 14 Aug 2020 02:40:18 +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 07E2eIWX087575; Fri, 14 Aug 2020 02:40:18 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07E2eIrt087573; Fri, 14 Aug 2020 02:40:18 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202008140240.07E2eIrt087573@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 14 Aug 2020 02:40:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364227 - in head: lib/liblua libexec/flua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head: lib/liblua libexec/flua X-SVN-Commit-Revision: 364227 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 14 Aug 2020 02:40:18 -0000 Author: kevans Date: Fri Aug 14 02:40:17 2020 New Revision: 364227 URL: https://svnweb.freebsd.org/changeset/base/364227 Log: Properly disable LUA_USE_DLOPEN for bootstrap flua flua does have some specific bits that will include luaconf.h, but the definition of LUA_USE_DLOPEN for those won't matter. This belongs in liblua instead. To expand on my previous commit, which was a little sparse with details, it's not really safe to allow LUA_USE_DLOPEN with host lib paths being used. The host system could have an entirely different lua version and this could cause us to crash and burn. If we want to revive this later, we need to make sure to define c module paths inside OBJDIR that are compiled against whatever version we've bootstrapped. Pointy hat: kevans Modified: head/lib/liblua/Makefile head/libexec/flua/Makefile Modified: head/lib/liblua/Makefile ============================================================================== --- head/lib/liblua/Makefile Fri Aug 14 02:22:19 2020 (r364226) +++ head/lib/liblua/Makefile Fri Aug 14 02:40:17 2020 (r364227) @@ -29,6 +29,8 @@ CFLAGS+= -DLUA_PROGNAME="\"${PROG}\"" .if defined(BOOTSTRAPPING) CFLAGS+= -DLUA_PATH_DEFAULT="\"/nonexistent/?.lua\"" CFLAGS+= -DLUA_CPATH_DEFAULT="\"/nonexistent/?.so\"" +# We don't support dynamic libs on bootstrap builds. +CFLAGS+= -DBOOTSTRAPPING .endif .include Modified: head/libexec/flua/Makefile ============================================================================== --- head/libexec/flua/Makefile Fri Aug 14 02:22:19 2020 (r364226) +++ head/libexec/flua/Makefile Fri Aug 14 02:40:17 2020 (r364227) @@ -31,9 +31,6 @@ CFLAGS+= -DLUA_USE_READLINE CFLAGS+= -I${SRCTOP}/lib/libedit -I${SRCTOP}/contrib/libedit LIBADD+= edit LDFLAGS+= -Wl,-E -.else -# We don't support dynamic libs on bootstrap builds. -CFLAGS+= -DBOOTSTRAPPING .endif UCLSRC?= ${SRCTOP}/contrib/libucl From owner-svn-src-all@freebsd.org Fri Aug 14 02:50:39 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9AE2F3B29AB; Fri, 14 Aug 2020 02:50:39 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-il1-f172.google.com (mail-il1-f172.google.com [209.85.166.172]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BSSby41JCz48G3; Fri, 14 Aug 2020 02:50:38 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-il1-f172.google.com with SMTP id t13so7269466ile.9; Thu, 13 Aug 2020 19:50:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=8T/uyZqcWWKQZikWoB3h9L9kTno4WFfOFY5OICuibmM=; b=U8syrZlKAAoWaaUvD9EPvre8MJHTec7p1Is/mbmVhW7o0xzzwf8GvUwOsDJnKuxb8t dUt1hvvJVjCi4fJK+Mq28j1tXRhjr1iisAhTgblZaAh/8X1nitV2TqqarhlqLUDWTE8p AHBXXLGYwO6lq4pqS1H2wJUWZ+IvbWQusgAocZ/X29ZErfdBmU/P+wW8vvIpuc7iX52J AeVWnOYPx6hZRO05QykZ0dRT7baWcZ0HEVLpn7MOG6V9dIGSs7zvq8ydjC9XpvCTUoTE BuYvuQqrXor5/3vDAwnx9CZIT89zRLY+plm5NKUwO4Rjbir4JfjFXg7DZdaV1QO6gr/C 9ZrQ== X-Gm-Message-State: AOAM533/l5rwxkNtu0s6UGOZgqCmtq5GusknAFB0fhgYyIiUPrQk3d0Q 4pS4NC40sPgpGzVAlX+4TJzmcyoWwypghzar78fqrWtj X-Google-Smtp-Source: ABdhPJxlR8URQNCwzrwpdAwAUkIUK6NY2Z2jj/EUCUI6lzQeu1OrlZ189TVflVZoXB8K1mg8uYhJ4sAZ94LdbrU4FWs= X-Received: by 2002:a92:c84f:: with SMTP id b15mr800527ilq.100.1597373437498; Thu, 13 Aug 2020 19:50:37 -0700 (PDT) MIME-Version: 1.0 References: <202008132313.07DND57i064095@repo.freebsd.org> <20200814003942.GA74291@bluezbox.com> In-Reply-To: <20200814003942.GA74291@bluezbox.com> From: Ed Maste Date: Thu, 13 Aug 2020 22:50:25 -0400 Message-ID: Subject: Re: svn commit: r364222 - in head: lib/liblua libexec/flua To: Oleksandr Tymoshenko Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4BSSby41JCz48G3 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of carpeddiem@gmail.com designates 209.85.166.172 as permitted sender) smtp.mailfrom=carpeddiem@gmail.com X-Spamd-Result: default: False [-1.03 / 15.00]; ARC_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; NEURAL_HAM_MEDIUM(-0.54)[-0.545]; 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(-0.81)[-0.806]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.org]; NEURAL_SPAM_SHORT(0.32)[0.324]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[209.85.166.172:from]; FORGED_SENDER(0.30)[emaste@freebsd.org,carpeddiem@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.166.172:from]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; FROM_NEQ_ENVFROM(0.00)[emaste@freebsd.org,carpeddiem@gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 14 Aug 2020 02:50:39 -0000 On Thu, 13 Aug 2020 at 20:39, Oleksandr Tymoshenko wrote: > > Hi Ed, > > This change breaks the build. flua segfaults when it is called during > libifconfig build. Sorry about that - thanks for the report, and thanks to kevans for the fix. From owner-svn-src-all@freebsd.org Fri Aug 14 06:41:59 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CD4883B65D4; Fri, 14 Aug 2020 06:41:59 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BSYkv50k5z4K2G; Fri, 14 Aug 2020 06:41:59 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 906F2A244; Fri, 14 Aug 2020 06:41:59 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07E6fxVB043982; Fri, 14 Aug 2020 06:41:59 GMT (envelope-from gbe@FreeBSD.org) Received: (from gbe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07E6fxMw043981; Fri, 14 Aug 2020 06:41:59 GMT (envelope-from gbe@FreeBSD.org) Message-Id: <202008140641.07E6fxMw043981@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gbe set sender to gbe@FreeBSD.org using -f From: Gordon Bergling Date: Fri, 14 Aug 2020 06:41: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: r364228 - stable/12/contrib/telnet/telnet X-SVN-Group: stable-12 X-SVN-Commit-Author: gbe X-SVN-Commit-Paths: stable/12/contrib/telnet/telnet X-SVN-Commit-Revision: 364228 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 14 Aug 2020 06:41:59 -0000 Author: gbe (doc committer) Date: Fri Aug 14 06:41:59 2020 New Revision: 364228 URL: https://svnweb.freebsd.org/changeset/base/364228 Log: MFC r364005: telnet(1): Document -P option PR: 248157 Submitted by: Juraj Lutter Reviewed by: bcr Approved by: bcr Obtained from: NetBSD Differential Revision: https://reviews.freebsd.org/D25794 Modified: stable/12/contrib/telnet/telnet/telnet.1 Directory Properties: stable/12/ (props changed) Modified: stable/12/contrib/telnet/telnet/telnet.1 ============================================================================== --- stable/12/contrib/telnet/telnet/telnet.1 Fri Aug 14 02:40:17 2020 (r364227) +++ stable/12/contrib/telnet/telnet/telnet.1 Fri Aug 14 06:41:59 2020 (r364228) @@ -28,7 +28,7 @@ .\" @(#)telnet.1 8.6 (Berkeley) 6/1/94 .\" $FreeBSD$ .\" -.Dd September 18, 2006 +.Dd August 7, 2020 .Dt TELNET 1 .Os .Sh NAME @@ -47,6 +47,7 @@ protocol .Op Fl l Ar user .Op Fl n Ar tracefile .Op Fl s Ar src_addr +.Op Fl P Ar policy .Oo .Ar host .Op Ar port @@ -189,6 +190,13 @@ for recording trace information. See the .Ic set tracefile command below. +.It Fl P Ar policy +Use IPsec policy specification string +.Ar policy , +for the connections. +See +.Xr ipsec_set_policy 3 +for details. .It Fl r Specifies a user interface similar to .Xr rlogin 1 . From owner-svn-src-all@freebsd.org Fri Aug 14 06:44:35 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 31F313B6675; Fri, 14 Aug 2020 06:44:35 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BSYnv0YKCz4Kdb; Fri, 14 Aug 2020 06:44:35 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EA10DA515; Fri, 14 Aug 2020 06:44:34 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07E6iY1D046517; Fri, 14 Aug 2020 06:44:34 GMT (envelope-from gbe@FreeBSD.org) Received: (from gbe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07E6iYRn046516; Fri, 14 Aug 2020 06:44:34 GMT (envelope-from gbe@FreeBSD.org) Message-Id: <202008140644.07E6iYRn046516@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gbe set sender to gbe@FreeBSD.org using -f From: Gordon Bergling Date: Fri, 14 Aug 2020 06:44: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: r364229 - stable/12/lib/libc/locale X-SVN-Group: stable-12 X-SVN-Commit-Author: gbe X-SVN-Commit-Paths: stable/12/lib/libc/locale X-SVN-Commit-Revision: 364229 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 14 Aug 2020 06:44:35 -0000 Author: gbe (doc committer) Date: Fri Aug 14 06:44:34 2020 New Revision: 364229 URL: https://svnweb.freebsd.org/changeset/base/364229 Log: MFC r364031: mbsrtowcs(3): Clarify the RETURN VALUES section PR: 215848 Submitted by: Andrew Stevenson Modified: stable/12/lib/libc/locale/mbsrtowcs.3 Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libc/locale/mbsrtowcs.3 ============================================================================== --- stable/12/lib/libc/locale/mbsrtowcs.3 Fri Aug 14 06:41:59 2020 (r364228) +++ stable/12/lib/libc/locale/mbsrtowcs.3 Fri Aug 14 06:44:34 2020 (r364229) @@ -23,7 +23,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd July 21, 2004 +.Dd August 7, 2020 .Dt MBSRTOWCS 3 .Os .Sh NAME @@ -98,15 +98,29 @@ except that conversion stops after reading at most bytes from the buffer pointed to by .Fa src . .Sh RETURN VALUES -The +If successful, and +.Fa dst +is not NULL, the .Fn mbsrtowcs and .Fn mbsnrtowcs functions return the number of wide characters stored in the array pointed to by +.Fa dst . +.Pp +If .Fa dst -if successful, otherwise it returns -.Po Vt size_t Pc Ns \-1 . +was NULL then the functions +.Fn mbsrtowcs +and +.Fn mbsnrtowcs +return the number of wide characters that would have been stored where +.Fa dst +points to an infinitely large array. +.Pp +If either one of the functions is not successful then +.Po Vt size_t Pc Ns \-1 +is returned. .Sh ERRORS The .Fn mbsrtowcs From owner-svn-src-all@freebsd.org Fri Aug 14 06:46:40 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CF57A3B697B; Fri, 14 Aug 2020 06:46:40 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BSYrJ582bz4Kfg; Fri, 14 Aug 2020 06:46:40 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 93074A4BD; Fri, 14 Aug 2020 06:46:40 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07E6kejm046683; Fri, 14 Aug 2020 06:46:40 GMT (envelope-from gbe@FreeBSD.org) Received: (from gbe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07E6keOu046682; Fri, 14 Aug 2020 06:46:40 GMT (envelope-from gbe@FreeBSD.org) Message-Id: <202008140646.07E6keOu046682@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gbe set sender to gbe@FreeBSD.org using -f From: Gordon Bergling Date: Fri, 14 Aug 2020 06:46: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: r364230 - stable/12/lib/libc/locale X-SVN-Group: stable-12 X-SVN-Commit-Author: gbe X-SVN-Commit-Paths: stable/12/lib/libc/locale X-SVN-Commit-Revision: 364230 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 14 Aug 2020 06:46:40 -0000 Author: gbe (doc committer) Date: Fri Aug 14 06:46:40 2020 New Revision: 364230 URL: https://svnweb.freebsd.org/changeset/base/364230 Log: MFC r364032: setlocale(3): Add an EXAMPLES section and add LANG category PR: 41824 Submitted by: Slaven Rezic Obtained from: NetBSD Modified: stable/12/lib/libc/locale/setlocale.3 Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libc/locale/setlocale.3 ============================================================================== --- stable/12/lib/libc/locale/setlocale.3 Fri Aug 14 06:44:34 2020 (r364229) +++ stable/12/lib/libc/locale/setlocale.3 Fri Aug 14 06:46:40 2020 (r364230) @@ -31,7 +31,7 @@ .\" @(#)setlocale.3 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd September 9, 2019 +.Dd August 7, 2020 .Dt SETLOCALE 3 .Os .Sh NAME @@ -98,6 +98,10 @@ as well as values returned by Set a locale for formatting dates and times using the .Fn strftime function. +.It Dv LANG +Sets the generic locale category for native language, local customs +and coded character set in the absence of more specific locale +variables. .El .Pp Only three locales are defined by default, @@ -153,6 +157,25 @@ if the given combination of and .Fa locale makes no sense. +.Sh EXAMPLES +The following code illustrates how a program can initialize the +international environment for one language, while selectively +modifying the program's locale such that regular expressions and +string operations can be applied to text recorded in a different +language: +.Bd -literal + setlocale(LC_ALL, "de"); + setlocale(LC_COLLATE, "fr"); +.Ed +.Pp +When a process is started, its current locale is set to the C or POSIX +locale. +An internationalized program that depends on locale data not defined in +the C or POSIX locale must invoke the setlocale subroutine in the +following manner before using any of the locale-specific information: +.Bd -literal + setlocale(LC_ALL, ""); +.Ed .Sh FILES .Bl -tag -width /usr/share/locale/locale/category -compact .It Pa $PATH_LOCALE/ Ns Em locale/category From owner-svn-src-all@freebsd.org Fri Aug 14 06:48:30 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6C1443B6D07; Fri, 14 Aug 2020 06:48:30 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BSYtQ2DSYz4L4p; Fri, 14 Aug 2020 06:48:30 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2B28AA254; Fri, 14 Aug 2020 06:48:30 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07E6mUGj046836; Fri, 14 Aug 2020 06:48:30 GMT (envelope-from gbe@FreeBSD.org) Received: (from gbe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07E6mU3H046835; Fri, 14 Aug 2020 06:48:30 GMT (envelope-from gbe@FreeBSD.org) Message-Id: <202008140648.07E6mU3H046835@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gbe set sender to gbe@FreeBSD.org using -f From: Gordon Bergling Date: Fri, 14 Aug 2020 06:48: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: r364231 - stable/12/lib/libc/stdio X-SVN-Group: stable-12 X-SVN-Commit-Author: gbe X-SVN-Commit-Paths: stable/12/lib/libc/stdio X-SVN-Commit-Revision: 364231 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 14 Aug 2020 06:48:30 -0000 Author: gbe (doc committer) Date: Fri Aug 14 06:48:29 2020 New Revision: 364231 URL: https://svnweb.freebsd.org/changeset/base/364231 Log: MFC r364029: tmpnam(3): Also mention tmpfile in the ENVIRONMENT section PR: 181785 Submitted by: Kevin P. Neal Modified: stable/12/lib/libc/stdio/tmpnam.3 Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libc/stdio/tmpnam.3 ============================================================================== --- stable/12/lib/libc/stdio/tmpnam.3 Fri Aug 14 06:46:40 2020 (r364230) +++ stable/12/lib/libc/stdio/tmpnam.3 Fri Aug 14 06:48:29 2020 (r364231) @@ -32,7 +32,7 @@ .\" @(#)tmpnam.3 8.2 (Berkeley) 11/17/93 .\" $FreeBSD$ .\" -.Dd March 18, 2007 +.Dd August 7, 2020 .Dt TMPFILE 3 .Os .Sh NAME @@ -156,6 +156,8 @@ on error. .Bl -tag -width Ds .It Ev TMPDIR .Pf [ Fn tempnam +and +.Fn tmpfile only] If set, the directory in which the temporary file is stored. From owner-svn-src-all@freebsd.org Fri Aug 14 08:48:19 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2B0B23B97D5; Fri, 14 Aug 2020 08:48:19 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BScXg0Ml8z4RXC; Fri, 14 Aug 2020 08:48:19 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C6ECEB767; Fri, 14 Aug 2020 08:48:18 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07E8mIkf020805; Fri, 14 Aug 2020 08:48:18 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07E8mIHl020803; Fri, 14 Aug 2020 08:48:18 GMT (envelope-from manu@FreeBSD.org) Message-Id: <202008140848.07E8mIHl020803@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Fri, 14 Aug 2020 08:48:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364232 - in head/sys/compat/linuxkpi/common: include/linux src X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: in head/sys/compat/linuxkpi/common: include/linux src X-SVN-Commit-Revision: 364232 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 14 Aug 2020 08:48:19 -0000 Author: manu Date: Fri Aug 14 08:48:17 2020 New Revision: 364232 URL: https://svnweb.freebsd.org/changeset/base/364232 Log: linuxkpi: Add a few wait_bit functions The linux function does a lot more than that as multiple waitqueue could be fetch from a static table based on the hash of the argument but since in DRM it's only used in one place just add a single variable. We will probably need to change that in the futur but it's ok with DRM even with current linux. Reviewed by: hselasky MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D26054 Added: head/sys/compat/linuxkpi/common/include/linux/wait_bit.h (contents, props changed) Modified: head/sys/compat/linuxkpi/common/include/linux/wait.h head/sys/compat/linuxkpi/common/src/linux_compat.c Modified: head/sys/compat/linuxkpi/common/include/linux/wait.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/wait.h Fri Aug 14 06:48:29 2020 (r364231) +++ head/sys/compat/linuxkpi/common/include/linux/wait.h Fri Aug 14 08:48:17 2020 (r364232) @@ -36,6 +36,7 @@ #include #include #include +#include #include Added: head/sys/compat/linuxkpi/common/include/linux/wait_bit.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/compat/linuxkpi/common/include/linux/wait_bit.h Fri Aug 14 08:48:17 2020 (r364232) @@ -0,0 +1,64 @@ +/*- + * Copyright (c) 2020 The FreeBSD Foundation + * + * This software was developed by Emmanuel Vadot under sponsorship + * from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __LINUX_WAITBIT_H__ +#define __LINUX_WAITBIT_H__ + +#include +#include + +extern wait_queue_head_t linux_bit_waitq; +extern wait_queue_head_t linux_var_waitq; + +#define wait_var_event_killable(var, cond) \ + wait_event_killable(linux_var_waitq, cond) + +static inline void +clear_and_wake_up_bit(int bit, void *word) +{ + clear_bit_unlock(bit, word); + wake_up_bit(word, bit); +} + +static inline wait_queue_head_t * +bit_waitqueue(void *word, int bit) +{ + + return (&linux_bit_waitq); +} + +static inline void +wake_up_var(void *var) +{ + + wake_up(&linux_var_waitq); +} + +#endif /* __LINUX_WAITBIT_H__ */ Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_compat.c Fri Aug 14 06:48:29 2020 (r364231) +++ head/sys/compat/linuxkpi/common/src/linux_compat.c Fri Aug 14 08:48:17 2020 (r364232) @@ -86,6 +86,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #if defined(__i386__) || defined(__amd64__) #include @@ -119,6 +120,9 @@ spinlock_t pci_lock; unsigned long linux_timer_hz_mask; +wait_queue_head_t linux_bit_waitq; +wait_queue_head_t linux_var_waitq; + int panic_cmp(struct rb_node *one, struct rb_node *two) { @@ -2523,6 +2527,8 @@ linux_compat_init(void *arg) mtx_init(&vmmaplock, "IO Map lock", NULL, MTX_DEF); for (i = 0; i < VMMAP_HASH_SIZE; i++) LIST_INIT(&vmmaphead[i]); + init_waitqueue_head(&linux_bit_waitq); + init_waitqueue_head(&linux_var_waitq); } SYSINIT(linux_compat, SI_SUB_DRIVERS, SI_ORDER_SECOND, linux_compat_init, NULL); From owner-svn-src-all@freebsd.org Fri Aug 14 08:49:40 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E43163B961D; Fri, 14 Aug 2020 08:49:40 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BScZD5mv0z4RsM; Fri, 14 Aug 2020 08:49:40 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AAE15B768; Fri, 14 Aug 2020 08:49:40 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07E8neR2020913; Fri, 14 Aug 2020 08:49:40 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07E8nehZ020912; Fri, 14 Aug 2020 08:49:40 GMT (envelope-from manu@FreeBSD.org) Message-Id: <202008140849.07E8nehZ020912@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Fri, 14 Aug 2020 08:49:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364233 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 364233 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 14 Aug 2020 08:49:41 -0000 Author: manu Date: Fri Aug 14 08:49:40 2020 New Revision: 364233 URL: https://svnweb.freebsd.org/changeset/base/364233 Log: Bump __FreeBSD_version after r364232 We now have everything needed for DRM from Linux v5.4, let the ports tree know that. Modified: head/sys/sys/param.h Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Fri Aug 14 08:48:17 2020 (r364232) +++ head/sys/sys/param.h Fri Aug 14 08:49:40 2020 (r364233) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300107 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300108 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-all@freebsd.org Fri Aug 14 09:45:42 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A209B3BB4A4; Fri, 14 Aug 2020 09:45:42 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BSdpt3pb8z4WRY; Fri, 14 Aug 2020 09:45:42 +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 61E42C469; Fri, 14 Aug 2020 09:45:42 +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 07E9jgeG057654; Fri, 14 Aug 2020 09:45:42 GMT (envelope-from arichardson@FreeBSD.org) Received: (from arichardson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07E9jfCj057652; Fri, 14 Aug 2020 09:45:41 GMT (envelope-from arichardson@FreeBSD.org) Message-Id: <202008140945.07E9jfCj057652@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arichardson set sender to arichardson@FreeBSD.org using -f From: Alex Richardson Date: Fri, 14 Aug 2020 09:45:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364234 - in head: tools/build usr.sbin/crunch/crunchgen X-SVN-Group: head X-SVN-Commit-Author: arichardson X-SVN-Commit-Paths: in head: tools/build usr.sbin/crunch/crunchgen X-SVN-Commit-Revision: 364234 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 14 Aug 2020 09:45:42 -0000 Author: arichardson Date: Fri Aug 14 09:45:41 2020 New Revision: 364234 URL: https://svnweb.freebsd.org/changeset/base/364234 Log: crunchgen: use pwd -P without env The -P flag is required by POSIX so we don't have to care whether pwd is a shell builtin or not. This also allows removing pwd from the list of bootstrap tools since all shells we care about for building have a builtin pwd command. This effectively reverts r364190. Suggested By: rgrimes, jrtc27 Modified: head/tools/build/Makefile head/usr.sbin/crunch/crunchgen/crunchgen.c Modified: head/tools/build/Makefile ============================================================================== --- head/tools/build/Makefile Fri Aug 14 08:49:40 2020 (r364233) +++ head/tools/build/Makefile Fri Aug 14 09:45:41 2020 (r364234) @@ -113,7 +113,7 @@ SYSINCS+= ${SRCTOP}/sys/sys/font.h # Linux/MacOS since we only use flags that are supported by all of them. _host_tools_to_symlink= basename bzip2 bunzip2 chmod chown cmp comm cp date dd \ dirname echo env false find fmt gzip gunzip head hostname id ln ls \ - mkdir mv nice patch pwd rm realpath sh sleep stat tee touch tr true \ + mkdir mv nice patch rm realpath sh sleep stat tee touch tr true \ uname uniq wc which # We also need a symlink to the absolute path to the make binary used for Modified: head/usr.sbin/crunch/crunchgen/crunchgen.c ============================================================================== --- head/usr.sbin/crunch/crunchgen/crunchgen.c Fri Aug 14 08:49:40 2020 (r364233) +++ head/usr.sbin/crunch/crunchgen/crunchgen.c Fri Aug 14 09:45:41 2020 (r364234) @@ -653,7 +653,7 @@ fillin_program(prog_t *p) /* Determine the actual srcdir (maybe symlinked). */ if (p->srcdir) { - snprintf(line, MAXLINELEN, "cd %s && env pwd -P", p->srcdir); + snprintf(line, MAXLINELEN, "cd %s && pwd -P", p->srcdir); f = popen(line,"r"); if (!f) errx(1, "Can't execute: %s\n", line); From owner-svn-src-all@freebsd.org Fri Aug 14 14:50:42 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C1EF43C1A89; Fri, 14 Aug 2020 14:50:42 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BSmZp4qScz3Xrt; Fri, 14 Aug 2020 14:50: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 89050FBBC; Fri, 14 Aug 2020 14:50: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 07EEog5b044239; Fri, 14 Aug 2020 14:50:42 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07EEogD7044237; Fri, 14 Aug 2020 14:50:42 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202008141450.07EEogD7044237@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 14 Aug 2020 14:50:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364235 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 364235 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 14 Aug 2020 14:50:42 -0000 Author: markj Date: Fri Aug 14 14:50:41 2020 New Revision: 364235 URL: https://svnweb.freebsd.org/changeset/base/364235 Log: Rename the pipe_map field of struct pipe. This is to avoid conflicts with a upcoming macro. pipe_pages is a more accurate name since the field tracks pages wired into the kernel as part of a process-to-process copy operation. Reviewed by: alc, kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/sys_pipe.c head/sys/sys/pipe.h Modified: head/sys/kern/sys_pipe.c ============================================================================== --- head/sys/kern/sys_pipe.c Fri Aug 14 09:45:41 2020 (r364234) +++ head/sys/kern/sys_pipe.c Fri Aug 14 14:50:41 2020 (r364235) @@ -749,19 +749,19 @@ pipe_read(struct file *fp, struct uio *uio, struct ucr /* * Direct copy, bypassing a kernel buffer. */ - } else if ((size = rpipe->pipe_map.cnt) != 0) { + } else if ((size = rpipe->pipe_pages.cnt) != 0) { if (size > uio->uio_resid) size = (u_int) uio->uio_resid; PIPE_UNLOCK(rpipe); - error = uiomove_fromphys(rpipe->pipe_map.ms, - rpipe->pipe_map.pos, size, uio); + error = uiomove_fromphys(rpipe->pipe_pages.ms, + rpipe->pipe_pages.pos, size, uio); PIPE_LOCK(rpipe); if (error) break; nread += size; - rpipe->pipe_map.pos += size; - rpipe->pipe_map.cnt -= size; - if (rpipe->pipe_map.cnt == 0) { + rpipe->pipe_pages.pos += size; + rpipe->pipe_pages.cnt -= size; + if (rpipe->pipe_pages.cnt == 0) { rpipe->pipe_state &= ~PIPE_WANTW; wakeup(rpipe); } @@ -865,7 +865,7 @@ pipe_build_write_buffer(struct pipe *wpipe, struct uio PIPE_LOCK_ASSERT(wpipe, MA_OWNED); KASSERT((wpipe->pipe_state & PIPE_DIRECTW) == 0, ("%s: PIPE_DIRECTW set on %p", __func__, wpipe)); - KASSERT(wpipe->pipe_map.cnt == 0, + KASSERT(wpipe->pipe_pages.cnt == 0, ("%s: pipe map for %p contains residual data", __func__, wpipe)); if (uio->uio_iov->iov_len > wpipe->pipe_buffer.size) @@ -877,17 +877,17 @@ pipe_build_write_buffer(struct pipe *wpipe, struct uio PIPE_UNLOCK(wpipe); i = vm_fault_quick_hold_pages(&curproc->p_vmspace->vm_map, (vm_offset_t)uio->uio_iov->iov_base, size, VM_PROT_READ, - wpipe->pipe_map.ms, PIPENPAGES); + wpipe->pipe_pages.ms, PIPENPAGES); PIPE_LOCK(wpipe); if (i < 0) { wpipe->pipe_state &= ~PIPE_DIRECTW; return (EFAULT); } - wpipe->pipe_map.npages = i; - wpipe->pipe_map.pos = + wpipe->pipe_pages.npages = i; + wpipe->pipe_pages.pos = ((vm_offset_t) uio->uio_iov->iov_base) & PAGE_MASK; - wpipe->pipe_map.cnt = size; + wpipe->pipe_pages.cnt = size; uio->uio_iov->iov_len -= size; uio->uio_iov->iov_base = (char *)uio->uio_iov->iov_base + size; @@ -908,12 +908,12 @@ pipe_destroy_write_buffer(struct pipe *wpipe) PIPE_LOCK_ASSERT(wpipe, MA_OWNED); KASSERT((wpipe->pipe_state & PIPE_DIRECTW) != 0, ("%s: PIPE_DIRECTW not set on %p", __func__, wpipe)); - KASSERT(wpipe->pipe_map.cnt == 0, + KASSERT(wpipe->pipe_pages.cnt == 0, ("%s: pipe map for %p contains residual data", __func__, wpipe)); wpipe->pipe_state &= ~PIPE_DIRECTW; - vm_page_unhold_pages(wpipe->pipe_map.ms, wpipe->pipe_map.npages); - wpipe->pipe_map.npages = 0; + vm_page_unhold_pages(wpipe->pipe_pages.ms, wpipe->pipe_pages.npages); + wpipe->pipe_pages.npages = 0; } /* @@ -933,9 +933,9 @@ pipe_clone_write_buffer(struct pipe *wpipe) KASSERT((wpipe->pipe_state & PIPE_DIRECTW) != 0, ("%s: PIPE_DIRECTW not set on %p", __func__, wpipe)); - size = wpipe->pipe_map.cnt; - pos = wpipe->pipe_map.pos; - wpipe->pipe_map.cnt = 0; + size = wpipe->pipe_pages.cnt; + pos = wpipe->pipe_pages.pos; + wpipe->pipe_pages.cnt = 0; wpipe->pipe_buffer.in = size; wpipe->pipe_buffer.out = 0; @@ -951,7 +951,7 @@ pipe_clone_write_buffer(struct pipe *wpipe) uio.uio_segflg = UIO_SYSSPACE; uio.uio_rw = UIO_READ; uio.uio_td = curthread; - uiomove_fromphys(wpipe->pipe_map.ms, pos, size, &uio); + uiomove_fromphys(wpipe->pipe_pages.ms, pos, size, &uio); PIPE_LOCK(wpipe); pipe_destroy_write_buffer(wpipe); } @@ -1015,7 +1015,7 @@ retry: goto error1; } - while (wpipe->pipe_map.cnt != 0 && + while (wpipe->pipe_pages.cnt != 0 && (wpipe->pipe_state & PIPE_EOF) == 0) { if (wpipe->pipe_state & PIPE_WANTR) { wpipe->pipe_state &= ~PIPE_WANTR; @@ -1032,7 +1032,7 @@ retry: } if ((wpipe->pipe_state & PIPE_EOF) != 0) { - wpipe->pipe_map.cnt = 0; + wpipe->pipe_pages.cnt = 0; pipe_destroy_write_buffer(wpipe); pipeselwakeup(wpipe); error = EPIPE; @@ -1157,7 +1157,7 @@ pipe_write(struct file *fp, struct uio *uio, struct uc * pipe buffer. We break out if a signal occurs or the * reader goes away. */ - if (wpipe->pipe_map.cnt != 0) { + if (wpipe->pipe_pages.cnt != 0) { if (wpipe->pipe_state & PIPE_WANTR) { wpipe->pipe_state &= ~PIPE_WANTR; wakeup(wpipe); @@ -1375,8 +1375,8 @@ pipe_ioctl(struct file *fp, u_long cmd, void *data, st PIPE_UNLOCK(mpipe); return (0); } - if (mpipe->pipe_map.cnt != 0) - *(int *)data = mpipe->pipe_map.cnt; + if (mpipe->pipe_pages.cnt != 0) + *(int *)data = mpipe->pipe_pages.cnt; else *(int *)data = mpipe->pipe_buffer.cnt; break; @@ -1431,7 +1431,7 @@ pipe_poll(struct file *fp, int events, struct ucred *a goto locked_error; #endif if (fp->f_flag & FREAD && events & (POLLIN | POLLRDNORM)) - if (rpipe->pipe_map.cnt > 0 || rpipe->pipe_buffer.cnt > 0) + if (rpipe->pipe_pages.cnt > 0 || rpipe->pipe_buffer.cnt > 0) revents |= events & (POLLIN | POLLRDNORM); if (fp->f_flag & FWRITE && events & (POLLOUT | POLLWRNORM)) @@ -1513,8 +1513,8 @@ pipe_stat(struct file *fp, struct stat *ub, struct ucr bzero(ub, sizeof(*ub)); ub->st_mode = S_IFIFO; ub->st_blksize = PAGE_SIZE; - if (pipe->pipe_map.cnt != 0) - ub->st_size = pipe->pipe_map.cnt; + if (pipe->pipe_pages.cnt != 0) + ub->st_size = pipe->pipe_pages.cnt; else ub->st_size = pipe->pipe_buffer.cnt; ub->st_blocks = howmany(ub->st_size, ub->st_blksize); @@ -1604,9 +1604,9 @@ pipe_free_kmem(struct pipe *cpipe) } #ifndef PIPE_NODIRECT { - cpipe->pipe_map.cnt = 0; - cpipe->pipe_map.pos = 0; - cpipe->pipe_map.npages = 0; + cpipe->pipe_pages.cnt = 0; + cpipe->pipe_pages.pos = 0; + cpipe->pipe_pages.npages = 0; } #endif } @@ -1752,7 +1752,7 @@ filt_piperead(struct knote *kn, long hint) PIPE_LOCK_ASSERT(rpipe, MA_OWNED); kn->kn_data = rpipe->pipe_buffer.cnt; if (kn->kn_data == 0) - kn->kn_data = rpipe->pipe_map.cnt; + kn->kn_data = rpipe->pipe_pages.cnt; if ((rpipe->pipe_state & PIPE_EOF) != 0 && ((rpipe->pipe_state & PIPE_NAMED) == 0 || Modified: head/sys/sys/pipe.h ============================================================================== --- head/sys/sys/pipe.h Fri Aug 14 09:45:41 2020 (r364234) +++ head/sys/sys/pipe.h Fri Aug 14 14:50:41 2020 (r364235) @@ -103,7 +103,7 @@ struct pipemapping { */ struct pipe { struct pipebuf pipe_buffer; /* data storage */ - struct pipemapping pipe_map; /* pipe mapping for direct I/O */ + struct pipemapping pipe_pages; /* wired pages for direct I/O */ struct selinfo pipe_sel; /* for compat with select */ struct timespec pipe_atime; /* time of last access */ struct timespec pipe_mtime; /* time of last modify */ From owner-svn-src-all@freebsd.org Fri Aug 14 16:44:11 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3C1A33C38BF; Fri, 14 Aug 2020 16:44:11 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BSq5l0d9Xz3f5H; Fri, 14 Aug 2020 16:44:11 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ED38B10D5C; Fri, 14 Aug 2020 16:44:10 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07EGiAXY016395; Fri, 14 Aug 2020 16:44:10 GMT (envelope-from rgrimes@FreeBSD.org) Received: (from rgrimes@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07EGiAEu016394; Fri, 14 Aug 2020 16:44:10 GMT (envelope-from rgrimes@FreeBSD.org) Message-Id: <202008141644.07EGiAEu016394@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rgrimes set sender to rgrimes@FreeBSD.org using -f From: "Rodney W. Grimes" Date: Fri, 14 Aug 2020 16:44:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org Subject: svn commit: r364236 - svnadmin/conf X-SVN-Group: svnadmin X-SVN-Commit-Author: rgrimes X-SVN-Commit-Paths: svnadmin/conf X-SVN-Commit-Revision: 364236 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 14 Aug 2020 16:44:11 -0000 Author: rgrimes Date: Fri Aug 14 16:44:10 2020 New Revision: 364236 URL: https://svnweb.freebsd.org/changeset/base/364236 Log: Release rscheff from mentorship. Modified: svnadmin/conf/mentors Modified: svnadmin/conf/mentors ============================================================================== --- svnadmin/conf/mentors Fri Aug 14 14:50:41 2020 (r364235) +++ svnadmin/conf/mentors Fri Aug 14 16:44:10 2020 (r364236) @@ -22,7 +22,6 @@ mjoras rstone nick philip Co-mentor: kp ram ken Co-mentor: mav rew kevans Co-mentor: allanjude -rscheff tuexen Co-mentor: rgrimes scottph scottl Co-mentor: emaste, jhb thj jtl Co-mentor: bz wosch cem From owner-svn-src-all@freebsd.org Fri Aug 14 18:48:48 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D3A323C613A; Fri, 14 Aug 2020 18:48:48 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BSssX5Bklz42bm; Fri, 14 Aug 2020 18:48:48 +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 95A7012A2C; Fri, 14 Aug 2020 18:48:48 +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 07EImmjM090651; Fri, 14 Aug 2020 18:48:48 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07EImmH5090650; Fri, 14 Aug 2020 18:48:48 GMT (envelope-from cem@FreeBSD.org) Message-Id: <202008141848.07EImmH5090650@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Fri, 14 Aug 2020 18:48:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364237 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 364237 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 14 Aug 2020 18:48:48 -0000 Author: cem Date: Fri Aug 14 18:48:48 2020 New Revision: 364237 URL: https://svnweb.freebsd.org/changeset/base/364237 Log: vm_pageout: Correct threshold calculation on single-CPU systems Reported by: Michael Butler X-MFC-With: r364129 Modified: head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Fri Aug 14 16:44:10 2020 (r364236) +++ head/sys/vm/vm_pageout.c Fri Aug 14 18:48:48 2020 (r364237) @@ -2216,7 +2216,7 @@ get_pageout_threads_per_domain(void) * Semi-arbitrarily constrain pagedaemon threads to less than half the * total number of threads in the system as an insane upper limit. */ - half_cpus_per_dom = (mp_ncpus / vm_ndomains) / 2; + half_cpus_per_dom = howmany(mp_ncpus / vm_ndomains, 2); if (pageout_threads_per_domain < 1) { printf("Invalid tuneable vm.pageout_threads_per_domain value: " From owner-svn-src-all@freebsd.org Fri Aug 14 21:29:59 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BEFF83799DE; Fri, 14 Aug 2020 21:29:59 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BSxRW3LN2z49t0; Fri, 14 Aug 2020 21:29:59 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 510841447A; Fri, 14 Aug 2020 21:29:59 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07ELTx9h088196; Fri, 14 Aug 2020 21:29:59 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07ELTvn1088186; Fri, 14 Aug 2020 21:29:57 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <202008142129.07ELTvn1088186@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Fri, 14 Aug 2020 21:29:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364238 - in head/sys: net net/route netinet netinet6 sys X-SVN-Group: head X-SVN-Commit-Author: melifaro X-SVN-Commit-Paths: in head/sys: net net/route netinet netinet6 sys X-SVN-Commit-Revision: 364238 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 14 Aug 2020 21:29:59 -0000 Author: melifaro Date: Fri Aug 14 21:29:56 2020 New Revision: 364238 URL: https://svnweb.freebsd.org/changeset/base/364238 Log: Simplify dom_. Remove unused arguments from dom_rtattach/dom_rtdetach functions and make them return/accept 'struct rib_head' instead of 'void **'. Declare inet/inet6 implementations in the relevant _var.h headers similar to domifattach / domifdetach. Add rib_subscribe_internal() function to accept subscriptions to the rnh directly. Differential Revision: https://reviews.freebsd.org/D26053 Modified: head/sys/net/route.c head/sys/net/route/route_ctl.c head/sys/net/route/route_ctl.h head/sys/netinet/in_proto.c head/sys/netinet/in_rmx.c head/sys/netinet/in_var.h head/sys/netinet6/in6_proto.c head/sys/netinet6/in6_rmx.c head/sys/netinet6/in6_var.h head/sys/sys/domain.h Modified: head/sys/net/route.c ============================================================================== --- head/sys/net/route.c Fri Aug 14 18:48:48 2020 (r364237) +++ head/sys/net/route.c Fri Aug 14 21:29:56 2020 (r364238) @@ -227,7 +227,7 @@ vnet_route_init(const void *unused __unused) rnh = rt_tables_get_rnh_ptr(table, fam); if (rnh == NULL) panic("%s: rnh NULL", __func__); - dom->dom_rtattach((void **)rnh, 0, table); + *rnh = dom->dom_rtattach(table); } } } @@ -256,7 +256,7 @@ vnet_route_uninit(const void *unused __unused) rnh = rt_tables_get_rnh_ptr(table, fam); if (rnh == NULL) panic("%s: rnh NULL", __func__); - dom->dom_rtdetach((void **)rnh, 0); + dom->dom_rtdetach(*rnh); } } Modified: head/sys/net/route/route_ctl.c ============================================================================== --- head/sys/net/route/route_ctl.c Fri Aug 14 18:48:48 2020 (r364237) +++ head/sys/net/route/route_ctl.c Fri Aug 14 21:29:56 2020 (r364238) @@ -817,6 +817,25 @@ rib_notify(struct rib_head *rnh, enum rib_subscription } } +static struct rib_subscription * +allocate_subscription(rib_subscription_cb_t *f, void *arg, + enum rib_subscription_type type, bool waitok) +{ + struct rib_subscription *rs; + int flags = M_ZERO | (waitok ? M_WAITOK : 0); + + rs = malloc(sizeof(struct rib_subscription), M_RTABLE, flags); + if (rs == NULL) + return (NULL); + + rs->func = f; + rs->arg = arg; + rs->type = type; + + return (rs); +} + + /* * Subscribe for the changes in the routing table specified by @fibnum and * @family. @@ -830,20 +849,33 @@ rib_subscribe(uint32_t fibnum, int family, rib_subscri struct rib_head *rnh; struct rib_subscription *rs; struct epoch_tracker et; - int flags = M_ZERO | (waitok ? M_WAITOK : 0); - rs = malloc(sizeof(struct rib_subscription), M_RTABLE, flags); - if (rs == NULL) + if ((rs = allocate_subscription(f, arg, type, waitok)) == NULL) return (NULL); NET_EPOCH_ENTER(et); KASSERT((fibnum < rt_numfibs), ("%s: bad fibnum", __func__)); rnh = rt_tables_get_rnh(fibnum, family); - rs->func = f; - rs->arg = arg; - rs->type = type; + RIB_WLOCK(rnh); + CK_STAILQ_INSERT_TAIL(&rnh->rnh_subscribers, rs, next); + RIB_WUNLOCK(rnh); + NET_EPOCH_EXIT(et); + return (rs); +} + +struct rib_subscription * +rib_subscribe_internal(struct rib_head *rnh, rib_subscription_cb_t *f, void *arg, + enum rib_subscription_type type, bool waitok) +{ + struct rib_subscription *rs; + struct epoch_tracker et; + + if ((rs = allocate_subscription(f, arg, type, waitok)) == NULL) + return (NULL); + + NET_EPOCH_ENTER(et); RIB_WLOCK(rnh); CK_STAILQ_INSERT_TAIL(&rnh->rnh_subscribers, rs, next); RIB_WUNLOCK(rnh); Modified: head/sys/net/route/route_ctl.h ============================================================================== --- head/sys/net/route/route_ctl.h Fri Aug 14 18:48:48 2020 (r364237) +++ head/sys/net/route/route_ctl.h Fri Aug 14 21:29:56 2020 (r364238) @@ -79,6 +79,9 @@ typedef void rib_subscription_cb_t(struct rib_head *rn struct rib_subscription *rib_subscribe(uint32_t fibnum, int family, rib_subscription_cb_t *f, void *arg, enum rib_subscription_type type, bool waitok); +struct rib_subscription *rib_subscribe_internal(struct rib_head *rnh, + rib_subscription_cb_t *f, void *arg, enum rib_subscription_type type, + bool waitok); int rib_unsibscribe(uint32_t fibnum, int family, struct rib_subscription *rs); #endif Modified: head/sys/netinet/in_proto.c ============================================================================== --- head/sys/netinet/in_proto.c Fri Aug 14 18:48:48 2020 (r364237) +++ head/sys/netinet/in_proto.c Fri Aug 14 21:29:56 2020 (r364238) @@ -294,9 +294,6 @@ IPPROTOSPACER, }, }; -extern int in_inithead(void **, int, u_int); -extern int in_detachhead(void **, int); - struct domain inetdomain = { .dom_family = AF_INET, .dom_name = "internet", Modified: head/sys/netinet/in_rmx.c ============================================================================== --- head/sys/netinet/in_rmx.c Fri Aug 14 18:48:48 2020 (r364237) +++ head/sys/netinet/in_rmx.c Fri Aug 14 21:29:56 2020 (r364238) @@ -54,10 +54,6 @@ __FBSDID("$FreeBSD$"); #include #include -extern int in_inithead(void **head, int off, u_int fibnum); -#ifdef VIMAGE -extern int in_detachhead(void **head, int off); -#endif static int rib4_preadd(u_int fibnum, const struct sockaddr *addr, const struct sockaddr *mask, @@ -121,38 +117,32 @@ rib4_preadd(u_int fibnum, const struct sockaddr *addr, return (0); } -static int _in_rt_was_here; /* * Initialize our routing tree. */ -int -in_inithead(void **head, int off, u_int fibnum) +struct rib_head * +in_inithead(uint32_t fibnum) { struct rib_head *rh; rh = rt_table_init(32, AF_INET, fibnum); if (rh == NULL) - return (0); + return (NULL); rh->rnh_preadd = rib4_preadd; #ifdef RADIX_MPATH rt_mpath_init_rnh(rh); #endif - *head = (void *)rh; - if (_in_rt_was_here == 0 ) { - _in_rt_was_here = 1; - } - return 1; + return (rh); } #ifdef VIMAGE -int -in_detachhead(void **head, int off) +void +in_detachhead(struct rib_head *rh) { - rt_table_destroy((struct rib_head *)(*head)); - return (1); + rt_table_destroy(rh); } #endif Modified: head/sys/netinet/in_var.h ============================================================================== --- head/sys/netinet/in_var.h Fri Aug 14 18:48:48 2020 (r364237) +++ head/sys/netinet/in_var.h Fri Aug 14 21:29:56 2020 (r364238) @@ -436,8 +436,7 @@ inm_rele_locked(struct in_multi_head *inmh, struct in_ #define MCAST_NOTSMEMBER 2 /* This host excluded source */ #define MCAST_MUTED 3 /* [deprecated] */ -struct rtentry; -struct route; +struct rib_head; struct ip_moptions; struct in_multi *inm_lookup_locked(struct ifnet *, const struct in_addr); @@ -471,6 +470,10 @@ void in_ifadown(struct ifaddr *ifa, int); struct mbuf *ip_tryforward(struct mbuf *); void *in_domifattach(struct ifnet *); void in_domifdetach(struct ifnet *, void *); +struct rib_head *in_inithead(uint32_t fibnum); +#ifdef VIMAGE +void in_detachhead(struct rib_head *rh); +#endif #endif /* _KERNEL */ Modified: head/sys/netinet6/in6_proto.c ============================================================================== --- head/sys/netinet6/in6_proto.c Fri Aug 14 18:48:48 2020 (r364237) +++ head/sys/netinet6/in6_proto.c Fri Aug 14 21:29:56 2020 (r364238) @@ -333,11 +333,6 @@ IP6PROTOSPACER, }, }; -extern int in6_inithead(void **, int, u_int); -#ifdef VIMAGE -extern int in6_detachhead(void **, int); -#endif - struct domain inet6domain = { .dom_family = AF_INET6, .dom_name = "internet6", Modified: head/sys/netinet6/in6_rmx.c ============================================================================== --- head/sys/netinet6/in6_rmx.c Fri Aug 14 18:48:48 2020 (r364237) +++ head/sys/netinet6/in6_rmx.c Fri Aug 14 21:29:56 2020 (r364238) @@ -101,11 +101,6 @@ __FBSDID("$FreeBSD$"); #include #include -extern int in6_inithead(void **head, int off, u_int fibnum); -#ifdef VIMAGE -extern int in6_detachhead(void **head, int off); -#endif - static int rib6_preadd(u_int fibnum, const struct sockaddr *addr, const struct sockaddr *mask, struct nhop_object *nh) @@ -147,8 +142,8 @@ rib6_preadd(u_int fibnum, const struct sockaddr *addr, * Initialize our routing tree. */ -int -in6_inithead(void **head, int off, u_int fibnum) +struct rib_head * +in6_inithead(uint32_t fibnum) { struct rib_head *rh; struct rib_subscription *rs; @@ -156,29 +151,26 @@ in6_inithead(void **head, int off, u_int fibnum) rh = rt_table_init(offsetof(struct sockaddr_in6, sin6_addr) << 3, AF_INET6, fibnum); if (rh == NULL) - return (0); + return (NULL); rh->rnh_preadd = rib6_preadd; #ifdef RADIX_MPATH rt_mpath_init_rnh(rh); #endif - *head = (void *)rh; - rs = rib_subscribe(fibnum, AF_INET6, nd6_subscription_cb, NULL, + rs = rib_subscribe_internal(rh, nd6_subscription_cb, NULL, RIB_NOTIFY_IMMEDIATE, true); KASSERT(rs != NULL, ("Unable to subscribe to fib %u\n", fibnum)); - return (1); + return (rh); } #ifdef VIMAGE -int -in6_detachhead(void **head, int off) +void +in6_detachhead(struct rib_head *rh) { - rt_table_destroy((struct rib_head *)(*head)); - - return (1); + rt_table_destroy(rh); } #endif Modified: head/sys/netinet6/in6_var.h ============================================================================== --- head/sys/netinet6/in6_var.h Fri Aug 14 18:48:48 2020 (r364237) +++ head/sys/netinet6/in6_var.h Fri Aug 14 21:29:56 2020 (r364238) @@ -857,6 +857,7 @@ in6m_rele_locked(struct in6_multi_head *inmh, struct i struct ip6_moptions; struct sockopt; struct inpcbinfo; +struct rib_head; /* Multicast KPIs. */ int im6o_mc_filter(const struct ip6_moptions *, const struct ifnet *, @@ -891,6 +892,8 @@ void in6_savemkludge(struct in6_ifaddr *); void *in6_domifattach(struct ifnet *); void in6_domifdetach(struct ifnet *, void *); int in6_domifmtu(struct ifnet *); +struct rib_head *in6_inithead(uint32_t fibnum); +void in6_detachhead(struct rib_head *rh); void in6_setmaxmtu(void); int in6_if2idlen(struct ifnet *); struct in6_ifaddr *in6ifa_ifpforlinklocal(struct ifnet *, int); Modified: head/sys/sys/domain.h ============================================================================== --- head/sys/sys/domain.h Fri Aug 14 18:48:48 2020 (r364237) +++ head/sys/sys/domain.h Fri Aug 14 21:29:56 2020 (r364238) @@ -45,6 +45,7 @@ struct mbuf; struct ifnet; struct socket; +struct rib_head; struct domain { int dom_family; /* AF_xxx */ @@ -59,10 +60,10 @@ struct domain { (struct socket *); struct protosw *dom_protosw, *dom_protoswNPROTOSW; struct domain *dom_next; - int (*dom_rtattach) /* initialize routing table */ - (void **, int, u_int); - int (*dom_rtdetach) /* clean up routing table */ - (void **, int); + struct rib_head *(*dom_rtattach) /* initialize routing table */ + (uint32_t); + void (*dom_rtdetach) /* clean up routing table */ + (struct rib_head *); void *(*dom_ifattach)(struct ifnet *); void (*dom_ifdetach)(struct ifnet *, void *); int (*dom_ifmtu)(struct ifnet *); From owner-svn-src-all@freebsd.org Fri Aug 14 21:37:38 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ACB29379CD7; Fri, 14 Aug 2020 21:37:38 +0000 (UTC) (envelope-from jah@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BSxcL47P7z4BfR; Fri, 14 Aug 2020 21:37:38 +0000 (UTC) (envelope-from jah@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 711CC1499A; Fri, 14 Aug 2020 21:37:38 +0000 (UTC) (envelope-from jah@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07ELbcNY094529; Fri, 14 Aug 2020 21:37:38 GMT (envelope-from jah@FreeBSD.org) Received: (from jah@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07ELbcPc094528; Fri, 14 Aug 2020 21:37:38 GMT (envelope-from jah@FreeBSD.org) Message-Id: <202008142137.07ELbcPc094528@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jah set sender to jah@FreeBSD.org using -f From: "Jason A. Harmening" Date: Fri, 14 Aug 2020 21:37:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364239 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: jah X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 364239 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 14 Aug 2020 21:37:38 -0000 Author: jah Date: Fri Aug 14 21:37:38 2020 New Revision: 364239 URL: https://svnweb.freebsd.org/changeset/base/364239 Log: kenv: avoid sleepable alloc for integer tunables Avoid performing a potentially-blocking malloc for kenv lookups that will only perform non-destructive integer conversions on the returned buffer. Instead, perform the strtoq() in-place with the kenv lock held. While here, factor the logic around kenv_lock acquire and release into kenv_acquire() and kenv_release(), and use these functions for some light cleanup. Collapse getenv_string_buffer() into kern_getenv(), as the former no longer has any other callers and the only additional task performed by the latter is a WITNESS check that hasn't been useful since r362231. PR: 248250 Reported by: gbe Reviewed by: mjg Tested by: gbe Differential Revision: https://reviews.freebsd.org/D26010 Modified: head/sys/kern/kern_environment.c Modified: head/sys/kern/kern_environment.c ============================================================================== --- head/sys/kern/kern_environment.c Fri Aug 14 21:29:56 2020 (r364238) +++ head/sys/kern/kern_environment.c Fri Aug 14 21:37:38 2020 (r364239) @@ -59,6 +59,9 @@ __FBSDID("$FreeBSD$"); static char *_getenv_dynamic_locked(const char *name, int *idx); static char *_getenv_dynamic(const char *name, int *idx); +static char *kenv_acquire(const char *name); +static void kenv_release(const char *buf); + static MALLOC_DEFINE(M_KENV, "kenv", "kernel environment"); #define KENV_SIZE 512 /* Maximum number of environment strings */ @@ -88,8 +91,6 @@ bool dynamic_kenv; #define KENV_CHECK if (!dynamic_kenv) \ panic("%s: called before SI_SUB_KMEM", __func__) -static char *getenv_string_buffer(const char *); - int sys_kenv(td, uap) struct thread *td; @@ -482,16 +483,24 @@ _getenv_static(const char *name) char * kern_getenv(const char *name) { - char *ret; + char *cp, *ret; + int len; if (dynamic_kenv) { - ret = getenv_string_buffer(name); - if (ret == NULL) { - WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, - "getenv"); + len = KENV_MNAMELEN + 1 + kenv_mvallen + 1; + ret = uma_zalloc(kenv_zone, M_WAITOK | M_ZERO); + mtx_lock(&kenv_lock); + cp = _getenv_dynamic(name, NULL); + if (cp != NULL) + strlcpy(ret, cp, len); + mtx_unlock(&kenv_lock); + if (cp == NULL) { + uma_zfree(kenv_zone, ret); + ret = NULL; } } else ret = _getenv_static(name); + return (ret); } @@ -503,12 +512,9 @@ testenv(const char *name) { char *cp; - if (dynamic_kenv) { - mtx_lock(&kenv_lock); - cp = _getenv_dynamic(name, NULL); - mtx_unlock(&kenv_lock); - } else - cp = _getenv_static(name); + cp = kenv_acquire(name); + kenv_release(cp); + if (cp != NULL) return (1); return (0); @@ -615,30 +621,33 @@ kern_unsetenv(const char *name) } /* - * Return a buffer containing the string value from an environment variable + * Return the internal kenv buffer for the variable name, if it exists. + * If the dynamic kenv is initialized and the name is present, return + * with kenv_lock held. */ static char * -getenv_string_buffer(const char *name) +kenv_acquire(const char *name) { - char *cp, *ret; - int len; + char *value; if (dynamic_kenv) { - len = KENV_MNAMELEN + 1 + kenv_mvallen + 1; - ret = uma_zalloc(kenv_zone, M_WAITOK | M_ZERO); mtx_lock(&kenv_lock); - cp = _getenv_dynamic(name, NULL); - if (cp != NULL) - strlcpy(ret, cp, len); - mtx_unlock(&kenv_lock); - if (cp == NULL) { - uma_zfree(kenv_zone, ret); - ret = NULL; - } + value = _getenv_dynamic(name, NULL); + if (value == NULL) + mtx_unlock(&kenv_lock); + return (value); } else - ret = _getenv_static(name); + return (_getenv_static(name)); +} - return (ret); +/* + * Undo a previous kenv_acquire() operation + */ +static void +kenv_release(const char *buf) +{ + if ((buf != NULL) && dynamic_kenv) + mtx_unlock(&kenv_lock); } /* @@ -649,17 +658,13 @@ getenv_string(const char *name, char *data, int size) { char *cp; - if (dynamic_kenv) { - mtx_lock(&kenv_lock); - cp = _getenv_dynamic(name, NULL); - if (cp != NULL) - strlcpy(data, cp, size); - mtx_unlock(&kenv_lock); - } else { - cp = _getenv_static(name); - if (cp != NULL) - strlcpy(data, cp, size); - } + cp = kenv_acquire(name); + + if (cp != NULL) + strlcpy(data, cp, size); + + kenv_release(cp); + return (cp != NULL); } @@ -673,16 +678,18 @@ getenv_array(const char *name, void *pdata, int size, uint8_t shift; int64_t value; int64_t old; - char *buf; + const char *buf; char *end; - char *ptr; + const char *ptr; int n; int rc; - if ((buf = getenv_string_buffer(name)) == NULL) - return (0); - rc = 0; /* assume failure */ + + buf = kenv_acquire(name); + if (buf == NULL) + goto error; + /* get maximum number of elements */ size /= type_size; @@ -797,8 +804,7 @@ getenv_array(const char *name, void *pdata, int size, if (n != 0) rc = 1; /* success */ error: - if (dynamic_kenv) - uma_zfree(kenv_zone, buf); + kenv_release(buf); return (rc); } @@ -898,18 +904,21 @@ getenv_ulong(const char *name, unsigned long *data) int getenv_quad(const char *name, quad_t *data) { - char *value, *vtp; - quad_t iv; + const char *value; + char suffix, *vtp; + quad_t iv; - value = getenv_string_buffer(name); - if (value == NULL) - return (0); + value = kenv_acquire(name); + if (value == NULL) { + goto error; + } iv = strtoq(value, &vtp, 0); if (vtp == value || (vtp[0] != '\0' && vtp[1] != '\0')) { - freeenv(value); - return (0); + goto error; } - switch (vtp[0]) { + suffix = vtp[0]; + kenv_release(value); + switch (suffix) { case 't': case 'T': iv *= 1024; /* FALLTHROUGH */ @@ -924,12 +933,13 @@ getenv_quad(const char *name, quad_t *data) case '\0': break; default: - freeenv(value); return (0); } - freeenv(value); *data = iv; return (1); +error: + kenv_release(value); + return (0); } /* From owner-svn-src-all@freebsd.org Sat Aug 15 03:20:40 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1FB2D3AA95F; Sat, 15 Aug 2020 03:20:40 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BT5D8029xz4TKN; Sat, 15 Aug 2020 03:20:40 +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 D9F4A18A5F; Sat, 15 Aug 2020 03:20:39 +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 07F3KdfH005078; Sat, 15 Aug 2020 03:20:39 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07F3KdRe005056; Sat, 15 Aug 2020 03:20:39 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <202008150320.07F3KdRe005056@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Sat, 15 Aug 2020 03:20:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364240 - head/sys/dev/ice X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/sys/dev/ice X-SVN-Commit-Revision: 364240 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 15 Aug 2020 03:20:40 -0000 Author: lwhsu Date: Sat Aug 15 03:20:39 2020 New Revision: 364240 URL: https://svnweb.freebsd.org/changeset/base/364240 Log: Remove redeclaration found by gcc build Reviewed by: erj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25953 Modified: head/sys/dev/ice/ice_common.h Modified: head/sys/dev/ice/ice_common.h ============================================================================== --- head/sys/dev/ice/ice_common.h Fri Aug 14 21:37:38 2020 (r364239) +++ head/sys/dev/ice/ice_common.h Sat Aug 15 03:20:39 2020 (r364240) @@ -46,16 +46,6 @@ enum ice_fw_modes { ICE_FW_MODE_ROLLBACK }; -/* prototype for functions used for SW locks */ -void ice_free_list(struct LIST_HEAD_TYPE *list); -void ice_init_lock(struct ice_lock *lock); -void ice_acquire_lock(struct ice_lock *lock); -void ice_release_lock(struct ice_lock *lock); -void ice_destroy_lock(struct ice_lock *lock); - -void *ice_alloc_dma_mem(struct ice_hw *hw, struct ice_dma_mem *m, u64 size); -void ice_free_dma_mem(struct ice_hw *hw, struct ice_dma_mem *m); - void ice_idle_aq(struct ice_hw *hw, struct ice_ctl_q_info *cq); bool ice_sq_done(struct ice_hw *hw, struct ice_ctl_q_info *cq); @@ -77,13 +67,6 @@ ice_clean_rq_elem(struct ice_hw *hw, struct ice_ctl_q_ enum ice_status ice_get_link_status(struct ice_port_info *pi, bool *link_up); enum ice_status ice_update_link_info(struct ice_port_info *pi); -enum ice_status -ice_acquire_nvm(struct ice_hw *hw, enum ice_aq_res_access_type access); -void ice_release_nvm(struct ice_hw *hw); -enum ice_status -ice_aq_read_nvm(struct ice_hw *hw, u16 module_typeid, u32 offset, u16 length, - void *data, bool last_command, bool read_shadow_ram, - struct ice_sq_cd *cd); enum ice_status ice_acquire_res(struct ice_hw *hw, enum ice_aq_res_ids res, enum ice_aq_res_access_type access, u32 timeout); From owner-svn-src-all@freebsd.org Sat Aug 15 03:26:00 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C4E713AB11A; Sat, 15 Aug 2020 03:26:00 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BT5LJ4nZgz4TgJ; Sat, 15 Aug 2020 03:26:00 +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 87705188E7; Sat, 15 Aug 2020 03:26:00 +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 07F3Q0QD010424; Sat, 15 Aug 2020 03:26:00 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07F3Q0qv010423; Sat, 15 Aug 2020 03:26:00 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <202008150326.07F3Q0qv010423@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Sat, 15 Aug 2020 03:26:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364241 - head/sys/dev/ixl X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/sys/dev/ixl X-SVN-Commit-Revision: 364241 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 15 Aug 2020 03:26:00 -0000 Author: lwhsu Date: Sat Aug 15 03:26:00 2020 New Revision: 364241 URL: https://svnweb.freebsd.org/changeset/base/364241 Log: Remove redeclaration found by gcc build Reviewed by: Jacob Keller Suggested editing from: Krzysztof Galazka Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25954 Modified: head/sys/dev/ixl/i40e_prototype.h Modified: head/sys/dev/ixl/i40e_prototype.h ============================================================================== --- head/sys/dev/ixl/i40e_prototype.h Sat Aug 15 03:20:39 2020 (r364240) +++ head/sys/dev/ixl/i40e_prototype.h Sat Aug 15 03:26:00 2020 (r364241) @@ -606,6 +606,4 @@ enum i40e_status_code i40e_read_phy_register(struct i4 enum i40e_status_code i40e_write_phy_register(struct i40e_hw *hw, u8 page, u16 reg, u8 phy_addr, u16 value); u8 i40e_get_phy_address(struct i40e_hw *hw, u8 dev_num); -enum i40e_status_code i40e_blink_phy_link_led(struct i40e_hw *hw, - u32 time, u32 interval); #endif /* _I40E_PROTOTYPE_H_ */ From owner-svn-src-all@freebsd.org Sat Aug 15 07:16:13 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6D10F3B0EF0; Sat, 15 Aug 2020 07:16:13 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BTBRx1txDz3T6c; Sat, 15 Aug 2020 07:16:13 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 23E811B7DE; Sat, 15 Aug 2020 07:16:13 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07F7GDIF052393; Sat, 15 Aug 2020 07:16:13 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07F7GCeI052392; Sat, 15 Aug 2020 07:16:12 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <202008150716.07F7GCeI052392@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sat, 15 Aug 2020 07:16:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org Subject: svn commit: r364244 - svnadmin/conf X-SVN-Group: svnadmin X-SVN-Commit-Author: hrs X-SVN-Commit-Paths: svnadmin/conf X-SVN-Commit-Revision: 364244 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 15 Aug 2020 07:16:13 -0000 Author: hrs Date: Sat Aug 15 07:16:12 2020 New Revision: 364244 URL: https://svnweb.freebsd.org/changeset/base/364244 Log: Disable the size limitation temporarily to commit changes to tools/tools/locale. Modified: svnadmin/conf/sizelimit.conf Modified: svnadmin/conf/sizelimit.conf ============================================================================== --- svnadmin/conf/sizelimit.conf Sat Aug 15 06:24:07 2020 (r364243) +++ svnadmin/conf/sizelimit.conf Sat Aug 15 07:16:12 2020 (r364244) @@ -19,6 +19,7 @@ andrew bapt davidcs dim 20480000 +hrs imp jb jeff From owner-svn-src-all@freebsd.org Sat Aug 15 07:19:39 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4991C3B11EE; Sat, 15 Aug 2020 07:19:39 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BTBWv1R7hz3TC5; Sat, 15 Aug 2020 07:19:39 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0F4241B667; Sat, 15 Aug 2020 07:19:39 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07F7JctM052657; Sat, 15 Aug 2020 07:19:38 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07F7Jcj5052654; Sat, 15 Aug 2020 07:19:38 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <202008150719.07F7Jcj5052654@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sat, 15 Aug 2020 07:19:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364245 - in head/tools/tools/locale: . etc/final-maps patch tools X-SVN-Group: head X-SVN-Commit-Author: hrs X-SVN-Commit-Paths: in head/tools/tools/locale: . etc/final-maps patch tools X-SVN-Commit-Revision: 364245 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 15 Aug 2020 07:19:39 -0000 Author: hrs Date: Sat Aug 15 07:19:37 2020 New Revision: 364245 URL: https://svnweb.freebsd.org/changeset/base/364245 Log: - Update to Unicode CLDR v35 (Unicode 12.0). - Update tools/tools/locale to add make targets to automatically generate locale source files. With this change, just typing "make obj && make -j4" will rebuild them. Check README for more details. - Fix issues in ja_JP ctypedef and range specification support in utf8-rollup.pl. - Add a temporary patch for UnicodeData.txt to fix code ranges of CJK Ideograph Extension A and Extension B. - tools/cldr2def.pl: Use eucJP for ja_JP ctypedef because eucJP is not compatible with UTF-8. - tools/convert_map.pl: Add a verbose error message. - tools/utf8-rollup.pl: Normalize entries to use Unicode, not UTF-8. Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D25503 Added: head/tools/tools/locale/patch/ head/tools/tools/locale/patch/patch-UnicodeData.txt (contents, props changed) Modified: head/tools/tools/locale/Makefile head/tools/tools/locale/README head/tools/tools/locale/etc/final-maps/map.UTF-8 head/tools/tools/locale/tools/cldr2def.pl head/tools/tools/locale/tools/convert_map.pl head/tools/tools/locale/tools/finalize head/tools/tools/locale/tools/utf8-rollup.pl Modified: head/tools/tools/locale/Makefile ============================================================================== --- head/tools/tools/locale/Makefile Sat Aug 15 07:16:12 2020 (r364244) +++ head/tools/tools/locale/Makefile Sat Aug 15 07:19:37 2020 (r364245) @@ -7,19 +7,30 @@ # # Modified by John Marino to suit DragonFly needs # +.if ${.CURDIR} == ${.OBJDIR} +.error Do make obj first. +.endif -.OBJDIR: . +LOCALESRCDIR?= ${DESTDIR}/usr/src/share +TMPDIR?= /tmp -.if !defined(UNIDIR) -.error UNIDIR is not set -.endif -PASSON= UNIDIR="${UNIDIR}" +BASEDIR= ${.CURDIR} +ETCDIR= ${BASEDIR}/etc +TOOLSDIR= ${BASEDIR}/tools +PATCHDIR= ${BASEDIR}/patch +UNIDIR= ${.OBJDIR:tA}/unicode -ETCDIR= ${.CURDIR}/etc +PKGS= openjdk8 \ + apache-ant \ + p5-XML-Parser \ + p5-Tie-IxHash \ + p5-Text-Iconv +tools-test: + pkg info -e ${PKGS} + @echo tools ok. KNOWN= monetdef numericdef msgdef colldef ctypedef # timedef TYPES?= ${KNOWN} -LOCALE_DESTDIR?= /tmp/generated-locales/ COLLATION_SPECIAL?= \ cs_CZ ISO8859-2 \ @@ -44,67 +55,81 @@ COLLATION_SPECIAL?= \ .for area enc in ${COLLATION_SPECIAL} COLLATIONS_SPECIAL_ENV+= ${area}.${enc} .endfor -PASSON+= COLLATIONS_SPECIAL="${COLLATIONS_SPECIAL_ENV}" +SETENV= env -i \ + PATH="${PATH}" \ + TMPDIR="${TMPDIR}" \ + COLLATIONS_SPECIAL="${COLLATIONS_SPECIAL_ENV}" \ + UNIDIR="${UNIDIR}" \ + BASEDIR="${BASEDIR}" \ + TOOLSDIR="${TOOLSDIR}" \ + ETCDIR="${ETCDIR}" -all: +all: posix build afterbuild +.ORDER: posix build afterbuild + +afterbuild: build + @echo "" + @find . -name *failed + .for t in ${TYPES} . if ${KNOWN:M${t}} - test -d ${t} || mkdir ${t} - make build-${t} +build: build-${t} +.ORDER: build-${t} afterbuild . endif .endfor - @echo "" - @find . -name *failed +diff: .for t in ${TYPES} +. if ${KNOWN:M${t}} +diff: diff-${t} +diff-${t}: + -/usr/bin/diff -ruN -x Makefile -x Makefile.depend \ + ${LOCALESRCDIR}/${t} ${t} +. endif +.endfor + +install: +.for t in ${TYPES} +. if ${KNOWN:M${t}} install: install-${t} install-${t}: -. if ${KNOWN:M${t}} - rm -rf ${.CURDIR}/${t}.draft - rm -f ${.CURDIR}/../../../share/${t}/Makefile - rm -f ${.CURDIR}/../../../share/${t}/*.src - mv ${.CURDIR}/${t}/* ${.CURDIR}/../../../share/${t}/ + cd ${LOCALESRCDIR}/${t} && \ + rm -f Makefile *.src && \ + install -c ${t}/* ${LOCALESRCDIR}/${t} . endif .endfor post-install: .for t in ${TYPES} . if ${KNOWN:M${t}} - (cd ${.CURDIR}/../../../share/${t} && \ - make && make install && make clean) + cd ${LOCALSRCDIR}/${t} && \ + make && make install && make clean . endif .endfor .for t in ${TYPES} -gen-${t}: - mkdir -p ${t} ${t}.draft - perl -I tools tools/cldr2def.pl \ - --unidir=$$(realpath ${UNIDIR}) \ - --etc=$$(realpath ${ETCDIR}) \ +CLEANDIRS+= ${t} ${t}.draft +${t}: + mkdir -p ${t} ${t}.draft && \ + perl -I ${TOOLSDIR} ${TOOLSDIR}/cldr2def.pl \ + --unidir=${UNIDIR:tA} \ + --etc=${ETCDIR:tA} \ --type=${t} -build-${t}: gen-${t} - env ${PASSON} tools/finalize ${t} +build-${t}: ${t} + ${SETENV} OUTBASEDIR="${.OBJDIR}/${t}" ${TOOLSDIR}/finalize ${t} .endfor -gen-ctypedef: ctype-rollup -static-colldef: gen-colldef +static-colldef: colldef build-colldef: static-colldef static-colldef: .for area enc in ${COLLATION_SPECIAL} - awk -f tools/extract-colldef.awk ${UNIDIR}/posix/${area}.${enc}.src > \ - colldef.draft/${area}.${enc}.src +colldef.draft/${area}.${enc}.src: posix/${area}.${enc}.src + awk -f ${TOOLSDIR}/extract-colldef.awk \ + ${.ALLSRC} > ${.TARGET} || (rm -f ${.TARGET} && false) .endfor -ctype-rollup: - perl -I tools tools/utf8-rollup.pl --unidir=$$(realpath ${UNIDIR}) - -clean: -.for t in ${TYPES} - rm -rf ${t} ${t}.draft -.endfor - BASE_LOCALES_OF_INTEREST?= \ af_ZA am_ET ar_AE ar_EG ar_JO ar_MA ar_QA ar_SA \ be_BY bg_BG ca_AD ca_ES ca_FR ca_IT \ @@ -145,31 +170,71 @@ ENCODINGS= Big5 \ US-ASCII \ UTF-8 -POSIX: posixsrc posixcol posixcm +# CLDR files +CLDRFILES_CORE= https://unicode.org/Public/cldr/35/core.zip +CLDRFILES_KEY= https://unicode.org/Public/cldr/35/keyboards.zip +CLDRFILES_TOOLS=https://unicode.org/Public/cldr/35/tools.zip +CLDRFILES_UCD= http://www.unicode.org/Public/zipped/latest/UCD.zip + +# fetch and extract targets +${UNIDIR}: + mkdir -p ${UNIDIR} +.for N in CORE KEY TOOLS UCD +${CLDRFILES_${N}:T}: + fetch ${CLDRFILES_${N}} +fetch: ${CLDRFILES_${N}:T} +extract-${CLDRFILES_${N}:T}:: ${CLDRFILES_${N}:T} ${UNIDIR} + cd ${UNIDIR} && unzip -o ../${CLDRFILES_${N}:T} +extract: extract-${CLDRFILES_${N}:T} +.endfor +patch:: +.if exists(${PATCHDIR}) + cd ${UNIDIR} && cat ${PATCHDIR}/patch-* | patch +.endif + .if !exists(${UNIDIR}/tools/java/cldr.jar) -.error check README about building cldr.jar +.ORDER: extract patch +build-tools: extract patch tools-test ${UNIDIR} + cd ${UNIDIR}/tools/java && ${SETENV} ant all jar +.else +build-tools: + @echo cldr.jar is ready. .endif + +JAVA_CLDR= java -DCLDR_DIR=${UNIDIR:Q} -jar ${UNIDIR}/tools/java/cldr.jar + +posix: posixcm post-posixcm posixsrc posixcol +.ORDER: posixcm post-posixcm posixsrc posixcol +${UNIDIR}/posix: + ln -s -f ../posix ${.TARGET} +clean-posix: + rm -rf posix ${UNIDIR}/posix +post-posixcm: ${UNIDIR}/posix + perl -I ${TOOLSDIR} ${TOOLSDIR}/utf8-rollup.pl \ + --unidir=${UNIDIR} +.for enc in ${ENCODINGS} +posixcm: build-tools posix/${enc}.cm +.ORDER: build-tools posix/${enc}.cm +posix/${enc}.cm: + mkdir -p posix && \ + ${JAVA_CLDR} org.unicode.cldr.posix.GenerateCharmap \ + -d posix -c ${enc} +.endfor .for area in ${BASE_LOCALES_OF_INTEREST} -posixsrc: ${UNIDIR}/posix/${area}.UTF-8.src -${UNIDIR}/posix/${area}.UTF-8.src: - java -DCLDR_DIR=${UNIDIR:Q} -jar ${UNIDIR}/tools/java/cldr.jar \ - org.unicode.cldr.posix.GeneratePOSIX \ - -d ${UNIDIR}/posix -m ${area} -c UTF-8 +posixsrc: build-tools posix/${area}.UTF-8.src +.ORDER: build-tools posix/${area}.UTF-8.src +posix/${area}.UTF-8.src: + mkdir -p posix && \ + ${JAVA_CLDR} org.unicode.cldr.posix.GeneratePOSIX \ + -d posix -m ${area} -c UTF-8 .endfor .for area encoding in ${COLLATION_SPECIAL} -posixcol: ${UNIDIR}/posix/${area}.${encoding}.src -${UNIDIR}/posix/${area}.${encoding}.src: - java -DCLDR_DIR=${UNIDIR:Q} -jar ${UNIDIR}/tools/java/cldr.jar \ - org.unicode.cldr.posix.GeneratePOSIX \ - -d ${UNIDIR}/posix -m ${area} -c ${encoding} +posixcol: build-tools posix/${area}.${encoding}.src +.ORDER: build-tools posix/${area}.${encoding}.src +posix/${area}.${encoding}.src: + mkdir -p posix && \ + ${JAVA_CLDR} org.unicode.cldr.posix.GeneratePOSIX \ + -d posix -m ${area} -c ${encoding} .endfor -.for enc in ${ENCODINGS} -posixcm: ${UNIDIR}/posix/${enc}.cm -${UNIDIR}/posix/${enc}.cm: - java -DCLDR_DIR=${UNIDIR:Q} -jar ${UNIDIR}/tools/java/cldr.jar \ - org.unicode.cldr.posix.GenerateCharmap \ - -d ${UNIDIR}/posix -c ${enc} -.endfor -clean-POSIX: - rm -f ${UNIDIR}/posix/* +.include Modified: head/tools/tools/locale/README ============================================================================== --- head/tools/tools/locale/README Sat Aug 15 07:16:12 2020 (r364244) +++ head/tools/tools/locale/README Sat Aug 15 07:19:37 2020 (r364245) @@ -1,32 +1,58 @@ # $FreeBSD$ -To generate the locales: +Files in this directory are used to generate locale source files +from files in CLDR (Unicode Common Locale Data Repository). -Tools needed: - java (openjdk >= 8) - perl - converters/p5-Text-Iconv - devel/apache-ant - devel/p5-Tie-IxHash - textproc/p5-XML-Parser +To generate the files, do the following: -1. Fetch CLDR data from: http://unicode.org/Public/cldr/. You need all of the -core.zip, keyboards.zip, and tools.zip. -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 -4. Export variable: - UNIDIR=~/unicode; export UNIDIR -5. Build the CLDR tools: - cd $UNIDIR/tools/java - ant jar -6. Build POSIX data files from CLDR data: - make POSIX -7. Build and install new locale data: - make + cd /usr/src/tools/tools/locale + make obj (mandatory) + make -j16 (-jN recommended) + make diff (check if the changes are reasonable) make install + +"make" downloads the necessary files, build them, and install the +results into /usr/src/share/* as source files for locales. + +More details are as follows: + +Variables: + LOCALESRCDIR + Destination path for the generated locale files. + Default: $DESTDIR/usr/src/share. + TMPDIR + Temporary directory. + Default: /tmp + +Targets: + make obj + Create a temporary directory for building. + + make clean + Clean up the obj directories. + + make cleandir + Remove the obj directories completely. + + make tools-test + Check if necessary tools are installed or not. + If something is missing, install them. + + make fetch + Download necessary files from CLDR. + + make build-tools + Build a tool to generate locale source files. + + make posix + Build POSIX locale source files. + + make build + Build locale files. + + make diff + Run diff(1) the build results against $LOCALESRCDIR. + + make install + Install the build results into $LOCALESRCDIR. +[EOF] Modified: head/tools/tools/locale/etc/final-maps/map.UTF-8 ============================================================================== --- head/tools/tools/locale/etc/final-maps/map.UTF-8 Sat Aug 15 07:16:12 2020 (r364244) +++ head/tools/tools/locale/etc/final-maps/map.UTF-8 Sat Aug 15 07:19:37 2020 (r364245) @@ -2969,6 +2969,7 @@ CHARMAP \xE0\xB1\xAD \xE0\xB1\xAE \xE0\xB1\xAF + \xE0\xB1\xB7 \xE0\xB1\xB8 \xE0\xB1\xB9 \xE0\xB1\xBA @@ -3363,14 +3364,24 @@ CHARMAP \xE0\xBA\x81 \xE0\xBA\x82 \xE0\xBA\x84 + \xE0\xBA\x86 \xE0\xBA\x87 \xE0\xBA\x88 + \xE0\xBA\x89 \xE0\xBA\x8A + \xE0\xBA\x8C \xE0\xBA\x8D + \xE0\xBA\x8E + \xE0\xBA\x8F + \xE0\xBA\x90 + \xE0\xBA\x91 + \xE0\xBA\x92 + \xE0\xBA\x93 \xE0\xBA\x94 \xE0\xBA\x95 \xE0\xBA\x96 \xE0\xBA\x97 + \xE0\xBA\x98 \xE0\xBA\x99 \xE0\xBA\x9A \xE0\xBA\x9B @@ -3378,13 +3389,17 @@ CHARMAP \xE0\xBA\x9D \xE0\xBA\x9E \xE0\xBA\x9F + \xE0\xBA\xA0 \xE0\xBA\xA1 \xE0\xBA\xA2 \xE0\xBA\xA3 \xE0\xBA\xA5 \xE0\xBA\xA7 + \xE0\xBA\xA8 + \xE0\xBA\xA9 \xE0\xBA\xAA \xE0\xBA\xAB + \xE0\xBA\xAC \xE0\xBA\xAD \xE0\xBA\xAE \xE0\xBA\xAF @@ -3398,6 +3413,7 @@ CHARMAP \xE0\xBA\xB7 \xE0\xBA\xB8 \xE0\xBA\xB9 + \xE0\xBA\xBA \xE0\xBA\xBB \xE0\xBA\xBC \xE0\xBA\xBD @@ -6656,6 +6672,7 @@ CHARMAP \xE1\xB3\xB7 \xE1\xB3\xB8 \xE1\xB3\xB9 + \xE1\xB3\xBA \xE1\xB4\x80 \xE1\xB4\x81 \xE1\xB4\x82 @@ -10325,6 +10342,7 @@ CHARMAP \xE2\xAF\x86 \xE2\xAF\x87 \xE2\xAF\x88 + \xE2\xAF\x89 \xE2\xAF\x8A \xE2\xAF\x8B \xE2\xAF\x8C @@ -10378,6 +10396,7 @@ CHARMAP \xE2\xAF\xBC \xE2\xAF\xBD \xE2\xAF\xBE + \xE2\xAF\xBF \xE2\xB0\x80 \xE2\xB0\x81 \xE2\xB0\x82 @@ -10916,6 +10935,7 @@ CHARMAP \xE2\xB9\x8C \xE2\xB9\x8D \xE2\xB9\x8E + \xE2\xB9\x8F \xE2\xBA\x80 \xE2\xBA\x81 \xE2\xBA\x82 @@ -41812,6 +41832,17 @@ CHARMAP \xEA\x9E\xB7 \xEA\x9E\xB8 \xEA\x9E\xB9 + \xEA\x9E\xBA + \xEA\x9E\xBB + \xEA\x9E\xBC + \xEA\x9E\xBD + \xEA\x9E\xBE + \xEA\x9E\xBF + \xEA\x9F\x82 + \xEA\x9F\x83 + \xEA\x9F\x84 + \xEA\x9F\x85 + \xEA\x9F\x86 \xEA\x9F\xB7 \xEA\x9F\xB8 \xEA\x9F\xB9 @@ -42577,6 +42608,8 @@ CHARMAP \xEA\xAD\xA3 \xEA\xAD\xA4 \xEA\xAD\xA5 + \xEA\xAD\xA6 + \xEA\xAD\xA7 \xEA\xAD\xB0 \xEA\xAD\xB1 \xEA\xAD\xB2 @@ -64381,6 +64414,29 @@ CHARMAP \xF0\x90\xBD\x97 \xF0\x90\xBD\x98 \xF0\x90\xBD\x99 + \xF0\x90\xBF\xA0 + \xF0\x90\xBF\xA1 + \xF0\x90\xBF\xA2 + \xF0\x90\xBF\xA3 + \xF0\x90\xBF\xA4 + \xF0\x90\xBF\xA5 + \xF0\x90\xBF\xA6 + \xF0\x90\xBF\xA7 + \xF0\x90\xBF\xA8 + \xF0\x90\xBF\xA9 + \xF0\x90\xBF\xAA + \xF0\x90\xBF\xAB + \xF0\x90\xBF\xAC + \xF0\x90\xBF\xAD + \xF0\x90\xBF\xAE + \xF0\x90\xBF\xAF + \xF0\x90\xBF\xB0 + \xF0\x90\xBF\xB1 + \xF0\x90\xBF\xB2 + \xF0\x90\xBF\xB3 + \xF0\x90\xBF\xB4 + \xF0\x90\xBF\xB5 + \xF0\x90\xBF\xB6 \xF0\x91\x80\x80 \xF0\x91\x80\x81 \xF0\x91\x80\x82 @@ -65163,6 +65219,7 @@ CHARMAP \xF0\x91\x91\x9B \xF0\x91\x91\x9D \xF0\x91\x91\x9E + \xF0\x91\x91\x9F \xF0\x91\x92\x80 \xF0\x91\x92\x81 \xF0\x91\x92\x82 @@ -65485,6 +65542,7 @@ CHARMAP \xF0\x91\x9A\xB5 \xF0\x91\x9A\xB6 \xF0\x91\x9A\xB7 + \xF0\x91\x9A\xB8 \xF0\x91\x9B\x80 \xF0\x91\x9B\x81 \xF0\x91\x9B\x82 @@ -65697,6 +65755,71 @@ CHARMAP \xF0\x91\xA3\xB1 \xF0\x91\xA3\xB2 \xF0\x91\xA3\xBF + \xF0\x91\xA6\xA0 + \xF0\x91\xA6\xA1 + \xF0\x91\xA6\xA2 + \xF0\x91\xA6\xA3 + \xF0\x91\xA6\xA4 + \xF0\x91\xA6\xA5 + \xF0\x91\xA6\xA6 + \xF0\x91\xA6\xA7 + \xF0\x91\xA6\xAA + \xF0\x91\xA6\xAB + \xF0\x91\xA6\xAC + \xF0\x91\xA6\xAD + \xF0\x91\xA6\xAE + \xF0\x91\xA6\xAF + \xF0\x91\xA6\xB0 + \xF0\x91\xA6\xB1 + \xF0\x91\xA6\xB2 + \xF0\x91\xA6\xB3 + \xF0\x91\xA6\xB4 + \xF0\x91\xA6\xB5 + \xF0\x91\xA6\xB6 + \xF0\x91\xA6\xB7 + \xF0\x91\xA6\xB8 + \xF0\x91\xA6\xB9 + \xF0\x91\xA6\xBA + \xF0\x91\xA6\xBB + \xF0\x91\xA6\xBC + \xF0\x91\xA6\xBD + \xF0\x91\xA6\xBE + \xF0\x91\xA6\xBF + \xF0\x91\xA7\x80 + \xF0\x91\xA7\x81 + \xF0\x91\xA7\x82 + \xF0\x91\xA7\x83 + \xF0\x91\xA7\x84 + \xF0\x91\xA7\x85 + \xF0\x91\xA7\x86 + \xF0\x91\xA7\x87 + \xF0\x91\xA7\x88 + \xF0\x91\xA7\x89 + \xF0\x91\xA7\x8A + \xF0\x91\xA7\x8B + \xF0\x91\xA7\x8C + \xF0\x91\xA7\x8D + \xF0\x91\xA7\x8E + \xF0\x91\xA7\x8F + \xF0\x91\xA7\x90 + \xF0\x91\xA7\x91 + \xF0\x91\xA7\x92 + \xF0\x91\xA7\x93 + \xF0\x91\xA7\x94 + \xF0\x91\xA7\x95 + \xF0\x91\xA7\x96 + \xF0\x91\xA7\x97 + \xF0\x91\xA7\x9A + \xF0\x91\xA7\x9B + \xF0\x91\xA7\x9C + \xF0\x91\xA7\x9D + \xF0\x91\xA7\x9E + \xF0\x91\xA7\x9F + \xF0\x91\xA7\xA0 + \xF0\x91\xA7\xA1 + \xF0\x91\xA7\xA2 + \xF0\x91\xA7\xA3 + \xF0\x91\xA7\xA4 \xF0\x91\xA8\x80 \xF0\x91\xA8\x81 \xF0\x91\xA8\x82 @@ -65821,6 +65944,8 @@ CHARMAP \xF0\x91\xAA\x81 \xF0\x91\xAA\x82 \xF0\x91\xAA\x83 + \xF0\x91\xAA\x84 + \xF0\x91\xAA\x85 \xF0\x91\xAA\x86 \xF0\x91\xAA\x87 \xF0\x91\xAA\x88 @@ -66235,6 +66360,57 @@ CHARMAP \xF0\x91\xBB\xB6 \xF0\x91\xBB\xB7 \xF0\x91\xBB\xB8 + \xF0\x91\xBF\x80 + \xF0\x91\xBF\x81 + \xF0\x91\xBF\x82 + \xF0\x91\xBF\x83 + \xF0\x91\xBF\x84 + \xF0\x91\xBF\x85 + \xF0\x91\xBF\x86 + \xF0\x91\xBF\x87 + \xF0\x91\xBF\x88 + \xF0\x91\xBF\x89 + \xF0\x91\xBF\x8A + \xF0\x91\xBF\x8B + \xF0\x91\xBF\x8C + \xF0\x91\xBF\x8D + \xF0\x91\xBF\x8E + \xF0\x91\xBF\x8F + \xF0\x91\xBF\x90 + \xF0\x91\xBF\x91 + \xF0\x91\xBF\x92 + \xF0\x91\xBF\x93 + \xF0\x91\xBF\x94 + \xF0\x91\xBF\x95 + \xF0\x91\xBF\x96 + \xF0\x91\xBF\x97 + \xF0\x91\xBF\x98 + \xF0\x91\xBF\x99 + \xF0\x91\xBF\x9A + \xF0\x91\xBF\x9B + \xF0\x91\xBF\x9C + \xF0\x91\xBF\x9D + \xF0\x91\xBF\x9E + \xF0\x91\xBF\x9F + \xF0\x91\xBF\xA0 + \xF0\x91\xBF\xA1 + \xF0\x91\xBF\xA2 + \xF0\x91\xBF\xA3 + \xF0\x91\xBF\xA4 + \xF0\x91\xBF\xA5 + \xF0\x91\xBF\xA6 + \xF0\x91\xBF\xA7 + \xF0\x91\xBF\xA8 + \xF0\x91\xBF\xA9 + \xF0\x91\xBF\xAA + \xF0\x91\xBF\xAB + \xF0\x91\xBF\xAC + \xF0\x91\xBF\xAD + \xF0\x91\xBF\xAE + \xF0\x91\xBF\xAF + \xF0\x91\xBF\xB0 + \xF0\x91\xBF\xB1 + \xF0\x91\xBF\xBF \xF0\x92\x80\x80 \xF0\x92\x80\x81 \xF0\x92\x80\x82 @@ -68540,6 +68716,15 @@ CHARMAP \xF0\x93\x90\xAC \xF0\x93\x90\xAD \xF0\x93\x90\xAE + \xF0\x93\x90\xB0 + \xF0\x93\x90\xB1 + \xF0\x93\x90\xB2 + \xF0\x93\x90\xB3 + \xF0\x93\x90\xB4 + \xF0\x93\x90\xB5 + \xF0\x93\x90\xB6 + \xF0\x93\x90\xB7 + \xF0\x93\x90\xB8 \xF0\x94\x90\x80 \xF0\x94\x90\x81 \xF0\x94\x90\x82 @@ -70058,6 +70243,13 @@ CHARMAP \xF0\x96\xBD\x82 \xF0\x96\xBD\x83 \xF0\x96\xBD\x84 + \xF0\x96\xBD\x85 + \xF0\x96\xBD\x86 + \xF0\x96\xBD\x87 + \xF0\x96\xBD\x88 + \xF0\x96\xBD\x89 + \xF0\x96\xBD\x8A + \xF0\x96\xBD\x8F \xF0\x96\xBD\x90 \xF0\x96\xBD\x91 \xF0\x96\xBD\x92 @@ -70105,6 +70297,15 @@ CHARMAP \xF0\x96\xBD\xBC \xF0\x96\xBD\xBD \xF0\x96\xBD\xBE + \xF0\x96\xBD\xBF + \xF0\x96\xBE\x80 + \xF0\x96\xBE\x81 + \xF0\x96\xBE\x82 + \xF0\x96\xBE\x83 + \xF0\x96\xBE\x84 + \xF0\x96\xBE\x85 + \xF0\x96\xBE\x86 + \xF0\x96\xBE\x87 \xF0\x96\xBE\x8F \xF0\x96\xBE\x90 \xF0\x96\xBE\x91 @@ -70124,6 +70325,8 @@ CHARMAP \xF0\x96\xBE\x9F \xF0\x96\xBF\xA0 \xF0\x96\xBF\xA1 + \xF0\x96\xBF\xA2 + \xF0\x96\xBF\xA3 \xF0\x97\x80\x80 \xF0\x97\x80\x81 \xF0\x97\x80\x82 @@ -76254,6 +76457,12 @@ CHARMAP \xF0\x98\x9F\xAF \xF0\x98\x9F\xB0 \xF0\x98\x9F\xB1 + \xF0\x98\x9F\xB2 + \xF0\x98\x9F\xB3 + \xF0\x98\x9F\xB4 + \xF0\x98\x9F\xB5 + \xF0\x98\x9F\xB6 + \xF0\x98\x9F\xB7 \xF0\x98\xA0\x80 \xF0\x98\xA0\x81 \xF0\x98\xA0\x82 @@ -77296,6 +77505,13 @@ CHARMAP \xF0\x9B\x84\x9C \xF0\x9B\x84\x9D \xF0\x9B\x84\x9E + \xF0\x9B\x85\x90 + \xF0\x9B\x85\x91 + \xF0\x9B\x85\x92 + \xF0\x9B\x85\xA4 + \xF0\x9B\x85\xA5 + \xF0\x9B\x85\xA6 + \xF0\x9B\x85\xA7 \xF0\x9B\x85\xB0 \xF0\x9B\x85\xB1 \xF0\x9B\x85\xB2 @@ -80224,6 +80440,136 @@ CHARMAP \xF0\x9E\x80\xA8 \xF0\x9E\x80\xA9 \xF0\x9E\x80\xAA + \xF0\x9E\x84\x80 + \xF0\x9E\x84\x81 + \xF0\x9E\x84\x82 + \xF0\x9E\x84\x83 + \xF0\x9E\x84\x84 + \xF0\x9E\x84\x85 + \xF0\x9E\x84\x86 + \xF0\x9E\x84\x87 + \xF0\x9E\x84\x88 + \xF0\x9E\x84\x89 + \xF0\x9E\x84\x8A + \xF0\x9E\x84\x8B + \xF0\x9E\x84\x8C + \xF0\x9E\x84\x8D + \xF0\x9E\x84\x8E + \xF0\x9E\x84\x8F + \xF0\x9E\x84\x90 + \xF0\x9E\x84\x91 + \xF0\x9E\x84\x92 + \xF0\x9E\x84\x93 + \xF0\x9E\x84\x94 + \xF0\x9E\x84\x95 + \xF0\x9E\x84\x96 + \xF0\x9E\x84\x97 + \xF0\x9E\x84\x98 + \xF0\x9E\x84\x99 + \xF0\x9E\x84\x9A + \xF0\x9E\x84\x9B + \xF0\x9E\x84\x9C + \xF0\x9E\x84\x9D + \xF0\x9E\x84\x9E + \xF0\x9E\x84\x9F + \xF0\x9E\x84\xA0 + \xF0\x9E\x84\xA1 + \xF0\x9E\x84\xA2 + \xF0\x9E\x84\xA3 + \xF0\x9E\x84\xA4 + \xF0\x9E\x84\xA5 + \xF0\x9E\x84\xA6 + \xF0\x9E\x84\xA7 + \xF0\x9E\x84\xA8 + \xF0\x9E\x84\xA9 + \xF0\x9E\x84\xAA + \xF0\x9E\x84\xAB + \xF0\x9E\x84\xAC + \xF0\x9E\x84\xB0 + \xF0\x9E\x84\xB1 + \xF0\x9E\x84\xB2 + \xF0\x9E\x84\xB3 + \xF0\x9E\x84\xB4 + \xF0\x9E\x84\xB5 + \xF0\x9E\x84\xB6 + \xF0\x9E\x84\xB7 + \xF0\x9E\x84\xB8 + \xF0\x9E\x84\xB9 + \xF0\x9E\x84\xBA + \xF0\x9E\x84\xBB + \xF0\x9E\x84\xBC + \xF0\x9E\x84\xBD + \xF0\x9E\x85\x80 + \xF0\x9E\x85\x81 + \xF0\x9E\x85\x82 + \xF0\x9E\x85\x83 + \xF0\x9E\x85\x84 + \xF0\x9E\x85\x85 + \xF0\x9E\x85\x86 + \xF0\x9E\x85\x87 + \xF0\x9E\x85\x88 + \xF0\x9E\x85\x89 + \xF0\x9E\x85\x8E + \xF0\x9E\x85\x8F + \xF0\x9E\x8B\x80 + \xF0\x9E\x8B\x81 + \xF0\x9E\x8B\x82 + \xF0\x9E\x8B\x83 + \xF0\x9E\x8B\x84 + \xF0\x9E\x8B\x85 + \xF0\x9E\x8B\x86 + \xF0\x9E\x8B\x87 + \xF0\x9E\x8B\x88 + \xF0\x9E\x8B\x89 + \xF0\x9E\x8B\x8A + \xF0\x9E\x8B\x8B + \xF0\x9E\x8B\x8C + \xF0\x9E\x8B\x8D + \xF0\x9E\x8B\x8E + \xF0\x9E\x8B\x8F + \xF0\x9E\x8B\x90 + \xF0\x9E\x8B\x91 + \xF0\x9E\x8B\x92 + \xF0\x9E\x8B\x93 + \xF0\x9E\x8B\x94 + \xF0\x9E\x8B\x95 + \xF0\x9E\x8B\x96 + \xF0\x9E\x8B\x97 + \xF0\x9E\x8B\x98 + \xF0\x9E\x8B\x99 + \xF0\x9E\x8B\x9A + \xF0\x9E\x8B\x9B + \xF0\x9E\x8B\x9C + \xF0\x9E\x8B\x9D + \xF0\x9E\x8B\x9E + \xF0\x9E\x8B\x9F + \xF0\x9E\x8B\xA0 + \xF0\x9E\x8B\xA1 + \xF0\x9E\x8B\xA2 + \xF0\x9E\x8B\xA3 + \xF0\x9E\x8B\xA4 + \xF0\x9E\x8B\xA5 + \xF0\x9E\x8B\xA6 + \xF0\x9E\x8B\xA7 + \xF0\x9E\x8B\xA8 + \xF0\x9E\x8B\xA9 + \xF0\x9E\x8B\xAA + \xF0\x9E\x8B\xAB + \xF0\x9E\x8B\xAC + \xF0\x9E\x8B\xAD + \xF0\x9E\x8B\xAE + \xF0\x9E\x8B\xAF + \xF0\x9E\x8B\xB0 + \xF0\x9E\x8B\xB1 + \xF0\x9E\x8B\xB2 + \xF0\x9E\x8B\xB3 + \xF0\x9E\x8B\xB4 + \xF0\x9E\x8B\xB5 + \xF0\x9E\x8B\xB6 + \xF0\x9E\x8B\xB7 + \xF0\x9E\x8B\xB8 + \xF0\x9E\x8B\xB9 + \xF0\x9E\x8B\xBF \xF0\x9E\xA0\x80 \xF0\x9E\xA0\x81 \xF0\x9E\xA0\x82 @@ -80512,6 +80858,7 @@ CHARMAP \xF0\x9E\xA5\x88 \xF0\x9E\xA5\x89 \xF0\x9E\xA5\x8A + \xF0\x9E\xA5\x8B \xF0\x9E\xA5\x90 \xF0\x9E\xA5\x91 \xF0\x9E\xA5\x92 @@ -80592,6 +80939,67 @@ CHARMAP \xF0\x9E\xB2\xB2 \xF0\x9E\xB2\xB3 \xF0\x9E\xB2\xB4 + \xF0\x9E\xB4\x81 + \xF0\x9E\xB4\x82 + \xF0\x9E\xB4\x83 + \xF0\x9E\xB4\x84 + \xF0\x9E\xB4\x85 + \xF0\x9E\xB4\x86 + \xF0\x9E\xB4\x87 + \xF0\x9E\xB4\x88 + \xF0\x9E\xB4\x89 + \xF0\x9E\xB4\x8A + \xF0\x9E\xB4\x8B + \xF0\x9E\xB4\x8C + \xF0\x9E\xB4\x8D + \xF0\x9E\xB4\x8E + \xF0\x9E\xB4\x8F + \xF0\x9E\xB4\x90 + \xF0\x9E\xB4\x91 + \xF0\x9E\xB4\x92 + \xF0\x9E\xB4\x93 + \xF0\x9E\xB4\x94 + \xF0\x9E\xB4\x95 + \xF0\x9E\xB4\x96 + \xF0\x9E\xB4\x97 + \xF0\x9E\xB4\x98 + \xF0\x9E\xB4\x99 + \xF0\x9E\xB4\x9A + \xF0\x9E\xB4\x9B + \xF0\x9E\xB4\x9C + \xF0\x9E\xB4\x9D + \xF0\x9E\xB4\x9E + \xF0\x9E\xB4\x9F + \xF0\x9E\xB4\xA0 + \xF0\x9E\xB4\xA1 + \xF0\x9E\xB4\xA2 + \xF0\x9E\xB4\xA3 + \xF0\x9E\xB4\xA4 + \xF0\x9E\xB4\xA5 + \xF0\x9E\xB4\xA6 + \xF0\x9E\xB4\xA7 + \xF0\x9E\xB4\xA8 + \xF0\x9E\xB4\xA9 + \xF0\x9E\xB4\xAA + \xF0\x9E\xB4\xAB + \xF0\x9E\xB4\xAC + \xF0\x9E\xB4\xAD + \xF0\x9E\xB4\xAE + \xF0\x9E\xB4\xAF + \xF0\x9E\xB4\xB0 + \xF0\x9E\xB4\xB1 + \xF0\x9E\xB4\xB2 + \xF0\x9E\xB4\xB3 + \xF0\x9E\xB4\xB4 + \xF0\x9E\xB4\xB5 + \xF0\x9E\xB4\xB6 + \xF0\x9E\xB4\xB7 + \xF0\x9E\xB4\xB8 + \xF0\x9E\xB4\xB9 + \xF0\x9E\xB4\xBA + \xF0\x9E\xB4\xBB + \xF0\x9E\xB4\xBC + \xF0\x9E\xB4\xBD \xF0\x9E\xB8\x80 \xF0\x9E\xB8\x81 \xF0\x9E\xB8\x82 @@ -81066,6 +81474,7 @@ CHARMAP \xF0\x9F\x85\xA9 \xF0\x9F\x85\xAA \xF0\x9F\x85\xAB + \xF0\x9F\x85\xAC \xF0\x9F\x85\xB0 \xF0\x9F\x85\xB1 \xF0\x9F\x85\xB2 @@ -82198,6 +82607,7 @@ CHARMAP \xF0\x9F\x9B\x92 \xF0\x9F\x9B\x93 \xF0\x9F\x9B\x94 + \xF0\x9F\x9B\x95 \xF0\x9F\x9B\xA0 \xF0\x9F\x9B\xA1 \xF0\x9F\x9B\xA2 @@ -82221,6 +82631,7 @@ CHARMAP \xF0\x9F\x9B\xB7 \xF0\x9F\x9B\xB8 \xF0\x9F\x9B\xB9 + \xF0\x9F\x9B\xBA \xF0\x9F\x9C\x80 \xF0\x9F\x9C\x81 \xF0\x9F\x9C\x82 @@ -82426,6 +82837,18 @@ CHARMAP \xF0\x9F\x9F\x96 \xF0\x9F\x9F\x97 \xF0\x9F\x9F\x98 + \xF0\x9F\x9F\xA0 + \xF0\x9F\x9F\xA1 + \xF0\x9F\x9F\xA2 + \xF0\x9F\x9F\xA3 + \xF0\x9F\x9F\xA4 + \xF0\x9F\x9F\xA5 + \xF0\x9F\x9F\xA6 + \xF0\x9F\x9F\xA7 + \xF0\x9F\x9F\xA8 + \xF0\x9F\x9F\xA9 + \xF0\x9F\x9F\xAA + \xF0\x9F\x9F\xAB \xF0\x9F\xA0\x80 \xF0\x9F\xA0\x81 \xF0\x9F\xA0\x82 @@ -82586,6 +83009,9 @@ CHARMAP \xF0\x9F\xA4\x89 \xF0\x9F\xA4\x8A \xF0\x9F\xA4\x8B + \xF0\x9F\xA4\x8D + \xF0\x9F\xA4\x8E + \xF0\x9F\xA4\x8F \xF0\x9F\xA4\x90 \xF0\x9F\xA4\x91 \xF0\x9F\xA4\x92 @@ -82633,6 +83059,7 @@ CHARMAP \xF0\x9F\xA4\xBC \xF0\x9F\xA4\xBD \xF0\x9F\xA4\xBE + \xF0\x9F\xA4\xBF \xF0\x9F\xA5\x80 \xF0\x9F\xA5\x81 \xF0\x9F\xA5\x82 @@ -82682,11 +83109,13 @@ CHARMAP \xF0\x9F\xA5\xAE \xF0\x9F\xA5\xAF \xF0\x9F\xA5\xB0 *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sat Aug 15 07:22:49 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 10DF13B12EA; Sat, 15 Aug 2020 07:22:49 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BTBbX6lnvz3TKR; Sat, 15 Aug 2020 07:22:48 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CB1071BBD4; Sat, 15 Aug 2020 07:22:48 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07F7MmfF058233; Sat, 15 Aug 2020 07:22:48 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07F7Mm3Z058232; Sat, 15 Aug 2020 07:22:48 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <202008150722.07F7Mm3Z058232@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sat, 15 Aug 2020 07:22:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org Subject: svn commit: r364246 - svnadmin/conf X-SVN-Group: svnadmin X-SVN-Commit-Author: hrs X-SVN-Commit-Paths: svnadmin/conf X-SVN-Commit-Revision: 364246 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 15 Aug 2020 07:22:49 -0000 Author: hrs Date: Sat Aug 15 07:22:48 2020 New Revision: 364246 URL: https://svnweb.freebsd.org/changeset/base/364246 Log: Revert r364244 since commit of r364245 completed. Modified: svnadmin/conf/sizelimit.conf Modified: svnadmin/conf/sizelimit.conf ============================================================================== --- svnadmin/conf/sizelimit.conf Sat Aug 15 07:19:37 2020 (r364245) +++ svnadmin/conf/sizelimit.conf Sat Aug 15 07:22:48 2020 (r364246) @@ -19,7 +19,6 @@ andrew bapt davidcs dim 20480000 -hrs imp jb jeff From owner-svn-src-all@freebsd.org Sat Aug 15 11:22:07 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CF1E13B60D9; Sat, 15 Aug 2020 11:22:07 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BTHvg57Cxz3gd0; Sat, 15 Aug 2020 11:22:07 +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 93E331E442; Sat, 15 Aug 2020 11:22:07 +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 07FBM73Y008791; Sat, 15 Aug 2020 11:22:07 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07FBM7sO008772; Sat, 15 Aug 2020 11:22:07 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008151122.07FBM7sO008772@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 15 Aug 2020 11:22:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364247 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 364247 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 15 Aug 2020 11:22:07 -0000 Author: tuexen Date: Sat Aug 15 11:22:07 2020 New Revision: 364247 URL: https://svnweb.freebsd.org/changeset/base/364247 Log: Enter epoch earlier. This is needed because we are exiting it also in error cases. MFC after: 1 week Modified: head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctputil.c ============================================================================== --- head/sys/netinet/sctputil.c Sat Aug 15 07:22:48 2020 (r364246) +++ head/sys/netinet/sctputil.c Sat Aug 15 11:22:07 2020 (r364247) @@ -1727,6 +1727,7 @@ sctp_timeout_handler(void *t) stcb = (struct sctp_tcb *)tmr->tcb; net = (struct sctp_nets *)tmr->net; CURVNET_SET((struct vnet *)tmr->vnet); + NET_EPOCH_ENTER(et); did_output = 1; released_asoc_reference = false; @@ -1786,7 +1787,6 @@ sctp_timeout_handler(void *t) /* Record in stopped_from which timeout occurred. */ tmr->stopped_from = type; - NET_EPOCH_ENTER(et); /* mark as being serviced now */ if (SCTP_OS_TIMER_PENDING(&tmr->timer)) { /* From owner-svn-src-all@freebsd.org Sat Aug 15 11:27:25 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 46D6E3B6901; Sat, 15 Aug 2020 11:27:25 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BTJ1n1Rr6z3y1M; Sat, 15 Aug 2020 11:27:25 +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 14CB41E894; Sat, 15 Aug 2020 11:27:25 +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 07FBRPnY009364; Sat, 15 Aug 2020 11:27:25 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07FBRMwr009350; Sat, 15 Aug 2020 11:27:22 GMT (envelope-from dim@FreeBSD.org) Message-Id: <202008151127.07FBRMwr009350@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 15 Aug 2020 11:27:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r364248 - in vendor/llvm-project/release-11.x: clang/lib/AST clang/lib/Serialization compiler-rt/lib/profile lld/ELF llvm/include/llvm llvm/lib/Analysis llvm/lib/CodeGen llvm/lib/CodeGe... X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in vendor/llvm-project/release-11.x: clang/lib/AST clang/lib/Serialization compiler-rt/lib/profile lld/ELF llvm/include/llvm llvm/lib/Analysis llvm/lib/CodeGen llvm/lib/CodeGen/GlobalISel llvm/lib/Exe... X-SVN-Commit-Revision: 364248 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 15 Aug 2020 11:27:25 -0000 Author: dim Date: Sat Aug 15 11:27:21 2020 New Revision: 364248 URL: https://svnweb.freebsd.org/changeset/base/364248 Log: Vendor import of llvm-project branch release/11.x llvmorg-11.0.0-rc1-47-gff47911ddfc. Modified: vendor/llvm-project/release-11.x/clang/lib/AST/ExprConstant.cpp vendor/llvm-project/release-11.x/clang/lib/Serialization/ASTReaderDecl.cpp vendor/llvm-project/release-11.x/compiler-rt/lib/profile/InstrProfilingPort.h vendor/llvm-project/release-11.x/lld/ELF/InputSection.cpp vendor/llvm-project/release-11.x/llvm/include/llvm/module.modulemap vendor/llvm-project/release-11.x/llvm/lib/Analysis/LoopAccessAnalysis.cpp vendor/llvm-project/release-11.x/llvm/lib/CodeGen/AtomicExpandPass.cpp vendor/llvm-project/release-11.x/llvm/lib/CodeGen/GlobalISel/InlineAsmLowering.cpp vendor/llvm-project/release-11.x/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp vendor/llvm-project/release-11.x/llvm/lib/Target/AArch64/MCTargetDesc/AArch64WinCOFFObjectWriter.cpp vendor/llvm-project/release-11.x/llvm/lib/Target/AMDGPU/AMDGPUAnnotateUniformValues.cpp vendor/llvm-project/release-11.x/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp vendor/llvm-project/release-11.x/llvm/lib/Target/PowerPC/PPCInstrInfo.h vendor/llvm-project/release-11.x/openmp/runtime/src/kmp_lock.cpp Modified: vendor/llvm-project/release-11.x/clang/lib/AST/ExprConstant.cpp ============================================================================== --- vendor/llvm-project/release-11.x/clang/lib/AST/ExprConstant.cpp Sat Aug 15 11:22:07 2020 (r364247) +++ vendor/llvm-project/release-11.x/clang/lib/AST/ExprConstant.cpp Sat Aug 15 11:27:21 2020 (r364248) @@ -8974,6 +8974,7 @@ bool PointerExprEvaluator::VisitCXXNewExpr(const CXXNe const Expr *Init = E->getInitializer(); const InitListExpr *ResizedArrayILE = nullptr; const CXXConstructExpr *ResizedArrayCCE = nullptr; + bool ValueInit = false; QualType AllocType = E->getAllocatedType(); if (Optional ArraySize = E->getArraySize()) { @@ -9017,7 +9018,14 @@ bool PointerExprEvaluator::VisitCXXNewExpr(const CXXNe // -- the new-initializer is a braced-init-list and the number of // array elements for which initializers are provided [...] // exceeds the number of elements to initialize - if (Init && !isa(Init)) { + if (!Init) { + // No initialization is performed. + } else if (isa(Init) || + isa(Init)) { + ValueInit = true; + } else if (auto *CCE = dyn_cast(Init)) { + ResizedArrayCCE = CCE; + } else { auto *CAT = Info.Ctx.getAsConstantArrayType(Init->getType()); assert(CAT && "unexpected type for array initializer"); @@ -9040,8 +9048,6 @@ bool PointerExprEvaluator::VisitCXXNewExpr(const CXXNe // special handling for this case when we initialize. if (InitBound != AllocBound) ResizedArrayILE = cast(Init); - } else if (Init) { - ResizedArrayCCE = cast(Init); } AllocType = Info.Ctx.getConstantArrayType(AllocType, ArrayBound, nullptr, @@ -9102,7 +9108,11 @@ bool PointerExprEvaluator::VisitCXXNewExpr(const CXXNe return false; } - if (ResizedArrayILE) { + if (ValueInit) { + ImplicitValueInitExpr VIE(AllocType); + if (!EvaluateInPlace(*Val, Info, Result, &VIE)) + return false; + } else if (ResizedArrayILE) { if (!EvaluateArrayNewInitList(Info, Result, *Val, ResizedArrayILE, AllocType)) return false; Modified: vendor/llvm-project/release-11.x/clang/lib/Serialization/ASTReaderDecl.cpp ============================================================================== --- vendor/llvm-project/release-11.x/clang/lib/Serialization/ASTReaderDecl.cpp Sat Aug 15 11:22:07 2020 (r364247) +++ vendor/llvm-project/release-11.x/clang/lib/Serialization/ASTReaderDecl.cpp Sat Aug 15 11:27:21 2020 (r364248) @@ -2912,9 +2912,11 @@ static bool isSameTemplateParameter(const NamedDecl *X return false; if (TX->hasTypeConstraint() != TY->hasTypeConstraint()) return false; - if (TX->hasTypeConstraint()) { - const TypeConstraint *TXTC = TX->getTypeConstraint(); - const TypeConstraint *TYTC = TY->getTypeConstraint(); + const TypeConstraint *TXTC = TX->getTypeConstraint(); + const TypeConstraint *TYTC = TY->getTypeConstraint(); + if (!TXTC != !TYTC) + return false; + if (TXTC && TYTC) { if (TXTC->getNamedConcept() != TYTC->getNamedConcept()) return false; if (TXTC->hasExplicitTemplateArgs() != TYTC->hasExplicitTemplateArgs()) Modified: vendor/llvm-project/release-11.x/compiler-rt/lib/profile/InstrProfilingPort.h ============================================================================== --- vendor/llvm-project/release-11.x/compiler-rt/lib/profile/InstrProfilingPort.h Sat Aug 15 11:22:07 2020 (r364247) +++ vendor/llvm-project/release-11.x/compiler-rt/lib/profile/InstrProfilingPort.h Sat Aug 15 11:27:21 2020 (r364248) @@ -53,9 +53,9 @@ #endif #if COMPILER_RT_HAS_ATOMICS == 1 -#ifdef _MSC_VER +#ifdef _WIN32 #include -#if _MSC_VER < 1900 +#if defined(_MSC_VER) && _MSC_VER < 1900 #define snprintf _snprintf #endif #if defined(_WIN64) @@ -73,7 +73,7 @@ (DomType *)InterlockedExchangeAdd((LONG volatile *)&PtrVar, \ (LONG)sizeof(DomType) * PtrIncr) #endif -#else /* !defined(_MSC_VER) */ +#else /* !defined(_WIN32) */ #define COMPILER_RT_BOOL_CMPXCHG(Ptr, OldV, NewV) \ __sync_bool_compare_and_swap(Ptr, OldV, NewV) #define COMPILER_RT_PTR_FETCH_ADD(DomType, PtrVar, PtrIncr) \ Modified: vendor/llvm-project/release-11.x/lld/ELF/InputSection.cpp ============================================================================== --- vendor/llvm-project/release-11.x/lld/ELF/InputSection.cpp Sat Aug 15 11:22:07 2020 (r364247) +++ vendor/llvm-project/release-11.x/lld/ELF/InputSection.cpp Sat Aug 15 11:27:21 2020 (r364248) @@ -938,14 +938,17 @@ void InputSection::relocateNonAlloc(uint8_t *buf, Arra // the folded-in function, so exclude .debug_line. // // For pre-DWARF-v5 .debug_loc and .debug_ranges, -1 is a reserved value - // (base address selection entry), so -2 is used. + // (base address selection entry), use 1 (which is used by GNU ld for + // .debug_ranges). + // + // TODO To reduce disruption, we use 0 instead of -1 as the tombstone + // value. Enable -1 in a future release. auto *ds = dyn_cast(&sym); if (!sym.getOutputSection() || (ds && ds->section->repl != ds->section && !isDebugLine)) { // If -z dead-reloc-in-nonalloc= is specified, respect it. - const uint64_t value = - tombstone ? SignExtend64(*tombstone) - : (isDebugLocOrRanges ? UINT64_MAX - 1 : UINT64_MAX); + const uint64_t value = tombstone ? SignExtend64(*tombstone) + : (isDebugLocOrRanges ? 1 : 0); target->relocateNoSym(bufLoc, type, value); continue; } Modified: vendor/llvm-project/release-11.x/llvm/include/llvm/module.modulemap ============================================================================== --- vendor/llvm-project/release-11.x/llvm/include/llvm/module.modulemap Sat Aug 15 11:22:07 2020 (r364247) +++ vendor/llvm-project/release-11.x/llvm/include/llvm/module.modulemap Sat Aug 15 11:27:21 2020 (r364248) @@ -388,7 +388,7 @@ module LLVM_Utils { umbrella "Support" module * { export * } - + // Exclude this; it should only be used on Windows. exclude header "Support/Windows/WindowsSupport.h" @@ -397,8 +397,9 @@ module LLVM_Utils { exclude header "Support/Solaris/sys/regset.h" // These are intended for textual inclusion. - textual header "Support/ARMTargetParser.def" textual header "Support/AArch64TargetParser.def" + textual header "Support/ARMTargetParser.def" + textual header "Support/RISCVTargetParser.def" textual header "Support/TargetOpcodes.def" textual header "Support/X86TargetParser.def" } Modified: vendor/llvm-project/release-11.x/llvm/lib/Analysis/LoopAccessAnalysis.cpp ============================================================================== --- vendor/llvm-project/release-11.x/llvm/lib/Analysis/LoopAccessAnalysis.cpp Sat Aug 15 11:22:07 2020 (r364247) +++ vendor/llvm-project/release-11.x/llvm/lib/Analysis/LoopAccessAnalysis.cpp Sat Aug 15 11:27:21 2020 (r364248) @@ -393,7 +393,10 @@ void RuntimePointerChecking::groupChecks( // equivalence class, the iteration order is deterministic. for (auto MI = DepCands.member_begin(LeaderI), ME = DepCands.member_end(); MI != ME; ++MI) { - unsigned Pointer = PositionMap[MI->getPointer()]; + auto PointerI = PositionMap.find(MI->getPointer()); + assert(PointerI != PositionMap.end() && + "pointer in equivalence class not found in PositionMap"); + unsigned Pointer = PointerI->second; bool Merged = false; // Mark this pointer as seen. Seen.insert(Pointer); @@ -726,52 +729,55 @@ bool AccessAnalysis::canCheckPtrAtRT(RuntimePointerChe SmallVector Retries; + // First, count how many write and read accesses are in the alias set. Also + // collect MemAccessInfos for later. + SmallVector AccessInfos; for (auto A : AS) { Value *Ptr = A.getValue(); bool IsWrite = Accesses.count(MemAccessInfo(Ptr, true)); - MemAccessInfo Access(Ptr, IsWrite); if (IsWrite) ++NumWritePtrChecks; else ++NumReadPtrChecks; + AccessInfos.emplace_back(Ptr, IsWrite); + } + // We do not need runtime checks for this alias set, if there are no writes + // or a single write and no reads. + if (NumWritePtrChecks == 0 || + (NumWritePtrChecks == 1 && NumReadPtrChecks == 0)) { + assert((AS.size() <= 1 || + all_of(AS, + [this](auto AC) { + MemAccessInfo AccessWrite(AC.getValue(), true); + return DepCands.findValue(AccessWrite) == DepCands.end(); + })) && + "Can only skip updating CanDoRT below, if all entries in AS " + "are reads or there is at most 1 entry"); + continue; + } + + for (auto &Access : AccessInfos) { if (!createCheckForAccess(RtCheck, Access, StridesMap, DepSetId, TheLoop, RunningDepId, ASId, ShouldCheckWrap, false)) { - LLVM_DEBUG(dbgs() << "LAA: Can't find bounds for ptr:" << *Ptr << '\n'); + LLVM_DEBUG(dbgs() << "LAA: Can't find bounds for ptr:" + << *Access.getPointer() << '\n'); Retries.push_back(Access); CanDoAliasSetRT = false; } } - // If we have at least two writes or one write and a read then we need to - // check them. But there is no need to checks if there is only one - // dependence set for this alias set. - // // Note that this function computes CanDoRT and MayNeedRTCheck // independently. For example CanDoRT=false, MayNeedRTCheck=false means that // we have a pointer for which we couldn't find the bounds but we don't // actually need to emit any checks so it does not matter. - bool NeedsAliasSetRTCheck = false; - if (!(IsDepCheckNeeded && CanDoAliasSetRT && RunningDepId == 2)) { - NeedsAliasSetRTCheck = (NumWritePtrChecks >= 2 || - (NumReadPtrChecks >= 1 && NumWritePtrChecks >= 1)); - // For alias sets without at least 2 writes or 1 write and 1 read, there - // is no need to generate RT checks and CanDoAliasSetRT for this alias set - // does not impact whether runtime checks can be generated. - if (!NeedsAliasSetRTCheck) { - assert((AS.size() <= 1 || - all_of(AS, - [this](auto AC) { - MemAccessInfo AccessWrite(AC.getValue(), true); - return DepCands.findValue(AccessWrite) == - DepCands.end(); - })) && - "Can only skip updating CanDoRT below, if all entries in AS " - "are reads or there is at most 1 entry"); - continue; - } - } + // + // We need runtime checks for this alias set, if there are at least 2 + // dependence sets (in which case RunningDepId > 2) or if we need to re-try + // any bound checks (because in that case the number of dependence sets is + // incomplete). + bool NeedsAliasSetRTCheck = RunningDepId > 2 || !Retries.empty(); // We need to perform run-time alias checks, but some pointers had bounds // that couldn't be checked. Modified: vendor/llvm-project/release-11.x/llvm/lib/CodeGen/AtomicExpandPass.cpp ============================================================================== --- vendor/llvm-project/release-11.x/llvm/lib/CodeGen/AtomicExpandPass.cpp Sat Aug 15 11:22:07 2020 (r364247) +++ vendor/llvm-project/release-11.x/llvm/lib/CodeGen/AtomicExpandPass.cpp Sat Aug 15 11:27:21 2020 (r364248) @@ -1239,7 +1239,8 @@ bool AtomicExpand::expandAtomicCmpXchg(AtomicCmpXchgIn Value *NewValueInsert = insertMaskedValue(Builder, LoadedTryStore, CI->getNewValOperand(), PMV); Value *StoreSuccess = - TLI->emitStoreConditional(Builder, NewValueInsert, Addr, MemOpOrder); + TLI->emitStoreConditional(Builder, NewValueInsert, PMV.AlignedAddr, + MemOpOrder); StoreSuccess = Builder.CreateICmpEQ( StoreSuccess, ConstantInt::get(Type::getInt32Ty(Ctx), 0), "success"); BasicBlock *RetryBB = HasReleasedLoadBB ? ReleasedLoadBB : StartBB; Modified: vendor/llvm-project/release-11.x/llvm/lib/CodeGen/GlobalISel/InlineAsmLowering.cpp ============================================================================== --- vendor/llvm-project/release-11.x/llvm/lib/CodeGen/GlobalISel/InlineAsmLowering.cpp Sat Aug 15 11:22:07 2020 (r364247) +++ vendor/llvm-project/release-11.x/llvm/lib/CodeGen/GlobalISel/InlineAsmLowering.cpp Sat Aug 15 11:27:21 2020 (r364248) @@ -455,19 +455,23 @@ bool InlineAsmLowering::lowerInlineAsm( unsigned DefRegIdx = InstFlagIdx + 1; Register Def = Inst->getOperand(DefRegIdx).getReg(); - // Copy input to new vreg with same reg class as Def - const TargetRegisterClass *RC = MRI->getRegClass(Def); ArrayRef SrcRegs = GetOrCreateVRegs(*OpInfo.CallOperandVal); assert(SrcRegs.size() == 1 && "Single register is expected here"); - Register Tmp = MRI->createVirtualRegister(RC); - if (!buildAnyextOrCopy(Tmp, SrcRegs[0], MIRBuilder)) - return false; - // Add Flag and input register operand (Tmp) to Inst. Tie Tmp to Def. + // When Def is physreg: use given input. + Register In = SrcRegs[0]; + // When Def is vreg: copy input to new vreg with same reg class as Def. + if (Def.isVirtual()) { + In = MRI->createVirtualRegister(MRI->getRegClass(Def)); + if (!buildAnyextOrCopy(In, SrcRegs[0], MIRBuilder)) + return false; + } + + // Add Flag and input register operand (In) to Inst. Tie In to Def. unsigned UseFlag = InlineAsm::getFlagWord(InlineAsm::Kind_RegUse, 1); unsigned Flag = InlineAsm::getFlagWordForMatchingOp(UseFlag, DefIdx); Inst.addImm(Flag); - Inst.addReg(Tmp); + Inst.addReg(In); Inst->tieOperands(DefRegIdx, Inst->getNumOperands() - 1); break; } Modified: vendor/llvm-project/release-11.x/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp ============================================================================== --- vendor/llvm-project/release-11.x/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp Sat Aug 15 11:22:07 2020 (r364247) +++ vendor/llvm-project/release-11.x/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp Sat Aug 15 11:27:21 2020 (r364248) @@ -269,7 +269,7 @@ void RuntimeDyldELF::resolveX86_64Relocation(const Sec uint64_t SymOffset) { switch (Type) { default: - llvm_unreachable("Relocation type not implemented yet!"); + report_fatal_error("Relocation type not implemented yet!"); break; case ELF::R_X86_64_NONE: break; @@ -359,7 +359,7 @@ void RuntimeDyldELF::resolveX86Relocation(const Sectio default: // There are other relocation types, but it appears these are the // only ones currently used by the LLVM ELF object writer - llvm_unreachable("Relocation type not implemented yet!"); + report_fatal_error("Relocation type not implemented yet!"); break; } } @@ -382,7 +382,7 @@ void RuntimeDyldELF::resolveAArch64Relocation(const Se switch (Type) { default: - llvm_unreachable("Relocation type not implemented yet!"); + report_fatal_error("Relocation type not implemented yet!"); break; case ELF::R_AARCH64_ABS16: { uint64_t Result = Value + Addend; @@ -721,7 +721,7 @@ void RuntimeDyldELF::resolvePPC32Relocation(const Sect uint8_t *LocalAddress = Section.getAddressWithOffset(Offset); switch (Type) { default: - llvm_unreachable("Relocation type not implemented yet!"); + report_fatal_error("Relocation type not implemented yet!"); break; case ELF::R_PPC_ADDR16_LO: writeInt16BE(LocalAddress, applyPPClo(Value + Addend)); @@ -741,7 +741,7 @@ void RuntimeDyldELF::resolvePPC64Relocation(const Sect uint8_t *LocalAddress = Section.getAddressWithOffset(Offset); switch (Type) { default: - llvm_unreachable("Relocation type not implemented yet!"); + report_fatal_error("Relocation type not implemented yet!"); break; case ELF::R_PPC64_ADDR16: writeInt16BE(LocalAddress, applyPPClo(Value + Addend)); @@ -835,7 +835,7 @@ void RuntimeDyldELF::resolveSystemZRelocation(const Se uint8_t *LocalAddress = Section.getAddressWithOffset(Offset); switch (Type) { default: - llvm_unreachable("Relocation type not implemented yet!"); + report_fatal_error("Relocation type not implemented yet!"); break; case ELF::R_390_PC16DBL: case ELF::R_390_PLT16DBL: { @@ -890,7 +890,7 @@ void RuntimeDyldELF::resolveBPFRelocation(const Sectio switch (Type) { default: - llvm_unreachable("Relocation type not implemented yet!"); + report_fatal_error("Relocation type not implemented yet!"); break; case ELF::R_BPF_NONE: break; Modified: vendor/llvm-project/release-11.x/llvm/lib/Target/AArch64/MCTargetDesc/AArch64WinCOFFObjectWriter.cpp ============================================================================== --- vendor/llvm-project/release-11.x/llvm/lib/Target/AArch64/MCTargetDesc/AArch64WinCOFFObjectWriter.cpp Sat Aug 15 11:22:07 2020 (r364247) +++ vendor/llvm-project/release-11.x/llvm/lib/Target/AArch64/MCTargetDesc/AArch64WinCOFFObjectWriter.cpp Sat Aug 15 11:27:21 2020 (r364248) @@ -11,6 +11,7 @@ #include "llvm/ADT/Twine.h" #include "llvm/BinaryFormat/COFF.h" #include "llvm/MC/MCAsmBackend.h" +#include "llvm/MC/MCContext.h" #include "llvm/MC/MCExpr.h" #include "llvm/MC/MCFixup.h" #include "llvm/MC/MCFixupKindInfo.h" @@ -48,10 +49,33 @@ unsigned AArch64WinCOFFObjectWriter::getRelocType( : Target.getSymA()->getKind(); const MCExpr *Expr = Fixup.getValue(); + if (const AArch64MCExpr *A64E = dyn_cast(Expr)) { + AArch64MCExpr::VariantKind RefKind = A64E->getKind(); + switch (AArch64MCExpr::getSymbolLoc(RefKind)) { + case AArch64MCExpr::VK_ABS: + case AArch64MCExpr::VK_SECREL: + // Supported + break; + default: + Ctx.reportError(Fixup.getLoc(), "relocation variant " + + A64E->getVariantKindName() + + " unsupported on COFF targets"); + return COFF::IMAGE_REL_ARM64_ABSOLUTE; // Dummy return value + } + } + switch (static_cast(Fixup.getKind())) { default: { - const MCFixupKindInfo &Info = MAB.getFixupKindInfo(Fixup.getKind()); - report_fatal_error(Twine("unsupported relocation type: ") + Info.Name); + if (const AArch64MCExpr *A64E = dyn_cast(Expr)) { + Ctx.reportError(Fixup.getLoc(), "relocation type " + + A64E->getVariantKindName() + + " unsupported on COFF targets"); + } else { + const MCFixupKindInfo &Info = MAB.getFixupKindInfo(Fixup.getKind()); + Ctx.reportError(Fixup.getLoc(), Twine("relocation type ") + Info.Name + + " unsupported on COFF targets"); + } + return COFF::IMAGE_REL_ARM64_ABSOLUTE; // Dummy return value } case FK_Data_4: Modified: vendor/llvm-project/release-11.x/llvm/lib/Target/AMDGPU/AMDGPUAnnotateUniformValues.cpp ============================================================================== --- vendor/llvm-project/release-11.x/llvm/lib/Target/AMDGPU/AMDGPUAnnotateUniformValues.cpp Sat Aug 15 11:22:07 2020 (r364247) +++ vendor/llvm-project/release-11.x/llvm/lib/Target/AMDGPU/AMDGPUAnnotateUniformValues.cpp Sat Aug 15 11:27:21 2020 (r364248) @@ -131,10 +131,20 @@ void AMDGPUAnnotateUniformValues::visitLoadInst(LoadIn // We're tracking up to the Function boundaries, and cannot go beyond because // of FunctionPass restrictions. We can ensure that is memory not clobbered // for memory operations that are live in to entry points only. - bool NotClobbered = isEntryFunc && !isClobberedInFunction(&I); Instruction *PtrI = dyn_cast(Ptr); - if (!PtrI && NotClobbered && isGlobalLoad(I)) { - if (isa(Ptr) || isa(Ptr)) { + + if (!isEntryFunc) { + if (PtrI) + setUniformMetadata(PtrI); + return; + } + + bool NotClobbered = false; + if (PtrI) + NotClobbered = !isClobberedInFunction(&I); + else if (isa(Ptr) || isa(Ptr)) { + if (isGlobalLoad(I) && !isClobberedInFunction(&I)) { + NotClobbered = true; // Lookup for the existing GEP if (noClobberClones.count(Ptr)) { PtrI = noClobberClones[Ptr]; Modified: vendor/llvm-project/release-11.x/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp ============================================================================== --- vendor/llvm-project/release-11.x/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp Sat Aug 15 11:22:07 2020 (r364247) +++ vendor/llvm-project/release-11.x/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp Sat Aug 15 11:27:21 2020 (r364248) @@ -2655,6 +2655,15 @@ const unsigned *PPCInstrInfo::getLoadOpcodesForSpillAr void PPCInstrInfo::fixupIsDeadOrKill(MachineInstr &StartMI, MachineInstr &EndMI, unsigned RegNo) const { + // Conservatively clear kill flag for the register if the instructions are in + // different basic blocks and in SSA form, because the kill flag may no longer + // be right. There is no need to bother with dead flags since defs with no + // uses will be handled by DCE. + MachineRegisterInfo &MRI = StartMI.getParent()->getParent()->getRegInfo(); + if (MRI.isSSA() && (StartMI.getParent() != EndMI.getParent())) { + MRI.clearKillFlags(RegNo); + return; + } // Instructions between [StartMI, EndMI] should be in same basic block. assert((StartMI.getParent() == EndMI.getParent()) && Modified: vendor/llvm-project/release-11.x/llvm/lib/Target/PowerPC/PPCInstrInfo.h ============================================================================== --- vendor/llvm-project/release-11.x/llvm/lib/Target/PowerPC/PPCInstrInfo.h Sat Aug 15 11:22:07 2020 (r364247) +++ vendor/llvm-project/release-11.x/llvm/lib/Target/PowerPC/PPCInstrInfo.h Sat Aug 15 11:27:21 2020 (r364248) @@ -565,14 +565,18 @@ class PPCInstrInfo : public PPCGenInstrInfo { (public) int64_t OffsetImm) const; /// Fixup killed/dead flag for register \p RegNo between instructions [\p - /// StartMI, \p EndMI]. Some PostRA transformations may violate register - /// killed/dead flags semantics, this function can be called to fix up. Before - /// calling this function, + /// StartMI, \p EndMI]. Some pre-RA or post-RA transformations may violate + /// register killed/dead flags semantics, this function can be called to fix + /// up. Before calling this function, /// 1. Ensure that \p RegNo liveness is killed after instruction \p EndMI. /// 2. Ensure that there is no new definition between (\p StartMI, \p EndMI) /// and possible definition for \p RegNo is \p StartMI or \p EndMI. - /// 3. Ensure that all instructions between [\p StartMI, \p EndMI] are in same - /// basic block. + /// 3. We can do accurate fixup for the case when all instructions between + /// [\p StartMI, \p EndMI] are in same basic block. + /// 4. For the case when \p StartMI and \p EndMI are not in same basic block, + /// we conservatively clear kill flag for all uses of \p RegNo for pre-RA + /// and for post-RA, we give an assertion as without reaching definition + /// analysis post-RA, \p StartMI and \p EndMI are hard to keep right. void fixupIsDeadOrKill(MachineInstr &StartMI, MachineInstr &EndMI, unsigned RegNo) const; void replaceInstrWithLI(MachineInstr &MI, const LoadImmediateInfo &LII) const; Modified: vendor/llvm-project/release-11.x/openmp/runtime/src/kmp_lock.cpp ============================================================================== --- vendor/llvm-project/release-11.x/openmp/runtime/src/kmp_lock.cpp Sat Aug 15 11:22:07 2020 (r364247) +++ vendor/llvm-project/release-11.x/openmp/runtime/src/kmp_lock.cpp Sat Aug 15 11:27:21 2020 (r364248) @@ -1706,7 +1706,8 @@ static void __kmp_set_queuing_lock_flags(kmp_queuing_l #if (KMP_COMPILER_ICC && __INTEL_COMPILER >= 1300) || \ (KMP_COMPILER_MSVC && _MSC_VER >= 1700) || \ - (KMP_COMPILER_CLANG && KMP_MSVC_COMPAT) + (KMP_COMPILER_CLANG && (KMP_MSVC_COMPAT || __MINGW32__)) || \ + (KMP_COMPILER_GCC && __MINGW32__) #include #define SOFT_ABORT_MASK (_XABORT_RETRY | _XABORT_CONFLICT | _XABORT_EXPLICIT) From owner-svn-src-all@freebsd.org Sat Aug 15 11:28:01 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D90613B68B4; Sat, 15 Aug 2020 11:28:01 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BTJ2T5N9zz3yCX; Sat, 15 Aug 2020 11:28:01 +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 84EA21E829; Sat, 15 Aug 2020 11:28:01 +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 07FBS1M1009463; Sat, 15 Aug 2020 11:28:01 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07FBS1no009462; Sat, 15 Aug 2020 11:28:01 GMT (envelope-from dim@FreeBSD.org) Message-Id: <202008151128.07FBS1no009462@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 15 Aug 2020 11:28:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r364249 - vendor/llvm-project/llvmorg-11.0.0-rc1-47-gff47911ddfc X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/llvm-project/llvmorg-11.0.0-rc1-47-gff47911ddfc X-SVN-Commit-Revision: 364249 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 15 Aug 2020 11:28:01 -0000 Author: dim Date: Sat Aug 15 11:28:01 2020 New Revision: 364249 URL: https://svnweb.freebsd.org/changeset/base/364249 Log: Tag llvm-project branch release/11.x llvmorg-11.0.0-rc1-47-gff47911ddfc. Added: vendor/llvm-project/llvmorg-11.0.0-rc1-47-gff47911ddfc/ - copied from r364248, vendor/llvm-project/release-11.x/ From owner-svn-src-all@freebsd.org Sat Aug 15 11:37:45 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 79F743B7146; Sat, 15 Aug 2020 11:37:45 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BTJFj2Rxqz3yfm; Sat, 15 Aug 2020 11:37:45 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 32ED41EC07; Sat, 15 Aug 2020 11:37:45 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07FBbjWO015393; Sat, 15 Aug 2020 11:37:45 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07FBbisc015389; Sat, 15 Aug 2020 11:37:44 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <202008151137.07FBbisc015389@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Sat, 15 Aug 2020 11:37:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364250 - in head/sys: net netinet6 X-SVN-Group: head X-SVN-Commit-Author: melifaro X-SVN-Commit-Paths: in head/sys: net netinet6 X-SVN-Commit-Revision: 364250 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 15 Aug 2020 11:37:45 -0000 Author: melifaro Date: Sat Aug 15 11:37:44 2020 New Revision: 364250 URL: https://svnweb.freebsd.org/changeset/base/364250 Log: Make net.inet6.ip6.deembed_scopeid behaviour default & remove sysctl. Submitted by: Neel Chauhan Differential Revision: https://reviews.freebsd.org/D25637 Modified: head/sys/net/rtsock.c head/sys/netinet6/in6.c head/sys/netinet6/scope6.c head/sys/netinet6/scope6_var.h Modified: head/sys/net/rtsock.c ============================================================================== --- head/sys/net/rtsock.c Sat Aug 15 11:28:01 2020 (r364249) +++ head/sys/net/rtsock.c Sat Aug 15 11:37:44 2020 (r364250) @@ -900,7 +900,7 @@ route_output(struct mbuf *m, struct socket *so, ...) error = lla_rt_output(rtm, &info); #ifdef INET6 if (error == 0) - rti_need_deembed = (V_deembed_scopeid) ? 1 : 0; + rti_need_deembed = 1; #endif goto flush; } @@ -915,7 +915,7 @@ route_output(struct mbuf *m, struct socket *so, ...) error = rib_action(fibnum, rtm->rtm_type, &info, &rc); if (error == 0) { #ifdef INET6 - rti_need_deembed = (V_deembed_scopeid) ? 1 : 0; + rti_need_deembed = 1; #endif rtm->rtm_index = rc.rc_nh_new->nh_ifp->if_index; nh = rc.rc_nh_new; @@ -930,7 +930,7 @@ route_output(struct mbuf *m, struct socket *so, ...) } #ifdef INET6 /* rt_msg2() will not be used when RTM_DELETE fails. */ - rti_need_deembed = (V_deembed_scopeid) ? 1 : 0; + rti_need_deembed = 1; #endif break; @@ -1192,7 +1192,7 @@ rtsock_msg_mbuf(int type, struct rt_addrinfo *rtinfo) rtinfo->rti_addrs |= (1 << i); dlen = SA_SIZE(sa); #ifdef INET6 - if (V_deembed_scopeid && sa->sa_family == AF_INET6) { + if (sa->sa_family == AF_INET6) { sin6 = (struct sockaddr_in6 *)&ss; bcopy(sa, sin6, sizeof(*sin6)); if (sa6_recoverscope(sin6) == 0) @@ -1298,7 +1298,7 @@ rtsock_msg_buffer(int type, struct rt_addrinfo *rtinfo dlen = SA_SIZE(sa); if (cp != NULL && buflen >= dlen) { #ifdef INET6 - if (V_deembed_scopeid && sa->sa_family == AF_INET6) { + if (sa->sa_family == AF_INET6) { sin6 = (struct sockaddr_in6 *)&ss; bcopy(sa, sin6, sizeof(*sin6)); if (sa6_recoverscope(sin6) == 0) Modified: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Sat Aug 15 11:28:01 2020 (r364249) +++ head/sys/netinet6/in6.c Sat Aug 15 11:37:44 2020 (r364250) @@ -2374,8 +2374,7 @@ in6_lltable_dump_entry(struct lltable *llt, struct lle ndpc.rtm.rtm_type = RTM_GET; ndpc.rtm.rtm_flags = RTF_UP; ndpc.rtm.rtm_addrs = RTA_DST | RTA_GATEWAY; - if (V_deembed_scopeid) - sa6_recoverscope(&ndpc.sin6); + sa6_recoverscope(&ndpc.sin6); /* publish */ if (lle->la_flags & LLE_PUB) Modified: head/sys/netinet6/scope6.c ============================================================================== --- head/sys/netinet6/scope6.c Sat Aug 15 11:28:01 2020 (r364249) +++ head/sys/netinet6/scope6.c Sat Aug 15 11:37:44 2020 (r364250) @@ -60,11 +60,7 @@ VNET_DEFINE(int, ip6_use_defzone) = 1; #else VNET_DEFINE(int, ip6_use_defzone) = 0; #endif -VNET_DEFINE(int, deembed_scopeid) = 1; SYSCTL_DECL(_net_inet6_ip6); -SYSCTL_INT(_net_inet6_ip6, OID_AUTO, deembed_scopeid, CTLFLAG_VNET | CTLFLAG_RW, - &VNET_NAME(deembed_scopeid), 0, - "Extract embedded zone ID and set it to sin6_scope_id in sockaddr_in6."); /* * The scope6_lock protects the global sid default stored in Modified: head/sys/netinet6/scope6_var.h ============================================================================== --- head/sys/netinet6/scope6_var.h Sat Aug 15 11:28:01 2020 (r364249) +++ head/sys/netinet6/scope6_var.h Sat Aug 15 11:37:44 2020 (r364250) @@ -47,9 +47,6 @@ struct scope6_id { uint32_t s6id_list[IPV6_ADDR_SCOPES_COUNT]; }; -VNET_DECLARE(int, deembed_scopeid); -#define V_deembed_scopeid VNET(deembed_scopeid) - void scope6_init(void); struct scope6_id *scope6_ifattach(struct ifnet *); void scope6_ifdetach(struct scope6_id *); From owner-svn-src-all@freebsd.org Sat Aug 15 14:57:54 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E927F3BC97A; Sat, 15 Aug 2020 14:57:54 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BTNhf5rgHz4DY9; Sat, 15 Aug 2020 14:57:54 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A7BC72100E; Sat, 15 Aug 2020 14:57:54 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07FEvsH2041133; Sat, 15 Aug 2020 14:57:54 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07FEvspK041131; Sat, 15 Aug 2020 14:57:54 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <202008151457.07FEvspK041131@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Sat, 15 Aug 2020 14:57:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364254 - in head/sys/arm64: arm64 include X-SVN-Group: head X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: in head/sys/arm64: arm64 include X-SVN-Commit-Revision: 364254 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 15 Aug 2020 14:57:55 -0000 Author: mhorne Date: Sat Aug 15 14:57:53 2020 New Revision: 364254 URL: https://svnweb.freebsd.org/changeset/base/364254 Log: arm64: update instruction set attribute register definitions This adds definitions for the latest additions to the AA64ISAR[01] ID registers. This brings these registers in sync with ARMv8.6 initial spec release. An future change will parse many of these fields for HWCAP features. Reviewed by: andrew, manu, markj (all previous versions) MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D26029 Modified: head/sys/arm64/arm64/identcpu.c head/sys/arm64/include/armreg.h Modified: head/sys/arm64/arm64/identcpu.c ============================================================================== --- head/sys/arm64/arm64/identcpu.c Sat Aug 15 12:29:55 2020 (r364253) +++ head/sys/arm64/arm64/identcpu.c Sat Aug 15 14:57:53 2020 (r364254) @@ -364,6 +364,31 @@ static struct mrs_field id_aa64dfr1_fields[] = { /* ID_AA64ISAR0_EL1 */ +static struct mrs_field_value id_aa64isar0_rndr[] = { + MRS_FIELD_VALUE(ID_AA64ISAR0_RNDR_NONE, ""), + MRS_FIELD_VALUE(ID_AA64ISAR0_RNDR_IMPL, "RNG"), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64isar0_tlb[] = { + MRS_FIELD_VALUE(ID_AA64ISAR0_TLB_NONE, ""), + MRS_FIELD_VALUE(ID_AA64ISAR0_TLB_TLBIOS, "TLBI-OS"), + MRS_FIELD_VALUE(ID_AA64ISAR0_TLB_TLBIOSR, "TLBI-OSR"), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64isar0_ts[] = { + MRS_FIELD_VALUE(ID_AA64ISAR0_TS_NONE, ""), + MRS_FIELD_VALUE(ID_AA64ISAR0_TS_CondM_8_4, "CondM-8.4"), + MRS_FIELD_VALUE(ID_AA64ISAR0_TS_CondM_8_5, "CondM-8.5"), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64isar0_fhm[] = { + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR0, FHM, NONE, IMPL), + MRS_FIELD_VALUE_END, +}; + static struct mrs_field_value id_aa64isar0_dp[] = { MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR0, DP, NONE, IMPL), MRS_FIELD_VALUE_END, @@ -417,6 +442,10 @@ static struct mrs_field_value id_aa64isar0_aes[] = { }; static struct mrs_field id_aa64isar0_fields[] = { + MRS_FIELD(ID_AA64ISAR0, RNDR, false, MRS_LOWER, id_aa64isar0_rndr), + MRS_FIELD(ID_AA64ISAR0, TLB, false, MRS_LOWER, id_aa64isar0_tlb), + MRS_FIELD(ID_AA64ISAR0, TS, false, MRS_LOWER, id_aa64isar0_ts), + MRS_FIELD(ID_AA64ISAR0, FHM, false, MRS_LOWER, id_aa64isar0_fhm), MRS_FIELD(ID_AA64ISAR0, DP, false, MRS_LOWER, id_aa64isar0_dp), MRS_FIELD(ID_AA64ISAR0, SM4, false, MRS_LOWER, id_aa64isar0_sm4), MRS_FIELD(ID_AA64ISAR0, SM3, false, MRS_LOWER, id_aa64isar0_sm3), @@ -432,6 +461,37 @@ static struct mrs_field id_aa64isar0_fields[] = { /* ID_AA64ISAR1_EL1 */ +static struct mrs_field_value id_aa64isar1_i8mm[] = { + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR1, I8MM, NONE, IMPL), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64isar1_dgh[] = { + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR1, DGH, NONE, IMPL), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64isar1_bf16[] = { + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR1, BF16, NONE, IMPL), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64isar1_specres[] = { + MRS_FIELD_VALUE(ID_AA64ISAR1_SPECRES_NONE, ""), + MRS_FIELD_VALUE(ID_AA64ISAR1_SPECRES_IMPL, "PredInv"), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64isar1_sb[] = { + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR1, SB, NONE, IMPL), + MRS_FIELD_VALUE_END, +}; + +static struct mrs_field_value id_aa64isar1_frintts[] = { + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR1, FRINTTS, NONE, IMPL), + MRS_FIELD_VALUE_END, +}; + static struct mrs_field_value id_aa64isar1_gpi[] = { MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR1, GPI, NONE, IMPL), MRS_FIELD_VALUE_END, @@ -443,7 +503,9 @@ static struct mrs_field_value id_aa64isar1_gpa[] = { }; static struct mrs_field_value id_aa64isar1_lrcpc[] = { - MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR1, LRCPC, NONE, IMPL), + MRS_FIELD_VALUE(ID_AA64ISAR1_LRCPC_NONE, ""), + MRS_FIELD_VALUE(ID_AA64ISAR1_LRCPC_RCPC_8_3, "RCPC-8.3"), + MRS_FIELD_VALUE(ID_AA64ISAR1_LRCPC_RCPC_8_4, "RCPC-8.4"), MRS_FIELD_VALUE_END, }; @@ -463,16 +525,26 @@ static struct mrs_field_value id_aa64isar1_api[] = { }; static struct mrs_field_value id_aa64isar1_apa[] = { - MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR1, GPA, NONE, IMPL), + MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR1, APA, NONE, IMPL), MRS_FIELD_VALUE_END, }; static struct mrs_field_value id_aa64isar1_dpb[] = { - MRS_FIELD_VALUE_NONE_IMPL(ID_AA64ISAR1, DPB, NONE, IMPL), + MRS_FIELD_VALUE(ID_AA64ISAR1_DPB_NONE, ""), + MRS_FIELD_VALUE(ID_AA64ISAR1_DPB_DCCVAP, "DCPoP"), + MRS_FIELD_VALUE(ID_AA64ISAR1_DPB_DCCVADP, "DCCVADP"), MRS_FIELD_VALUE_END, }; static struct mrs_field id_aa64isar1_fields[] = { + MRS_FIELD(ID_AA64ISAR1, I8MM, false, MRS_LOWER, id_aa64isar1_i8mm), + MRS_FIELD(ID_AA64ISAR1, DGH, false, MRS_LOWER, id_aa64isar1_dgh), + MRS_FIELD(ID_AA64ISAR1, BF16, false, MRS_LOWER, id_aa64isar1_bf16), + MRS_FIELD(ID_AA64ISAR1, SPECRES, false, MRS_LOWER, + id_aa64isar1_specres), + MRS_FIELD(ID_AA64ISAR1, SB, false, MRS_LOWER, id_aa64isar1_sb), + MRS_FIELD(ID_AA64ISAR1, FRINTTS, false, MRS_LOWER, + id_aa64isar1_frintts), MRS_FIELD(ID_AA64ISAR1, GPI, false, MRS_EXACT, id_aa64isar1_gpi), MRS_FIELD(ID_AA64ISAR1, GPA, false, MRS_EXACT, id_aa64isar1_gpa), MRS_FIELD(ID_AA64ISAR1, LRCPC, false, MRS_LOWER, id_aa64isar1_lrcpc), @@ -1159,7 +1231,7 @@ parse_cpu_features_hwcap(u_int cpu) break; } - if (ID_AA64ISAR1_LRCPC_VAL(cpu_desc[cpu].id_aa64isar1) == ID_AA64ISAR1_LRCPC_IMPL) + if (ID_AA64ISAR1_LRCPC_VAL(cpu_desc[cpu].id_aa64isar1) == ID_AA64ISAR1_LRCPC_RCPC_8_3) hwcap |= HWCAP_LRCPC; if (ID_AA64ISAR1_FCMA_VAL(cpu_desc[cpu].id_aa64isar1) == ID_AA64ISAR1_FCMA_IMPL) @@ -1168,7 +1240,7 @@ parse_cpu_features_hwcap(u_int cpu) if (ID_AA64ISAR1_JSCVT_VAL(cpu_desc[cpu].id_aa64isar1) == ID_AA64ISAR1_JSCVT_IMPL) hwcap |= HWCAP_JSCVT; - if (ID_AA64ISAR1_DPB_VAL(cpu_desc[cpu].id_aa64isar1) == ID_AA64ISAR1_DPB_IMPL) + if (ID_AA64ISAR1_DPB_VAL(cpu_desc[cpu].id_aa64isar1) == ID_AA64ISAR1_DPB_DCCVAP) hwcap |= HWCAP_DCPOP; if (ID_AA64PFR0_SVE_VAL(cpu_desc[cpu].id_aa64pfr0) == ID_AA64PFR0_SVE_IMPL) Modified: head/sys/arm64/include/armreg.h ============================================================================== --- head/sys/arm64/include/armreg.h Sat Aug 15 12:29:55 2020 (r364253) +++ head/sys/arm64/include/armreg.h Sat Aug 15 14:57:53 2020 (r364254) @@ -350,6 +350,28 @@ #define ID_AA64ISAR0_DP_VAL(x) ((x) & ID_AA64ISAR0_DP_MASK) #define ID_AA64ISAR0_DP_NONE (UL(0x0) << ID_AA64ISAR0_DP_SHIFT) #define ID_AA64ISAR0_DP_IMPL (UL(0x1) << ID_AA64ISAR0_DP_SHIFT) +#define ID_AA64ISAR0_FHM_SHIFT 48 +#define ID_AA64ISAR0_FHM_MASK (UL(0xf) << ID_AA64ISAR0_FHM_SHIFT) +#define ID_AA64ISAR0_FHM_VAL(x) ((x) & ID_AA64ISAR0_FHM_MASK) +#define ID_AA64ISAR0_FHM_NONE (UL(0x0) << ID_AA64ISAR0_FHM_SHIFT) +#define ID_AA64ISAR0_FHM_IMPL (UL(0x1) << ID_AA64ISAR0_FHM_SHIFT) +#define ID_AA64ISAR0_TS_SHIFT 52 +#define ID_AA64ISAR0_TS_MASK (UL(0xf) << ID_AA64ISAR0_TS_SHIFT) +#define ID_AA64ISAR0_TS_VAL(x) ((x) & ID_AA64ISAR0_TS_MASK) +#define ID_AA64ISAR0_TS_NONE (UL(0x0) << ID_AA64ISAR0_TS_SHIFT) +#define ID_AA64ISAR0_TS_CondM_8_4 (UL(0x1) << ID_AA64ISAR0_TS_SHIFT) +#define ID_AA64ISAR0_TS_CondM_8_5 (UL(0x2) << ID_AA64ISAR0_TS_SHIFT) +#define ID_AA64ISAR0_TLB_SHIFT 56 +#define ID_AA64ISAR0_TLB_MASK (UL(0xf) << ID_AA64ISAR0_TLB_SHIFT) +#define ID_AA64ISAR0_TLB_VAL(x) ((x) & ID_AA64ISAR0_TLB_MASK) +#define ID_AA64ISAR0_TLB_NONE (UL(0x0) << ID_AA64ISAR0_TLB_SHIFT) +#define ID_AA64ISAR0_TLB_TLBIOS (UL(0x1) << ID_AA64ISAR0_TLB_SHIFT) +#define ID_AA64ISAR0_TLB_TLBIOSR (UL(0x2) << ID_AA64ISAR0_TLB_SHIFT) +#define ID_AA64ISAR0_RNDR_SHIFT 60 +#define ID_AA64ISAR0_RNDR_MASK (UL(0xf) << ID_AA64ISAR0_RNDR_SHIFT) +#define ID_AA64ISAR0_RNDR_VAL(x) ((x) & ID_AA64ISAR0_RNDR_MASK) +#define ID_AA64ISAR0_RNDR_NONE (UL(0x0) << ID_AA64ISAR0_RNDR_SHIFT) +#define ID_AA64ISAR0_RNDR_IMPL (UL(0x1) << ID_AA64ISAR0_RNDR_SHIFT) /* ID_AA64ISAR1_EL1 */ #define ID_AA64ISAR1_EL1 MRS_REG(3, 0, 0, 6, 1) @@ -357,7 +379,8 @@ #define ID_AA64ISAR1_DPB_MASK (UL(0xf) << ID_AA64ISAR1_DPB_SHIFT) #define ID_AA64ISAR1_DPB_VAL(x) ((x) & ID_AA64ISAR1_DPB_MASK) #define ID_AA64ISAR1_DPB_NONE (UL(0x0) << ID_AA64ISAR1_DPB_SHIFT) -#define ID_AA64ISAR1_DPB_IMPL (UL(0x1) << ID_AA64ISAR1_DPB_SHIFT) +#define ID_AA64ISAR1_DPB_DCCVAP (UL(0x1) << ID_AA64ISAR1_DPB_SHIFT) +#define ID_AA64ISAR1_DPB_DCCVADP (UL(0x2) << ID_AA64ISAR1_DPB_SHIFT) #define ID_AA64ISAR1_APA_SHIFT 4 #define ID_AA64ISAR1_APA_MASK (UL(0xf) << ID_AA64ISAR1_APA_SHIFT) #define ID_AA64ISAR1_APA_VAL(x) ((x) & ID_AA64ISAR1_APA_MASK) @@ -382,7 +405,8 @@ #define ID_AA64ISAR1_LRCPC_MASK (UL(0xf) << ID_AA64ISAR1_LRCPC_SHIFT) #define ID_AA64ISAR1_LRCPC_VAL(x) ((x) & ID_AA64ISAR1_LRCPC_MASK) #define ID_AA64ISAR1_LRCPC_NONE (UL(0x0) << ID_AA64ISAR1_LRCPC_SHIFT) -#define ID_AA64ISAR1_LRCPC_IMPL (UL(0x1) << ID_AA64ISAR1_LRCPC_SHIFT) +#define ID_AA64ISAR1_LRCPC_RCPC_8_3 (UL(0x1) << ID_AA64ISAR1_LRCPC_SHIFT) +#define ID_AA64ISAR1_LRCPC_RCPC_8_4 (UL(0x2) << ID_AA64ISAR1_LRCPC_SHIFT) #define ID_AA64ISAR1_GPA_SHIFT 24 #define ID_AA64ISAR1_GPA_MASK (UL(0xf) << ID_AA64ISAR1_GPA_SHIFT) #define ID_AA64ISAR1_GPA_VAL(x) ((x) & ID_AA64ISAR1_GPA_MASK) @@ -393,6 +417,36 @@ #define ID_AA64ISAR1_GPI_VAL(x) ((x) & ID_AA64ISAR1_GPI_MASK) #define ID_AA64ISAR1_GPI_NONE (UL(0x0) << ID_AA64ISAR1_GPI_SHIFT) #define ID_AA64ISAR1_GPI_IMPL (UL(0x1) << ID_AA64ISAR1_GPI_SHIFT) +#define ID_AA64ISAR1_FRINTTS_SHIFT 32 +#define ID_AA64ISAR1_FRINTTS_MASK (UL(0xf) << ID_AA64ISAR1_FRINTTS_SHIFT) +#define ID_AA64ISAR1_FRINTTS_VAL(x) ((x) & ID_AA64ISAR1_FRINTTS_MASK) +#define ID_AA64ISAR1_FRINTTS_NONE (UL(0x0) << ID_AA64ISAR1_FRINTTS_SHIFT) +#define ID_AA64ISAR1_FRINTTS_IMPL (UL(0x1) << ID_AA64ISAR1_FRINTTS_SHIFT) +#define ID_AA64ISAR1_SB_SHIFT 36 +#define ID_AA64ISAR1_SB_MASK (UL(0xf) << ID_AA64ISAR1_SB_SHIFT) +#define ID_AA64ISAR1_SB_VAL(x) ((x) & ID_AA64ISAR1_SB_MASK) +#define ID_AA64ISAR1_SB_NONE (UL(0x0) << ID_AA64ISAR1_SB_SHIFT) +#define ID_AA64ISAR1_SB_IMPL (UL(0x1) << ID_AA64ISAR1_SB_SHIFT) +#define ID_AA64ISAR1_SPECRES_SHIFT 40 +#define ID_AA64ISAR1_SPECRES_MASK (UL(0xf) << ID_AA64ISAR1_SPECRES_SHIFT) +#define ID_AA64ISAR1_SPECRES_VAL(x) ((x) & ID_AA64ISAR1_SPECRES_MASK) +#define ID_AA64ISAR1_SPECRES_NONE (UL(0x0) << ID_AA64ISAR1_SPECRES_SHIFT) +#define ID_AA64ISAR1_SPECRES_IMPL (UL(0x1) << ID_AA64ISAR1_SPECRES_SHIFT) +#define ID_AA64ISAR1_BF16_SHIFT 44 +#define ID_AA64ISAR1_BF16_MASK (UL(0xf) << ID_AA64ISAR1_BF16_SHIFT) +#define ID_AA64ISAR1_BF16_VAL(x) ((x) & ID_AA64ISAR1_BF16_MASK) +#define ID_AA64ISAR1_BF16_NONE (UL(0x0) << ID_AA64ISAR1_BF16_SHIFT) +#define ID_AA64ISAR1_BF16_IMPL (UL(0x1) << ID_AA64ISAR1_BF16_SHIFT) +#define ID_AA64ISAR1_DGH_SHIFT 48 +#define ID_AA64ISAR1_DGH_MASK (UL(0xf) << ID_AA64ISAR1_DGH_SHIFT) +#define ID_AA64ISAR1_DGH_VAL(x) ((x) & ID_AA64ISAR1_DGH_MASK) +#define ID_AA64ISAR1_DGH_NONE (UL(0x0) << ID_AA64ISAR1_DGH_SHIFT) +#define ID_AA64ISAR1_DGH_IMPL (UL(0x1) << ID_AA64ISAR1_DGH_SHIFT) +#define ID_AA64ISAR1_I8MM_SHIFT 52 +#define ID_AA64ISAR1_I8MM_MASK (UL(0xf) << ID_AA64ISAR1_I8MM_SHIFT) +#define ID_AA64ISAR1_I8MM_VAL(x) ((x) & ID_AA64ISAR1_I8MM_MASK) +#define ID_AA64ISAR1_I8MM_NONE (UL(0x0) << ID_AA64ISAR1_I8MM_SHIFT) +#define ID_AA64ISAR1_I8MM_IMPL (UL(0x1) << ID_AA64ISAR1_I8MM_SHIFT) /* ID_AA64MMFR0_EL1 */ #define ID_AA64MMFR0_EL1 MRS_REG(3, 0, 0, 7, 0) From owner-svn-src-all@freebsd.org Sat Aug 15 15:06:40 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 382E33BCAAF; Sat, 15 Aug 2020 15:06:40 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BTNtm0hqKz4FS4; Sat, 15 Aug 2020 15:06:40 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EFC83211BA; Sat, 15 Aug 2020 15:06:39 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07FF6dNU047112; Sat, 15 Aug 2020 15:06:39 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07FF6dN3047111; Sat, 15 Aug 2020 15:06:39 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <202008151506.07FF6dN3047111@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Sat, 15 Aug 2020 15:06:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364255 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 364255 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 15 Aug 2020 15:06:40 -0000 Author: mhorne Date: Sat Aug 15 15:06:39 2020 New Revision: 364255 URL: https://svnweb.freebsd.org/changeset/base/364255 Log: arm64: parse HWCAP values using user_cpu_desc The hard work of parsing fields per-CPU, handling heterogeneous features, and excluding features from userspace is already done by update_special_regs. We can build our set of HWCAPs from the result. This exposed a small bug in update_special_regs, in which the generated bitmask was not wide enough, and as a result some bits weren't being exposed in user_cpu_desc. Fix this. While here, adjust some formatting. Reviewed by: andrew MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D26069 Modified: head/sys/arm64/arm64/identcpu.c Modified: head/sys/arm64/arm64/identcpu.c ============================================================================== --- head/sys/arm64/arm64/identcpu.c Sat Aug 15 14:57:53 2020 (r364254) +++ head/sys/arm64/arm64/identcpu.c Sat Aug 15 15:06:39 2020 (r364255) @@ -47,7 +47,7 @@ __FBSDID("$FreeBSD$"); #include static void print_cpu_features(u_int cpu); -static u_long parse_cpu_features_hwcap(u_int cpu); +static u_long parse_cpu_features_hwcap(void); char machine[] = "arm64"; @@ -1095,7 +1095,7 @@ update_special_regs(u_int cpu) for (j = 0; fields[j].type != 0; j++) { switch (fields[j].type & MRS_TYPE_MASK) { case MRS_EXACT: - user_reg &= ~(0xfu << fields[j].shift); + user_reg &= ~(0xful << fields[j].shift); user_reg |= (uint64_t)MRS_EXACT_FIELD(fields[j].type) << fields[j].shift; @@ -1131,7 +1131,6 @@ static void identify_cpu_sysinit(void *dummy __unused) { int cpu; - u_long hwcap; bool dic, idc; dic = (allow_dic != 0); @@ -1139,11 +1138,6 @@ identify_cpu_sysinit(void *dummy __unused) CPU_FOREACH(cpu) { check_cpu_regs(cpu); - hwcap = parse_cpu_features_hwcap(cpu); - if (elf_hwcap == 0) - elf_hwcap = hwcap; - else - elf_hwcap &= hwcap; if (cpu != 0) update_special_regs(cpu); @@ -1153,6 +1147,9 @@ identify_cpu_sysinit(void *dummy __unused) idc = false; } + /* Exposed to userspace as AT_HWCAP */ + elf_hwcap = parse_cpu_features_hwcap(); + if (dic && idc) { arm64_icache_sync_range = &arm64_dic_idc_icache_sync_range; if (bootverbose) @@ -1184,43 +1181,49 @@ cpu_features_sysinit(void *dummy __unused) SYSINIT(cpu_features, SI_SUB_SMP, SI_ORDER_ANY, cpu_features_sysinit, NULL); static u_long -parse_cpu_features_hwcap(u_int cpu) +parse_cpu_features_hwcap(void) { u_long hwcap = 0; - if (ID_AA64ISAR0_DP_VAL(cpu_desc[cpu].id_aa64isar0) == ID_AA64ISAR0_DP_IMPL) + if (ID_AA64ISAR0_DP_VAL(user_cpu_desc.id_aa64isar0) == + ID_AA64ISAR0_DP_IMPL) hwcap |= HWCAP_ASIMDDP; - if (ID_AA64ISAR0_SM4_VAL(cpu_desc[cpu].id_aa64isar0) == ID_AA64ISAR0_SM4_IMPL) + if (ID_AA64ISAR0_SM4_VAL(user_cpu_desc.id_aa64isar0) == + ID_AA64ISAR0_SM4_IMPL) hwcap |= HWCAP_SM4; - if (ID_AA64ISAR0_SM3_VAL(cpu_desc[cpu].id_aa64isar0) == ID_AA64ISAR0_SM3_IMPL) + if (ID_AA64ISAR0_SM3_VAL(user_cpu_desc.id_aa64isar0) == + ID_AA64ISAR0_SM3_IMPL) hwcap |= HWCAP_SM3; - if (ID_AA64ISAR0_RDM_VAL(cpu_desc[cpu].id_aa64isar0) == ID_AA64ISAR0_RDM_IMPL) + if (ID_AA64ISAR0_RDM_VAL(user_cpu_desc.id_aa64isar0) == + ID_AA64ISAR0_RDM_IMPL) hwcap |= HWCAP_ASIMDRDM; - if (ID_AA64ISAR0_Atomic_VAL(cpu_desc[cpu].id_aa64isar0) == ID_AA64ISAR0_Atomic_IMPL) + if (ID_AA64ISAR0_Atomic_VAL(user_cpu_desc.id_aa64isar0) == + ID_AA64ISAR0_Atomic_IMPL) hwcap |= HWCAP_ATOMICS; - if (ID_AA64ISAR0_CRC32_VAL(cpu_desc[cpu].id_aa64isar0) == ID_AA64ISAR0_CRC32_BASE) + if (ID_AA64ISAR0_CRC32_VAL(user_cpu_desc.id_aa64isar0) == + ID_AA64ISAR0_CRC32_BASE) hwcap |= HWCAP_CRC32; - switch (ID_AA64ISAR0_SHA2_VAL(cpu_desc[cpu].id_aa64isar0)) { - case ID_AA64ISAR0_SHA2_BASE: - hwcap |= HWCAP_SHA2; - break; - case ID_AA64ISAR0_SHA2_512: - hwcap |= HWCAP_SHA2 | HWCAP_SHA512; - break; + switch (ID_AA64ISAR0_SHA2_VAL(user_cpu_desc.id_aa64isar0)) { + case ID_AA64ISAR0_SHA2_BASE: + hwcap |= HWCAP_SHA2; + break; + case ID_AA64ISAR0_SHA2_512: + hwcap |= HWCAP_SHA2 | HWCAP_SHA512; + break; default: break; } - if (ID_AA64ISAR0_SHA1_VAL(cpu_desc[cpu].id_aa64isar0)) + if (ID_AA64ISAR0_SHA1_VAL(user_cpu_desc.id_aa64isar0)) hwcap |= HWCAP_SHA1; - switch (ID_AA64ISAR0_AES_VAL(cpu_desc[cpu].id_aa64isar0)) { + switch (ID_AA64ISAR0_AES_VAL(user_cpu_desc.id_aa64isar0)) { case ID_AA64ISAR0_AES_BASE: hwcap |= HWCAP_AES; break; @@ -1231,22 +1234,27 @@ parse_cpu_features_hwcap(u_int cpu) break; } - if (ID_AA64ISAR1_LRCPC_VAL(cpu_desc[cpu].id_aa64isar1) == ID_AA64ISAR1_LRCPC_RCPC_8_3) + if (ID_AA64ISAR1_LRCPC_VAL(user_cpu_desc.id_aa64isar1) == + ID_AA64ISAR1_LRCPC_RCPC_8_3) hwcap |= HWCAP_LRCPC; - if (ID_AA64ISAR1_FCMA_VAL(cpu_desc[cpu].id_aa64isar1) == ID_AA64ISAR1_FCMA_IMPL) + if (ID_AA64ISAR1_FCMA_VAL(user_cpu_desc.id_aa64isar1) == + ID_AA64ISAR1_FCMA_IMPL) hwcap |= HWCAP_FCMA; - if (ID_AA64ISAR1_JSCVT_VAL(cpu_desc[cpu].id_aa64isar1) == ID_AA64ISAR1_JSCVT_IMPL) + if (ID_AA64ISAR1_JSCVT_VAL(user_cpu_desc.id_aa64isar1) == + ID_AA64ISAR1_JSCVT_IMPL) hwcap |= HWCAP_JSCVT; - if (ID_AA64ISAR1_DPB_VAL(cpu_desc[cpu].id_aa64isar1) == ID_AA64ISAR1_DPB_DCCVAP) + if (ID_AA64ISAR1_DPB_VAL(user_cpu_desc.id_aa64isar1) == + ID_AA64ISAR1_DPB_DCCVAP) hwcap |= HWCAP_DCPOP; - if (ID_AA64PFR0_SVE_VAL(cpu_desc[cpu].id_aa64pfr0) == ID_AA64PFR0_SVE_IMPL) + if (ID_AA64PFR0_SVE_VAL(user_cpu_desc.id_aa64pfr0) == + ID_AA64PFR0_SVE_IMPL) hwcap |= HWCAP_SVE; - switch (ID_AA64PFR0_AdvSIMD_VAL(cpu_desc[cpu].id_aa64pfr0)) { + switch (ID_AA64PFR0_AdvSIMD_VAL(user_cpu_desc.id_aa64pfr0)) { case ID_AA64PFR0_AdvSIMD_IMPL: hwcap |= HWCAP_ASIMD; break; @@ -1257,7 +1265,7 @@ parse_cpu_features_hwcap(u_int cpu) break; } - switch (ID_AA64PFR0_FP_VAL(cpu_desc[cpu].id_aa64pfr0)) { + switch (ID_AA64PFR0_FP_VAL(user_cpu_desc.id_aa64pfr0)) { case ID_AA64PFR0_FP_IMPL: hwcap |= HWCAP_FP; break; From owner-svn-src-all@freebsd.org Sat Aug 15 16:15:35 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5742B3BE33E; Sat, 15 Aug 2020 16:15:35 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BTQQH1XNDz4J4Z; Sat, 15 Aug 2020 16:15:35 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 13DEA21CAB; Sat, 15 Aug 2020 16:15:35 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07FGFYci090451; Sat, 15 Aug 2020 16:15:34 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07FGFY5T090450; Sat, 15 Aug 2020 16:15:34 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <202008151615.07FGFY5T090450@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Sat, 15 Aug 2020 16:15:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364256 - head/sys/riscv/riscv X-SVN-Group: head X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: head/sys/riscv/riscv X-SVN-Commit-Revision: 364256 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 15 Aug 2020 16:15:35 -0000 Author: mhorne Date: Sat Aug 15 16:15:34 2020 New Revision: 364256 URL: https://svnweb.freebsd.org/changeset/base/364256 Log: RISC-V: copy kernelname from the environment This is allows kern.bootfile to report the correct value. Modified: head/sys/riscv/riscv/machdep.c Modified: head/sys/riscv/riscv/machdep.c ============================================================================== --- head/sys/riscv/riscv/machdep.c Sat Aug 15 15:06:39 2020 (r364255) +++ head/sys/riscv/riscv/machdep.c Sat Aug 15 16:15:34 2020 (r364256) @@ -861,6 +861,7 @@ initriscv(struct riscv_bootparams *rvbp) phandle_t chosen; uint32_t hart; #endif + char *env; TSRAW(&thread0, TS_ENTER, __func__, NULL); @@ -954,6 +955,10 @@ initriscv(struct riscv_bootparams *rvbp) mutex_init(); init_param2(physmem); kdb_init(); + + env = kern_getenv("kernelname"); + if (env != NULL) + strlcpy(kernelname, env, sizeof(kernelname)); if (boothowto & RB_VERBOSE) physmem_print_tables(); From owner-svn-src-all@freebsd.org Sat Aug 15 16:48:59 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 007883BF13E; Sat, 15 Aug 2020 16:48:59 +0000 (UTC) (envelope-from qingli@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BTR8p5McRz4P90; Sat, 15 Aug 2020 16:48:58 +0000 (UTC) (envelope-from qingli@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9B60F2243B; Sat, 15 Aug 2020 16:48:58 +0000 (UTC) (envelope-from qingli@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07FGmwUu015391; Sat, 15 Aug 2020 16:48:58 GMT (envelope-from qingli@FreeBSD.org) Received: (from qingli@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07FGmwJB015390; Sat, 15 Aug 2020 16:48:58 GMT (envelope-from qingli@FreeBSD.org) Message-Id: <202008151648.07FGmwJB015390@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: qingli set sender to qingli@FreeBSD.org using -f From: Qing Li Date: Sat, 15 Aug 2020 16:48:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364257 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: qingli X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 364257 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 15 Aug 2020 16:48:59 -0000 Author: qingli Date: Sat Aug 15 16:48:58 2020 New Revision: 364257 URL: https://svnweb.freebsd.org/changeset/base/364257 Log: Correct the mask byte order when checking for reserved bits. Reviewed by: gnn Approved by: gnn MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D26071 Modified: head/sys/net/if_vxlan.c Modified: head/sys/net/if_vxlan.c ============================================================================== --- head/sys/net/if_vxlan.c Sat Aug 15 16:15:34 2020 (r364256) +++ head/sys/net/if_vxlan.c Sat Aug 15 16:48:58 2020 (r364257) @@ -2545,7 +2545,7 @@ vxlan_rcv_udp_packet(struct mbuf *m, int offset, struc * the behavior of the Linux implementation. */ if (vxh->vxlh_flags != htonl(VXLAN_HDR_FLAGS_VALID_VNI) || - vxh->vxlh_vni & ~htonl(VXLAN_VNI_MASK)) + vxh->vxlh_vni & ~VXLAN_VNI_MASK) goto out; vni = ntohl(vxh->vxlh_vni) >> VXLAN_HDR_VNI_SHIFT; From owner-svn-src-all@freebsd.org Sat Aug 15 17:02:23 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EE8663BF7CA; Sat, 15 Aug 2020 17:02:23 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BTRSH67kVz4Q1G; Sat, 15 Aug 2020 17:02:23 +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 B54EC224E8; Sat, 15 Aug 2020 17:02:23 +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 07FH2N5B026955; Sat, 15 Aug 2020 17:02:23 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07FH2NFt026954; Sat, 15 Aug 2020 17:02:23 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008151702.07FH2NFt026954@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sat, 15 Aug 2020 17:02:23 +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: r364258 - stable/12/sys/amd64/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/amd64/linux X-SVN-Commit-Revision: 364258 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 15 Aug 2020 17:02:24 -0000 Author: trasz Date: Sat Aug 15 17:02:23 2020 New Revision: 364258 URL: https://svnweb.freebsd.org/changeset/base/364258 Log: MFC r351783: Unbreak Linux binaries linked against new glibc, such as the ones from recent Ubuntu versions. Without it they segfault on startup. Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/amd64/linux/linux_sysvec.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/linux/linux_sysvec.c ============================================================================== --- stable/12/sys/amd64/linux/linux_sysvec.c Sat Aug 15 16:48:58 2020 (r364257) +++ stable/12/sys/amd64/linux/linux_sysvec.c Sat Aug 15 17:02:23 2020 (r364258) @@ -357,6 +357,12 @@ linux_copyout_strings(struct image_params *imgp) */ vectp -= imgp->args->argc + 1 + imgp->args->envc + 1; + /* + * Starting with 2.24, glibc depends on a 16-byte stack alignment. + * One "long argc" will be prepended later. + */ + vectp = (char **)((((uintptr_t)vectp + 8) & ~0xF) - 8); + /* vectp also becomes our initial stack base. */ stack_base = (register_t *)vectp; From owner-svn-src-all@freebsd.org Sat Aug 15 17:18:37 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C63673783F6; Sat, 15 Aug 2020 17:18:37 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BTRq14vmVz4VqV; Sat, 15 Aug 2020 17:18:37 +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 8B5EC22A1F; Sat, 15 Aug 2020 17:18:37 +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 07FHIbOd039842; Sat, 15 Aug 2020 17:18:37 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07FHIbE2039840; Sat, 15 Aug 2020 17:18:37 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008151718.07FHIbE2039840@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sat, 15 Aug 2020 17:18:37 +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: r364259 - stable/12/share/man/man4 X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/share/man/man4 X-SVN-Commit-Revision: 364259 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 15 Aug 2020 17:18:37 -0000 Author: trasz Date: Sat Aug 15 17:18:36 2020 New Revision: 364259 URL: https://svnweb.freebsd.org/changeset/base/364259 Log: MFC r354139: Document the fact that Linux binaries depend on pty(4). Sponsored by: The FreeBSD Foundation Modified: stable/12/share/man/man4/linux.4 stable/12/share/man/man4/pty.4 Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/linux.4 ============================================================================== --- stable/12/share/man/man4/linux.4 Sat Aug 15 17:02:23 2020 (r364258) +++ stable/12/share/man/man4/linux.4 Sat Aug 15 17:18:36 2020 (r364259) @@ -139,6 +139,7 @@ limited Linux system file system .El .Sh SEE ALSO .Xr brandelf 1 , +.Xr pty 4 , .Xr elf 5 , .Xr fdescfs 5 , .Xr linprocfs 5 , Modified: stable/12/share/man/man4/pty.4 ============================================================================== --- stable/12/share/man/man4/pty.4 Sat Aug 15 17:02:23 2020 (r364258) +++ stable/12/share/man/man4/pty.4 Sat Aug 15 17:18:36 2020 (r364259) @@ -27,19 +27,21 @@ .\" .\" $FreeBSD$ .\" -.Dd August 20, 2008 +.Dd October 28, 2019 .Dt PTY 4 .Os .Sh NAME .Nm pty -.Nd BSD-style and System V-style compatibility pseudo-terminal driver +.Nd old-style compatibility pseudo-terminal driver .Sh SYNOPSIS .Cd "device pty" .Sh DESCRIPTION The .Nm driver provides support for the traditional BSD naming scheme that was -used for accessing pseudo-terminals. +used for accessing pseudo-terminals before it was replaced by +.Xr pts 4 . +This traditional naming is still used in Linux. When the device .Pa /dev/ptyXX is being opened, a new terminal shall be created with the @@ -59,7 +61,8 @@ interface. It is only provided for compatibility with older C libraries that tried to open such devices when .Xr posix_openpt 2 -was being called. +was being called, +and for running Linux binaries. .Sh FILES The BSD-style compatibility pseudo-terminal driver uses the following device names: From owner-svn-src-all@freebsd.org Sat Aug 15 18:46:29 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5791A37AB3C; Sat, 15 Aug 2020 18:46:29 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BTTmN3Jrjz4b5P; Sat, 15 Aug 2020 18:46:28 +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 87ED623853; Sat, 15 Aug 2020 18:46:26 +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 07FIkQjF095314; Sat, 15 Aug 2020 18:46:26 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07FIkQB6095313; Sat, 15 Aug 2020 18:46:26 GMT (envelope-from cem@FreeBSD.org) Message-Id: <202008151846.07FIkQB6095313@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Sat, 15 Aug 2020 18:46:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364260 - head/sys/contrib/pcg-c/include X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/contrib/pcg-c/include X-SVN-Commit-Revision: 364260 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 15 Aug 2020 18:46:29 -0000 Author: cem Date: Sat Aug 15 18:46:26 2020 New Revision: 364260 URL: https://svnweb.freebsd.org/changeset/base/364260 Log: pcg-c: Add 'static' to inline function definitions Make the inlines static to avoid kernel build failure with Clang 11 on i386. (The issue was not observed with Clang 10, currently in tree; reproduction depends on compiler inlining choices.) The compiler may choose not to inline 'bare' C inlines, and in that case expects a symbol of the same name will be available. It does not automatically define that symbol at use, because of traditional C linking semantics. (In contrast, C++ does define it, and then deduplicates redundant definitions at link). As we do not instantiate the C99 inline ('extern inline ...;'), the linker errors with "undefined symbol." Reported by: dim Tested by: dim Fixes: r364219 Modified: head/sys/contrib/pcg-c/include/pcg_variants.h Modified: head/sys/contrib/pcg-c/include/pcg_variants.h ============================================================================== --- head/sys/contrib/pcg-c/include/pcg_variants.h Sat Aug 15 17:18:36 2020 (r364259) +++ head/sys/contrib/pcg-c/include/pcg_variants.h Sat Aug 15 18:46:26 2020 (r364260) @@ -53,7 +53,7 @@ extern "C" { * Rotate helper functions. */ -inline uint8_t pcg_rotr_8(uint8_t value, unsigned int rot) +static inline uint8_t pcg_rotr_8(uint8_t value, unsigned int rot) { /* Unfortunately, clang is kinda pathetic when it comes to properly * recognizing idiomatic rotate code, so for clang we actually provide @@ -67,7 +67,7 @@ inline uint8_t pcg_rotr_8(uint8_t value, unsigned int #endif } -inline uint16_t pcg_rotr_16(uint16_t value, unsigned int rot) +static inline uint16_t pcg_rotr_16(uint16_t value, unsigned int rot) { #if PCG_USE_INLINE_ASM && defined(__clang__) && (defined(__x86_64__) || defined(__i386__)) __asm__ ("rorw %%cl, %0" : "=r" (value) : "0" (value), "c" (rot)); @@ -77,7 +77,7 @@ inline uint16_t pcg_rotr_16(uint16_t value, unsigned i #endif } -inline uint32_t pcg_rotr_32(uint32_t value, unsigned int rot) +static inline uint32_t pcg_rotr_32(uint32_t value, unsigned int rot) { #if PCG_USE_INLINE_ASM && defined(__clang__) && (defined(__x86_64__) || defined(__i386__)) __asm__ ("rorl %%cl, %0" : "=r" (value) : "0" (value), "c" (rot)); @@ -87,7 +87,7 @@ inline uint32_t pcg_rotr_32(uint32_t value, unsigned i #endif } -inline uint64_t pcg_rotr_64(uint64_t value, unsigned int rot) +static inline uint64_t pcg_rotr_64(uint64_t value, unsigned int rot) { #if 0 && PCG_USE_INLINE_ASM && defined(__clang__) && (defined(__x86_64__) || defined(__i386__)) /* For whatever reason, clang actually *does* generate rotq by @@ -100,7 +100,7 @@ inline uint64_t pcg_rotr_64(uint64_t value, unsigned i } #if PCG_HAS_128BIT_OPS -inline pcg128_t pcg_rotr_128(pcg128_t value, unsigned int rot) +static inline pcg128_t pcg_rotr_128(pcg128_t value, unsigned int rot) { return (value >> rot) | (value << ((- rot) & 127)); } @@ -112,24 +112,24 @@ inline pcg128_t pcg_rotr_128(pcg128_t value, unsigned /* XSH RS */ -inline uint8_t pcg_output_xsh_rs_16_8(uint16_t state) +static inline uint8_t pcg_output_xsh_rs_16_8(uint16_t state) { return (uint8_t)(((state >> 7u) ^ state) >> ((state >> 14u) + 3u)); } -inline uint16_t pcg_output_xsh_rs_32_16(uint32_t state) +static inline uint16_t pcg_output_xsh_rs_32_16(uint32_t state) { return (uint16_t)(((state >> 11u) ^ state) >> ((state >> 30u) + 11u)); } -inline uint32_t pcg_output_xsh_rs_64_32(uint64_t state) +static inline uint32_t pcg_output_xsh_rs_64_32(uint64_t state) { return (uint32_t)(((state >> 22u) ^ state) >> ((state >> 61u) + 22u)); } #if PCG_HAS_128BIT_OPS -inline uint64_t pcg_output_xsh_rs_128_64(pcg128_t state) +static inline uint64_t pcg_output_xsh_rs_128_64(pcg128_t state) { return (uint64_t)(((state >> 43u) ^ state) >> ((state >> 124u) + 45u)); } @@ -137,23 +137,23 @@ inline uint64_t pcg_output_xsh_rs_128_64(pcg128_t stat /* XSH RR */ -inline uint8_t pcg_output_xsh_rr_16_8(uint16_t state) +static inline uint8_t pcg_output_xsh_rr_16_8(uint16_t state) { return pcg_rotr_8(((state >> 5u) ^ state) >> 5u, state >> 13u); } -inline uint16_t pcg_output_xsh_rr_32_16(uint32_t state) +static inline uint16_t pcg_output_xsh_rr_32_16(uint32_t state) { return pcg_rotr_16(((state >> 10u) ^ state) >> 12u, state >> 28u); } -inline uint32_t pcg_output_xsh_rr_64_32(uint64_t state) +static inline uint32_t pcg_output_xsh_rr_64_32(uint64_t state) { return pcg_rotr_32(((state >> 18u) ^ state) >> 27u, state >> 59u); } #if PCG_HAS_128BIT_OPS -inline uint64_t pcg_output_xsh_rr_128_64(pcg128_t state) +static inline uint64_t pcg_output_xsh_rr_128_64(pcg128_t state) { return pcg_rotr_64(((state >> 35u) ^ state) >> 58u, state >> 122u); } @@ -161,25 +161,25 @@ inline uint64_t pcg_output_xsh_rr_128_64(pcg128_t stat /* RXS M XS */ -inline uint8_t pcg_output_rxs_m_xs_8_8(uint8_t state) +static inline uint8_t pcg_output_rxs_m_xs_8_8(uint8_t state) { uint8_t word = ((state >> ((state >> 6u) + 2u)) ^ state) * 217u; return (word >> 6u) ^ word; } -inline uint16_t pcg_output_rxs_m_xs_16_16(uint16_t state) +static inline uint16_t pcg_output_rxs_m_xs_16_16(uint16_t state) { uint16_t word = ((state >> ((state >> 13u) + 3u)) ^ state) * 62169u; return (word >> 11u) ^ word; } -inline uint32_t pcg_output_rxs_m_xs_32_32(uint32_t state) +static inline uint32_t pcg_output_rxs_m_xs_32_32(uint32_t state) { uint32_t word = ((state >> ((state >> 28u) + 4u)) ^ state) * 277803737u; return (word >> 22u) ^ word; } -inline uint64_t pcg_output_rxs_m_xs_64_64(uint64_t state) +static inline uint64_t pcg_output_rxs_m_xs_64_64(uint64_t state) { uint64_t word = ((state >> ((state >> 59u) + 5u)) ^ state) * 12605985483714917081ull; @@ -187,7 +187,7 @@ inline uint64_t pcg_output_rxs_m_xs_64_64(uint64_t sta } #if PCG_HAS_128BIT_OPS -inline pcg128_t pcg_output_rxs_m_xs_128_128(pcg128_t state) +static inline pcg128_t pcg_output_rxs_m_xs_128_128(pcg128_t state) { pcg128_t word = ((state >> ((state >> 122u) + 6u)) ^ state) * (PCG_128BIT_CONSTANT(17766728186571221404ULL, @@ -199,24 +199,24 @@ inline pcg128_t pcg_output_rxs_m_xs_128_128(pcg128_t s /* RXS M */ -inline uint8_t pcg_output_rxs_m_16_8(uint16_t state) +static inline uint8_t pcg_output_rxs_m_16_8(uint16_t state) { return (((state >> ((state >> 13u) + 3u)) ^ state) * 62169u) >> 8u; } -inline uint16_t pcg_output_rxs_m_32_16(uint32_t state) +static inline uint16_t pcg_output_rxs_m_32_16(uint32_t state) { return (((state >> ((state >> 28u) + 4u)) ^ state) * 277803737u) >> 16u; } -inline uint32_t pcg_output_rxs_m_64_32(uint64_t state) +static inline uint32_t pcg_output_rxs_m_64_32(uint64_t state) { return (((state >> ((state >> 59u) + 5u)) ^ state) * 12605985483714917081ull) >> 32u; } #if PCG_HAS_128BIT_OPS -inline uint64_t pcg_output_rxs_m_128_64(pcg128_t state) +static inline uint64_t pcg_output_rxs_m_128_64(pcg128_t state) { return (((state >> ((state >> 122u) + 6u)) ^ state) * (PCG_128BIT_CONSTANT(17766728186571221404ULL, @@ -227,14 +227,14 @@ inline uint64_t pcg_output_rxs_m_128_64(pcg128_t state /* XSL RR (only defined for >= 64 bits) */ -inline uint32_t pcg_output_xsl_rr_64_32(uint64_t state) +static inline uint32_t pcg_output_xsl_rr_64_32(uint64_t state) { return pcg_rotr_32(((uint32_t)(state >> 32u)) ^ (uint32_t)state, state >> 59u); } #if PCG_HAS_128BIT_OPS -inline uint64_t pcg_output_xsl_rr_128_64(pcg128_t state) +static inline uint64_t pcg_output_xsl_rr_128_64(pcg128_t state) { return pcg_rotr_64(((uint64_t)(state >> 64u)) ^ (uint64_t)state, state >> 122u); @@ -243,7 +243,7 @@ inline uint64_t pcg_output_xsl_rr_128_64(pcg128_t stat /* XSL RR RR (only defined for >= 64 bits) */ -inline uint64_t pcg_output_xsl_rr_rr_64_64(uint64_t state) +static inline uint64_t pcg_output_xsl_rr_rr_64_64(uint64_t state) { uint32_t rot1 = (uint32_t)(state >> 59u); uint32_t high = (uint32_t)(state >> 32u); @@ -255,7 +255,7 @@ inline uint64_t pcg_output_xsl_rr_rr_64_64(uint64_t st } #if PCG_HAS_128BIT_OPS -inline pcg128_t pcg_output_xsl_rr_rr_128_128(pcg128_t state) +static inline pcg128_t pcg_output_xsl_rr_rr_128_128(pcg128_t state) { uint32_t rot1 = (uint32_t)(state >> 122u); uint64_t high = (uint64_t)(state >> 64u); @@ -400,191 +400,191 @@ extern pcg128_t pcg_advance_lcg_128(pcg128_t state, pc * a good reason to call them directly. */ -inline void pcg_oneseq_8_step_r(struct pcg_state_8* rng) +static inline void pcg_oneseq_8_step_r(struct pcg_state_8* rng) { rng->state = rng->state * PCG_DEFAULT_MULTIPLIER_8 + PCG_DEFAULT_INCREMENT_8; } -inline void pcg_oneseq_8_advance_r(struct pcg_state_8* rng, uint8_t delta) +static inline void pcg_oneseq_8_advance_r(struct pcg_state_8* rng, uint8_t delta) { rng->state = pcg_advance_lcg_8(rng->state, delta, PCG_DEFAULT_MULTIPLIER_8, PCG_DEFAULT_INCREMENT_8); } -inline void pcg_mcg_8_step_r(struct pcg_state_8* rng) +static inline void pcg_mcg_8_step_r(struct pcg_state_8* rng) { rng->state = rng->state * PCG_DEFAULT_MULTIPLIER_8; } -inline void pcg_mcg_8_advance_r(struct pcg_state_8* rng, uint8_t delta) +static inline void pcg_mcg_8_advance_r(struct pcg_state_8* rng, uint8_t delta) { rng->state = pcg_advance_lcg_8(rng->state, delta, PCG_DEFAULT_MULTIPLIER_8, 0u); } -inline void pcg_unique_8_step_r(struct pcg_state_8* rng) +static inline void pcg_unique_8_step_r(struct pcg_state_8* rng) { rng->state = rng->state * PCG_DEFAULT_MULTIPLIER_8 + (uint8_t)(((intptr_t)rng) | 1u); } -inline void pcg_unique_8_advance_r(struct pcg_state_8* rng, uint8_t delta) +static inline void pcg_unique_8_advance_r(struct pcg_state_8* rng, uint8_t delta) { rng->state = pcg_advance_lcg_8(rng->state, delta, PCG_DEFAULT_MULTIPLIER_8, (uint8_t)(((intptr_t)rng) | 1u)); } -inline void pcg_setseq_8_step_r(struct pcg_state_setseq_8* rng) +static inline void pcg_setseq_8_step_r(struct pcg_state_setseq_8* rng) { rng->state = rng->state * PCG_DEFAULT_MULTIPLIER_8 + rng->inc; } -inline void pcg_setseq_8_advance_r(struct pcg_state_setseq_8* rng, +static inline void pcg_setseq_8_advance_r(struct pcg_state_setseq_8* rng, uint8_t delta) { rng->state = pcg_advance_lcg_8(rng->state, delta, PCG_DEFAULT_MULTIPLIER_8, rng->inc); } -inline void pcg_oneseq_16_step_r(struct pcg_state_16* rng) +static inline void pcg_oneseq_16_step_r(struct pcg_state_16* rng) { rng->state = rng->state * PCG_DEFAULT_MULTIPLIER_16 + PCG_DEFAULT_INCREMENT_16; } -inline void pcg_oneseq_16_advance_r(struct pcg_state_16* rng, uint16_t delta) +static inline void pcg_oneseq_16_advance_r(struct pcg_state_16* rng, uint16_t delta) { rng->state = pcg_advance_lcg_16( rng->state, delta, PCG_DEFAULT_MULTIPLIER_16, PCG_DEFAULT_INCREMENT_16); } -inline void pcg_mcg_16_step_r(struct pcg_state_16* rng) +static inline void pcg_mcg_16_step_r(struct pcg_state_16* rng) { rng->state = rng->state * PCG_DEFAULT_MULTIPLIER_16; } -inline void pcg_mcg_16_advance_r(struct pcg_state_16* rng, uint16_t delta) +static inline void pcg_mcg_16_advance_r(struct pcg_state_16* rng, uint16_t delta) { rng->state = pcg_advance_lcg_16(rng->state, delta, PCG_DEFAULT_MULTIPLIER_16, 0u); } -inline void pcg_unique_16_step_r(struct pcg_state_16* rng) +static inline void pcg_unique_16_step_r(struct pcg_state_16* rng) { rng->state = rng->state * PCG_DEFAULT_MULTIPLIER_16 + (uint16_t)(((intptr_t)rng) | 1u); } -inline void pcg_unique_16_advance_r(struct pcg_state_16* rng, uint16_t delta) +static inline void pcg_unique_16_advance_r(struct pcg_state_16* rng, uint16_t delta) { rng->state = pcg_advance_lcg_16(rng->state, delta, PCG_DEFAULT_MULTIPLIER_16, (uint16_t)(((intptr_t)rng) | 1u)); } -inline void pcg_setseq_16_step_r(struct pcg_state_setseq_16* rng) +static inline void pcg_setseq_16_step_r(struct pcg_state_setseq_16* rng) { rng->state = rng->state * PCG_DEFAULT_MULTIPLIER_16 + rng->inc; } -inline void pcg_setseq_16_advance_r(struct pcg_state_setseq_16* rng, +static inline void pcg_setseq_16_advance_r(struct pcg_state_setseq_16* rng, uint16_t delta) { rng->state = pcg_advance_lcg_16(rng->state, delta, PCG_DEFAULT_MULTIPLIER_16, rng->inc); } -inline void pcg_oneseq_32_step_r(struct pcg_state_32* rng) +static inline void pcg_oneseq_32_step_r(struct pcg_state_32* rng) { rng->state = rng->state * PCG_DEFAULT_MULTIPLIER_32 + PCG_DEFAULT_INCREMENT_32; } -inline void pcg_oneseq_32_advance_r(struct pcg_state_32* rng, uint32_t delta) +static inline void pcg_oneseq_32_advance_r(struct pcg_state_32* rng, uint32_t delta) { rng->state = pcg_advance_lcg_32( rng->state, delta, PCG_DEFAULT_MULTIPLIER_32, PCG_DEFAULT_INCREMENT_32); } -inline void pcg_mcg_32_step_r(struct pcg_state_32* rng) +static inline void pcg_mcg_32_step_r(struct pcg_state_32* rng) { rng->state = rng->state * PCG_DEFAULT_MULTIPLIER_32; } -inline void pcg_mcg_32_advance_r(struct pcg_state_32* rng, uint32_t delta) +static inline void pcg_mcg_32_advance_r(struct pcg_state_32* rng, uint32_t delta) { rng->state = pcg_advance_lcg_32(rng->state, delta, PCG_DEFAULT_MULTIPLIER_32, 0u); } -inline void pcg_unique_32_step_r(struct pcg_state_32* rng) +static inline void pcg_unique_32_step_r(struct pcg_state_32* rng) { rng->state = rng->state * PCG_DEFAULT_MULTIPLIER_32 + (uint32_t)(((intptr_t)rng) | 1u); } -inline void pcg_unique_32_advance_r(struct pcg_state_32* rng, uint32_t delta) +static inline void pcg_unique_32_advance_r(struct pcg_state_32* rng, uint32_t delta) { rng->state = pcg_advance_lcg_32(rng->state, delta, PCG_DEFAULT_MULTIPLIER_32, (uint32_t)(((intptr_t)rng) | 1u)); } -inline void pcg_setseq_32_step_r(struct pcg_state_setseq_32* rng) +static inline void pcg_setseq_32_step_r(struct pcg_state_setseq_32* rng) { rng->state = rng->state * PCG_DEFAULT_MULTIPLIER_32 + rng->inc; } -inline void pcg_setseq_32_advance_r(struct pcg_state_setseq_32* rng, +static inline void pcg_setseq_32_advance_r(struct pcg_state_setseq_32* rng, uint32_t delta) { rng->state = pcg_advance_lcg_32(rng->state, delta, PCG_DEFAULT_MULTIPLIER_32, rng->inc); } -inline void pcg_oneseq_64_step_r(struct pcg_state_64* rng) +static inline void pcg_oneseq_64_step_r(struct pcg_state_64* rng) { rng->state = rng->state * PCG_DEFAULT_MULTIPLIER_64 + PCG_DEFAULT_INCREMENT_64; } -inline void pcg_oneseq_64_advance_r(struct pcg_state_64* rng, uint64_t delta) +static inline void pcg_oneseq_64_advance_r(struct pcg_state_64* rng, uint64_t delta) { rng->state = pcg_advance_lcg_64( rng->state, delta, PCG_DEFAULT_MULTIPLIER_64, PCG_DEFAULT_INCREMENT_64); } -inline void pcg_mcg_64_step_r(struct pcg_state_64* rng) +static inline void pcg_mcg_64_step_r(struct pcg_state_64* rng) { rng->state = rng->state * PCG_DEFAULT_MULTIPLIER_64; } -inline void pcg_mcg_64_advance_r(struct pcg_state_64* rng, uint64_t delta) +static inline void pcg_mcg_64_advance_r(struct pcg_state_64* rng, uint64_t delta) { rng->state = pcg_advance_lcg_64(rng->state, delta, PCG_DEFAULT_MULTIPLIER_64, 0u); } -inline void pcg_unique_64_step_r(struct pcg_state_64* rng) +static inline void pcg_unique_64_step_r(struct pcg_state_64* rng) { rng->state = rng->state * PCG_DEFAULT_MULTIPLIER_64 + (uint64_t)(((intptr_t)rng) | 1u); } -inline void pcg_unique_64_advance_r(struct pcg_state_64* rng, uint64_t delta) +static inline void pcg_unique_64_advance_r(struct pcg_state_64* rng, uint64_t delta) { rng->state = pcg_advance_lcg_64(rng->state, delta, PCG_DEFAULT_MULTIPLIER_64, (uint64_t)(((intptr_t)rng) | 1u)); } -inline void pcg_setseq_64_step_r(struct pcg_state_setseq_64* rng) +static inline void pcg_setseq_64_step_r(struct pcg_state_setseq_64* rng) { rng->state = rng->state * PCG_DEFAULT_MULTIPLIER_64 + rng->inc; } -inline void pcg_setseq_64_advance_r(struct pcg_state_setseq_64* rng, +static inline void pcg_setseq_64_advance_r(struct pcg_state_setseq_64* rng, uint64_t delta) { rng->state = pcg_advance_lcg_64(rng->state, delta, @@ -592,7 +592,7 @@ inline void pcg_setseq_64_advance_r(struct pcg_state_s } #if PCG_HAS_128BIT_OPS -inline void pcg_oneseq_128_step_r(struct pcg_state_128* rng) +static inline void pcg_oneseq_128_step_r(struct pcg_state_128* rng) { rng->state = rng->state * PCG_DEFAULT_MULTIPLIER_128 + PCG_DEFAULT_INCREMENT_128; @@ -600,7 +600,7 @@ inline void pcg_oneseq_128_step_r(struct pcg_state_128 #endif #if PCG_HAS_128BIT_OPS -inline void pcg_oneseq_128_advance_r(struct pcg_state_128* rng, pcg128_t delta) +static inline void pcg_oneseq_128_advance_r(struct pcg_state_128* rng, pcg128_t delta) { rng->state = pcg_advance_lcg_128(rng->state, delta, PCG_DEFAULT_MULTIPLIER_128, @@ -609,14 +609,14 @@ inline void pcg_oneseq_128_advance_r(struct pcg_state_ #endif #if PCG_HAS_128BIT_OPS -inline void pcg_mcg_128_step_r(struct pcg_state_128* rng) +static inline void pcg_mcg_128_step_r(struct pcg_state_128* rng) { rng->state = rng->state * PCG_DEFAULT_MULTIPLIER_128; } #endif #if PCG_HAS_128BIT_OPS -inline void pcg_mcg_128_advance_r(struct pcg_state_128* rng, pcg128_t delta) +static inline void pcg_mcg_128_advance_r(struct pcg_state_128* rng, pcg128_t delta) { rng->state = pcg_advance_lcg_128(rng->state, delta, PCG_DEFAULT_MULTIPLIER_128, 0u); @@ -624,7 +624,7 @@ inline void pcg_mcg_128_advance_r(struct pcg_state_128 #endif #if PCG_HAS_128BIT_OPS -inline void pcg_unique_128_step_r(struct pcg_state_128* rng) +static inline void pcg_unique_128_step_r(struct pcg_state_128* rng) { rng->state = rng->state * PCG_DEFAULT_MULTIPLIER_128 + (pcg128_t)(((intptr_t)rng) | 1u); @@ -632,7 +632,7 @@ inline void pcg_unique_128_step_r(struct pcg_state_128 #endif #if PCG_HAS_128BIT_OPS -inline void pcg_unique_128_advance_r(struct pcg_state_128* rng, pcg128_t delta) +static inline void pcg_unique_128_advance_r(struct pcg_state_128* rng, pcg128_t delta) { rng->state = pcg_advance_lcg_128(rng->state, delta, PCG_DEFAULT_MULTIPLIER_128, @@ -641,14 +641,14 @@ inline void pcg_unique_128_advance_r(struct pcg_state_ #endif #if PCG_HAS_128BIT_OPS -inline void pcg_setseq_128_step_r(struct pcg_state_setseq_128* rng) +static inline void pcg_setseq_128_step_r(struct pcg_state_setseq_128* rng) { rng->state = rng->state * PCG_DEFAULT_MULTIPLIER_128 + rng->inc; } #endif #if PCG_HAS_128BIT_OPS -inline void pcg_setseq_128_advance_r(struct pcg_state_setseq_128* rng, +static inline void pcg_setseq_128_advance_r(struct pcg_state_setseq_128* rng, pcg128_t delta) { rng->state = pcg_advance_lcg_128(rng->state, delta, @@ -661,7 +661,7 @@ inline void pcg_setseq_128_advance_r(struct pcg_state_ * these functions. */ -inline void pcg_oneseq_8_srandom_r(struct pcg_state_8* rng, uint8_t initstate) +static inline void pcg_oneseq_8_srandom_r(struct pcg_state_8* rng, uint8_t initstate) { rng->state = 0U; pcg_oneseq_8_step_r(rng); @@ -669,12 +669,12 @@ inline void pcg_oneseq_8_srandom_r(struct pcg_state_8* pcg_oneseq_8_step_r(rng); } -inline void pcg_mcg_8_srandom_r(struct pcg_state_8* rng, uint8_t initstate) +static inline void pcg_mcg_8_srandom_r(struct pcg_state_8* rng, uint8_t initstate) { rng->state = initstate | 1u; } -inline void pcg_unique_8_srandom_r(struct pcg_state_8* rng, uint8_t initstate) +static inline void pcg_unique_8_srandom_r(struct pcg_state_8* rng, uint8_t initstate) { rng->state = 0U; pcg_unique_8_step_r(rng); @@ -682,7 +682,7 @@ inline void pcg_unique_8_srandom_r(struct pcg_state_8* pcg_unique_8_step_r(rng); } -inline void pcg_setseq_8_srandom_r(struct pcg_state_setseq_8* rng, +static inline void pcg_setseq_8_srandom_r(struct pcg_state_setseq_8* rng, uint8_t initstate, uint8_t initseq) { rng->state = 0U; @@ -692,7 +692,7 @@ inline void pcg_setseq_8_srandom_r(struct pcg_state_se pcg_setseq_8_step_r(rng); } -inline void pcg_oneseq_16_srandom_r(struct pcg_state_16* rng, +static inline void pcg_oneseq_16_srandom_r(struct pcg_state_16* rng, uint16_t initstate) { rng->state = 0U; @@ -701,12 +701,12 @@ inline void pcg_oneseq_16_srandom_r(struct pcg_state_1 pcg_oneseq_16_step_r(rng); } -inline void pcg_mcg_16_srandom_r(struct pcg_state_16* rng, uint16_t initstate) +static inline void pcg_mcg_16_srandom_r(struct pcg_state_16* rng, uint16_t initstate) { rng->state = initstate | 1u; } -inline void pcg_unique_16_srandom_r(struct pcg_state_16* rng, +static inline void pcg_unique_16_srandom_r(struct pcg_state_16* rng, uint16_t initstate) { rng->state = 0U; @@ -715,7 +715,7 @@ inline void pcg_unique_16_srandom_r(struct pcg_state_1 pcg_unique_16_step_r(rng); } -inline void pcg_setseq_16_srandom_r(struct pcg_state_setseq_16* rng, +static inline void pcg_setseq_16_srandom_r(struct pcg_state_setseq_16* rng, uint16_t initstate, uint16_t initseq) { rng->state = 0U; @@ -725,7 +725,7 @@ inline void pcg_setseq_16_srandom_r(struct pcg_state_s pcg_setseq_16_step_r(rng); } -inline void pcg_oneseq_32_srandom_r(struct pcg_state_32* rng, +static inline void pcg_oneseq_32_srandom_r(struct pcg_state_32* rng, uint32_t initstate) { rng->state = 0U; @@ -734,12 +734,12 @@ inline void pcg_oneseq_32_srandom_r(struct pcg_state_3 pcg_oneseq_32_step_r(rng); } -inline void pcg_mcg_32_srandom_r(struct pcg_state_32* rng, uint32_t initstate) +static inline void pcg_mcg_32_srandom_r(struct pcg_state_32* rng, uint32_t initstate) { rng->state = initstate | 1u; } -inline void pcg_unique_32_srandom_r(struct pcg_state_32* rng, +static inline void pcg_unique_32_srandom_r(struct pcg_state_32* rng, uint32_t initstate) { rng->state = 0U; @@ -748,7 +748,7 @@ inline void pcg_unique_32_srandom_r(struct pcg_state_3 pcg_unique_32_step_r(rng); } -inline void pcg_setseq_32_srandom_r(struct pcg_state_setseq_32* rng, +static inline void pcg_setseq_32_srandom_r(struct pcg_state_setseq_32* rng, uint32_t initstate, uint32_t initseq) { rng->state = 0U; @@ -758,7 +758,7 @@ inline void pcg_setseq_32_srandom_r(struct pcg_state_s pcg_setseq_32_step_r(rng); } -inline void pcg_oneseq_64_srandom_r(struct pcg_state_64* rng, +static inline void pcg_oneseq_64_srandom_r(struct pcg_state_64* rng, uint64_t initstate) { rng->state = 0U; @@ -767,12 +767,12 @@ inline void pcg_oneseq_64_srandom_r(struct pcg_state_6 pcg_oneseq_64_step_r(rng); } -inline void pcg_mcg_64_srandom_r(struct pcg_state_64* rng, uint64_t initstate) +static inline void pcg_mcg_64_srandom_r(struct pcg_state_64* rng, uint64_t initstate) { rng->state = initstate | 1u; } -inline void pcg_unique_64_srandom_r(struct pcg_state_64* rng, +static inline void pcg_unique_64_srandom_r(struct pcg_state_64* rng, uint64_t initstate) { rng->state = 0U; @@ -781,7 +781,7 @@ inline void pcg_unique_64_srandom_r(struct pcg_state_6 pcg_unique_64_step_r(rng); } -inline void pcg_setseq_64_srandom_r(struct pcg_state_setseq_64* rng, +static inline void pcg_setseq_64_srandom_r(struct pcg_state_setseq_64* rng, uint64_t initstate, uint64_t initseq) { rng->state = 0U; @@ -792,7 +792,7 @@ inline void pcg_setseq_64_srandom_r(struct pcg_state_s } #if PCG_HAS_128BIT_OPS -inline void pcg_oneseq_128_srandom_r(struct pcg_state_128* rng, +static inline void pcg_oneseq_128_srandom_r(struct pcg_state_128* rng, pcg128_t initstate) { rng->state = 0U; @@ -803,14 +803,14 @@ inline void pcg_oneseq_128_srandom_r(struct pcg_state_ #endif #if PCG_HAS_128BIT_OPS -inline void pcg_mcg_128_srandom_r(struct pcg_state_128* rng, pcg128_t initstate) +static inline void pcg_mcg_128_srandom_r(struct pcg_state_128* rng, pcg128_t initstate) { rng->state = initstate | 1u; } #endif #if PCG_HAS_128BIT_OPS -inline void pcg_unique_128_srandom_r(struct pcg_state_128* rng, +static inline void pcg_unique_128_srandom_r(struct pcg_state_128* rng, pcg128_t initstate) { rng->state = 0U; @@ -821,7 +821,7 @@ inline void pcg_unique_128_srandom_r(struct pcg_state_ #endif #if PCG_HAS_128BIT_OPS -inline void pcg_setseq_128_srandom_r(struct pcg_state_setseq_128* rng, +static inline void pcg_setseq_128_srandom_r(struct pcg_state_setseq_128* rng, pcg128_t initstate, pcg128_t initseq) { rng->state = 0U; @@ -863,14 +863,14 @@ inline void pcg_setseq_128_srandom_r(struct pcg_state_ /* Generation functions for XSH RS */ -inline uint8_t pcg_oneseq_16_xsh_rs_8_random_r(struct pcg_state_16* rng) +static inline uint8_t pcg_oneseq_16_xsh_rs_8_random_r(struct pcg_state_16* rng) { uint16_t oldstate = rng->state; pcg_oneseq_16_step_r(rng); return pcg_output_xsh_rs_16_8(oldstate); } -inline uint8_t pcg_oneseq_16_xsh_rs_8_boundedrand_r(struct pcg_state_16* rng, +static inline uint8_t pcg_oneseq_16_xsh_rs_8_boundedrand_r(struct pcg_state_16* rng, uint8_t bound) { uint8_t threshold = ((uint8_t)(-bound)) % bound; @@ -881,14 +881,14 @@ inline uint8_t pcg_oneseq_16_xsh_rs_8_boundedrand_r(st } } -inline uint16_t pcg_oneseq_32_xsh_rs_16_random_r(struct pcg_state_32* rng) +static inline uint16_t pcg_oneseq_32_xsh_rs_16_random_r(struct pcg_state_32* rng) { uint32_t oldstate = rng->state; pcg_oneseq_32_step_r(rng); return pcg_output_xsh_rs_32_16(oldstate); } -inline uint16_t pcg_oneseq_32_xsh_rs_16_boundedrand_r(struct pcg_state_32* rng, +static inline uint16_t pcg_oneseq_32_xsh_rs_16_boundedrand_r(struct pcg_state_32* rng, uint16_t bound) { uint16_t threshold = ((uint16_t)(-bound)) % bound; @@ -899,14 +899,14 @@ inline uint16_t pcg_oneseq_32_xsh_rs_16_boundedrand_r( } } -inline uint32_t pcg_oneseq_64_xsh_rs_32_random_r(struct pcg_state_64* rng) +static inline uint32_t pcg_oneseq_64_xsh_rs_32_random_r(struct pcg_state_64* rng) { uint64_t oldstate = rng->state; pcg_oneseq_64_step_r(rng); return pcg_output_xsh_rs_64_32(oldstate); } -inline uint32_t pcg_oneseq_64_xsh_rs_32_boundedrand_r(struct pcg_state_64* rng, +static inline uint32_t pcg_oneseq_64_xsh_rs_32_boundedrand_r(struct pcg_state_64* rng, uint32_t bound) { uint32_t threshold = -bound % bound; @@ -918,7 +918,7 @@ inline uint32_t pcg_oneseq_64_xsh_rs_32_boundedrand_r( } #if PCG_HAS_128BIT_OPS -inline uint64_t pcg_oneseq_128_xsh_rs_64_random_r(struct pcg_state_128* rng) +static inline uint64_t pcg_oneseq_128_xsh_rs_64_random_r(struct pcg_state_128* rng) { pcg_oneseq_128_step_r(rng); return pcg_output_xsh_rs_128_64(rng->state); @@ -926,7 +926,7 @@ inline uint64_t pcg_oneseq_128_xsh_rs_64_random_r(stru #endif #if PCG_HAS_128BIT_OPS -inline uint64_t +static inline uint64_t pcg_oneseq_128_xsh_rs_64_boundedrand_r(struct pcg_state_128* rng, uint64_t bound) { @@ -939,14 +939,14 @@ pcg_oneseq_128_xsh_rs_64_boundedrand_r(struct pcg_stat } #endif -inline uint8_t pcg_unique_16_xsh_rs_8_random_r(struct pcg_state_16* rng) +static inline uint8_t pcg_unique_16_xsh_rs_8_random_r(struct pcg_state_16* rng) { uint16_t oldstate = rng->state; pcg_unique_16_step_r(rng); return pcg_output_xsh_rs_16_8(oldstate); } -inline uint8_t pcg_unique_16_xsh_rs_8_boundedrand_r(struct pcg_state_16* rng, +static inline uint8_t pcg_unique_16_xsh_rs_8_boundedrand_r(struct pcg_state_16* rng, uint8_t bound) { uint8_t threshold = ((uint8_t)(-bound)) % bound; @@ -957,14 +957,14 @@ inline uint8_t pcg_unique_16_xsh_rs_8_boundedrand_r(st } } -inline uint16_t pcg_unique_32_xsh_rs_16_random_r(struct pcg_state_32* rng) +static inline uint16_t pcg_unique_32_xsh_rs_16_random_r(struct pcg_state_32* rng) { uint32_t oldstate = rng->state; pcg_unique_32_step_r(rng); return pcg_output_xsh_rs_32_16(oldstate); } -inline uint16_t pcg_unique_32_xsh_rs_16_boundedrand_r(struct pcg_state_32* rng, +static inline uint16_t pcg_unique_32_xsh_rs_16_boundedrand_r(struct pcg_state_32* rng, uint16_t bound) { uint16_t threshold = ((uint16_t)(-bound)) % bound; @@ -975,14 +975,14 @@ inline uint16_t pcg_unique_32_xsh_rs_16_boundedrand_r( } } -inline uint32_t pcg_unique_64_xsh_rs_32_random_r(struct pcg_state_64* rng) +static inline uint32_t pcg_unique_64_xsh_rs_32_random_r(struct pcg_state_64* rng) { uint64_t oldstate = rng->state; pcg_unique_64_step_r(rng); return pcg_output_xsh_rs_64_32(oldstate); } -inline uint32_t pcg_unique_64_xsh_rs_32_boundedrand_r(struct pcg_state_64* rng, +static inline uint32_t pcg_unique_64_xsh_rs_32_boundedrand_r(struct pcg_state_64* rng, uint32_t bound) { uint32_t threshold = -bound % bound; @@ -994,7 +994,7 @@ inline uint32_t pcg_unique_64_xsh_rs_32_boundedrand_r( } #if PCG_HAS_128BIT_OPS -inline uint64_t pcg_unique_128_xsh_rs_64_random_r(struct pcg_state_128* rng) +static inline uint64_t pcg_unique_128_xsh_rs_64_random_r(struct pcg_state_128* rng) { pcg_unique_128_step_r(rng); return pcg_output_xsh_rs_128_64(rng->state); @@ -1002,7 +1002,7 @@ inline uint64_t pcg_unique_128_xsh_rs_64_random_r(stru #endif #if PCG_HAS_128BIT_OPS -inline uint64_t +static inline uint64_t pcg_unique_128_xsh_rs_64_boundedrand_r(struct pcg_state_128* rng, uint64_t bound) { @@ -1015,14 +1015,14 @@ pcg_unique_128_xsh_rs_64_boundedrand_r(struct pcg_stat } #endif -inline uint8_t pcg_setseq_16_xsh_rs_8_random_r(struct pcg_state_setseq_16* rng) +static inline uint8_t pcg_setseq_16_xsh_rs_8_random_r(struct pcg_state_setseq_16* rng) { uint16_t oldstate = rng->state; pcg_setseq_16_step_r(rng); return pcg_output_xsh_rs_16_8(oldstate); } -inline uint8_t +static inline uint8_t pcg_setseq_16_xsh_rs_8_boundedrand_r(struct pcg_state_setseq_16* rng, uint8_t bound) { @@ -1034,7 +1034,7 @@ pcg_setseq_16_xsh_rs_8_boundedrand_r(struct pcg_state_ } } -inline uint16_t +static inline uint16_t pcg_setseq_32_xsh_rs_16_random_r(struct pcg_state_setseq_32* rng) { uint32_t oldstate = rng->state; @@ -1042,7 +1042,7 @@ pcg_setseq_32_xsh_rs_16_random_r(struct pcg_state_sets return pcg_output_xsh_rs_32_16(oldstate); } -inline uint16_t +static inline uint16_t pcg_setseq_32_xsh_rs_16_boundedrand_r(struct pcg_state_setseq_32* rng, uint16_t bound) { @@ -1054,7 +1054,7 @@ pcg_setseq_32_xsh_rs_16_boundedrand_r(struct pcg_state } } -inline uint32_t +static inline uint32_t pcg_setseq_64_xsh_rs_32_random_r(struct pcg_state_setseq_64* rng) { uint64_t oldstate = rng->state; @@ -1062,7 +1062,7 @@ pcg_setseq_64_xsh_rs_32_random_r(struct pcg_state_sets return pcg_output_xsh_rs_64_32(oldstate); } -inline uint32_t +static inline uint32_t pcg_setseq_64_xsh_rs_32_boundedrand_r(struct pcg_state_setseq_64* rng, uint32_t bound) { @@ -1075,7 +1075,7 @@ pcg_setseq_64_xsh_rs_32_boundedrand_r(struct pcg_state } #if PCG_HAS_128BIT_OPS -inline uint64_t +static inline uint64_t pcg_setseq_128_xsh_rs_64_random_r(struct pcg_state_setseq_128* rng) { pcg_setseq_128_step_r(rng); @@ -1084,7 +1084,7 @@ pcg_setseq_128_xsh_rs_64_random_r(struct pcg_state_set #endif #if PCG_HAS_128BIT_OPS -inline uint64_t +static inline uint64_t pcg_setseq_128_xsh_rs_64_boundedrand_r(struct pcg_state_setseq_128* rng, uint64_t bound) { @@ -1097,14 +1097,14 @@ pcg_setseq_128_xsh_rs_64_boundedrand_r(struct pcg_stat } #endif -inline uint8_t pcg_mcg_16_xsh_rs_8_random_r(struct pcg_state_16* rng) +static inline uint8_t pcg_mcg_16_xsh_rs_8_random_r(struct pcg_state_16* rng) { uint16_t oldstate = rng->state; pcg_mcg_16_step_r(rng); return pcg_output_xsh_rs_16_8(oldstate); } -inline uint8_t pcg_mcg_16_xsh_rs_8_boundedrand_r(struct pcg_state_16* rng, +static inline uint8_t pcg_mcg_16_xsh_rs_8_boundedrand_r(struct pcg_state_16* rng, uint8_t bound) { uint8_t threshold = ((uint8_t)(-bound)) % bound; @@ -1115,14 +1115,14 @@ inline uint8_t pcg_mcg_16_xsh_rs_8_boundedrand_r(struc } } -inline uint16_t pcg_mcg_32_xsh_rs_16_random_r(struct pcg_state_32* rng) +static inline uint16_t pcg_mcg_32_xsh_rs_16_random_r(struct pcg_state_32* rng) { uint32_t oldstate = rng->state; pcg_mcg_32_step_r(rng); return pcg_output_xsh_rs_32_16(oldstate); } -inline uint16_t pcg_mcg_32_xsh_rs_16_boundedrand_r(struct pcg_state_32* rng, +static inline uint16_t pcg_mcg_32_xsh_rs_16_boundedrand_r(struct pcg_state_32* rng, uint16_t bound) { uint16_t threshold = ((uint16_t)(-bound)) % bound; @@ -1133,14 +1133,14 @@ inline uint16_t pcg_mcg_32_xsh_rs_16_boundedrand_r(str } } -inline uint32_t pcg_mcg_64_xsh_rs_32_random_r(struct pcg_state_64* rng) +static inline uint32_t pcg_mcg_64_xsh_rs_32_random_r(struct pcg_state_64* rng) { uint64_t oldstate = rng->state; pcg_mcg_64_step_r(rng); return pcg_output_xsh_rs_64_32(oldstate); } -inline uint32_t pcg_mcg_64_xsh_rs_32_boundedrand_r(struct pcg_state_64* rng, +static inline uint32_t pcg_mcg_64_xsh_rs_32_boundedrand_r(struct pcg_state_64* rng, uint32_t bound) { uint32_t threshold = -bound % bound; @@ -1152,7 +1152,7 @@ inline uint32_t pcg_mcg_64_xsh_rs_32_boundedrand_r(str } #if PCG_HAS_128BIT_OPS -inline uint64_t pcg_mcg_128_xsh_rs_64_random_r(struct pcg_state_128* rng) +static inline uint64_t pcg_mcg_128_xsh_rs_64_random_r(struct pcg_state_128* rng) { pcg_mcg_128_step_r(rng); return pcg_output_xsh_rs_128_64(rng->state); @@ -1160,7 +1160,7 @@ inline uint64_t pcg_mcg_128_xsh_rs_64_random_r(struct #endif #if PCG_HAS_128BIT_OPS -inline uint64_t pcg_mcg_128_xsh_rs_64_boundedrand_r(struct pcg_state_128* rng, +static inline uint64_t pcg_mcg_128_xsh_rs_64_boundedrand_r(struct pcg_state_128* rng, uint64_t bound) { uint64_t threshold = -bound % bound; @@ -1174,14 +1174,14 @@ inline uint64_t pcg_mcg_128_xsh_rs_64_boundedrand_r(st /* Generation functions for XSH RR */ -inline uint8_t pcg_oneseq_16_xsh_rr_8_random_r(struct pcg_state_16* rng) +static inline uint8_t pcg_oneseq_16_xsh_rr_8_random_r(struct pcg_state_16* rng) { uint16_t oldstate = rng->state; pcg_oneseq_16_step_r(rng); return pcg_output_xsh_rr_16_8(oldstate); } -inline uint8_t pcg_oneseq_16_xsh_rr_8_boundedrand_r(struct pcg_state_16* rng, +static inline uint8_t pcg_oneseq_16_xsh_rr_8_boundedrand_r(struct pcg_state_16* rng, uint8_t bound) { uint8_t threshold = ((uint8_t)(-bound)) % bound; @@ -1192,14 +1192,14 @@ inline uint8_t pcg_oneseq_16_xsh_rr_8_boundedrand_r(st } } -inline uint16_t pcg_oneseq_32_xsh_rr_16_random_r(struct pcg_state_32* rng) +static inline uint16_t pcg_oneseq_32_xsh_rr_16_random_r(struct pcg_state_32* rng) { uint32_t oldstate = rng->state; pcg_oneseq_32_step_r(rng); return pcg_output_xsh_rr_32_16(oldstate); } -inline uint16_t pcg_oneseq_32_xsh_rr_16_boundedrand_r(struct pcg_state_32* rng, +static inline uint16_t pcg_oneseq_32_xsh_rr_16_boundedrand_r(struct pcg_state_32* rng, uint16_t bound) { uint16_t threshold = ((uint16_t)(-bound)) % bound; @@ -1210,14 +1210,14 @@ inline uint16_t pcg_oneseq_32_xsh_rr_16_boundedrand_r( } } -inline uint32_t pcg_oneseq_64_xsh_rr_32_random_r(struct pcg_state_64* rng) +static inline uint32_t pcg_oneseq_64_xsh_rr_32_random_r(struct pcg_state_64* rng) { uint64_t oldstate = rng->state; pcg_oneseq_64_step_r(rng); return pcg_output_xsh_rr_64_32(oldstate); } -inline uint32_t pcg_oneseq_64_xsh_rr_32_boundedrand_r(struct pcg_state_64* rng, +static inline uint32_t pcg_oneseq_64_xsh_rr_32_boundedrand_r(struct pcg_state_64* rng, uint32_t bound) { uint32_t threshold = -bound % bound; @@ -1229,7 +1229,7 @@ inline uint32_t pcg_oneseq_64_xsh_rr_32_boundedrand_r( } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sat Aug 15 19:45:50 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C4CF837CA2F; Sat, 15 Aug 2020 19:45:50 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BTW4t4n1qz4fJC; Sat, 15 Aug 2020 19:45:50 +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 875C8244E0; Sat, 15 Aug 2020 19:45:50 +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 07FJjojh032666; Sat, 15 Aug 2020 19:45:50 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07FJjo8r032665; Sat, 15 Aug 2020 19:45:50 GMT (envelope-from cem@FreeBSD.org) Message-Id: <202008151945.07FJjo8r032665@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Sat, 15 Aug 2020 19:45:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364261 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 364261 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 15 Aug 2020 19:45:50 -0000 Author: cem Date: Sat Aug 15 19:45:50 2020 New Revision: 364261 URL: https://svnweb.freebsd.org/changeset/base/364261 Log: witness(4): Print stack of prior observed lock order on reversal The first time Witness observes a lock order between two locks, it records the caller's stack. On detected reversal, print out that previous observed stack. It is quite possible that the reported "LOR" is the correct ordering, and the violation was the observed earlier ordering. Reviewed by: mjg Differential Revision: https://reviews.freebsd.org/D26070 Modified: head/sys/kern/subr_witness.c Modified: head/sys/kern/subr_witness.c ============================================================================== --- head/sys/kern/subr_witness.c Sat Aug 15 18:46:26 2020 (r364260) +++ head/sys/kern/subr_witness.c Sat Aug 15 19:45:50 2020 (r364261) @@ -338,6 +338,7 @@ static void witness_ddb_display_list(int(*prnt)(const static void witness_ddb_level_descendants(struct witness *parent, int l); static void witness_ddb_list(struct thread *td); #endif +static void witness_enter_debugger(const char *msg); static void witness_debugger(int cond, const char *msg); static void witness_free(struct witness *m); static struct witness *witness_get(void); @@ -358,6 +359,8 @@ static struct witness_lock_order_data *witness_lock_or static void witness_list_lock(struct lock_instance *instance, int (*prnt)(const char *fmt, ...)); static int witness_output(const char *fmt, ...) __printflike(1, 2); +static int witness_output_drain(void *arg __unused, const char *data, + int len); static int witness_voutput(const char *fmt, va_list ap) __printflike(1, 0); static void witness_setflag(struct lock_object *lock, int flag, int set); @@ -1281,6 +1284,8 @@ witness_checkorder(struct lock_object *lock, int flags for (j = 0, lle = lock_list; lle != NULL; lle = lle->ll_next) { for (i = lle->ll_count - 1; i >= 0; i--, j++) { + struct stack pstack; + bool pstackv, trace; MPASS(j < LOCK_CHILDCOUNT * LOCK_NCHILDREN); lock1 = &lle->ll_children[i]; @@ -1367,6 +1372,19 @@ witness_checkorder(struct lock_object *lock, int flags */ if (blessed(w, w1)) goto out; + + trace = atomic_load_int(&witness_trace); + if (trace) { + struct witness_lock_order_data *data; + + pstackv = false; + data = witness_lock_order_get(w, w1); + if (data != NULL) { + stack_copy(&data->wlod_stack, + &pstack); + pstackv = true; + } + } mtx_unlock_spin(&w_mtx); #ifdef WITNESS_NO_VNODE @@ -1413,28 +1431,60 @@ witness_checkorder(struct lock_object *lock, int flags i--; } while (i >= 0); if (i < 0) { - witness_output(" 1st %p %s (%s) @ %s:%d\n", + witness_output(" 1st %p %s (%s, %s) @ %s:%d\n", lock1->li_lock, lock1->li_lock->lo_name, - w1->w_name, fixup_filename(lock1->li_file), + w1->w_name, w1->w_class->lc_name, + fixup_filename(lock1->li_file), lock1->li_line); - witness_output(" 2nd %p %s (%s) @ %s:%d\n", lock, - lock->lo_name, w->w_name, - fixup_filename(file), line); + witness_output(" 2nd %p %s (%s, %s) @ %s:%d\n", + lock, lock->lo_name, w->w_name, + w->w_class->lc_name, fixup_filename(file), + line); } else { - witness_output(" 1st %p %s (%s) @ %s:%d\n", + struct witness *w2 = lock2->li_lock->lo_witness; + + witness_output(" 1st %p %s (%s, %s) @ %s:%d\n", lock2->li_lock, lock2->li_lock->lo_name, - lock2->li_lock->lo_witness->w_name, + w2->w_name, w2->w_class->lc_name, fixup_filename(lock2->li_file), lock2->li_line); - witness_output(" 2nd %p %s (%s) @ %s:%d\n", + witness_output(" 2nd %p %s (%s, %s) @ %s:%d\n", lock1->li_lock, lock1->li_lock->lo_name, - w1->w_name, fixup_filename(lock1->li_file), + w1->w_name, w1->w_class->lc_name, + fixup_filename(lock1->li_file), lock1->li_line); - witness_output(" 3rd %p %s (%s) @ %s:%d\n", lock, + witness_output(" 3rd %p %s (%s, %s) @ %s:%d\n", lock, lock->lo_name, w->w_name, - fixup_filename(file), line); + w->w_class->lc_name, fixup_filename(file), + line); } - witness_debugger(1, __func__); + if (trace) { + char buf[64]; + struct sbuf sb; + + sbuf_new(&sb, buf, sizeof(buf), SBUF_FIXEDLEN); + sbuf_set_drain(&sb, witness_output_drain, + NULL); + + if (pstackv) { + sbuf_printf(&sb, + "lock order %s -> %s established at:\n", + w->w_name, w1->w_name); + stack_sbuf_print_flags(&sb, &pstack, + M_NOWAIT, STACK_SBUF_FMT_LONG); + } + + sbuf_printf(&sb, + "lock order %s -> %s attempted at:\n", + w1->w_name, w->w_name); + stack_save(&pstack); + stack_sbuf_print_flags(&sb, &pstack, M_NOWAIT, + STACK_SBUF_FMT_LONG); + + sbuf_finish(&sb); + sbuf_delete(&sb); + } + witness_enter_debugger(__func__); return; } } @@ -3085,6 +3135,12 @@ witness_debugger(int cond, const char *msg) sbuf_finish(&sb); } + witness_enter_debugger(msg); +} + +static void +witness_enter_debugger(const char *msg) +{ #ifdef KDB if (witness_kdb) kdb_enter(KDB_WHY_WITNESS, msg); From owner-svn-src-all@freebsd.org Sat Aug 15 21:40:37 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5B38E37F4CC; Sat, 15 Aug 2020 21:40:37 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BTYdK1rqYz4lcc; Sat, 15 Aug 2020 21:40:37 +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 23AD225CEA; Sat, 15 Aug 2020 21:40:37 +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 07FLebOD002268; Sat, 15 Aug 2020 21:40:37 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07FLebuI002267; Sat, 15 Aug 2020 21:40:37 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <202008152140.07FLebuI002267@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Sat, 15 Aug 2020 21:40:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364262 - 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: 364262 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages 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, 15 Aug 2020 21:40:37 -0000 Author: mckusick Date: Sat Aug 15 21:40:36 2020 New Revision: 364262 URL: https://svnweb.freebsd.org/changeset/base/364262 Log: Use the sbput() function to write alternate superblocks so that they get a checkhash. PR: 246983 Sponsored by: Netflix Modified: head/sbin/fsck_ffs/main.c Modified: head/sbin/fsck_ffs/main.c ============================================================================== --- head/sbin/fsck_ffs/main.c Sat Aug 15 19:45:50 2020 (r364261) +++ head/sbin/fsck_ffs/main.c Sat Aug 15 21:40:36 2020 (r364262) @@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -604,10 +605,8 @@ checkfilesys(char *filesys) /* * Write out the duplicate super blocks */ - for (cylno = 0; cylno < sblock.fs_ncg; cylno++) - blwrite(fswritefd, (char *)&sblock, - fsbtodb(&sblock, cgsblock(&sblock, cylno)), - SBLOCKSIZE); + if (sbput(fswritefd, &sblock, sblock.fs_ncg) == 0) + fsmodified = 1; } if (rerun) resolved = 0;