From owner-svn-src-head@freebsd.org Sun Aug 13 00:04:52 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 50837DD3D8B; Sun, 13 Aug 2017 00:04:52 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 2C64777565; Sun, 13 Aug 2017 00:04:52 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7D04pYU054623; Sun, 13 Aug 2017 00:04:51 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7D04p6X054619; Sun, 13 Aug 2017 00:04:51 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201708130004.v7D04p6X054619@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sun, 13 Aug 2017 00:04:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322447 - in head/lib/libcasper/services: cap_dns/tests cap_grp/tests cap_pwd/tests cap_sysctl/tests X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: in head/lib/libcasper/services: cap_dns/tests cap_grp/tests cap_pwd/tests cap_sysctl/tests X-SVN-Commit-Revision: 322447 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Aug 2017 00:04:52 -0000 Author: ngie Date: Sun Aug 13 00:04:50 2017 New Revision: 322447 URL: https://svnweb.freebsd.org/changeset/base/322447 Log: Fix result printing - Flushing stdout prevents the buffer from being printed twice, fixing issues with stdout printing out the testplan, etc, twice. - Don't print out raw source/line numbers; hide them behind comments. MFC after: 1 week Modified: head/lib/libcasper/services/cap_dns/tests/dns_test.c head/lib/libcasper/services/cap_grp/tests/grp_test.c head/lib/libcasper/services/cap_pwd/tests/pwd_test.c head/lib/libcasper/services/cap_sysctl/tests/sysctl_test.c Modified: head/lib/libcasper/services/cap_dns/tests/dns_test.c ============================================================================== --- head/lib/libcasper/services/cap_dns/tests/dns_test.c Sat Aug 12 23:40:01 2017 (r322446) +++ head/lib/libcasper/services/cap_dns/tests/dns_test.c Sun Aug 13 00:04:50 2017 (r322447) @@ -52,18 +52,20 @@ static int ntest = 1; #define CHECK(expr) do { \ if ((expr)) \ - printf("ok %d %s:%u\n", ntest, __FILE__, __LINE__); \ + printf("ok %d # %s:%u\n", ntest, __FILE__, __LINE__); \ else \ - printf("not ok %d %s:%u\n", ntest, __FILE__, __LINE__); \ + printf("not ok %d # %s:%u\n", ntest, __FILE__, __LINE__); \ + fflush(stdout); \ ntest++; \ } while (0) #define CHECKX(expr) do { \ if ((expr)) { \ - printf("ok %d %s:%u\n", ntest, __FILE__, __LINE__); \ + printf("ok %d # %s:%u\n", ntest, __FILE__, __LINE__); \ } else { \ - printf("not ok %d %s:%u\n", ntest, __FILE__, __LINE__); \ + printf("not ok %d # %s:%u\n", ntest, __FILE__, __LINE__); \ exit(1); \ } \ + fflush(stdout); \ ntest++; \ } while (0) @@ -332,6 +334,7 @@ main(void) int families[2]; printf("1..91\n"); + fflush(stdout); capcas = cap_init(); CHECKX(capcas != NULL); Modified: head/lib/libcasper/services/cap_grp/tests/grp_test.c ============================================================================== --- head/lib/libcasper/services/cap_grp/tests/grp_test.c Sat Aug 12 23:40:01 2017 (r322446) +++ head/lib/libcasper/services/cap_grp/tests/grp_test.c Sun Aug 13 00:04:50 2017 (r322447) @@ -52,6 +52,7 @@ static int ntest = 1; printf("ok %d %s:%u\n", ntest, __FILE__, __LINE__); \ else \ printf("not ok %d %s:%u\n", ntest, __FILE__, __LINE__); \ + fflush(stdout); \ ntest++; \ } while (0) #define CHECKX(expr) do { \ @@ -61,6 +62,7 @@ static int ntest = 1; printf("not ok %d %s:%u\n", ntest, __FILE__, __LINE__); \ exit(1); \ } \ + fflush(stdout); \ ntest++; \ } while (0) @@ -1524,6 +1526,7 @@ main(void) cap_channel_t *capcas, *capgrp; printf("1..199\n"); + fflush(stdout); capcas = cap_init(); CHECKX(capcas != NULL); Modified: head/lib/libcasper/services/cap_pwd/tests/pwd_test.c ============================================================================== --- head/lib/libcasper/services/cap_pwd/tests/pwd_test.c Sat Aug 12 23:40:01 2017 (r322446) +++ head/lib/libcasper/services/cap_pwd/tests/pwd_test.c Sun Aug 13 00:04:50 2017 (r322447) @@ -49,18 +49,20 @@ static int ntest = 1; #define CHECK(expr) do { \ if ((expr)) \ - printf("ok %d %s:%u\n", ntest, __FILE__, __LINE__); \ + printf("ok %d # %s:%u\n", ntest, __FILE__, __LINE__); \ else \ - printf("not ok %d %s:%u\n", ntest, __FILE__, __LINE__);\ + printf("not ok %d # %s:%u\n", ntest, __FILE__, __LINE__); \ + fflush(stdout); \ ntest++; \ } while (0) #define CHECKX(expr) do { \ if ((expr)) { \ - printf("ok %d %s:%u\n", ntest, __FILE__, __LINE__); \ + printf("ok %d # %s:%u\n", ntest, __FILE__, __LINE__); \ } else { \ - printf("not ok %d %s:%u\n", ntest, __FILE__, __LINE__);\ + printf("not ok %d # %s:%u\n", ntest, __FILE__, __LINE__); \ exit(1); \ } \ + fflush(stdout); \ ntest++; \ } while (0) @@ -1510,6 +1512,7 @@ main(void) cap_channel_t *capcas, *cappwd; printf("1..188\n"); + fflush(stdout); capcas = cap_init(); CHECKX(capcas != NULL); Modified: head/lib/libcasper/services/cap_sysctl/tests/sysctl_test.c ============================================================================== --- head/lib/libcasper/services/cap_sysctl/tests/sysctl_test.c Sat Aug 12 23:40:01 2017 (r322446) +++ head/lib/libcasper/services/cap_sysctl/tests/sysctl_test.c Sun Aug 13 00:04:50 2017 (r322447) @@ -61,18 +61,20 @@ static int ntest = 1; #define CHECK(expr) do { \ if ((expr)) \ - printf("ok %d %s:%u\n", ntest, __FILE__, __LINE__); \ + printf("ok %d # %s:%u\n", ntest, __FILE__, __LINE__); \ else \ - printf("not ok %d %s:%u\n", ntest, __FILE__, __LINE__); \ + printf("not ok %d # %s:%u\n", ntest, __FILE__, __LINE__); \ + fflush(stdout); \ ntest++; \ } while (0) #define CHECKX(expr) do { \ if ((expr)) { \ - printf("ok %d %s:%u\n", ntest, __FILE__, __LINE__); \ + printf("ok %d # %s:%u\n", ntest, __FILE__, __LINE__); \ } else { \ - printf("not ok %d %s:%u\n", ntest, __FILE__, __LINE__); \ + printf("not ok %d # %s:%u\n", ntest, __FILE__, __LINE__); \ exit(1); \ } \ + fflush(stdout); \ ntest++; \ } while (0) @@ -1472,6 +1474,7 @@ main(void) size_t scsize; printf("1..256\n"); + fflush(stdout); scsize = sizeof(scvalue0); CHECKX(sysctlbyname(SYSCTL0_NAME, &scvalue0, &scsize, NULL, 0) == 0); From owner-svn-src-head@freebsd.org Sun Aug 13 00:14:09 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AFA57DD46FF; Sun, 13 Aug 2017 00:14:09 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 7E59E77AAF; Sun, 13 Aug 2017 00:14:09 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7D0E8Np058679; Sun, 13 Aug 2017 00:14:08 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7D0E8oC058678; Sun, 13 Aug 2017 00:14:08 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201708130014.v7D0E8oC058678@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sun, 13 Aug 2017 00:14:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322448 - head/lib/libcasper/services/cap_sysctl/tests X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: head/lib/libcasper/services/cap_sysctl/tests X-SVN-Commit-Revision: 322448 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Aug 2017 00:14:09 -0000 Author: ngie Date: Sun Aug 13 00:14:08 2017 New Revision: 322448 URL: https://svnweb.freebsd.org/changeset/base/322448 Log: Make root-privileges a requirement for the test Some of the testcases try to manipulate sysctls that require root privileges, e.g., "kern.sync_on_panic". Make root-privileges a hard requirement so the tests don't raise false positives due to privilege issues when calling sysctlbyname(3) on writable sysctls. MFC after: 1 week Modified: head/lib/libcasper/services/cap_sysctl/tests/Makefile Modified: head/lib/libcasper/services/cap_sysctl/tests/Makefile ============================================================================== --- head/lib/libcasper/services/cap_sysctl/tests/Makefile Sun Aug 13 00:04:50 2017 (r322447) +++ head/lib/libcasper/services/cap_sysctl/tests/Makefile Sun Aug 13 00:14:08 2017 (r322448) @@ -8,4 +8,6 @@ LIBADD+= nv WARNS?= 3 +TEST_METADATA.sysctl_test+= required_user="root" + .include From owner-svn-src-head@freebsd.org Sun Aug 13 00:14:21 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9315DDD473A; Sun, 13 Aug 2017 00:14:21 +0000 (UTC) (envelope-from rlibby@gmail.com) Received: from mail-pg0-f51.google.com (mail-pg0-f51.google.com [74.125.83.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6744E77B4A; Sun, 13 Aug 2017 00:14:21 +0000 (UTC) (envelope-from rlibby@gmail.com) Received: by mail-pg0-f51.google.com with SMTP id y129so28390951pgy.4; Sat, 12 Aug 2017 17:14:21 -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:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=FPz4eKACPGkocJGHxzxdag8nxVytYtNLvbM6Sbkq8zo=; b=D3YOiAeuxvEPrLS4MQcNetbtkWYSLaivFCtgzxoQytKIv5cxawllfyPavO8nZebuPL PWtKLcaFkHSQUA3NGfMZTalWy2DkTmUAw46h/IJ1SzSgMXvSo0f//zeza3b4ZWVOvJ1D fB8wsnPgY+vhJ7DDrJzAN39Yd/386ZKZ3we4Hxc8atsPijCTIcdVRxSz06rzShYKViuv HINVNA1P0a95WIoEwSmEv9p25vXcQNTon8KVLUaUF7dduBeJAKJjpotSYYVBqkQLl0f1 T5BVxhbEanX7mB+BqXWxDeqxFzEWeY17ot7YIJqn1v5ICrGLfr0VCyVWDjvIDGcHgEsp 3LnA== X-Gm-Message-State: AHYfb5jlTamY1i/JKi+1rE69MhrVA7wPvUGEcwVrlW24Di2P6073ML3K e92SRlyZg4TaRfVyl+AALA== X-Received: by 10.84.132.46 with SMTP id 43mr22579520ple.409.1502583255620; Sat, 12 Aug 2017 17:14:15 -0700 (PDT) Received: from mail-pf0-f176.google.com (mail-pf0-f176.google.com. [209.85.192.176]) by smtp.gmail.com with ESMTPSA id h71sm7782602pfh.120.2017.08.12.17.14.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 12 Aug 2017 17:14:15 -0700 (PDT) Received: by mail-pf0-f176.google.com with SMTP id h68so28987289pfk.0; Sat, 12 Aug 2017 17:14:15 -0700 (PDT) X-Received: by 10.99.124.26 with SMTP id x26mr16794095pgc.280.1502583255186; Sat, 12 Aug 2017 17:14:15 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.207.193 with HTTP; Sat, 12 Aug 2017 17:14:14 -0700 (PDT) In-Reply-To: References: <201708112241.v7BMfP5X028262@repo.freebsd.org> <1502555191.47886.30.camel@freebsd.org> <5672BE7A-0640-4C8B-9B41-44AD83D7B59E@gmail.com> From: Ryan Libby Date: Sat, 12 Aug 2017 17:14:14 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r322418 - head/lib/msun/src To: "Ngie Cooper (yaneurabeya)" Cc: Ian Lepore , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, Bruce Evans Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Aug 2017 00:14:21 -0000 On Sat, Aug 12, 2017 at 2:53 PM, Ngie Cooper (yaneurabeya) wrote: [...] > Here are the full gamut of definitions for LDBL_MAX_EXP. It seems= that sparc64 isn=E2=80=99t the only architecture using this pattern: > > $ grep -r DBL_MAX_EXP sys/*/include > sys/arm/include/float.h:#define DBL_MAX_EXP 1024 > sys/arm/include/float.h:#define LDBL_MAX_EXP DBL_MAX_EXP > sys/arm64/include/float.h:#define DBL_MAX_EXP 1024 > sys/arm64/include/float.h:#define LDBL_MAX_EXP (+16384) > sys/mips/include/float.h:#define DBL_MAX_EXP 1024 > sys/mips/include/float.h:#define LDBL_MAX_EXP DBL_MAX_EXP > sys/powerpc/include/float.h:#define DBL_MAX_EXP 1024 > sys/powerpc/include/float.h:#define LDBL_MAX_EXP DBL_MAX_EXP > sys/riscv/include/float.h:#define DBL_MAX_EXP 1024 > sys/riscv/include/float.h:#define LDBL_MAX_EXP (+16384) > sys/sparc64/include/float.h:#define DBL_MAX_EXP 1024 > sys/sparc64/include/float.h:#define LDBL_MAX_EXP (+16384) > sys/x86/include/float.h:#define DBL_MAX_EXP 1024 > sys/x86/include/float.h:#define LDBL_MAX_EXP 16384 > > It might also be an inconsistency with how clang vs gcc [4.2.1] h= andles __CONCAT, and what -std=3D flags are passed to ${CC} in the Makefile= , since the implementation is predicated by whether or not it=E2=80=99s C++= or __STDC__ is defined. There might be an update that we can grab from Net= BSD (since the macro originated there). > I don=E2=80=99t understand [right now] why the (+foo) form is use= d *shrugs*. Yeah, unsure. Aesthetically it mirrors the declaration for the macros with negative values such as LDBL_MIN_EXP (where the parentheses do have a functional purpose), but in sys/*/include/{_limits.h,_stdint.h} by comparison we don't have parens around the positive values. Anyway maybe the macro pasting method is just too fragile of a hack. From owner-svn-src-head@freebsd.org Sun Aug 13 00:56:44 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E1CDCDD7314; Sun, 13 Aug 2017 00:56:44 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 B08B47D0CD; Sun, 13 Aug 2017 00:56:44 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7D0uhQl074670; Sun, 13 Aug 2017 00:56:43 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7D0uhJo074669; Sun, 13 Aug 2017 00:56:43 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201708130056.v7D0uhJo074669@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sun, 13 Aug 2017 00:56:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322449 - head/lib/libcasper/services/cap_dns/tests X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: head/lib/libcasper/services/cap_dns/tests X-SVN-Commit-Revision: 322449 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Aug 2017 00:56:45 -0000 Author: ngie Date: Sun Aug 13 00:56:43 2017 New Revision: 322449 URL: https://svnweb.freebsd.org/changeset/base/322449 Log: Use hardcoded IPv4/IPv6 addresses for google-public-dns-a.google.com instead of freefall.freebsd.org to unbreak the DNS tests The address allocations for freefall.freebsd.org have changed in the past 4 years. Use a more stable set of hardcoded addresses for now to make the tests succeed reliably. The hostname should be resolved dynamically instead of hardcoding the addresses in the future. This is just a bandaid. MFC after: 1 week Modified: head/lib/libcasper/services/cap_dns/tests/dns_test.c Modified: head/lib/libcasper/services/cap_dns/tests/dns_test.c ============================================================================== --- head/lib/libcasper/services/cap_dns/tests/dns_test.c Sun Aug 13 00:14:08 2017 (r322448) +++ head/lib/libcasper/services/cap_dns/tests/dns_test.c Sun Aug 13 00:56:43 2017 (r322449) @@ -297,32 +297,26 @@ runtest(cap_channel_t *capdns) freeaddrinfo(aic); } - /* - * 8.8.178.135 is IPv4 address of freefall.freebsd.org - * as of 27 October 2013. - */ - inet_pton(AF_INET, "8.8.178.135", &ip4); + /* XXX: hardcoded addresses for "google-public-dns-a.google.com". */ +#define GOOGLE_DNS_IPV4 "8.8.8.8" +#define GOOGLE_DNS_IPV6 "2001:4860:4860::8888" + + inet_pton(AF_INET, GOOGLE_DNS_IPV4, &ip4); hps = gethostbyaddr(&ip4, sizeof(ip4), AF_INET); if (hps == NULL) - fprintf(stderr, "Unable to resolve %s.\n", "8.8.178.135"); + fprintf(stderr, "Unable to resolve %s.\n", GOOGLE_DNS_IPV4); hpc = cap_gethostbyaddr(capdns, &ip4, sizeof(ip4), AF_INET); if (hostent_compare(hps, hpc)) result |= GETHOSTBYADDR_AF_INET; - /* - * 2001:1900:2254:206c::16:87 is IPv6 address of freefall.freebsd.org - * as of 27 October 2013. - */ - inet_pton(AF_INET6, "2001:1900:2254:206c::16:87", &ip6); + inet_pton(AF_INET6, GOOGLE_DNS_IPV6, &ip6); hps = gethostbyaddr(&ip6, sizeof(ip6), AF_INET6); if (hps == NULL) { - fprintf(stderr, "Unable to resolve %s.\n", - "2001:1900:2254:206c::16:87"); + fprintf(stderr, "Unable to resolve %s.\n", GOOGLE_DNS_IPV6); } hpc = cap_gethostbyaddr(capdns, &ip6, sizeof(ip6), AF_INET6); if (hostent_compare(hps, hpc)) result |= GETHOSTBYADDR_AF_INET6; - return (result); } From owner-svn-src-head@freebsd.org Sun Aug 13 01:04:46 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 16289DD7A52; Sun, 13 Aug 2017 01:04:46 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 E0E8A7D584; Sun, 13 Aug 2017 01:04:45 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7D14jDm078751; Sun, 13 Aug 2017 01:04:45 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7D14if3078747; Sun, 13 Aug 2017 01:04:44 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201708130104.v7D14if3078747@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sun, 13 Aug 2017 01:04:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322450 - in head/lib/libcasper: . services services/tests tests X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: in head/lib/libcasper: . services services/tests tests X-SVN-Commit-Revision: 322450 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Aug 2017 01:04:46 -0000 Author: ngie Date: Sun Aug 13 01:04:44 2017 New Revision: 322450 URL: https://svnweb.freebsd.org/changeset/base/322450 Log: Integrate the tests moved in r305626 in to the FreeBSD test suite The reachover Kyuafiles were never added, and thus the tests were installed as standalone tests, and not integrated into the full suite. MFC after: 1 week MFC with: r305626, 305629, r307863, r322447, r322448, r322449 Added: head/lib/libcasper/services/tests/ head/lib/libcasper/services/tests/Makefile - copied, changed from r322439, head/tests/etc/Makefile head/lib/libcasper/tests/ head/lib/libcasper/tests/Makefile - copied, changed from r322439, head/tests/etc/Makefile Modified: head/lib/libcasper/Makefile head/lib/libcasper/services/Makefile Modified: head/lib/libcasper/Makefile ============================================================================== --- head/lib/libcasper/Makefile Sun Aug 13 00:56:43 2017 (r322449) +++ head/lib/libcasper/Makefile Sun Aug 13 01:04:44 2017 (r322450) @@ -3,6 +3,8 @@ SUBDIR= libcasper SUBDIR+= services +SUBDIR.${MK_TESTS}+= tests + SUBDIR_PARALLEL= .include Modified: head/lib/libcasper/services/Makefile ============================================================================== --- head/lib/libcasper/services/Makefile Sun Aug 13 00:56:43 2017 (r322449) +++ head/lib/libcasper/services/Makefile Sun Aug 13 01:04:44 2017 (r322450) @@ -6,6 +6,8 @@ SUBDIR+= cap_pwd SUBDIR+= cap_random SUBDIR+= cap_sysctl +SUBDIR.${MK_TESTS}+= tests + SUBDIR_PARALLEL= .include Copied and modified: head/lib/libcasper/services/tests/Makefile (from r322439, head/tests/etc/Makefile) ============================================================================== --- head/tests/etc/Makefile Sat Aug 12 21:20:51 2017 (r322439, copy source) +++ head/lib/libcasper/services/tests/Makefile Sun Aug 13 01:04:44 2017 (r322450) @@ -1,12 +1,8 @@ # $FreeBSD$ -.include +TESTSDIR= ${TESTSBASE}/lib/libcasper/services -TESTSDIR= ${TESTSBASE}/etc - .PATH: ${SRCTOP}/tests KYUAFILE= yes - -SUBDIR+= rc.d .include Copied and modified: head/lib/libcasper/tests/Makefile (from r322439, head/tests/etc/Makefile) ============================================================================== --- head/tests/etc/Makefile Sat Aug 12 21:20:51 2017 (r322439, copy source) +++ head/lib/libcasper/tests/Makefile Sun Aug 13 01:04:44 2017 (r322450) @@ -1,12 +1,8 @@ # $FreeBSD$ -.include +TESTSDIR= ${TESTSBASE}/lib/libcasper -TESTSDIR= ${TESTSBASE}/etc - .PATH: ${SRCTOP}/tests KYUAFILE= yes - -SUBDIR+= rc.d .include From owner-svn-src-head@freebsd.org Sun Aug 13 01:08:38 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F3384DD7DD3; Sun, 13 Aug 2017 01:08:38 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 BE0C57D750; Sun, 13 Aug 2017 01:08:38 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7D18b4O078922; Sun, 13 Aug 2017 01:08:37 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7D18bUm078920; Sun, 13 Aug 2017 01:08:37 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201708130108.v7D18bUm078920@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sun, 13 Aug 2017 01:08:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322451 - in head/lib/libcasper: services/tests tests X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: in head/lib/libcasper: services/tests tests X-SVN-Commit-Revision: 322451 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Aug 2017 01:08:39 -0000 Author: ngie Date: Sun Aug 13 01:08:37 2017 New Revision: 322451 URL: https://svnweb.freebsd.org/changeset/base/322451 Log: TESTSDIR isn't required; remove it MFC after: 1 week MFC with: r322450 Modified: head/lib/libcasper/services/tests/Makefile head/lib/libcasper/tests/Makefile Modified: head/lib/libcasper/services/tests/Makefile ============================================================================== --- head/lib/libcasper/services/tests/Makefile Sun Aug 13 01:04:44 2017 (r322450) +++ head/lib/libcasper/services/tests/Makefile Sun Aug 13 01:08:37 2017 (r322451) @@ -1,7 +1,5 @@ # $FreeBSD$ -TESTSDIR= ${TESTSBASE}/lib/libcasper/services - .PATH: ${SRCTOP}/tests KYUAFILE= yes Modified: head/lib/libcasper/tests/Makefile ============================================================================== --- head/lib/libcasper/tests/Makefile Sun Aug 13 01:04:44 2017 (r322450) +++ head/lib/libcasper/tests/Makefile Sun Aug 13 01:08:37 2017 (r322451) @@ -1,7 +1,5 @@ # $FreeBSD$ -TESTSDIR= ${TESTSBASE}/lib/libcasper - .PATH: ${SRCTOP}/tests KYUAFILE= yes From owner-svn-src-head@freebsd.org Sun Aug 13 04:10:49 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 40F46DE2587; Sun, 13 Aug 2017 04:10:49 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0ED2382C7B; Sun, 13 Aug 2017 04:10:48 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7D4Amwq052210; Sun, 13 Aug 2017 04:10:48 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7D4Amth052209; Sun, 13 Aug 2017 04:10:48 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201708130410.v7D4Amth052209@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 13 Aug 2017 04:10:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322453 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 322453 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Aug 2017 04:10:49 -0000 Author: imp Date: Sun Aug 13 04:10:47 2017 New Revision: 322453 URL: https://svnweb.freebsd.org/changeset/base/322453 Log: We don't use ARM_ARCH_6 in the tree, and haven't for a long long time. Remove it from here. As far as I could tell, nothing in ports use it (either __ARM_ARCH or __ARM_ARCH_6__ is used in all the apatches). We do have a define for _ARM_ARCH_6, but it's mostly unused (and will remain, since it isn't in this file). Modified: head/share/mk/bsd.cpu.mk Modified: head/share/mk/bsd.cpu.mk ============================================================================== --- head/share/mk/bsd.cpu.mk Sun Aug 13 01:23:13 2017 (r322452) +++ head/share/mk/bsd.cpu.mk Sun Aug 13 04:10:47 2017 (r322453) @@ -111,10 +111,9 @@ _CPUCFLAGS = -march=armv5te -D__XSCALE__ . elif ${CPUTYPE:M*soft*} != "" _CPUCFLAGS = -mfloat-abi=softfp . elif ${CPUTYPE} == "armv6" -# Not sure we still need ARM_ARCH_6=1 here. -_CPUCFLAGS = -march=${CPUTYPE} -DARM_ARCH_6=1 +_CPUCFLAGS = -march=${CPUTYPE} . elif ${CPUTYPE} == "cortexa" -_CPUCFLAGS = -march=armv7 -DARM_ARCH_6=1 -mfpu=vfp +_CPUCFLAGS = -march=armv7 -mfpu=vfp . elif ${CPUTYPE:Marmv[4567]*} != "" # Handle all the armvX types that FreeBSD runs: # armv4, armv4t, armv5, armv5te, armv6, armv6t2, armv7, armv7-a, armv7ve From owner-svn-src-head@freebsd.org Sun Aug 13 14:36:12 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2B068DB693A; Sun, 13 Aug 2017 14:36:12 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ED79671168; Sun, 13 Aug 2017 14:36:11 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7DEaB4g008009; Sun, 13 Aug 2017 14:36:11 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7DEaBTt008007; Sun, 13 Aug 2017 14:36:11 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201708131436.v7DEaBTt008007@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sun, 13 Aug 2017 14:36:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322455 - head/bin/sh/tests/invocation X-SVN-Group: head X-SVN-Commit-Author: jilles X-SVN-Commit-Paths: head/bin/sh/tests/invocation X-SVN-Commit-Revision: 322455 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Aug 2017 14:36:12 -0000 Author: jilles Date: Sun Aug 13 14:36:10 2017 New Revision: 322455 URL: https://svnweb.freebsd.org/changeset/base/322455 Log: sh: Add test for sh -c with missing command string. This already works correctly. Added: head/bin/sh/tests/invocation/sh-c-missing1.0 (contents, props changed) Modified: head/bin/sh/tests/invocation/Makefile Modified: head/bin/sh/tests/invocation/Makefile ============================================================================== --- head/bin/sh/tests/invocation/Makefile Sun Aug 13 07:40:05 2017 (r322454) +++ head/bin/sh/tests/invocation/Makefile Sun Aug 13 14:36:10 2017 (r322455) @@ -8,6 +8,7 @@ TESTSDIR= ${TESTSBASE}/bin/sh/${.CURDIR:T} ATF_TESTS_SH= functional_test ${PACKAGE}FILES+= sh-ac1.0 +${PACKAGE}FILES+= sh-c-missing1.0 ${PACKAGE}FILES+= sh-c1.0 ${PACKAGE}FILES+= sh-ca1.0 ${PACKAGE}FILES+= sh-fca1.0 Added: head/bin/sh/tests/invocation/sh-c-missing1.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/bin/sh/tests/invocation/sh-c-missing1.0 Sun Aug 13 14:36:10 2017 (r322455) @@ -0,0 +1,3 @@ +# $FreeBSD$ + +! echo echo bad | ${SH} -c 2>/dev/null From owner-svn-src-head@freebsd.org Sun Aug 13 14:42:25 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 255B5DB70AE; Sun, 13 Aug 2017 14:42:25 +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 mx1.freebsd.org (Postfix) with ESMTPS id D28F6714E0; Sun, 13 Aug 2017 14:42:24 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7DEgNXn011869; Sun, 13 Aug 2017 14:42:23 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7DEgNmP011868; Sun, 13 Aug 2017 14:42:23 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708131442.v7DEgNmP011868@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 13 Aug 2017 14:42:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322456 - head/lib/libc/x86/sys X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/lib/libc/x86/sys X-SVN-Commit-Revision: 322456 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Aug 2017 14:42:25 -0000 Author: kib Date: Sun Aug 13 14:42:23 2017 New Revision: 322456 URL: https://svnweb.freebsd.org/changeset/base/322456 Log: Fix a regression in r321608. On i386 with CPUID but without SSE2, set lfence_works to LMB_NONE instead of looping. Reported and tested by: Andre Albsmeier Sponsored by: The FreeBSD Foundation MFC after: 3 days Modified: head/lib/libc/x86/sys/__vdso_gettc.c Modified: head/lib/libc/x86/sys/__vdso_gettc.c ============================================================================== --- head/lib/libc/x86/sys/__vdso_gettc.c Sun Aug 13 14:36:10 2017 (r322455) +++ head/lib/libc/x86/sys/__vdso_gettc.c Sun Aug 13 14:42:23 2017 (r322456) @@ -101,6 +101,7 @@ init_fence(void) #if defined(__i386__) u_int cpuid_supported, p[4]; + lfence_works = LMB_NONE; __asm __volatile( " pushfl\n" " popl %%eax\n" @@ -121,8 +122,7 @@ init_fence(void) cpuidp(0x1, p); if ((p[3] & CPUID_SSE2) != 0) lfence_works = select_lmb(); - } else - lfence_works = LMB_NONE; + } #elif defined(__amd64__) lfence_works = select_lmb(); #else From owner-svn-src-head@freebsd.org Sun Aug 13 14:50:39 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4379FDB7A16; Sun, 13 Aug 2017 14:50:39 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 1100671912; Sun, 13 Aug 2017 14:50:38 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7DEocEO012307; Sun, 13 Aug 2017 14:50:38 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7DEocAx012306; Sun, 13 Aug 2017 14:50:38 GMT (envelope-from royger@FreeBSD.org) Message-Id: <201708131450.v7DEocAx012306@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= Date: Sun, 13 Aug 2017 14:50:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322457 - head/sys/x86/acpica X-SVN-Group: head X-SVN-Commit-Author: royger X-SVN-Commit-Paths: head/sys/x86/acpica X-SVN-Commit-Revision: 322457 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Aug 2017 14:50:39 -0000 Author: royger Date: Sun Aug 13 14:50:38 2017 New Revision: 322457 URL: https://svnweb.freebsd.org/changeset/base/322457 Log: srat: use pmap_unmapbios To match the pmap_mapbios. Reported by: jhb MFC with: r322403 Modified: head/sys/x86/acpica/srat.c Modified: head/sys/x86/acpica/srat.c ============================================================================== --- head/sys/x86/acpica/srat.c Sun Aug 13 14:42:23 2017 (r322456) +++ head/sys/x86/acpica/srat.c Sun Aug 13 14:50:38 2017 (r322457) @@ -536,7 +536,7 @@ srat_set_cpus(void *dummy) } /* Last usage of the cpus array, unmap it. */ - pmap_unmapdev((vm_offset_t)cpus, sizeof(*cpus) * (max_apic_id + 1)); + pmap_unmapbios((vm_offset_t)cpus, sizeof(*cpus) * (max_apic_id + 1)); cpus = NULL; } SYSINIT(srat_set_cpus, SI_SUB_CPU, SI_ORDER_ANY, srat_set_cpus, NULL); From owner-svn-src-head@freebsd.org Sun Aug 13 15:15:41 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AB888DC35CB; Sun, 13 Aug 2017 15:15:41 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7AB5F72719; Sun, 13 Aug 2017 15:15:41 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7DFFeRm024258; Sun, 13 Aug 2017 15:15:40 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7DFFeKE024257; Sun, 13 Aug 2017 15:15:40 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201708131515.v7DFFeKE024257@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 13 Aug 2017 15:15:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322458 - head/lib/libc/sys X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/lib/libc/sys X-SVN-Commit-Revision: 322458 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Aug 2017 15:15:41 -0000 Author: tuexen Date: Sun Aug 13 15:15:40 2017 New Revision: 322458 URL: https://svnweb.freebsd.org/changeset/base/322458 Log: Fix minor formatting issue. Modified: head/lib/libc/sys/getsockopt.2 Modified: head/lib/libc/sys/getsockopt.2 ============================================================================== --- head/lib/libc/sys/getsockopt.2 Sun Aug 13 14:50:38 2017 (r322457) +++ head/lib/libc/sys/getsockopt.2 Sun Aug 13 15:15:40 2017 (r322458) @@ -188,7 +188,7 @@ The following options are recognized in .It Dv SO_LISTENINCQLEN Ta "get incomplete queue length of the socket (get only)" .It Dv SO_USER_COOKIE Ta "set the 'so_user_cookie' value for the socket (uint32_t, set only)" .It Dv SO_TS_CLOCK Ta "set specific format of timestamp returned by SO_TIMESTAMP" -.It Dv SO_MAX_PACING_RATE "set the maximum transmit rate in bytes per second for the socket" +.It Dv SO_MAX_PACING_RATE Ta "set the maximum transmit rate in bytes per second for the socket" .El .Pp .Dv SO_DEBUG From owner-svn-src-head@freebsd.org Sun Aug 13 16:39:51 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 23048DC91E4; Sun, 13 Aug 2017 16:39:51 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D9F607561D; Sun, 13 Aug 2017 16:39:50 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7DGdooR057211; Sun, 13 Aug 2017 16:39:50 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7DGdnk0057209; Sun, 13 Aug 2017 16:39:50 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201708131639.v7DGdnk0057209@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sun, 13 Aug 2017 16:39:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322459 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 322459 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Aug 2017 16:39:51 -0000 Author: alc Date: Sun Aug 13 16:39:49 2017 New Revision: 322459 URL: https://svnweb.freebsd.org/changeset/base/322459 Log: The *_meta_* functions include a radix parameter, a blk parameter, and another parameter that identifies a starting point in the memory address block. Radix is a power of two, blk is a multiple of radix, and the starting point is in the range [blk, blk+radix), so that blk can always be computed from the other two. This change drops the blk parameter from the meta functions and computes it instead. (On amd64, for example, this change reduces subr_blist.o's text size by 7%.) It also makes the radix parameters unsigned to address concerns that the calculation of '-radix' might overflow without the -fwrapv option. (See https://reviews.freebsd.org/D11819.) Submitted by: Doug Moore MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D11964 Modified: head/sys/kern/subr_blist.c head/sys/sys/blist.h Modified: head/sys/kern/subr_blist.c ============================================================================== --- head/sys/kern/subr_blist.c Sun Aug 13 15:15:40 2017 (r322458) +++ head/sys/kern/subr_blist.c Sun Aug 13 16:39:49 2017 (r322459) @@ -123,16 +123,16 @@ void panic(const char *ctl, ...); */ static daddr_t blst_leaf_alloc(blmeta_t *scan, daddr_t blk, int count, daddr_t cursor); -static daddr_t blst_meta_alloc(blmeta_t *scan, daddr_t blk, daddr_t count, - daddr_t radix, daddr_t cursor); +static daddr_t blst_meta_alloc(blmeta_t *scan, daddr_t cursor, daddr_t count, + u_daddr_t radix); static void blst_leaf_free(blmeta_t *scan, daddr_t relblk, int count); static void blst_meta_free(blmeta_t *scan, daddr_t freeBlk, daddr_t count, - daddr_t radix, daddr_t blk); + u_daddr_t radix); static void blst_copy(blmeta_t *scan, daddr_t blk, daddr_t radix, blist_t dest, daddr_t count); static daddr_t blst_leaf_fill(blmeta_t *scan, daddr_t blk, int count); static daddr_t blst_meta_fill(blmeta_t *scan, daddr_t allocBlk, daddr_t count, - daddr_t radix, daddr_t blk); + u_daddr_t radix); static daddr_t blst_radix_init(blmeta_t *scan, daddr_t radix, daddr_t count); #ifndef _KERNEL static void blst_radix_print(blmeta_t *scan, daddr_t blk, daddr_t radix, @@ -247,8 +247,8 @@ blist_alloc(blist_t bl, daddr_t count) * reduce the hint, stopping further iterations. */ while (count <= bl->bl_root->bm_bighint) { - blk = blst_meta_alloc(bl->bl_root, 0, count, bl->bl_radix, - bl->bl_cursor); + blk = blst_meta_alloc(bl->bl_root, bl->bl_cursor, count, + bl->bl_radix); if (blk != SWAPBLK_NONE) { bl->bl_cursor = blk + count; return (blk); @@ -280,7 +280,7 @@ void blist_free(blist_t bl, daddr_t blkno, daddr_t count) { - blst_meta_free(bl->bl_root, blkno, count, bl->bl_radix, 0); + blst_meta_free(bl->bl_root, blkno, count, bl->bl_radix); } /* @@ -293,7 +293,7 @@ daddr_t blist_fill(blist_t bl, daddr_t blkno, daddr_t count) { - return (blst_meta_fill(bl->bl_root, blkno, count, bl->bl_radix, 0)); + return (blst_meta_fill(bl->bl_root, blkno, count, bl->bl_radix)); } /* @@ -447,13 +447,13 @@ blst_leaf_alloc(blmeta_t *scan, daddr_t blk, int count * and we have a few optimizations strewn in as well. */ static daddr_t -blst_meta_alloc(blmeta_t *scan, daddr_t blk, daddr_t count, daddr_t radix, - daddr_t cursor) +blst_meta_alloc(blmeta_t *scan, daddr_t cursor, daddr_t count, u_daddr_t radix) { - daddr_t i, next_skip, r, skip; + daddr_t blk, i, next_skip, r, skip; int child; bool scan_from_start; + blk = cursor & -radix; if (radix == BLIST_BMAP_RADIX) return (blst_leaf_alloc(scan, blk, count, cursor)); if (scan->u.bmu_avail < count) { @@ -505,8 +505,8 @@ blst_meta_alloc(blmeta_t *scan, daddr_t blk, daddr_t c /* * The allocation might fit in the i'th subtree. */ - r = blst_meta_alloc(&scan[i], blk, count, radix, - cursor > blk ? cursor : blk); + r = blst_meta_alloc(&scan[i], + cursor > blk ? cursor : blk, count, radix); if (r != SWAPBLK_NONE) { scan->u.bmu_avail -= count; return (r); @@ -574,10 +574,9 @@ blst_leaf_free(blmeta_t *scan, daddr_t blk, int count) * range). */ static void -blst_meta_free(blmeta_t *scan, daddr_t freeBlk, daddr_t count, daddr_t radix, - daddr_t blk) +blst_meta_free(blmeta_t *scan, daddr_t freeBlk, daddr_t count, u_daddr_t radix) { - daddr_t i, next_skip, skip, v; + daddr_t blk, i, next_skip, skip, v; int child; if (scan->bm_bighint == (daddr_t)-1) @@ -628,6 +627,7 @@ blst_meta_free(blmeta_t *scan, daddr_t freeBlk, daddr_ * Break the free down into its components */ + blk = freeBlk & -radix; radix /= BLIST_META_RADIX; child = (freeBlk - blk) / radix; @@ -637,7 +637,7 @@ blst_meta_free(blmeta_t *scan, daddr_t freeBlk, daddr_ v = blk + radix - freeBlk; if (v > count) v = count; - blst_meta_free(&scan[i], freeBlk, v, radix, blk); + blst_meta_free(&scan[i], freeBlk, v, radix); if (scan->bm_bighint < scan[i].bm_bighint) scan->bm_bighint = scan[i].bm_bighint; count -= v; @@ -755,10 +755,9 @@ blst_leaf_fill(blmeta_t *scan, daddr_t blk, int count) * number of blocks allocated by the call. */ static daddr_t -blst_meta_fill(blmeta_t *scan, daddr_t allocBlk, daddr_t count, daddr_t radix, - daddr_t blk) +blst_meta_fill(blmeta_t *scan, daddr_t allocBlk, daddr_t count, u_daddr_t radix) { - daddr_t i, nblks, next_skip, skip, v; + daddr_t blk, i, nblks, next_skip, skip, v; int child; if (scan->bm_bighint == (daddr_t)-1) @@ -783,6 +782,7 @@ blst_meta_fill(blmeta_t *scan, daddr_t allocBlk, daddr } skip = radix_to_skip(radix); next_skip = skip / BLIST_META_RADIX; + blk = allocBlk & -radix; /* * An ALL-FREE meta node requires special handling before allocating @@ -814,7 +814,7 @@ blst_meta_fill(blmeta_t *scan, daddr_t allocBlk, daddr v = blk + radix - allocBlk; if (v > count) v = count; - nblks += blst_meta_fill(&scan[i], allocBlk, v, radix, blk); + nblks += blst_meta_fill(&scan[i], allocBlk, v, radix); count -= v; allocBlk += v; blk += radix; Modified: head/sys/sys/blist.h ============================================================================== --- head/sys/sys/blist.h Sun Aug 13 15:15:40 2017 (r322458) +++ head/sys/sys/blist.h Sun Aug 13 16:39:49 2017 (r322459) @@ -80,7 +80,7 @@ typedef struct blmeta { typedef struct blist { daddr_t bl_blocks; /* area of coverage */ - daddr_t bl_radix; /* coverage radix */ + u_daddr_t bl_radix; /* coverage radix */ daddr_t bl_cursor; /* next-fit search starts at */ blmeta_t *bl_root; /* root of radix tree */ } *blist_t; From owner-svn-src-head@freebsd.org Sun Aug 13 18:06:40 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 317E9DCF4C4; Sun, 13 Aug 2017 18:06:40 +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 mx1.freebsd.org (Postfix) with ESMTPS id EB7757CA7F; Sun, 13 Aug 2017 18:06:39 +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 v7DI6dqX094327; Sun, 13 Aug 2017 18:06:39 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7DI6dCa094326; Sun, 13 Aug 2017 18:06:39 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201708131806.v7DI6dCa094326@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Sun, 13 Aug 2017 18:06:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322463 - head/sys/geom/journal X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: head/sys/geom/journal X-SVN-Commit-Revision: 322463 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Aug 2017 18:06:40 -0000 Author: mckusick Date: Sun Aug 13 18:06:38 2017 New Revision: 322463 URL: https://svnweb.freebsd.org/changeset/base/322463 Log: Eliminate a variable that is only ever set. Submitted by: Dr. Andreas Longwitz Discussed with: kib MFC after: 1 week Modified: head/sys/geom/journal/g_journal.c Modified: head/sys/geom/journal/g_journal.c ============================================================================== --- head/sys/geom/journal/g_journal.c Sun Aug 13 17:30:03 2017 (r322462) +++ head/sys/geom/journal/g_journal.c Sun Aug 13 18:06:38 2017 (r322463) @@ -1236,7 +1236,7 @@ g_journal_flush(struct g_journal_softc *sc) struct g_provider *pp; struct bio **bioq; struct bio *bp, *fbp, *pbp; - off_t joffset, size; + off_t joffset; u_char *data, hash[16]; MD5_CTX ctx; u_int i; @@ -1244,7 +1244,6 @@ g_journal_flush(struct g_journal_softc *sc) if (sc->sc_current_count == 0) return; - size = 0; pp = sc->sc_jprovider; GJ_VALIDATE_OFFSET(sc->sc_journal_offset, sc); joffset = sc->sc_journal_offset; @@ -1294,7 +1293,6 @@ g_journal_flush(struct g_journal_softc *sc) ent->je_offset = bp->bio_offset; ent->je_joffset = joffset; ent->je_length = bp->bio_length; - size += ent->je_length; data = bp->bio_data; if (sc->sc_flags & GJF_DEVICE_CHECKSUM) From owner-svn-src-head@freebsd.org Sun Aug 13 18:09:23 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2CB9ADCF6CA; Sun, 13 Aug 2017 18:09:23 +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 mx1.freebsd.org (Postfix) with ESMTPS id 067267CBF6; Sun, 13 Aug 2017 18:09:22 +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 v7DI9MiJ094463; Sun, 13 Aug 2017 18:09:22 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7DI9MP3094462; Sun, 13 Aug 2017 18:09:22 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201708131809.v7DI9MP3094462@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Sun, 13 Aug 2017 18:09:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322464 - head/sys/geom/journal X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: head/sys/geom/journal X-SVN-Commit-Revision: 322464 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Aug 2017 18:09:23 -0000 Author: mckusick Date: Sun Aug 13 18:09:22 2017 New Revision: 322464 URL: https://svnweb.freebsd.org/changeset/base/322464 Log: When read requests are sent from a filesystem running above g_journal, the g_journal level needs to check whether it is holding a newer copy of the block than that which exists on the disk. If so, it needs to return its copy. If not, it should pass the request down to the disk to fulfill. It currently considers six queues: 0) delayed queue, 1) unsent (current queue), 2) in-flight to the journal (flush queue), 3) active journal (active queue), 4) inactive journal (inactive queue), and 5) inflight to the disk (copy queue). Checking on two of these queues is unnecessary: 0) The delayed requests should not be used for reads because they have not yet been entered into the journal, so their value should reflect the disk contents, not the future contents that are not yet committed. 2) Because all the bio's in the flush queue are also found on the active queue, there is no need to inspect the flush queue for reads since they will be found when searching the active queue. Submitted by: Dr. Andreas Longwitz Discussed with: kib MFC after: 1 week Modified: head/sys/geom/journal/g_journal.c Modified: head/sys/geom/journal/g_journal.c ============================================================================== --- head/sys/geom/journal/g_journal.c Sun Aug 13 18:06:38 2017 (r322463) +++ head/sys/geom/journal/g_journal.c Sun Aug 13 18:09:22 2017 (r322464) @@ -1514,49 +1514,10 @@ g_journal_read_find(struct bio *head, int sorted, stru } /* - * Try to find requested data in cache. - */ -static struct bio * -g_journal_read_queue_find(struct bio_queue *head, struct bio *pbp, off_t ostart, - off_t oend) -{ - off_t cstart, cend; - struct bio *bp; - - TAILQ_FOREACH(bp, head, bio_queue) { - cstart = MAX(ostart, bp->bio_offset); - cend = MIN(oend, bp->bio_offset + bp->bio_length); - if (cend <= ostart) - continue; - else if (cstart >= oend) - continue; - KASSERT(bp->bio_data != NULL, - ("%s: bio_data == NULL", __func__)); - GJ_DEBUG(3, "READ(%p): (%jd, %jd) (bp=%p)", head, cstart, cend, - bp); - bcopy(bp->bio_data + cstart - bp->bio_offset, - pbp->bio_data + cstart - pbp->bio_offset, cend - cstart); - pbp->bio_completed += cend - cstart; - if (pbp->bio_completed == pbp->bio_length) { - /* - * Cool, the whole request was in cache, deliver happy - * message. - */ - g_io_deliver(pbp, 0); - return (pbp); - } - break; - } - return (bp); -} - -/* - * This function is used for colecting data on read. + * This function is used for collecting data on read. * The complexity is because parts of the data can be stored in four different * places: - * - in delayed requests * - in memory - the data not yet send to the active journal provider - * - in requests which are going to be sent to the active journal * - in the active journal * - in the inactive journal * - in the data provider @@ -1574,20 +1535,14 @@ g_journal_read(struct g_journal_softc *sc, struct bio cstart = cend = -1; bp = NULL; head = NULL; - for (i = 0; i <= 5; i++) { + for (i = 1; i <= 5; i++) { switch (i) { - case 0: /* Delayed requests. */ - head = NULL; - sorted = 0; - break; case 1: /* Not-yet-send data. */ head = sc->sc_current_queue; sorted = 1; break; - case 2: /* In-flight to the active journal. */ - head = sc->sc_flush_queue; - sorted = 0; - break; + case 2: /* Skip flush queue as they are also in active queue */ + continue; case 3: /* Active journal. */ head = sc->sc_active.jj_queue; sorted = 1; @@ -1606,10 +1561,7 @@ g_journal_read(struct g_journal_softc *sc, struct bio default: panic("gjournal %s: i=%d", __func__, i); } - if (i == 0) - bp = g_journal_read_queue_find(&sc->sc_delayed_queue.queue, pbp, ostart, oend); - else - bp = g_journal_read_find(head, sorted, pbp, ostart, oend); + bp = g_journal_read_find(head, sorted, pbp, ostart, oend); if (bp == pbp) { /* Got the whole request. */ GJ_DEBUG(2, "Got the whole request from %u.", i); return; From owner-svn-src-head@freebsd.org Sun Aug 13 18:10:25 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EE5A2DCF875; Sun, 13 Aug 2017 18:10:25 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C76277CD54; Sun, 13 Aug 2017 18:10:25 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7DIAOZc094570; Sun, 13 Aug 2017 18:10:24 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7DIAOYi094566; Sun, 13 Aug 2017 18:10:24 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201708131810.v7DIAOYi094566@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 13 Aug 2017 18:10:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322465 - in head: share/man/man9 sys/kern sys/sys X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in head: share/man/man9 sys/kern sys/sys X-SVN-Commit-Revision: 322465 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Aug 2017 18:10:26 -0000 Author: ian Date: Sun Aug 13 18:10:24 2017 New Revision: 322465 URL: https://svnweb.freebsd.org/changeset/base/322465 Log: Add config_intrhook_oneshot(): schedule an intrhook function and unregister it automatically after it runs. The config_intrhook mechanism allows a driver to stall the boot process until device(s) required for booting are available, by not allowing system inits to proceed until all intrhook functions have been unregistered. Virtually all existing code simply unregisters from within the hook function when it gets called. This new function makes that common usage more convenient. Instead of allocating and filling in a struct, passing it to a function that might (in theory) fail, and checking the return code, now a driver can simply call this cannot-fail routine, passing just the intrhook function and its arg. Differential Revision: https://reviews.freebsd.org/D11963 Modified: head/share/man/man9/Makefile head/share/man/man9/config_intrhook.9 head/sys/kern/subr_autoconf.c head/sys/sys/kernel.h Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Sun Aug 13 18:09:22 2017 (r322464) +++ head/share/man/man9/Makefile Sun Aug 13 18:10:24 2017 (r322465) @@ -669,7 +669,8 @@ MLINKS+=condvar.9 cv_broadcast.9 \ condvar.9 cv_wait_unlock.9 \ condvar.9 cv_wmesg.9 MLINKS+=config_intrhook.9 config_intrhook_disestablish.9 \ - config_intrhook.9 config_intrhook_establish.9 + config_intrhook.9 config_intrhook_establish.9 \ + config_intrhook.9 config_intrhook_oneshot.9 MLINKS+=contigmalloc.9 contigfree.9 MLINKS+=casuword.9 casueword.9 \ casuword.9 casueword32.9 \ Modified: head/share/man/man9/config_intrhook.9 ============================================================================== --- head/share/man/man9/config_intrhook.9 Sun Aug 13 18:09:22 2017 (r322464) +++ head/share/man/man9/config_intrhook.9 Sun Aug 13 18:10:24 2017 (r322465) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 24, 2006 +.Dd August 10, 2017 .Dt CONFIG_INTRHOOK 9 .Os .Sh NAME @@ -35,10 +35,13 @@ but before root is mounted .Sh SYNOPSIS .In sys/kernel.h +.Vt typedef void (*ich_func_t)(void *arg); .Ft int .Fn config_intrhook_establish "struct intr_config_hook *hook" .Ft void .Fn config_intrhook_disestablish "struct intr_config_hook *hook" +.Ft void +.Fn config_intrhook_oneshot "ich_func_t func" "void *arg" .Sh DESCRIPTION The .Fn config_intrhook_establish @@ -51,6 +54,18 @@ The .Fn config_intrhook_disestablish function removes the entry from the hook queue. .Pp +The +.Fn config_intrhook_oneshot +function schedules a function to be run as described for +.Fn config_intrhook_establish ; +the entry is automatically removed from the hook queue +after that function runs. +This is appropriate when additional device configuration must be done +after interrupts are enabled, but there is no need to stall the +boot process after that. +This function allocates memory using M_WAITOK; do not call this while +holding any non-sleepable locks. +.Pp Before root is mounted, all the previously established hooks are run. The boot process is then stalled until all handlers remove their hook @@ -71,8 +86,8 @@ This structure is defined as follows: .Bd -literal struct intr_config_hook { TAILQ_ENTRY(intr_config_hook) ich_links;/* Private */ - void (*ich_func)(void *arg); /* function to call */ - void *ich_arg; /* Argument to call */ + ich_func_t ich_func; /* function to call */ + void *ich_arg; /* Argument to call */ }; .Ed .Pp Modified: head/sys/kern/subr_autoconf.c ============================================================================== --- head/sys/kern/subr_autoconf.c Sun Aug 13 18:09:22 2017 (r322464) +++ head/sys/kern/subr_autoconf.c Sun Aug 13 18:10:24 2017 (r322465) @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -63,6 +64,27 @@ MTX_SYSINIT(intr_config_hook, &intr_config_hook_lock, static void run_interrupt_driven_config_hooks(void); /* + * Private data and a shim function for implementing config_interhook_oneshot(). + */ +struct oneshot_config_hook { + struct intr_config_hook + och_hook; /* Must be first */ + ich_func_t och_func; + void *och_arg; +}; + +static void +config_intrhook_oneshot_func(void *arg) +{ + struct oneshot_config_hook *ohook; + + ohook = arg; + ohook->och_func(ohook->och_arg); + config_intrhook_disestablish(&ohook->och_hook); + free(ohook, M_DEVBUF); +} + +/* * If we wait too long for an interrupt-driven config hook to return, print * a diagnostic. */ @@ -181,6 +203,22 @@ config_intrhook_establish(struct intr_config_hook *hoo /* XXX Sufficient for modules loaded after initial config??? */ run_interrupt_driven_config_hooks(); return (0); +} + +/* + * Register a hook function that is automatically unregistered after it runs. + */ +void +config_intrhook_oneshot(ich_func_t func, void *arg) +{ + struct oneshot_config_hook *ohook; + + ohook = malloc(sizeof(*ohook), M_DEVBUF, M_WAITOK); + ohook->och_func = func; + ohook->och_arg = arg; + ohook->och_hook.ich_func = config_intrhook_oneshot_func; + ohook->och_hook.ich_arg = ohook; + config_intrhook_establish(&ohook->och_hook); } void Modified: head/sys/sys/kernel.h ============================================================================== --- head/sys/sys/kernel.h Sun Aug 13 18:09:22 2017 (r322464) +++ head/sys/sys/kernel.h Sun Aug 13 18:10:24 2017 (r322465) @@ -400,13 +400,16 @@ struct tunable_str { #define TUNABLE_STR_FETCH(path, var, size) \ getenv_string((path), (var), (size)) +typedef void (*ich_func_t)(void *_arg); + struct intr_config_hook { TAILQ_ENTRY(intr_config_hook) ich_links; - void (*ich_func)(void *arg); - void *ich_arg; + ich_func_t ich_func; + void *ich_arg; }; int config_intrhook_establish(struct intr_config_hook *hook); void config_intrhook_disestablish(struct intr_config_hook *hook); +void config_intrhook_oneshot(ich_func_t _func, void *_arg); #endif /* !_SYS_KERNEL_H_*/ From owner-svn-src-head@freebsd.org Sun Aug 13 18:54:52 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9A869DD298A; Sun, 13 Aug 2017 18:54:52 +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 mx1.freebsd.org (Postfix) with ESMTPS id 7469A7E9CC; Sun, 13 Aug 2017 18:54:52 +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 v7DIspA3014934; Sun, 13 Aug 2017 18:54:51 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7DIspAC014931; Sun, 13 Aug 2017 18:54:51 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201708131854.v7DIspAC014931@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Sun, 13 Aug 2017 18:54:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322470 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 322470 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Aug 2017 18:54:52 -0000 Author: andrew Date: Sun Aug 13 18:54:51 2017 New Revision: 322470 URL: https://svnweb.freebsd.org/changeset/base/322470 Log: Add support for multiple GICv3 ITS devices. For this we add sc_irq_base and sc_irq_length to the softc to handle the base number of IRQs available, make gicv3_get_nirqs return the number of available interrupt IDs, and limit which CPUs we send interrupts to based on the numa domain. The last point is only strictly needed on a dual socket ThunderX where we are unable to send MSI/MSI-X interrupts between sockets. Sponsored by: DARPA, AFRL Modified: head/sys/arm64/arm64/gic_v3.c head/sys/arm64/arm64/gic_v3_fdt.c head/sys/arm64/arm64/gicv3_its.c Modified: head/sys/arm64/arm64/gic_v3.c ============================================================================== --- head/sys/arm64/arm64/gic_v3.c Sun Aug 13 18:41:37 2017 (r322469) +++ head/sys/arm64/arm64/gic_v3.c Sun Aug 13 18:54:51 2017 (r322470) @@ -374,7 +374,7 @@ gic_v3_read_ivar(device_t dev, device_t child, int whi switch (which) { case GICV3_IVAR_NIRQS: - *result = sc->gic_nirqs; + *result = (NIRQ - sc->gic_nirqs) / sc->gic_nchildren; return (0); case GICV3_IVAR_REDIST_VADDR: *result = (uintptr_t)rman_get_virtual( Modified: head/sys/arm64/arm64/gic_v3_fdt.c ============================================================================== --- head/sys/arm64/arm64/gic_v3_fdt.c Sun Aug 13 18:41:37 2017 (r322469) +++ head/sys/arm64/arm64/gic_v3_fdt.c Sun Aug 13 18:54:51 2017 (r322470) @@ -266,10 +266,12 @@ static int gic_v3_ofw_bus_attach(device_t dev) { struct gic_v3_ofw_devinfo *di; + struct gic_v3_softc *sc; device_t child; phandle_t parent, node; pcell_t addr_cells, size_cells; + sc = device_get_softc(dev); parent = ofw_bus_get_node(dev); if (parent > 0) { addr_cells = 2; @@ -320,6 +322,7 @@ gic_v3_ofw_bus_attach(device_t dev) continue; } + sc->gic_nchildren++; device_set_ivars(child, di); } } Modified: head/sys/arm64/arm64/gicv3_its.c ============================================================================== --- head/sys/arm64/arm64/gicv3_its.c Sun Aug 13 18:41:37 2017 (r322469) +++ head/sys/arm64/arm64/gicv3_its.c Sun Aug 13 18:54:51 2017 (r322470) @@ -228,6 +228,9 @@ struct gicv3_its_softc { struct intr_pic *sc_pic; struct resource *sc_its_res; + cpuset_t sc_cpus; + u_int gic_irq_cpu; + struct its_ptable sc_its_ptab[GITS_BASER_NUM]; struct its_col *sc_its_cols[MAXCPU]; /* Per-CPU collections */ @@ -245,6 +248,8 @@ struct gicv3_its_softc { vmem_t *sc_irq_alloc; struct gicv3_its_irqsrc *sc_irqs; + u_int sc_irq_base; + u_int sc_irq_length; struct mtx sc_its_dev_lock; TAILQ_HEAD(its_dev_list, its_dev) sc_its_dev_list; @@ -274,8 +279,6 @@ static const struct { }, }; -static u_int gic_irq_cpu; - #define gic_its_read_4(sc, reg) \ bus_read_4((sc)->sc_its_res, (reg)) #define gic_its_read_8(sc, reg) \ @@ -555,7 +558,7 @@ gicv3_its_pendtables_init(struct gicv3_its_softc *sc) int i; for (i = 0; i < mp_ncpus; i++) { - if (CPU_ISSET(i, &all_cpus) == 0) + if (CPU_ISSET(i, &sc->sc_cpus) == 0) continue; sc->sc_pend_base[i] = (vm_offset_t)contigmalloc( @@ -578,6 +581,9 @@ its_init_cpu(device_t dev, struct gicv3_its_softc *sc) u_int cpuid; int domain; + if (!CPU_ISSET(PCPU_GET(cpuid), &sc->sc_cpus)) + return (0); + if (bus_get_domain(dev, &domain) == 0) { if (PCPU_GET(domain) != domain) return (0); @@ -683,7 +689,7 @@ gicv3_its_attach(device_t dev) struct gicv3_its_softc *sc; const char *name; uint32_t iidr; - int err, i, rid; + int domain, err, i, rid; sc = device_get_softc(dev); @@ -718,12 +724,20 @@ gicv3_its_attach(device_t dev) /* Protects access to the ITS command circular buffer. */ mtx_init(&sc->sc_its_cmd_lock, "ITS cmd lock", NULL, MTX_SPIN); + if (bus_get_domain(dev, &domain) == 0) { + CPU_ZERO(&sc->sc_cpus); + if (domain < MAXMEMDOM) + CPU_COPY(&cpuset_domain[domain], &sc->sc_cpus); + } else { + CPU_COPY(&all_cpus, &sc->sc_cpus); + } + /* Allocate the command circular buffer */ gicv3_its_cmdq_init(sc); /* Allocate the per-CPU collections */ for (int cpu = 0; cpu < mp_ncpus; cpu++) - if (CPU_ISSET(cpu, &all_cpus) != 0) + if (CPU_ISSET(cpu, &sc->sc_cpus) != 0) sc->sc_its_cols[cpu] = malloc( sizeof(*sc->sc_its_cols[0]), M_GICV3_ITS, M_WAITOK | M_ZERO); @@ -746,18 +760,18 @@ gicv3_its_attach(device_t dev) TAILQ_INIT(&sc->sc_its_dev_list); /* - * Create the vmem object to allocate IRQs from. We try to use all - * IRQs not already used by the GICv3. + * Create the vmem object to allocate INTRNG IRQs from. We try to + * use all IRQs not already used by the GICv3. * XXX: This assumes there are no other interrupt controllers in the * system. */ sc->sc_irq_alloc = vmem_create("GICv3 ITS IRQs", 0, - NIRQ - gicv3_get_nirqs(dev), 1, 1, M_FIRSTFIT | M_WAITOK); + gicv3_get_nirqs(dev), 1, 1, M_FIRSTFIT | M_WAITOK); - sc->sc_irqs = malloc(sizeof(*sc->sc_irqs) * LPI_NIRQS, M_GICV3_ITS, - M_WAITOK | M_ZERO); + sc->sc_irqs = malloc(sizeof(*sc->sc_irqs) * sc->sc_irq_length, + M_GICV3_ITS, M_WAITOK | M_ZERO); name = device_get_nameunit(dev); - for (i = 0; i < LPI_NIRQS; i++) { + for (i = 0; i < sc->sc_irq_length; i++) { sc->sc_irqs[i].gi_irq = i; err = intr_isrc_register(&sc->sc_irqs[i].gi_isrc, dev, 0, "%s,%u", name, i); @@ -837,11 +851,11 @@ gicv3_its_intr(void *arg, uintptr_t irq) struct gicv3_its_irqsrc *girq; struct trapframe *tf; - irq -= GIC_FIRST_LPI; + irq -= sc->sc_irq_base; girq = &sc->sc_irqs[irq]; if (girq == NULL) panic("gicv3_its_intr: Invalid interrupt %ld", - irq + GIC_FIRST_LPI); + irq + sc->sc_irq_base); tf = curthread->td_intr_frame; intr_isrc_dispatch(&girq->gi_isrc, tf); @@ -852,10 +866,12 @@ static void gicv3_its_pre_ithread(device_t dev, struct intr_irqsrc *isrc) { struct gicv3_its_irqsrc *girq; + struct gicv3_its_softc *sc; + sc = device_get_softc(dev); girq = (struct gicv3_its_irqsrc *)isrc; gicv3_its_disable_intr(dev, isrc); - gic_icc_write(EOIR1, girq->gi_irq + GIC_FIRST_LPI); + gic_icc_write(EOIR1, girq->gi_irq + sc->sc_irq_base); } static void @@ -869,20 +885,25 @@ static void gicv3_its_post_filter(device_t dev, struct intr_irqsrc *isrc) { struct gicv3_its_irqsrc *girq; + struct gicv3_its_softc *sc; + sc = device_get_softc(dev); girq = (struct gicv3_its_irqsrc *)isrc; - gic_icc_write(EOIR1, girq->gi_irq + GIC_FIRST_LPI); + gic_icc_write(EOIR1, girq->gi_irq + sc->sc_irq_base); } static int gicv3_its_bind_intr(device_t dev, struct intr_irqsrc *isrc) { struct gicv3_its_irqsrc *girq; + struct gicv3_its_softc *sc; + sc = device_get_softc(dev); girq = (struct gicv3_its_irqsrc *)isrc; if (CPU_EMPTY(&isrc->isrc_cpu)) { - gic_irq_cpu = intr_irq_next_cpu(gic_irq_cpu, &all_cpus); - CPU_SETOF(gic_irq_cpu, &isrc->isrc_cpu); + sc->gic_irq_cpu = intr_irq_next_cpu(sc->gic_irq_cpu, + &sc->sc_cpus); + CPU_SETOF(sc->gic_irq_cpu, &isrc->isrc_cpu); } its_cmd_movi(dev, girq); @@ -1558,7 +1579,7 @@ its_cmd_mapti(device_t dev, struct gicv3_its_irqsrc *g /* The EventID sent to the device */ desc.cmd_desc_mapvi.id = girq->gi_irq - girq->gi_its_dev->lpis.lpi_base; /* The physical interrupt presented to softeware */ - desc.cmd_desc_mapvi.pid = girq->gi_irq + GIC_FIRST_LPI; + desc.cmd_desc_mapvi.pid = girq->gi_irq + sc->sc_irq_base; its_cmd_send(dev, &desc); } @@ -1649,17 +1670,21 @@ gicv3_its_fdt_attach(device_t dev) phandle_t xref; int err; + sc = device_get_softc(dev); + + sc->sc_irq_length = gicv3_get_nirqs(dev); + sc->sc_irq_base = GIC_FIRST_LPI; + sc->sc_irq_base += device_get_unit(dev) * sc->sc_irq_length; + err = gicv3_its_attach(dev); if (err != 0) return (err); - sc = device_get_softc(dev); - /* Register this device as a interrupt controller */ xref = OF_xref_from_node(ofw_bus_get_node(dev)); sc->sc_pic = intr_pic_register(dev, xref); intr_pic_add_handler(device_get_parent(dev), sc->sc_pic, - gicv3_its_intr, sc, GIC_FIRST_LPI, LPI_NIRQS); + gicv3_its_intr, sc, sc->sc_irq_base, sc->sc_irq_length); /* Register this device to handle MSI interrupts */ intr_msi_register(dev, xref); From owner-svn-src-head@freebsd.org Sun Aug 13 18:59:20 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 43D3BDD2D72; Sun, 13 Aug 2017 18:59:20 +0000 (UTC) (envelope-from ohauer@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 12A697EB9D; Sun, 13 Aug 2017 18:59:20 +0000 (UTC) (envelope-from ohauer@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7DIxJk1015165; Sun, 13 Aug 2017 18:59:19 GMT (envelope-from ohauer@FreeBSD.org) Received: (from ohauer@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7DIxJJ8015164; Sun, 13 Aug 2017 18:59:19 GMT (envelope-from ohauer@FreeBSD.org) Message-Id: <201708131859.v7DIxJJ8015164@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ohauer set sender to ohauer@FreeBSD.org using -f From: Olli Hauer Date: Sun, 13 Aug 2017 18:59:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322471 - head/usr.bin/calendar/calendars X-SVN-Group: head X-SVN-Commit-Author: ohauer X-SVN-Commit-Paths: head/usr.bin/calendar/calendars X-SVN-Commit-Revision: 322471 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Aug 2017 18:59:20 -0000 Author: ohauer (ports committer) Date: Sun Aug 13 18:59:19 2017 New Revision: 322471 URL: https://svnweb.freebsd.org/changeset/base/322471 Log: - Add myswlf Reported by: mckusick Modified: head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Sun Aug 13 18:54:51 2017 (r322470) +++ head/usr.bin/calendar/calendars/calendar.freebsd Sun Aug 13 18:59:19 2017 (r322471) @@ -386,6 +386,7 @@ 10/26 Matthew Ahrens born in United States, 1979 10/26 Philip M. Gollucci born in Silver Spring, Maryland, United States, 1979 10/27 Takanori Watanabe born in Numazu, Shizuoka, Japan, 1972 +10/30 Olli Hauer born in Sindelfingen, Germany, 1968 10/31 Taras Korenko born in Cherkasy region, Ukraine, 1980 11/03 Ryan Stone born in Ottawa, Ontario, Canada, 1985 11/05 M. Warner Losh born in Kansas City, Kansas, United States, 1966 From owner-svn-src-head@freebsd.org Sun Aug 13 19:04:33 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A646CDD3388; Sun, 13 Aug 2017 19:04:33 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-pg0-f44.google.com (mail-pg0-f44.google.com [74.125.83.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 809B97F0B7; Sun, 13 Aug 2017 19:04:33 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-pg0-f44.google.com with SMTP id y129so33532333pgy.4; Sun, 13 Aug 2017 12:04:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=RcGgfN2ErSQVy6KaobyyUGUfOhvrH32rLGA6TVX4Bxc=; b=fLXFX/nyRGK2U3Z/heBy5PAo66AR8lXQk4Qn/Do8ZnlQTJHJlsmOnaxlB01Pjau51G uqcF2JECV2mp6g+k3qOwgSs1FXXtV3ICYNaWGU3uWB+FABJd5R/4UphTndtPMlDJerhO sgGkIOQRSIfmUTSwhinanaZ6D/F1HDt028fXxiiqxFaZ6W4GczGWqpxfEjKWBsxNtMYL LOpgGGFqPIYVBeLFQ0Y6Ngr2WBDtqdyU2qUuD2WlilffYbZKvDTBdGwYm0EUsDV7Sza6 y40q09lbyEqXpm+XpPCWV0CZWWhu++5HWiGZcvf0l0/xImH2AuOWRDMFyClrZ1efsmPs Vr2Q== X-Gm-Message-State: AHYfb5jfIPosf4Fe3H9Znl2nGxT4GmSdX0NLlpfz7ZEZkmRHb1d17TjB guJ4cAew8z6EiHo+iYA= X-Received: by 10.84.254.9 with SMTP id b9mr23510160plm.422.1502649678668; Sun, 13 Aug 2017 11:41:18 -0700 (PDT) Received: from mail-pg0-f48.google.com (mail-pg0-f48.google.com. [74.125.83.48]) by smtp.gmail.com with ESMTPSA id 206sm10054991pfc.61.2017.08.13.11.41.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 13 Aug 2017 11:41:18 -0700 (PDT) Received: by mail-pg0-f48.google.com with SMTP id l64so33244358pge.5; Sun, 13 Aug 2017 11:41:18 -0700 (PDT) X-Received: by 10.101.90.7 with SMTP id y7mr21248036pgs.29.1502649678383; Sun, 13 Aug 2017 11:41:18 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.100.150.15 with HTTP; Sun, 13 Aug 2017 11:41:17 -0700 (PDT) In-Reply-To: <201708131810.v7DIAOYi094566@repo.freebsd.org> References: <201708131810.v7DIAOYi094566@repo.freebsd.org> From: Conrad Meyer Date: Sun, 13 Aug 2017 11:41:17 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r322465 - in head: share/man/man9 sys/kern sys/sys To: Ian Lepore Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Aug 2017 19:04:33 -0000 On Sun, Aug 13, 2017 at 11:10 AM, Ian Lepore wrote: > Author: ian > Date: Sun Aug 13 18:10:24 2017 > New Revision: 322465 > URL: https://svnweb.freebsd.org/changeset/base/322465 > > Log: > Add config_intrhook_oneshot(): schedule an intrhook function and unregister > it automatically after it runs. > > The config_intrhook mechanism allows a driver to stall the boot process > until device(s) required for booting are available, by not allowing system > inits to proceed until all intrhook functions have been unregistered. > Virtually all existing code simply unregisters from within the hook function > when it gets called. > > This new function makes that common usage more convenient. Instead of > allocating and filling in a struct, passing it to a function that might (in > theory) fail, and checking the return code, now a driver can simply call > this cannot-fail routine, passing just the intrhook function and its arg. > > Differential Revision: https://reviews.freebsd.org/D11963 Reviewed by: cem, bcr (manpages) From owner-svn-src-head@freebsd.org Sun Aug 13 19:46:01 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AC3FBDD5ECA for ; Sun, 13 Aug 2017 19:46:01 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from bat.yew.relay.mailchannels.net (bat.yew.relay.mailchannels.net [23.83.220.13]) (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 78D3380790 for ; Sun, 13 Aug 2017 19:45:59 +0000 (UTC) (envelope-from ian@freebsd.org) X-Sender-Id: _forwarded-from|73.78.92.27 Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 0FCB51083AD for ; Sun, 13 Aug 2017 19:06:35 +0000 (UTC) Received: from outbound1a.eu.mailhop.org (unknown [100.96.126.104]) (Authenticated sender: duocircle) by relay.mailchannels.net (Postfix) with ESMTPA id 7CB91107F04 for ; Sun, 13 Aug 2017 19:06:34 +0000 (UTC) X-Sender-Id: _forwarded-from|73.78.92.27 Received: from outbound1a.eu.mailhop.org (outbound1a.eu.mailhop.org [172.20.55.158]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.9.10); Sun, 13 Aug 2017 19:06:35 +0000 X-MC-Relay: Junk X-MailChannels-SenderId: _forwarded-from|73.78.92.27 X-MailChannels-Auth-Id: duocircle X-Average-Shoe: 225039f42bda8904_1502651194936_447365305 X-MC-Loop-Signature: 1502651194936:2737076243 X-MC-Ingress-Time: 1502651194935 X-MHO-User: 81c6565a-805a-11e7-83af-a91f44540cb3 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 73.78.92.27 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [73.78.92.27]) by outbound1.eu.mailhop.org (Halon) with ESMTPSA id 81c6565a-805a-11e7-83af-a91f44540cb3; Sun, 13 Aug 2017 19:06:28 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id v7DJ6Q44006505; Sun, 13 Aug 2017 13:06:26 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1502651186.47886.38.camel@freebsd.org> Subject: Re: svn commit: r322465 - in head: share/man/man9 sys/kern sys/sys From: Ian Lepore To: cem@freebsd.org Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Sun, 13 Aug 2017 13:06:26 -0600 In-Reply-To: References: <201708131810.v7DIAOYi094566@repo.freebsd.org> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Aug 2017 19:46:01 -0000 On Sun, 2017-08-13 at 11:41 -0700, Conrad Meyer wrote: > On Sun, Aug 13, 2017 at 11:10 AM, Ian Lepore wrote: > >=20 > > Author: ian > > Date: Sun Aug 13 18:10:24 2017 > > New Revision: 322465 > > URL: https://svnweb.freebsd.org/changeset/base/322465 > >=20 > > Log: > > =A0 Add config_intrhook_oneshot(): schedule an intrhook function and > > unregister > > =A0 it automatically after it runs. > >=20 > > =A0 The config_intrhook mechanism allows a driver to stall the boot > > process > > =A0 until device(s) required for booting are available, by not > > allowing system > > =A0 inits to proceed until all intrhook functions have been > > unregistered. > > =A0 Virtually all existing code simply unregisters from within the > > hook function > > =A0 when it gets called. > >=20 > > =A0 This new function makes that common usage more convenient. > > Instead of > > =A0 allocating and filling in a struct, passing it to a function that > > might (in > > =A0 theory) fail, and checking the return code, now a driver can > > simply call > > =A0 this cannot-fail routine, passing just the intrhook function and > > its arg. > >=20 > > =A0 Differential Revision:=A0=A0=A0=A0=A0=A0=A0=A0https://reviews.fre= ebsd.org/D11963 > Reviewed by: cem, bcr (manpages) As indicated in the referenced differential revision. -- Ian From owner-svn-src-head@freebsd.org Sun Aug 13 21:02:42 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 405BADDA503; Sun, 13 Aug 2017 21:02:42 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E512282C0E; Sun, 13 Aug 2017 21:02:41 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7DL2fBP067945; Sun, 13 Aug 2017 21:02:41 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7DL2eYG067940; Sun, 13 Aug 2017 21:02:40 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201708132102.v7DL2eYG067940@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 13 Aug 2017 21:02:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322473 - in head/sys: conf dev/iicbus modules/i2c modules/i2c/ds13rtc X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in head/sys: conf dev/iicbus modules/i2c modules/i2c/ds13rtc X-SVN-Commit-Revision: 322473 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Aug 2017 21:02:42 -0000 Author: ian Date: Sun Aug 13 21:02:40 2017 New Revision: 322473 URL: https://svnweb.freebsd.org/changeset/base/322473 Log: Add a new driver, ds13rtc, that handles all DS13xx series i2c RTC chips. This driver supports only basic timekeeping functionality. It completely replaces the ds133x driver. It can also replace the ds1374 driver, but that will take a few other changes in MIPS code and config, and will be committed separately. It does NOT replace the existing ds1307 driver, which provides access to some of the extended features on the 1307 chip, such as controlling the square wave output signal. If both ds1307 and ds13rtc drivers are present, the ds1307 driver will outbid and win control of the device. This driver can be configured with FDT data, or by using hints on non-FDT systems. In addition to the standard hints for i2c devices, it requires a "chiptype" string of the form "dallas,ds13xx" where 'xx' is the chip id (i.e., the same format as FDT compat strings). Added: head/sys/dev/iicbus/ds13rtc.c (contents, props changed) head/sys/modules/i2c/ds13rtc/ head/sys/modules/i2c/ds13rtc/Makefile (contents, props changed) Deleted: head/sys/dev/iicbus/ds133x.c Modified: head/sys/conf/NOTES head/sys/conf/files head/sys/modules/i2c/Makefile Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Sun Aug 13 19:35:48 2017 (r322472) +++ head/sys/conf/NOTES Sun Aug 13 21:02:40 2017 (r322473) @@ -2524,8 +2524,8 @@ device iicoc # OpenCores I2C controller support # I2C peripheral devices # device ds1307 # Dallas DS1307 RTC and compatible -device ds133x # Dallas DS1337, DS1338 and DS1339 RTC device ds1374 # Dallas DS1374 RTC +device ds13rtc # All Dallas/Maxim ds13xx chips device ds1672 # Dallas DS1672 RTC device ds3231 # Dallas DS3231 RTC + temperature device icee # AT24Cxxx and compatible EEPROMs Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sun Aug 13 19:35:48 2017 (r322472) +++ head/sys/conf/files Sun Aug 13 21:02:40 2017 (r322473) @@ -1752,8 +1752,8 @@ dev/ida/ida_disk.c optional ida dev/ida/ida_pci.c optional ida pci dev/iicbus/ad7418.c optional ad7418 dev/iicbus/ds1307.c optional ds1307 -dev/iicbus/ds133x.c optional ds133x dev/iicbus/ds1374.c optional ds1374 +dev/iicbus/ds13rtc.c optional ds13rtc | ds133x dev/iicbus/ds1672.c optional ds1672 dev/iicbus/ds3231.c optional ds3231 dev/iicbus/icee.c optional icee Added: head/sys/dev/iicbus/ds13rtc.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/iicbus/ds13rtc.c Sun Aug 13 21:02:40 2017 (r322473) @@ -0,0 +1,629 @@ +/*- + * Copyright (c) 2017 Ian Lepore + * 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$"); + +/* + * Driver for Dallas/Maxim DS13xx real-time clock/calendar chips: + * + * - DS1307 = Original/basic rtc + 56 bytes ram; 5v only. + * - DS1308 = Updated 1307, available in 1.8v-5v variations. + * - DS1337 = Like 1308, integrated xtal, 32khz output on at powerup. + * - DS1338 = Like 1308, integrated xtal. + * - DS1339 = Like 1337, integrated xtal, integrated trickle charger. + * - DS1340 = Like 1338, ST M41T00 compatible. + * - DS1341 = Like 1338, can slave-sync osc to external clock signal. + * - DS1342 = Like 1341 but requires different xtal. + * - DS1371 = 32-bit binary counter, watchdog timer. + * - DS1372 = 32-bit binary counter, 64-bit unique id in rom. + * - DS1374 = 32-bit binary counter, watchdog timer, trickle charger. + * - DS1375 = Like 1308 but only 16 bytes ram. + * - DS1388 = Rtc, watchdog timer, 512 bytes eeprom (not sram). + * + * This driver supports only basic timekeeping functions. It provides no access + * to or control over any other functionality provided by the chips. + */ + +#include "opt_platform.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#ifdef FDT +#include +#include +#include +#endif + +#include "clock_if.h" +#include "iicbus_if.h" + +/* + * I2C address 1101 000x + */ +#define DS13xx_ADDR 0xd0 + +/* + * Registers, bits within them, and masks for the various chip types. + */ + +#define DS13xx_R_NONE 0xff /* Placeholder */ + +#define DS130x_R_CONTROL 0x07 +#define DS133x_R_CONTROL 0x0e +#define DS1340_R_CONTROL 0x07 +#define DS1341_R_CONTROL 0x0e +#define DS1371_R_CONTROL 0x07 +#define DS1372_R_CONTROL 0x07 +#define DS1374_R_CONTROL 0x07 +#define DS1375_R_CONTROL 0x0e +#define DS1388_R_CONTROL 0x0c + +#define DS13xx_R_SECOND 0x00 +#define DS1388_R_SECOND 0x01 + +#define DS130x_R_STATUS DS13xx_R_NONE +#define DS133x_R_STATUS 0x0f +#define DS1340_R_STATUS 0x09 +#define DS137x_R_STATUS 0x08 +#define DS1388_R_STATUS 0x0b + +#define DS13xx_B_STATUS_OSF 0x80 /* OSF is 1<<7 in status and sec regs */ +#define DS13xx_B_HOUR_AMPM 0x40 /* AMPM mode is bit 1<<6 */ +#define DS13xx_B_HOUR_PM 0x20 /* PM hours indicated by 1<<5 */ +#define DS13xx_B_MONTH_CENTURY 0x80 /* 21st century indicated by 1<<7 */ + +#define DS13xx_M_SECOND 0x7f /* Masks for all BCD time regs... */ +#define DS13xx_M_MINUTE 0x7f +#define DS13xx_M_12HOUR 0x1f +#define DS13xx_M_24HOUR 0x3f +#define DS13xx_M_DAY 0x3f +#define DS13xx_M_MONTH 0x1f +#define DS13xx_M_YEAR 0xff + +/* + * The chip types we support. + */ +enum { + TYPE_NONE, + TYPE_DS1307, + TYPE_DS1308, + TYPE_DS1337, + TYPE_DS1338, + TYPE_DS1339, + TYPE_DS1340, + TYPE_DS1341, + TYPE_DS1342, + TYPE_DS1371, + TYPE_DS1372, + TYPE_DS1374, + TYPE_DS1375, + TYPE_DS1388, + + TYPE_COUNT +}; +static const char *desc_strings[] = { + "", + "Dallas/Maxim DS1307 RTC", + "Dallas/Maxim DS1308 RTC", + "Dallas/Maxim DS1337 RTC", + "Dallas/Maxim DS1338 RTC", + "Dallas/Maxim DS1339 RTC", + "Dallas/Maxim DS1340 RTC", + "Dallas/Maxim DS1341 RTC", + "Dallas/Maxim DS1342 RTC", + "Dallas/Maxim DS1371 RTC", + "Dallas/Maxim DS1372 RTC", + "Dallas/Maxim DS1374 RTC", + "Dallas/Maxim DS1375 RTC", + "Dallas/Maxim DS1388 RTC", +}; +CTASSERT(nitems(desc_strings) == TYPE_COUNT); + +/* + * The time registers in the order they are laid out in hardware. + */ +struct time_regs { + uint8_t sec, min, hour, wday, day, month, year; +}; + +struct ds13rtc_softc { + device_t dev; + device_t busdev; + u_int flags; /* SC_F_* flags */ + u_int chiptype; /* Type of DS13xx chip */ + uint8_t secaddr; /* Address of seconds register */ + uint8_t osfaddr; /* Address of register with OSF */ +}; + +#define SC_F_BINARY (1u << 0) /* Time is 32-bit binary counter */ +#define SC_F_AMPM (1u << 1) /* Use PM flag in hours reg */ +#define SC_F_CENTURY (1u << 2) /* Use century bit */ + +/* + * We use the compat_data table to look up hint strings in the non-FDT case, so + * define the struct locally when we don't get it from ofw_bus_subr.h. + */ +#ifdef FDT +typedef struct ofw_compat_data ds13_compat_data; +#else +typedef struct { + const char *ocd_str; + uintptr_t ocd_data; +} ds13_compat_data; +#endif + +static ds13_compat_data compat_data[] = { + {"dallas,ds1307", TYPE_DS1307}, + {"dallas,ds1308", TYPE_DS1308}, + {"dallas,ds1337", TYPE_DS1337}, + {"dallas,ds1338", TYPE_DS1338}, + {"dallas,ds1339", TYPE_DS1339}, + {"dallas,ds1340", TYPE_DS1340}, + {"dallas,ds1341", TYPE_DS1341}, + {"dallas,ds1342", TYPE_DS1342}, + {"dallas,ds1371", TYPE_DS1371}, + {"dallas,ds1372", TYPE_DS1372}, + {"dallas,ds1374", TYPE_DS1374}, + {"dallas,ds1375", TYPE_DS1375}, + {"dallas,ds1388", TYPE_DS1388}, + + {NULL, TYPE_NONE}, +}; + +static int +read_reg(struct ds13rtc_softc *sc, uint8_t reg, uint8_t *val) +{ + + return (iicdev_readfrom(sc->dev, reg, val, sizeof(*val), IIC_WAIT)); +} + +static int +write_reg(struct ds13rtc_softc *sc, uint8_t reg, uint8_t val) +{ + + return (iicdev_writeto(sc->dev, reg, &val, sizeof(val), IIC_WAIT)); +} + +static int +read_timeregs(struct ds13rtc_softc *sc, struct time_regs *tregs) +{ + int err; + + if ((err = iicdev_readfrom(sc->dev, sc->secaddr, tregs, + sizeof(*tregs), IIC_WAIT)) != 0) + return (err); + + return (err); +} + +static int +write_timeregs(struct ds13rtc_softc *sc, struct time_regs *tregs) +{ + + return (iicdev_writeto(sc->dev, sc->secaddr, tregs, + sizeof(*tregs), IIC_WAIT)); +} + +static int +read_timeword(struct ds13rtc_softc *sc, time_t *secs) +{ + int err; + uint8_t buf[4]; + + if ((err = iicdev_readfrom(sc->dev, sc->secaddr, buf, sizeof(buf), + IIC_WAIT)) == 0) + *secs = le32dec(buf); + + return (err); +} + +static int +write_timeword(struct ds13rtc_softc *sc, time_t secs) +{ + uint8_t buf[4]; + + le32enc(buf, (uint32_t)secs); + return (iicdev_writeto(sc->dev, sc->secaddr, buf, sizeof(buf), + IIC_WAIT)); +} + +static void +ds13rtc_start(void *arg) +{ + struct ds13rtc_softc *sc; + uint8_t ctlreg, statreg; + + sc = arg; + + /* + * Every chip in this family can be usefully initialized by writing 0 to + * the control register, except DS1375 which has an external oscillator + * controlled by values in the ctlreg that we know nothing about, so + * we'd best leave them alone. For all other chips, writing 0 enables + * the oscillator, disables signals/outputs in battery-backed mode + * (saves power) and disables features like watchdog timers and alarms. + */ + switch (sc->chiptype) { + case TYPE_DS1307: + case TYPE_DS1308: + case TYPE_DS1338: + case TYPE_DS1340: + case TYPE_DS1371: + case TYPE_DS1372: + case TYPE_DS1374: + ctlreg = DS130x_R_CONTROL; + break; + case TYPE_DS1337: + case TYPE_DS1339: + ctlreg = DS133x_R_CONTROL; + break; + case TYPE_DS1341: + case TYPE_DS1342: + ctlreg = DS1341_R_CONTROL; + break; + case TYPE_DS1375: + ctlreg = DS13xx_R_NONE; + break; + case TYPE_DS1388: + ctlreg = DS1388_R_CONTROL; + break; + default: + device_printf(sc->dev, "missing init code for this chiptype\n"); + return; + } + if (ctlreg != DS13xx_R_NONE) + write_reg(sc, ctlreg, 0); + + /* + * Common init. Read the OSF/CH status bit and report stopped clocks to + * the user. The status bit will be cleared the first time we write + * valid time to the chip (and must not be cleared before that). + */ + if (read_reg(sc, sc->osfaddr, &statreg) != 0) { + device_printf(sc->dev, "cannot read RTC clock status bit\n"); + return; + } + if (statreg & DS13xx_B_STATUS_OSF) { + device_printf(sc->dev, + "WARNING: RTC battery failed; time is invalid\n"); + } + + /* + * Figure out whether the chip is configured for AM/PM mode. On all + * chips that do AM/PM mode, the flag bit is in the hours register, + * which is secaddr+2. + */ + if ((sc->chiptype != TYPE_DS1340) && !(sc->flags & SC_F_BINARY)) { + if (read_reg(sc, sc->secaddr + 2, &statreg) != 0) { + device_printf(sc->dev, + "cannot read RTC clock AM/PM bit\n"); + return; + } + if (statreg & DS13xx_B_HOUR_AMPM) + sc->flags |= SC_F_AMPM; + } + + /* + * Everything looks good if we make it to here; register as an RTC. + * Schedule RTC updates to happen just after top-of-second. + */ + clock_register_flags(sc->dev, 1000000, CLOCKF_SETTIME_NO_ADJ); + clock_schedule(sc->dev, 1); +} + +static int +ds13rtc_gettime(device_t dev, struct timespec *ts) +{ + struct clocktime ct; + struct time_regs tregs; + struct ds13rtc_softc *sc; + int err; + uint8_t statreg, hourmask; + + sc = device_get_softc(dev); + + /* Read the OSF/CH bit; if the clock stopped we can't provide time. */ + if ((err = read_reg(sc, sc->osfaddr, &statreg)) != 0) { + return (err); + } + if (statreg & DS13xx_B_STATUS_OSF) + return (EINVAL); /* hardware is good, time is not. */ + + /* If the chip counts time in binary, we just read and return it. */ + if (sc->flags & SC_F_BINARY) { + if ((err = read_timeword(sc, &ts->tv_sec)) != 0) + return (err); + ts->tv_nsec = 0; + } + + /* + * Chip counts in BCD, read and decode it... + */ + if ((err = read_timeregs(sc, &tregs)) != 0) { + device_printf(dev, "cannot read RTC time\n"); + return (err); + } + + if (sc->flags & SC_F_AMPM) + hourmask = DS13xx_M_12HOUR; + else + hourmask = DS13xx_M_24HOUR; + + ct.sec = FROMBCD(tregs.sec & DS13xx_M_SECOND); + ct.min = FROMBCD(tregs.min & DS13xx_M_MINUTE); + ct.hour = FROMBCD(tregs.hour & hourmask); + ct.day = FROMBCD(tregs.day & DS13xx_M_DAY); + ct.mon = FROMBCD(tregs.month & DS13xx_M_MONTH); + ct.year = FROMBCD(tregs.year & DS13xx_M_YEAR); + ct.nsec = 0; + + if (sc->flags & SC_F_AMPM) { + if (ct.hour == 12) + ct.hour = 0; + if (tregs.hour & DS13xx_B_HOUR_PM) + ct.hour += 12; + } + + /* + * If this chip has a century bit, honor it. Otherwise let + * clock_ct_to_ts() infer the century from the 2-digit year. + */ + if (sc->flags & SC_F_CENTURY) + ct.year += (tregs.month & DS13xx_B_MONTH_CENTURY) ? 2000 : 1900; + + err = clock_ct_to_ts(&ct, ts); + + return (err); +} + +static int +ds13rtc_settime(device_t dev, struct timespec *ts) +{ + struct clocktime ct; + struct time_regs tregs; + struct ds13rtc_softc *sc; + int err; + uint8_t cflag, statreg, pmflag; + + sc = device_get_softc(dev); + + /* + * We request a timespec with no resolution-adjustment. That also + * disables utc adjustment, so apply that ourselves. + */ + ts->tv_sec -= utc_offset(); + + /* If the chip counts time in binary, store tv_sec and we're done. */ + if (sc->flags & SC_F_BINARY) + return (write_timeword(sc, ts->tv_sec)); + + clock_ts_to_ct(ts, &ct); + + /* If the chip is in AMPM mode deal with the PM flag. */ + pmflag = 0; + if (sc->flags & SC_F_AMPM) { + if (ct.hour >= 12) { + ct.hour -= 12; + pmflag = DS13xx_B_HOUR_PM; + } + if (ct.hour == 0) + ct.hour = 12; + } + + /* If the chip has a century bit, set it as needed. */ + cflag = 0; + if (sc->flags & SC_F_CENTURY) { + if (ct.year >= 2000) + cflag |= DS13xx_B_MONTH_CENTURY; + } + + tregs.sec = TOBCD(ct.sec); + tregs.min = TOBCD(ct.min); + tregs.hour = TOBCD(ct.hour) | pmflag; + tregs.day = TOBCD(ct.day); + tregs.month = TOBCD(ct.mon) | cflag; + tregs.year = TOBCD(ct.year % 100); + tregs.wday = ct.dow; + + /* + * Set the time. Reset the OSF bit if it is on and it is not part of + * the time registers (in which case writing time resets it). + */ + if ((err = write_timeregs(sc, &tregs)) != 0) + goto errout; + if (sc->osfaddr != sc->secaddr) { + if ((err = read_reg(sc, sc->osfaddr, &statreg)) != 0) + goto errout; + if (statreg & DS13xx_B_STATUS_OSF) { + statreg &= ~DS13xx_B_STATUS_OSF; + err = write_reg(sc, sc->osfaddr, statreg); + } + } + +errout: + + if (err != 0) + device_printf(dev, "cannot update RTC time\n"); + + return (err); +} + +static int +ds13rtc_get_chiptype(device_t dev) +{ +#ifdef FDT + + return (ofw_bus_search_compatible(dev, compat_data)->ocd_data); +#else + ds13_compat_data *cdata; + const char *htype; + + /* + * We can only attach if provided a chiptype hint string. + */ + if (resource_string_value(device_get_name(dev), + device_get_unit(dev), "chiptype", &htype) != 0) + return (TYPE_NONE); + + /* + * Loop through the ofw compat data comparing the hinted chip type to + * the compat strings. + */ + for (cdata = compat_data; cdata->ocd_str != NULL; ++cdata) { + if (strcmp(htype, cdata->ocd_str) == 0) + break; + } + return (cdata->ocd_data); +#endif +} + +static int +ds13rtc_probe(device_t dev) +{ + int chiptype, goodrv; + +#ifdef FDT + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + goodrv = BUS_PROBE_GENERIC; +#else + goodrv = BUS_PROBE_NOWILDCARD; +#endif + + chiptype = ds13rtc_get_chiptype(dev); + if (chiptype == TYPE_NONE) + return (ENXIO); + + device_set_desc(dev, desc_strings[chiptype]); + return (goodrv); +} + +static int +ds13rtc_attach(device_t dev) +{ + struct ds13rtc_softc *sc; + + sc = device_get_softc(dev); + sc->dev = dev; + sc->busdev = device_get_parent(dev); + + /* + * We need to know what kind of chip we're driving. + */ + if ((sc->chiptype = ds13rtc_get_chiptype(dev)) == TYPE_NONE) { + device_printf(dev, "impossible: cannot determine chip type\n"); + return (ENXIO); + } + + /* The seconds register is in the same place on all except DS1388. */ + if (sc->chiptype == TYPE_DS1388) + sc->secaddr = DS1388_R_SECOND; + else + sc->secaddr = DS13xx_R_SECOND; + + /* + * The OSF/CH (osc failed/clock-halted) bit appears in different + * registers for different chip types. The DS1375 has no OSF indicator + * because it has no internal oscillator; we just point to an always- + * zero bit in the status register for that chip. + */ + switch (sc->chiptype) { + case TYPE_DS1307: + case TYPE_DS1308: + case TYPE_DS1338: + sc->osfaddr = DS13xx_R_SECOND; + break; + case TYPE_DS1337: + case TYPE_DS1339: + case TYPE_DS1341: + case TYPE_DS1342: + case TYPE_DS1375: + sc->osfaddr = DS133x_R_STATUS; + sc->flags |= SC_F_CENTURY; + break; + case TYPE_DS1340: + sc->osfaddr = DS1340_R_STATUS; + break; + case TYPE_DS1371: + case TYPE_DS1372: + case TYPE_DS1374: + sc->osfaddr = DS137x_R_STATUS; + sc->flags |= SC_F_BINARY; + break; + case TYPE_DS1388: + sc->osfaddr = DS1388_R_STATUS; + break; + } + + /* + * We have to wait until interrupts are enabled. Sometimes I2C read + * and write only works when the interrupts are available. + */ + config_intrhook_oneshot(ds13rtc_start, sc); + + return (0); +} + +static int +ds13rtc_detach(device_t dev) +{ + + clock_unregister(dev); + return (0); +} + +static device_method_t ds13rtc_methods[] = { + DEVMETHOD(device_probe, ds13rtc_probe), + DEVMETHOD(device_attach, ds13rtc_attach), + DEVMETHOD(device_detach, ds13rtc_detach), + + DEVMETHOD(clock_gettime, ds13rtc_gettime), + DEVMETHOD(clock_settime, ds13rtc_settime), + + DEVMETHOD_END +}; + +static driver_t ds13rtc_driver = { + "ds13rtc", + ds13rtc_methods, + sizeof(struct ds13rtc_softc), +}; + +static devclass_t ds13rtc_devclass; + +DRIVER_MODULE(ds13rtc, iicbus, ds13rtc_driver, ds13rtc_devclass, NULL, NULL); +MODULE_VERSION(ds13rtc, 1); +MODULE_DEPEND(ds13rtc, iicbus, IICBB_MINVER, IICBB_PREFVER, IICBB_MAXVER); Modified: head/sys/modules/i2c/Makefile ============================================================================== --- head/sys/modules/i2c/Makefile Sun Aug 13 19:35:48 2017 (r322472) +++ head/sys/modules/i2c/Makefile Sun Aug 13 21:02:40 2017 (r322473) @@ -4,6 +4,7 @@ SUBDIR = \ controllers \ cyapa \ ds1307 \ + ds13rtc \ ds3231 \ if_ic \ iic \ Added: head/sys/modules/i2c/ds13rtc/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/i2c/ds13rtc/Makefile Sun Aug 13 21:02:40 2017 (r322473) @@ -0,0 +1,7 @@ +# $FreeBSD$ + +.PATH: ${SRCTOP}/sys/dev/iicbus +KMOD = ds13rtc +SRCS = ds13rtc.c bus_if.h clock_if.h device_if.h iicbus_if.h ofw_bus_if.h + +.include From owner-svn-src-head@freebsd.org Sun Aug 13 21:11:50 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 076CDDDAF22; Sun, 13 Aug 2017 21:11:50 +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 mx1.freebsd.org (Postfix) with ESMTPS id C9D2C83189; Sun, 13 Aug 2017 21:11:49 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7DLBmoX068310; Sun, 13 Aug 2017 21:11:48 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7DLBmdV068309; Sun, 13 Aug 2017 21:11:48 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201708132111.v7DLBmdV068309@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Sun, 13 Aug 2017 21:11:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322474 - head/contrib/llvm/tools/lld/ELF X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/contrib/llvm/tools/lld/ELF X-SVN-Commit-Revision: 322474 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Aug 2017 21:11:50 -0000 Author: emaste Date: Sun Aug 13 21:11:48 2017 New Revision: 322474 URL: https://svnweb.freebsd.org/changeset/base/322474 Log: lld: Add `-z muldefs` option. Obtained from: LLVM r310757 Modified: head/contrib/llvm/tools/lld/ELF/Driver.cpp Modified: head/contrib/llvm/tools/lld/ELF/Driver.cpp ============================================================================== --- head/contrib/llvm/tools/lld/ELF/Driver.cpp Sun Aug 13 21:02:40 2017 (r322473) +++ head/contrib/llvm/tools/lld/ELF/Driver.cpp Sun Aug 13 21:11:48 2017 (r322474) @@ -615,7 +615,8 @@ static bool getCompressDebugSections(opt::InputArgList // Initializes Config members by the command line options. void LinkerDriver::readConfigs(opt::InputArgList &Args) { - Config->AllowMultipleDefinition = Args.hasArg(OPT_allow_multiple_definition); + Config->AllowMultipleDefinition = + Args.hasArg(OPT_allow_multiple_definition) || hasZOption(Args, "muldefs"); Config->AuxiliaryList = getArgs(Args, OPT_auxiliary); Config->Bsymbolic = Args.hasArg(OPT_Bsymbolic); Config->BsymbolicFunctions = Args.hasArg(OPT_Bsymbolic_functions); From owner-svn-src-head@freebsd.org Sun Aug 13 21:45:47 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 99F98DDCCCB; Sun, 13 Aug 2017 21:45:47 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6631E8D; Sun, 13 Aug 2017 21:45:47 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7DLjk13084039; Sun, 13 Aug 2017 21:45:46 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7DLjkLn084038; Sun, 13 Aug 2017 21:45:46 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201708132145.v7DLjkLn084038@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 13 Aug 2017 21:45:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322475 - head/sys/dev/iicbus X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/iicbus X-SVN-Commit-Revision: 322475 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Aug 2017 21:45:47 -0000 Author: ian Date: Sun Aug 13 21:45:46 2017 New Revision: 322475 URL: https://svnweb.freebsd.org/changeset/base/322475 Log: Change "chiptype" to "compatible". Making the hint name the same as the FDT property name should make it easier to document the list of names accepted by both configuration mechanisms. Modified: head/sys/dev/iicbus/ds13rtc.c Modified: head/sys/dev/iicbus/ds13rtc.c ============================================================================== --- head/sys/dev/iicbus/ds13rtc.c Sun Aug 13 21:11:48 2017 (r322474) +++ head/sys/dev/iicbus/ds13rtc.c Sun Aug 13 21:45:46 2017 (r322475) @@ -495,7 +495,7 @@ ds13rtc_get_chiptype(device_t dev) * We can only attach if provided a chiptype hint string. */ if (resource_string_value(device_get_name(dev), - device_get_unit(dev), "chiptype", &htype) != 0) + device_get_unit(dev), "compatible", &htype) != 0) return (TYPE_NONE); /* From owner-svn-src-head@freebsd.org Sun Aug 13 22:07:44 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8B8A4DDE122; Sun, 13 Aug 2017 22:07:44 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 66091D4F; Sun, 13 Aug 2017 22:07:44 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7DM7hiW092332; Sun, 13 Aug 2017 22:07:43 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7DM7ggO092324; Sun, 13 Aug 2017 22:07:42 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201708132207.v7DM7ggO092324@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 13 Aug 2017 22:07:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322476 - in head/sys: conf dev/iicbus mips/conf mips/rmi X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in head/sys: conf dev/iicbus mips/conf mips/rmi X-SVN-Commit-Revision: 322476 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Aug 2017 22:07:44 -0000 Author: ian Date: Sun Aug 13 22:07:42 2017 New Revision: 322476 URL: https://svnweb.freebsd.org/changeset/base/322476 Log: Remove the old ds1374 driver and use the ds13rtc driver instead. Adjust several mips config files accordingly. Deleted: head/sys/dev/iicbus/ds1374.c Modified: head/sys/conf/NOTES head/sys/conf/files head/sys/mips/conf/XLP.hints head/sys/mips/conf/XLR head/sys/mips/conf/XLR64 head/sys/mips/conf/XLRN32 head/sys/mips/conf/std.XLP head/sys/mips/rmi/xlr_i2c.c Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Sun Aug 13 21:45:46 2017 (r322475) +++ head/sys/conf/NOTES Sun Aug 13 22:07:42 2017 (r322476) @@ -2524,7 +2524,6 @@ device iicoc # OpenCores I2C controller support # I2C peripheral devices # device ds1307 # Dallas DS1307 RTC and compatible -device ds1374 # Dallas DS1374 RTC device ds13rtc # All Dallas/Maxim ds13xx chips device ds1672 # Dallas DS1672 RTC device ds3231 # Dallas DS3231 RTC + temperature Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sun Aug 13 21:45:46 2017 (r322475) +++ head/sys/conf/files Sun Aug 13 22:07:42 2017 (r322476) @@ -1752,8 +1752,7 @@ dev/ida/ida_disk.c optional ida dev/ida/ida_pci.c optional ida pci dev/iicbus/ad7418.c optional ad7418 dev/iicbus/ds1307.c optional ds1307 -dev/iicbus/ds1374.c optional ds1374 -dev/iicbus/ds13rtc.c optional ds13rtc | ds133x +dev/iicbus/ds13rtc.c optional ds13rtc | ds133x | ds1374 dev/iicbus/ds1672.c optional ds1672 dev/iicbus/ds3231.c optional ds3231 dev/iicbus/icee.c optional icee Modified: head/sys/mips/conf/XLP.hints ============================================================================== --- head/sys/mips/conf/XLP.hints Sun Aug 13 21:45:46 2017 (r322475) +++ head/sys/mips/conf/XLP.hints Sun Aug 13 22:07:42 2017 (r322476) @@ -1,5 +1,6 @@ # $FreeBSD$ # RTC -hint.ds1374_rtc.0.at="iicbus1" -hint.ds1374_rtc.0.addr=0xd0 +hint.ds13rtc.0.at="iicbus1" +hint.ds13rtc.0.addr=0xd0 +hint.ds13rtc.0.compatible="dallas,ds1374" Modified: head/sys/mips/conf/XLR ============================================================================== --- head/sys/mips/conf/XLR Sun Aug 13 21:45:46 2017 (r322475) +++ head/sys/mips/conf/XLR Sun Aug 13 22:07:42 2017 (r322476) @@ -136,7 +136,7 @@ device ic device iic device iicbb device iicbus -device ds1374 # RTC on XLR boards +device ds13rtc # RTC on XLR boards device max6657 # Temparature sensor on XLR boards device at24co2n # EEPROM on XLR boards Modified: head/sys/mips/conf/XLR64 ============================================================================== --- head/sys/mips/conf/XLR64 Sun Aug 13 21:45:46 2017 (r322475) +++ head/sys/mips/conf/XLR64 Sun Aug 13 22:07:42 2017 (r322476) @@ -110,7 +110,7 @@ device ic device iic device iicbb device iicbus -device ds1374 # RTC on XLR boards +device ds13rtc # RTC on XLR boards device max6657 # Temparature sensor on XLR boards device at24co2n # EEPROM on XLR boards Modified: head/sys/mips/conf/XLRN32 ============================================================================== --- head/sys/mips/conf/XLRN32 Sun Aug 13 21:45:46 2017 (r322475) +++ head/sys/mips/conf/XLRN32 Sun Aug 13 22:07:42 2017 (r322476) @@ -114,7 +114,7 @@ device ic device iic device iicbb device iicbus -device ds1374 # RTC on XLR boards +device ds13rtc # RTC on XLR boards device max6657 # Temparature sensor on XLR boards device at24co2n # EEPROM on XLR boards Modified: head/sys/mips/conf/std.XLP ============================================================================== --- head/sys/mips/conf/std.XLP Sun Aug 13 21:45:46 2017 (r322475) +++ head/sys/mips/conf/std.XLP Sun Aug 13 22:07:42 2017 (r322476) @@ -95,7 +95,7 @@ device umass # Requires scbus and da device iic device iicbus device iicoc -device ds1374 # RTC on XLP boards +device ds13rtc # RTC on XLP boards # Crypto device crypto Modified: head/sys/mips/rmi/xlr_i2c.c ============================================================================== --- head/sys/mips/rmi/xlr_i2c.c Sun Aug 13 21:45:46 2017 (r322475) +++ head/sys/mips/rmi/xlr_i2c.c Sun Aug 13 22:07:42 2017 (r322476) @@ -187,7 +187,7 @@ xlr_i2c_attach(device_t dev) return -1; } if(xlr_board_info.xlr_i2c_device[I2C_RTC].enabled == 1) { - tmpd = device_add_child(sc->iicbus, "ds1374_rtc", 0); + tmpd = device_add_child(sc->iicbus, "ds13rtc", 0); device_set_ivars(tmpd, &xlr_board_info.xlr_i2c_device[I2C_RTC]); } if(xlr_board_info.xlr_i2c_device[I2C_THERMAL].enabled == 1) { @@ -198,6 +198,16 @@ xlr_i2c_attach(device_t dev) tmpd = device_add_child(sc->iicbus, "at24co2n", 0); device_set_ivars(tmpd, &xlr_board_info.xlr_i2c_device[I2C_EEPROM]); } + + /* + * The old ds1374 rtc driver only handled one chip type. The new + * ds13rtc driver handles all ds13xx chips, but must be told the chip + * type via hints. XLR historically hasn't had a standard hints file, + * so set up the hint now if it isn't already there. + */ +#define HINTNAME "hint.ds13rtc.0.compatible" + if (!testenv(HINTNAME)) + kern_setenv(HINTNAME, "dallas,ds1374"); bus_generic_attach(dev); From owner-svn-src-head@freebsd.org Mon Aug 14 00:00:25 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B56A5DB6669; Mon, 14 Aug 2017 00:00:25 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8FB6A639B9; Mon, 14 Aug 2017 00:00:25 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7E00Osu038095; Mon, 14 Aug 2017 00:00:24 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7E00OFJ038092; Mon, 14 Aug 2017 00:00:24 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201708140000.v7E00OFJ038092@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 14 Aug 2017 00:00:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322477 - in head/sys: dev/iicbus modules/i2c modules/i2c/s35390a X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in head/sys: dev/iicbus modules/i2c modules/i2c/s35390a X-SVN-Commit-Revision: 322477 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Aug 2017 00:00:25 -0000 Author: ian Date: Mon Aug 14 00:00:24 2017 New Revision: 322477 URL: https://svnweb.freebsd.org/changeset/base/322477 Log: Minor fixes and enhancements for the s35390a i2c RTC driver... - Add FDT probe code. - Do i2c transfers with exclusive bus ownership. - Use config_intrhook_oneshot() to defer chip setup because some i2c busses can't do transfers without interrupts. - Add a detach() routine. - Add to module build. Added: head/sys/modules/i2c/s35390a/ head/sys/modules/i2c/s35390a/Makefile (contents, props changed) Modified: head/sys/dev/iicbus/s35390a.c head/sys/modules/i2c/Makefile Modified: head/sys/dev/iicbus/s35390a.c ============================================================================== --- head/sys/dev/iicbus/s35390a.c Sun Aug 13 22:07:42 2017 (r322476) +++ head/sys/dev/iicbus/s35390a.c Mon Aug 14 00:00:24 2017 (r322477) @@ -59,6 +59,8 @@ __FBSDID("$FreeBSD$"); * Driver for Seiko Instruments S-35390A Real-time Clock */ +#include "opt_platform.h" + #include #include #include @@ -69,6 +71,12 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef FDT +#include +#include +#include +#endif + #include "clock_if.h" #include "iicbus_if.h" @@ -159,7 +167,7 @@ s390rtc_read(device_t dev, uint8_t reg, uint8_t *buf, int i; int error; - error = iicbus_transfer(dev, msg, 1); + error = iicbus_transfer_excl(dev, msg, 1, IIC_WAIT); if (error) return (error); @@ -188,13 +196,20 @@ s390rtc_write(device_t dev, uint8_t reg, uint8_t *buf, for (i = 0; i < len; ++i) buf[i] = bitreverse(buf[i]); - return (iicbus_transfer(dev, msg, 1)); + return (iicbus_transfer_excl(dev, msg, 1, IIC_WAIT)); } static int s390rtc_probe(device_t dev) { +#ifdef FDT + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (!ofw_bus_is_compatible(dev, "sii,s35390a")) + return (ENXIO); +#else if (iicbus_get_addr(dev) != S390_ADDR) { if (bootverbose) device_printf(dev, "slave address mismatch. " @@ -202,35 +217,35 @@ s390rtc_probe(device_t dev) S390_ADDR); return (ENXIO); } - device_set_desc(dev, "Seiko Instruments S-35390A Real-time Clock"); +#endif + device_set_desc(dev, "Seiko Instruments S-35390A RTC"); - return (BUS_PROBE_SPECIFIC); + return (BUS_PROBE_DEFAULT); } -static int -s390rtc_attach(device_t dev) +static void +s390rtc_start(void *arg) { - struct s390rtc_softc *sc; + device_t dev; uint8_t reg; int error; - sc = device_get_softc(dev); - sc->sc_dev = dev; - sc->sc_addr = iicbus_get_addr(dev); + dev = arg; /* Reset the chip and turn on 24h mode, after power-off or battery. */ error = s390rtc_read(dev, S390_STATUS1, ®, 1); if (error) { device_printf(dev, "%s: cannot read status1 register\n", __func__); - return (error); + return; } if (reg & (S390_ST1_POC | S390_ST1_BLD)) { reg |= S390_ST1_24H | S390_ST1_RESET; error = s390rtc_write(dev, S390_STATUS1, ®, 1); if (error) { - device_printf(dev, "%s: cannot initialize\n", __func__); - return (error); + device_printf(dev, + "%s: cannot initialize\n", __func__); + return; } } @@ -239,7 +254,7 @@ s390rtc_attach(device_t dev) if (error) { device_printf(dev, "%s: cannot read status2 register\n", __func__); - return (error); + return; } if (reg & S390_ST2_TEST) { reg &= ~S390_ST2_TEST; @@ -247,15 +262,36 @@ s390rtc_attach(device_t dev) if (error) { device_printf(dev, "%s: cannot disable the test mode\n", __func__); - return (error); + return; } } clock_register(dev, 1000000); /* 1 second resolution */ +} + +static int +s390rtc_attach(device_t dev) +{ + struct s390rtc_softc *sc; + + sc = device_get_softc(dev); + sc->sc_dev = dev; + sc->sc_addr = iicbus_get_addr(dev); + + config_intrhook_oneshot(s390rtc_start, dev); + return (0); } static int +s390rtc_detach(device_t dev) +{ + + clock_unregister(dev); + return (0); +} + +static int s390rtc_gettime(device_t dev, struct timespec *ts) { uint8_t bcd[S390_RT1_NBYTES]; @@ -310,6 +346,7 @@ s390rtc_settime(device_t dev, struct timespec *ts) static device_method_t s390rtc_methods[] = { DEVMETHOD(device_probe, s390rtc_probe), DEVMETHOD(device_attach, s390rtc_attach), + DEVMETHOD(device_detach, s390rtc_detach), DEVMETHOD(clock_gettime, s390rtc_gettime), DEVMETHOD(clock_settime, s390rtc_settime), Modified: head/sys/modules/i2c/Makefile ============================================================================== --- head/sys/modules/i2c/Makefile Sun Aug 13 22:07:42 2017 (r322476) +++ head/sys/modules/i2c/Makefile Mon Aug 14 00:00:24 2017 (r322477) @@ -15,6 +15,7 @@ SUBDIR = \ isl12xx \ jedec_ts \ nxprtc \ + s35390a \ smb \ smbus \ Added: head/sys/modules/i2c/s35390a/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/i2c/s35390a/Makefile Mon Aug 14 00:00:24 2017 (r322477) @@ -0,0 +1,7 @@ +# $FreeBSD$ + +.PATH: ${SRCTOP}/sys/dev/iicbus +KMOD = s35390a +SRCS = s35390a.c bus_if.h clock_if.h device_if.h iicbus_if.h ofw_bus_if.h + +.include From owner-svn-src-head@freebsd.org Mon Aug 14 00:12:16 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 39B17DB7707; Mon, 14 Aug 2017 00:12:16 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 09ADA64302; Mon, 14 Aug 2017 00:12:15 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7E0CFsi045347; Mon, 14 Aug 2017 00:12:15 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7E0CF8U045346; Mon, 14 Aug 2017 00:12:15 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201708140012.v7E0CF8U045346@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 14 Aug 2017 00:12:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322478 - head/sys/arm/conf X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/arm/conf X-SVN-Commit-Revision: 322478 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Aug 2017 00:12:16 -0000 Author: ian Date: Mon Aug 14 00:12:14 2017 New Revision: 322478 URL: https://svnweb.freebsd.org/changeset/base/322478 Log: Add back the drivers for Dallas/Maxim ds13xx and Seiko S35390x now that they've been rewritten/fixed to not cause panics by doing i2c transfers before interrupts are available. PR: 221227 Modified: head/sys/arm/conf/GENERIC Modified: head/sys/arm/conf/GENERIC ============================================================================== --- head/sys/arm/conf/GENERIC Mon Aug 14 00:00:24 2017 (r322477) +++ head/sys/arm/conf/GENERIC Mon Aug 14 00:12:14 2017 (r322478) @@ -139,9 +139,11 @@ device twl_clks # twl external clocks # i2c RTCs device ds1307 # Dallas DS1307 RTC and compatible +device ds13rtc # All Dallas/Maxim DS13xx RTCs device ds1672 # Dallas DS1672 RTC device ds3231 # Dallas DS3231 RTC + temperature device nxprtc # NXP RTCs: PCA/PFC212x PCA/PCF85xx +device s35390a # Seiko s3539x RTCs # GPIO device gpio From owner-svn-src-head@freebsd.org Mon Aug 14 02:23:12 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0CF09DCA1E2; Mon, 14 Aug 2017 02:23:12 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DB50067B1F; Mon, 14 Aug 2017 02:23:11 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7E2NAj9097834; Mon, 14 Aug 2017 02:23:10 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7E2NAFc097833; Mon, 14 Aug 2017 02:23:10 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201708140223.v7E2NAFc097833@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 14 Aug 2017 02:23:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322479 - head/sys/dev/iicbus X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/iicbus X-SVN-Commit-Revision: 322479 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Aug 2017 02:23:12 -0000 Author: ian Date: Mon Aug 14 02:23:10 2017 New Revision: 322479 URL: https://svnweb.freebsd.org/changeset/base/322479 Log: Add hinted attachment for non-FDT systems. Also, print a message if setting up the timer fails, because on some types of chips that's the first attempt to access the device. If the chip is missing/non-responsive then you'd get a driver that attached and didn't register the rtc, with no clue about why. On other chip types there are inits that come before timer setup, and they already print messages about errors. Modified: head/sys/dev/iicbus/nxprtc.c Modified: head/sys/dev/iicbus/nxprtc.c ============================================================================== --- head/sys/dev/iicbus/nxprtc.c Mon Aug 14 00:12:14 2017 (r322478) +++ head/sys/dev/iicbus/nxprtc.c Mon Aug 14 02:23:10 2017 (r322479) @@ -191,15 +191,26 @@ struct nxprtc_softc { u_int chiptype; /* Type of PCF85xx chip */ uint8_t secaddr; /* Address of seconds register */ uint8_t tmcaddr; /* Address of timer count register */ - uint8_t slave_addr; /* PCF85xx slave address */ bool use_timer; /* Use timer for fractional sec */ }; #define SC_F_CPOL (1 << 0) /* Century bit means 19xx */ #define SC_F_AMPM (1 << 1) /* Use PM flag in hours reg */ +/* + * We use the compat_data table to look up hint strings in the non-FDT case, so + * define the struct locally when we don't get it from ofw_bus_subr.h. + */ #ifdef FDT -static struct ofw_compat_data compat_data[] = { +typedef struct ofw_compat_data nxprtc_compat_data; +#else +typedef struct { + const char *ocd_str; + uintptr_t ocd_data; +} nxprtc_compat_data; +#endif + +static nxprtc_compat_data compat_data[] = { {"nxp,pca2129", TYPE_PCA2129}, {"nxp,pca8565", TYPE_PCA8565}, {"nxp,pcf2127", TYPE_PCF2127}, @@ -214,7 +225,6 @@ static struct ofw_compat_data compat_data[] = { {NULL, TYPE_NONE}, }; -#endif static int read_reg(struct nxprtc_softc *sc, uint8_t reg, uint8_t *val) @@ -476,19 +486,25 @@ nxprtc_start(void *dev) case TYPE_PCF2127: if (pcf8523_start(sc) != 0) return; - if (pcf2127_start_timer(sc) != 0) + if (pcf2127_start_timer(sc) != 0) { + device_printf(sc->dev, "cannot set up timer\n"); return; + } break; case TYPE_PCF8523: if (pcf8523_start(sc) != 0) return; - if (pcf8523_start_timer(sc) != 0) + if (pcf8523_start_timer(sc) != 0) { + device_printf(sc->dev, "cannot set up timer\n"); return; + } break; case TYPE_PCA8565: case TYPE_PCF8563: - if (pcf8563_start_timer(sc) != 0) + if (pcf8563_start_timer(sc) != 0) { + device_printf(sc->dev, "cannot set up timer\n"); return; + } break; default: device_printf(sc->dev, "missing init code for this chiptype\n"); @@ -685,24 +701,59 @@ errout: } static int -nxprtc_probe(device_t dev) +nxprtc_get_chiptype(device_t dev) { +#ifdef FDT + + return (ofw_bus_search_compatible(dev, compat_data)->ocd_data); +#else + nxprtc_compat_data *cdata; + const char *htype; int chiptype; + /* + * If given a chiptype hint string, loop through the ofw compat data + * comparing the hinted chip type to the compat strings. The table end + * marker ocd_data is TYPE_NONE. + */ + if (resource_string_value(device_get_name(dev), + device_get_unit(dev), "compatible", &htype) == 0) { + for (cdata = compat_data; cdata->ocd_str != NULL; ++cdata) { + if (strcmp(htype, cdata->ocd_str) == 0) + break; + } + chiptype = cdata->ocd_data; + } else + chiptype = TYPE_NONE; + + /* + * On non-FDT systems the historical behavior of this driver was to + * assume a PCF8563; keep doing that for compatibility. + */ + if (chiptype == TYPE_NONE) + return (TYPE_PCF8563); + else + return (chiptype); +#endif +} + +static int +nxprtc_probe(device_t dev) +{ + int chiptype, rv; + #ifdef FDT if (!ofw_bus_status_okay(dev)) return (ENXIO); - - chiptype = ofw_bus_search_compatible(dev, compat_data)->ocd_data; - if (chiptype == TYPE_NONE) - return (ENXIO); + rv = BUS_PROBE_GENERIC; #else - /* Historically the non-FDT driver supports only PCF8563. */ - chiptype = TYPE_PCF8563; + rv = BUS_PROBE_NOWILDCARD; #endif - device_set_desc(dev, desc_strings[chiptype]); + if ((chiptype = nxprtc_get_chiptype(dev)) == TYPE_NONE) + return (ENXIO); - return (BUS_PROBE_GENERIC); + device_set_desc(dev, desc_strings[chiptype]); + return (rv); } static int @@ -713,21 +764,9 @@ nxprtc_attach(device_t dev) sc = device_get_softc(dev); sc->dev = dev; sc->busdev = device_get_parent(dev); - sc->slave_addr = iicbus_get_addr(dev); - /* - * We need to know what kind of chip we're driving. Historically the - * non-FDT driver supported only PCF8563. There is no machine-readable - * identifier in the chip so we would need a set of hints defined to use - * the other chips on non-FDT systems. - */ -#ifdef FDT - sc->chiptype = ofw_bus_search_compatible(dev, compat_data)->ocd_data; -#else - sc->chiptype = TYPE_PCF8563; - if (sc->slave_addr == 0) - sc->slave_addr = PCF8563_ADDR; -#endif + /* We need to know what kind of chip we're driving. */ + sc->chiptype = nxprtc_get_chiptype(dev); /* The features and some register addresses vary by chip type. */ switch (sc->chiptype) { From owner-svn-src-head@freebsd.org Mon Aug 14 05:30:03 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E7EF6DD5D72; Mon, 14 Aug 2017 05:30:03 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 B732E6D9C5; Mon, 14 Aug 2017 05:30:03 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7E5U2Co071387; Mon, 14 Aug 2017 05:30:02 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7E5U2aT071386; Mon, 14 Aug 2017 05:30:02 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201708140530.v7E5U2aT071386@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 14 Aug 2017 05:30:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322483 - head/sys/dev/hyperv/netvsc X-SVN-Group: head X-SVN-Commit-Author: sephe X-SVN-Commit-Paths: head/sys/dev/hyperv/netvsc X-SVN-Commit-Revision: 322483 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Aug 2017 05:30:04 -0000 Author: sephe Date: Mon Aug 14 05:30:02 2017 New Revision: 322483 URL: https://svnweb.freebsd.org/changeset/base/322483 Log: hyperv/hn: Update VF's ibytes properly under transparent VF mode. While, I'm here add comment about why updating VF's imcast stat is not necessary. MFC after: 3 days Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11948 Modified: head/sys/dev/hyperv/netvsc/if_hn.c Modified: head/sys/dev/hyperv/netvsc/if_hn.c ============================================================================== --- head/sys/dev/hyperv/netvsc/if_hn.c Mon Aug 14 04:48:35 2017 (r322482) +++ head/sys/dev/hyperv/netvsc/if_hn.c Mon Aug 14 05:30:02 2017 (r322483) @@ -1266,16 +1266,37 @@ hn_xpnt_vf_input(struct ifnet *vf_ifp, struct mbuf *m) rm_runlock(&hn_vfmap_lock, &pt); if (hn_ifp != NULL) { - /* - * Fix up rcvif and go through hn(4)'s if_input and - * increase ipackets. - */ for (mn = m; mn != NULL; mn = mn->m_nextpkt) { - /* Allow tapping on the VF. */ + /* + * Allow tapping on the VF. + */ ETHER_BPF_MTAP(vf_ifp, mn); + + /* + * Update VF stats. + */ + if ((vf_ifp->if_capenable & IFCAP_HWSTATS) == 0) { + if_inc_counter(vf_ifp, IFCOUNTER_IBYTES, + mn->m_pkthdr.len); + } + /* + * XXX IFCOUNTER_IMCAST + * This stat updating is kinda invasive, since it + * requires two checks on the mbuf: the length check + * and the ethernet header check. As of this write, + * all multicast packets go directly to hn(4), which + * makes imcast stat updating in the VF a try in vian. + */ + + /* + * Fix up rcvif and increase hn(4)'s ipackets. + */ mn->m_pkthdr.rcvif = hn_ifp; if_inc_counter(hn_ifp, IFCOUNTER_IPACKETS, 1); } + /* + * Go through hn(4)'s if_input. + */ hn_ifp->if_input(hn_ifp, m); } else { /* From owner-svn-src-head@freebsd.org Mon Aug 14 05:31:52 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7749CDD5F6B; Mon, 14 Aug 2017 05:31:52 +0000 (UTC) (envelope-from bhughes@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 46D916DD37; Mon, 14 Aug 2017 05:31:52 +0000 (UTC) (envelope-from bhughes@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7E5Vpbp075182; Mon, 14 Aug 2017 05:31:51 GMT (envelope-from bhughes@FreeBSD.org) Received: (from bhughes@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7E5VpBf075181; Mon, 14 Aug 2017 05:31:51 GMT (envelope-from bhughes@FreeBSD.org) Message-Id: <201708140531.v7E5VpBf075181@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bhughes set sender to bhughes@FreeBSD.org using -f From: "Bradley T. Hughes" Date: Mon, 14 Aug 2017 05:31:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322484 - head/usr.bin/calendar/calendars X-SVN-Group: head X-SVN-Commit-Author: bhughes X-SVN-Commit-Paths: head/usr.bin/calendar/calendars X-SVN-Commit-Revision: 322484 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Aug 2017 05:31:52 -0000 Author: bhughes (ports committer) Date: Mon Aug 14 05:31:51 2017 New Revision: 322484 URL: https://svnweb.freebsd.org/changeset/base/322484 Log: Add myself Reported by: mckusick Modified: head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Mon Aug 14 05:30:02 2017 (r322483) +++ head/usr.bin/calendar/calendars/calendar.freebsd Mon Aug 14 05:31:51 2017 (r322484) @@ -242,6 +242,7 @@ 06/26 Brian Somers born in Dundrum, Dublin, Ireland, 1967 06/28 Mark Santcroos born in Rotterdam, the Netherlands, 1979 06/28 Xin Li born in Beijing, People's Republic of China, 1982 +06/28 Bradley T. Hughes born in Amarillo, Texas, United States, 1977 06/29 Wilfredo Sanchez Vega born in Majaguez, Puerto Rico, United States, 1972 06/29 Daniel Harris born in Lubbock, Texas, United States, 1985 06/29 Andrew Pantyukhin born in Moscow, Russian Federation, 1985 From owner-svn-src-head@freebsd.org Mon Aug 14 05:40:53 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7D7D2DD67FF; Mon, 14 Aug 2017 05:40:53 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 578A16E22C; Mon, 14 Aug 2017 05:40:53 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7E5eq8r075882; Mon, 14 Aug 2017 05:40:52 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7E5eqbr075879; Mon, 14 Aug 2017 05:40:52 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201708140540.v7E5eqbr075879@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 14 Aug 2017 05:40:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322485 - head/sys/dev/hyperv/netvsc X-SVN-Group: head X-SVN-Commit-Author: sephe X-SVN-Commit-Paths: head/sys/dev/hyperv/netvsc X-SVN-Commit-Revision: 322485 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Aug 2017 05:40:53 -0000 Author: sephe Date: Mon Aug 14 05:40:52 2017 New Revision: 322485 URL: https://svnweb.freebsd.org/changeset/base/322485 Log: hyperv/hn: Fix/enhance receiving path when VF is activated. - Update hn(4)'s stats properly for non-transparent mode VF. - Allow BPF tapping to hn(4) for non-transparent mode VF. - Don't setup mbuf hash, if 'options RSS' is set. In Azure, when VF is activated, TCP SYN and SYN|ACK go through hn(4) while the rest of segments and ACKs belonging to the same TCP 4-tuple go through the VF. So don't setup mbuf hash, if a VF is activated and 'options RSS' is not enabled. hn(4) and the VF may use neither the same RSS hash key nor the same RSS hash function, so the hash value for packets belonging to the same flow could be different! - Disable LRO. hn(4) will only receive broadcast packets, multicast packets, TCP SYN and SYN|ACK (in Azure), LRO is useless for these packet types. For non-transparent, we definitely _cannot_ enable LRO at all, since the LRO flush will use hn(4) as the receiving interface; i.e. hn_ifp->if_input(hn_ifp, m). While I'm here, remove unapplied comment and minor style change. MFC after: 3 days Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11978 Modified: head/sys/dev/hyperv/netvsc/if_hn.c head/sys/dev/hyperv/netvsc/if_hnvar.h Modified: head/sys/dev/hyperv/netvsc/if_hn.c ============================================================================== --- head/sys/dev/hyperv/netvsc/if_hn.c Mon Aug 14 05:31:51 2017 (r322484) +++ head/sys/dev/hyperv/netvsc/if_hn.c Mon Aug 14 05:40:52 2017 (r322485) @@ -282,6 +282,8 @@ static bool hn_xpnt_vf_isready(struct hn_softc *); static void hn_xpnt_vf_setready(struct hn_softc *); static void hn_xpnt_vf_init_taskfunc(void *, int); static void hn_xpnt_vf_init(struct hn_softc *); +static void hn_xpnt_vf_setenable(struct hn_softc *); +static void hn_xpnt_vf_setdisable(struct hn_softc *, bool); static int hn_rndis_rxinfo(const void *, int, struct hn_rxinfo *); @@ -1427,6 +1429,40 @@ hn_xpnt_vf_isready(struct hn_softc *sc) } static void +hn_xpnt_vf_setenable(struct hn_softc *sc) +{ + int i; + + HN_LOCK_ASSERT(sc); + + /* NOTE: hn_vf_lock for hn_transmit()/hn_qflush() */ + rm_wlock(&sc->hn_vf_lock); + sc->hn_xvf_flags |= HN_XVFFLAG_ENABLED; + rm_wunlock(&sc->hn_vf_lock); + + for (i = 0; i < sc->hn_rx_ring_cnt; ++i) + sc->hn_rx_ring[i].hn_rx_flags |= HN_RX_FLAG_XPNT_VF; +} + +static void +hn_xpnt_vf_setdisable(struct hn_softc *sc, bool clear_vf) +{ + int i; + + HN_LOCK_ASSERT(sc); + + /* NOTE: hn_vf_lock for hn_transmit()/hn_qflush() */ + rm_wlock(&sc->hn_vf_lock); + sc->hn_xvf_flags &= ~HN_XVFFLAG_ENABLED; + if (clear_vf) + sc->hn_vf_ifp = NULL; + rm_wunlock(&sc->hn_vf_lock); + + for (i = 0; i < sc->hn_rx_ring_cnt; ++i) + sc->hn_rx_ring[i].hn_rx_flags &= ~HN_RX_FLAG_XPNT_VF; +} + +static void hn_xpnt_vf_init(struct hn_softc *sc) { int error; @@ -1459,10 +1495,8 @@ hn_xpnt_vf_init(struct hn_softc *sc) */ hn_nvs_set_datapath(sc, HN_NVS_DATAPATH_VF); - /* NOTE: hn_vf_lock for hn_transmit()/hn_qflush() */ - rm_wlock(&sc->hn_vf_lock); - sc->hn_xvf_flags |= HN_XVFFLAG_ENABLED; - rm_wunlock(&sc->hn_vf_lock); + /* Mark transparent mode VF as enabled. */ + hn_xpnt_vf_setenable(sc); } static void @@ -1648,11 +1682,8 @@ hn_ifnet_detevent(void *xsc, struct ifnet *ifp) hn_resume_mgmt(sc); } - /* NOTE: hn_vf_lock for hn_transmit()/hn_qflush() */ - rm_wlock(&sc->hn_vf_lock); - sc->hn_xvf_flags &= ~HN_XVFFLAG_ENABLED; - sc->hn_vf_ifp = NULL; - rm_wunlock(&sc->hn_vf_lock); + /* Mark transparent mode VF as disabled. */ + hn_xpnt_vf_setdisable(sc, true /* clear hn_vf_ifp */); rm_wlock(&hn_vfmap_lock); @@ -2994,13 +3025,16 @@ static int hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, const struct hn_rxinfo *info) { - struct ifnet *ifp; + struct ifnet *ifp, *hn_ifp = rxr->hn_ifp; struct mbuf *m_new; int size, do_lro = 0, do_csum = 1; int hash_type; - /* If the VF is active, inject the packet through the VF */ - ifp = rxr->hn_rxvf_ifp ? rxr->hn_rxvf_ifp : rxr->hn_ifp; + /* + * If the non-transparent mode VF is active, inject this packet + * into the VF. + */ + ifp = rxr->hn_rxvf_ifp ? rxr->hn_rxvf_ifp : hn_ifp; if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { /* @@ -3014,10 +3048,15 @@ hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int return (0); } + if (__predict_false(dlen < ETHER_HDR_LEN)) { + if_inc_counter(hn_ifp, IFCOUNTER_IERRORS, 1); + return (0); + } + if (dlen <= MHLEN) { m_new = m_gethdr(M_NOWAIT, MT_DATA); if (m_new == NULL) { - if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1); + if_inc_counter(hn_ifp, IFCOUNTER_IQDROPS, 1); return (0); } memcpy(mtod(m_new, void *), data, dlen); @@ -3038,7 +3077,7 @@ hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int m_new = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, size); if (m_new == NULL) { - if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1); + if_inc_counter(hn_ifp, IFCOUNTER_IQDROPS, 1); return (0); } @@ -3046,7 +3085,7 @@ hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int } m_new->m_pkthdr.rcvif = ifp; - if (__predict_false((ifp->if_capenable & IFCAP_RXCSUM) == 0)) + if (__predict_false((hn_ifp->if_capenable & IFCAP_RXCSUM) == 0)) do_csum = 0; /* receive side checksum offload */ @@ -3087,8 +3126,9 @@ hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int int hoff; hoff = sizeof(*eh); - if (m_new->m_len < hoff) - goto skip; + /* Checked at the beginning of this function. */ + KASSERT(m_new->m_len >= hoff, ("not ethernet frame")); + eh = mtod(m_new, struct ether_header *); etype = ntohs(eh->ether_type); if (etype == ETHERTYPE_VLAN) { @@ -3143,6 +3183,37 @@ skip: m_new->m_flags |= M_VLANTAG; } + /* + * If VF is activated (tranparent/non-transparent mode does not + * matter here). + * + * - Don't setup mbuf hash, if 'options RSS' is set. + * + * In Azure, when VF is activated, TCP SYN and SYN|ACK go + * through hn(4) while the rest of segments and ACKs belonging + * to the same TCP 4-tuple go through the VF. So don't setup + * mbuf hash, if a VF is activated and 'options RSS' is not + * enabled. hn(4) and the VF may use neither the same RSS + * hash key nor the same RSS hash function, so the hash value + * for packets belonging to the same flow could be different! + * + * - Disable LRO + * + * hn(4) will only receive broadcast packets, multicast packets, + * TCP SYN and SYN|ACK (in Azure), LRO is useless for these + * packet types. + * + * For non-transparent, we definitely _cannot_ enable LRO at + * all, since the LRO flush will use hn(4) as the receiving + * interface; i.e. hn_ifp->if_input(hn_ifp, m). + */ + if (hn_ifp != ifp || (rxr->hn_rx_flags & HN_RX_FLAG_XPNT_VF)) { + do_lro = 0; /* disable LRO. */ +#ifndef RSS + goto skip_hash; /* skip mbuf hash setup */ +#endif + } + if (info->hash_info != HN_NDIS_HASH_INFO_INVALID) { rxr->hn_rss_pkts++; m_new->m_pkthdr.flowid = info->hash_value; @@ -3192,15 +3263,36 @@ skip: } M_HASHTYPE_SET(m_new, hash_type); - /* - * Note: Moved RX completion back to hv_nv_on_receive() so all - * messages (not just data messages) will trigger a response. - */ - +#ifndef RSS +skip_hash: +#endif if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); + if (hn_ifp != ifp) { + const struct ether_header *eh; + + /* + * Non-transparent mode VF is activated. + */ + + /* + * Allow tapping on hn(4). + */ + ETHER_BPF_MTAP(hn_ifp, m_new); + + /* + * Update hn(4)'s stats. + */ + if_inc_counter(hn_ifp, IFCOUNTER_IPACKETS, 1); + if_inc_counter(hn_ifp, IFCOUNTER_IBYTES, m_new->m_pkthdr.len); + /* Checked at the beginning of this function. */ + KASSERT(m_new->m_len >= ETHER_HDR_LEN, ("not ethernet frame")); + eh = mtod(m_new, struct ether_header *); + if (ETHER_IS_MULTICAST(eh->ether_dhost)) + if_inc_counter(hn_ifp, IFCOUNTER_IMCASTS, 1); + } rxr->hn_pkts++; - if ((ifp->if_capenable & IFCAP_LRO) && do_lro) { + if ((hn_ifp->if_capenable & IFCAP_LRO) && do_lro) { #if defined(INET) || defined(INET6) struct lro_ctrl *lro = &rxr->hn_lro; @@ -3213,10 +3305,8 @@ skip: } #endif } + ifp->if_input(ifp, m_new); - /* We're not holding the lock here, so don't release it */ - (*ifp->if_input)(ifp, m_new); - return (0); } @@ -3511,10 +3601,8 @@ hn_stop(struct hn_softc *sc, bool detaching) KASSERT(sc->hn_vf_ifp != NULL, ("%s: VF is not attached", ifp->if_xname)); - /* NOTE: hn_vf_lock for hn_transmit() */ - rm_wlock(&sc->hn_vf_lock); - sc->hn_xvf_flags &= ~HN_XVFFLAG_ENABLED; - rm_wunlock(&sc->hn_vf_lock); + /* Mark transparent mode VF as disabled. */ + hn_xpnt_vf_setdisable(sc, false /* keep hn_vf_ifp */); /* * NOTE: Modified: head/sys/dev/hyperv/netvsc/if_hnvar.h ============================================================================== --- head/sys/dev/hyperv/netvsc/if_hnvar.h Mon Aug 14 05:31:51 2017 (r322484) +++ head/sys/dev/hyperv/netvsc/if_hnvar.h Mon Aug 14 05:40:52 2017 (r322485) @@ -63,6 +63,7 @@ struct hn_rx_ring { struct hn_tx_ring *hn_txr; void *hn_pktbuf; int hn_pktbuf_len; + int hn_rx_flags; /* HN_RX_FLAG_ */ uint8_t *hn_rxbuf; /* shadow sc->hn_rxbuf */ int hn_rx_idx; @@ -82,7 +83,6 @@ struct hn_rx_ring { /* Rarely used stuffs */ struct sysctl_oid *hn_rx_sysctl_tree; - int hn_rx_flags; void *hn_br; /* TX/RX bufring */ struct hyperv_dma hn_br_dma; @@ -96,6 +96,7 @@ struct hn_rx_ring { #define HN_RX_FLAG_ATTACHED 0x0001 #define HN_RX_FLAG_BR_REF 0x0002 +#define HN_RX_FLAG_XPNT_VF 0x0004 struct hn_tx_ring { #ifndef HN_USE_TXDESC_BUFRING From owner-svn-src-head@freebsd.org Mon Aug 14 05:46:51 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B39A6DD6C65; Mon, 14 Aug 2017 05:46:51 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 811C46E616; Mon, 14 Aug 2017 05:46:51 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7E5koaE079863; Mon, 14 Aug 2017 05:46:50 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7E5koo2079862; Mon, 14 Aug 2017 05:46:50 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201708140546.v7E5koo2079862@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 14 Aug 2017 05:46:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322486 - head/sys/dev/hyperv/netvsc X-SVN-Group: head X-SVN-Commit-Author: sephe X-SVN-Commit-Paths: head/sys/dev/hyperv/netvsc X-SVN-Commit-Revision: 322486 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Aug 2017 05:46:51 -0000 Author: sephe Date: Mon Aug 14 05:46:50 2017 New Revision: 322486 URL: https://svnweb.freebsd.org/changeset/base/322486 Log: hyperv/hn: Minor cleanup MFC after: 3 days Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11979 Modified: head/sys/dev/hyperv/netvsc/if_hn.c Modified: head/sys/dev/hyperv/netvsc/if_hn.c ============================================================================== --- head/sys/dev/hyperv/netvsc/if_hn.c Mon Aug 14 05:40:52 2017 (r322485) +++ head/sys/dev/hyperv/netvsc/if_hn.c Mon Aug 14 05:46:50 2017 (r322486) @@ -580,6 +580,12 @@ hn_rss_key_default[NDIS_HASH_KEYSIZE_TOEPLITZ] = { }; #endif /* !RSS */ +static const struct hyperv_guid hn_guid = { + .hv_guid = { + 0x63, 0x51, 0x61, 0xf8, 0x3e, 0xdf, 0xc5, 0x46, + 0x91, 0x3f, 0xf2, 0xd2, 0xf9, 0x65, 0xed, 0x0e } +}; + static device_method_t hn_methods[] = { /* Device interface */ DEVMETHOD(device_probe, hn_probe), @@ -1711,18 +1717,11 @@ hn_ifnet_lnkevent(void *xsc, struct ifnet *ifp, int li if_link_state_change(sc->hn_ifp, link_state); } -/* {F8615163-DF3E-46c5-913F-F2D2F965ED0E} */ -static const struct hyperv_guid g_net_vsc_device_type = { - .hv_guid = {0x63, 0x51, 0x61, 0xF8, 0x3E, 0xDF, 0xc5, 0x46, - 0x91, 0x3F, 0xF2, 0xD2, 0xF9, 0x65, 0xED, 0x0E} -}; - static int hn_probe(device_t dev) { - if (VMBUS_PROBE_GUID(device_get_parent(dev), dev, - &g_net_vsc_device_type) == 0) { + if (VMBUS_PROBE_GUID(device_get_parent(dev), dev, &hn_guid) == 0) { device_set_desc(dev, "Hyper-V Network Interface"); return BUS_PROBE_DEFAULT; } From owner-svn-src-head@freebsd.org Mon Aug 14 05:55:17 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 66226DD7135; Mon, 14 Aug 2017 05:55:17 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 287056EB0F; Mon, 14 Aug 2017 05:55:17 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7E5tG71083733; Mon, 14 Aug 2017 05:55:16 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7E5tGad083732; Mon, 14 Aug 2017 05:55:16 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201708140555.v7E5tGad083732@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 14 Aug 2017 05:55:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322487 - head/sys/dev/hyperv/netvsc X-SVN-Group: head X-SVN-Commit-Author: sephe X-SVN-Commit-Paths: head/sys/dev/hyperv/netvsc X-SVN-Commit-Revision: 322487 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Aug 2017 05:55:17 -0000 Author: sephe Date: Mon Aug 14 05:55:16 2017 New Revision: 322487 URL: https://svnweb.freebsd.org/changeset/base/322487 Log: hyperv/hn: Re-set datapath after synthetic parts reattached. Do this even for non-transparent mode VF. Better safe than sorry. MFC after: 3 days Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11981 Modified: head/sys/dev/hyperv/netvsc/if_hn.c Modified: head/sys/dev/hyperv/netvsc/if_hn.c ============================================================================== --- head/sys/dev/hyperv/netvsc/if_hn.c Mon Aug 14 05:46:50 2017 (r322486) +++ head/sys/dev/hyperv/netvsc/if_hn.c Mon Aug 14 05:55:16 2017 (r322487) @@ -3403,7 +3403,8 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) */ hn_resume(sc); - if (sc->hn_xvf_flags & HN_XVFFLAG_ENABLED) { + if ((sc->hn_flags & HN_FLAG_RXVF) || + (sc->hn_xvf_flags & HN_XVFFLAG_ENABLED)) { /* * Since we have reattached the NVS part, * change the datapath to VF again; in case From owner-svn-src-head@freebsd.org Mon Aug 14 06:00:53 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E8C86DD72B9; Mon, 14 Aug 2017 06:00:53 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 C48EF6ECF0; Mon, 14 Aug 2017 06:00:53 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7E60q0i084008; Mon, 14 Aug 2017 06:00:52 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7E60pbs083991; Mon, 14 Aug 2017 06:00:51 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201708140600.v7E60pbs083991@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 14 Aug 2017 06:00:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322488 - in head/sys/dev/hyperv: include netvsc pcib storvsc utilities vmbus vmbus/amd64 X-SVN-Group: head X-SVN-Commit-Author: sephe X-SVN-Commit-Paths: in head/sys/dev/hyperv: include netvsc pcib storvsc utilities vmbus vmbus/amd64 X-SVN-Commit-Revision: 322488 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Aug 2017 06:00:54 -0000 Author: sephe Date: Mon Aug 14 06:00:50 2017 New Revision: 322488 URL: https://svnweb.freebsd.org/changeset/base/322488 Log: hyperv: Update copyright for the files changed in 2017 MFC after: 3 days Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11982 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/netvsc/hn_nvs.c head/sys/dev/hyperv/netvsc/hn_nvs.h head/sys/dev/hyperv/netvsc/hn_rndis.c head/sys/dev/hyperv/netvsc/hn_rndis.h head/sys/dev/hyperv/netvsc/if_hn.c head/sys/dev/hyperv/netvsc/if_hnreg.h head/sys/dev/hyperv/netvsc/if_hnvar.h head/sys/dev/hyperv/pcib/vmbus_pcib.c head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c head/sys/dev/hyperv/storvsc/hv_vstorage.h head/sys/dev/hyperv/utilities/hv_kvp.c head/sys/dev/hyperv/utilities/vmbus_timesync.c head/sys/dev/hyperv/vmbus/amd64/hyperv_machdep.c head/sys/dev/hyperv/vmbus/hyperv.c head/sys/dev/hyperv/vmbus/vmbus.c head/sys/dev/hyperv/vmbus/vmbus_et.c Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Mon Aug 14 05:55:16 2017 (r322487) +++ head/sys/dev/hyperv/include/hyperv.h Mon Aug 14 06:00:50 2017 (r322488) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009-2012,2016 Microsoft Corp. + * Copyright (c) 2009-2012,2016-2017 Microsoft Corp. * Copyright (c) 2012 NetApp Inc. * Copyright (c) 2012 Citrix Inc. * All rights reserved. Modified: head/sys/dev/hyperv/netvsc/hn_nvs.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hn_nvs.c Mon Aug 14 05:55:16 2017 (r322487) +++ head/sys/dev/hyperv/netvsc/hn_nvs.c Mon Aug 14 06:00:50 2017 (r322488) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009-2012,2016 Microsoft Corp. + * Copyright (c) 2009-2012,2016-2017 Microsoft Corp. * Copyright (c) 2010-2012 Citrix Inc. * Copyright (c) 2012 NetApp Inc. * All rights reserved. Modified: head/sys/dev/hyperv/netvsc/hn_nvs.h ============================================================================== --- head/sys/dev/hyperv/netvsc/hn_nvs.h Mon Aug 14 05:55:16 2017 (r322487) +++ head/sys/dev/hyperv/netvsc/hn_nvs.h Mon Aug 14 06:00:50 2017 (r322488) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009-2012,2016 Microsoft Corp. + * Copyright (c) 2009-2012,2016-2017 Microsoft Corp. * Copyright (c) 2010-2012 Citrix Inc. * Copyright (c) 2012 NetApp Inc. * All rights reserved. Modified: head/sys/dev/hyperv/netvsc/hn_rndis.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hn_rndis.c Mon Aug 14 05:55:16 2017 (r322487) +++ head/sys/dev/hyperv/netvsc/hn_rndis.c Mon Aug 14 06:00:50 2017 (r322488) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009-2012,2016 Microsoft Corp. + * Copyright (c) 2009-2012,2016-2017 Microsoft Corp. * Copyright (c) 2010-2012 Citrix Inc. * Copyright (c) 2012 NetApp Inc. * All rights reserved. Modified: head/sys/dev/hyperv/netvsc/hn_rndis.h ============================================================================== --- head/sys/dev/hyperv/netvsc/hn_rndis.h Mon Aug 14 05:55:16 2017 (r322487) +++ head/sys/dev/hyperv/netvsc/hn_rndis.h Mon Aug 14 06:00:50 2017 (r322488) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009-2012,2016 Microsoft Corp. + * Copyright (c) 2009-2012,2016-2017 Microsoft Corp. * Copyright (c) 2010-2012 Citrix Inc. * Copyright (c) 2012 NetApp Inc. * All rights reserved. Modified: head/sys/dev/hyperv/netvsc/if_hn.c ============================================================================== --- head/sys/dev/hyperv/netvsc/if_hn.c Mon Aug 14 05:55:16 2017 (r322487) +++ head/sys/dev/hyperv/netvsc/if_hn.c Mon Aug 14 06:00:50 2017 (r322488) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2010-2012 Citrix Inc. - * Copyright (c) 2009-2012,2016 Microsoft Corp. + * Copyright (c) 2009-2012,2016-2017 Microsoft Corp. * Copyright (c) 2012 NetApp Inc. * All rights reserved. * Modified: head/sys/dev/hyperv/netvsc/if_hnreg.h ============================================================================== --- head/sys/dev/hyperv/netvsc/if_hnreg.h Mon Aug 14 05:55:16 2017 (r322487) +++ head/sys/dev/hyperv/netvsc/if_hnreg.h Mon Aug 14 06:00:50 2017 (r322488) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2016 Microsoft Corp. + * Copyright (c) 2016-2017 Microsoft Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/hyperv/netvsc/if_hnvar.h ============================================================================== --- head/sys/dev/hyperv/netvsc/if_hnvar.h Mon Aug 14 05:55:16 2017 (r322487) +++ head/sys/dev/hyperv/netvsc/if_hnvar.h Mon Aug 14 06:00:50 2017 (r322488) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2016 Microsoft Corp. + * Copyright (c) 2016-2017 Microsoft Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/hyperv/pcib/vmbus_pcib.c ============================================================================== --- head/sys/dev/hyperv/pcib/vmbus_pcib.c Mon Aug 14 05:55:16 2017 (r322487) +++ head/sys/dev/hyperv/pcib/vmbus_pcib.c Mon Aug 14 06:00:50 2017 (r322488) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2016 Microsoft Corp. + * Copyright (c) 2016-2017 Microsoft Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Mon Aug 14 05:55:16 2017 (r322487) +++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Mon Aug 14 06:00:50 2017 (r322488) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009-2012,2016 Microsoft Corp. + * Copyright (c) 2009-2012,2016-2017 Microsoft Corp. * Copyright (c) 2012 NetApp Inc. * Copyright (c) 2012 Citrix Inc. * All rights reserved. Modified: head/sys/dev/hyperv/storvsc/hv_vstorage.h ============================================================================== --- head/sys/dev/hyperv/storvsc/hv_vstorage.h Mon Aug 14 05:55:16 2017 (r322487) +++ head/sys/dev/hyperv/storvsc/hv_vstorage.h Mon Aug 14 06:00:50 2017 (r322488) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009-2012 Microsoft Corp. + * Copyright (c) 2009-2012,2017 Microsoft Corp. * Copyright (c) 2012 NetApp Inc. * Copyright (c) 2012 Citrix Inc. * All rights reserved. Modified: head/sys/dev/hyperv/utilities/hv_kvp.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_kvp.c Mon Aug 14 05:55:16 2017 (r322487) +++ head/sys/dev/hyperv/utilities/hv_kvp.c Mon Aug 14 06:00:50 2017 (r322488) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2014,2016 Microsoft Corp. + * Copyright (c) 2014,2016-2017 Microsoft Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/hyperv/utilities/vmbus_timesync.c ============================================================================== --- head/sys/dev/hyperv/utilities/vmbus_timesync.c Mon Aug 14 05:55:16 2017 (r322487) +++ head/sys/dev/hyperv/utilities/vmbus_timesync.c Mon Aug 14 06:00:50 2017 (r322488) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2014,2016 Microsoft Corp. + * Copyright (c) 2014,2016-2017 Microsoft Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/hyperv/vmbus/amd64/hyperv_machdep.c ============================================================================== --- head/sys/dev/hyperv/vmbus/amd64/hyperv_machdep.c Mon Aug 14 05:55:16 2017 (r322487) +++ head/sys/dev/hyperv/vmbus/amd64/hyperv_machdep.c Mon Aug 14 06:00:50 2017 (r322488) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2016 Microsoft Corp. + * Copyright (c) 2016-2017 Microsoft Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/hyperv/vmbus/hyperv.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hyperv.c Mon Aug 14 05:55:16 2017 (r322487) +++ head/sys/dev/hyperv/vmbus/hyperv.c Mon Aug 14 06:00:50 2017 (r322488) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009-2012,2016 Microsoft Corp. + * Copyright (c) 2009-2012,2016-2017 Microsoft Corp. * Copyright (c) 2012 NetApp Inc. * Copyright (c) 2012 Citrix Inc. * All rights reserved. Modified: head/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus.c Mon Aug 14 05:55:16 2017 (r322487) +++ head/sys/dev/hyperv/vmbus/vmbus.c Mon Aug 14 06:00:50 2017 (r322488) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009-2012,2016 Microsoft Corp. + * Copyright (c) 2009-2012,2016-2017 Microsoft Corp. * Copyright (c) 2012 NetApp Inc. * Copyright (c) 2012 Citrix Inc. * All rights reserved. Modified: head/sys/dev/hyperv/vmbus/vmbus_et.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_et.c Mon Aug 14 05:55:16 2017 (r322487) +++ head/sys/dev/hyperv/vmbus/vmbus_et.c Mon Aug 14 06:00:50 2017 (r322488) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015,2016 Microsoft Corp. + * Copyright (c) 2015,2016-2017 Microsoft Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without From owner-svn-src-head@freebsd.org Mon Aug 14 06:28:07 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7B7F1DD8167; Mon, 14 Aug 2017 06:28:07 +0000 (UTC) (envelope-from sepherosa@gmail.com) Received: from mail-pg0-x232.google.com (mail-pg0-x232.google.com [IPv6:2607:f8b0:400e:c05::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4D9896FA5B; Mon, 14 Aug 2017 06:28:07 +0000 (UTC) (envelope-from sepherosa@gmail.com) Received: by mail-pg0-x232.google.com with SMTP id l64so40729769pge.5; Sun, 13 Aug 2017 23:28:07 -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=9lutK7ck7xntPh2SBXshWA04cPqN7lD0zySaw7Ru2AM=; b=ZMhUkW/MkkJiLXY9DfAUMkHB7siXHCdmzzqi7e+Wles13j1+WLiExYcJvgBcKKETkf 8W/wCXeRM+n/5fZV3AwkBqZBbT70POoYo3n6HC1x503J/1sSZf8h5AdNP2t4PBm6jswT zbo006QuDiEfnniXqRheO1b5Ca4jSegdCZpgA1I5roiCPX2+0hgbFROifNcRnzEQ4Kec uJA5ObpN+tEji6kdN9SctJ/Ebu03sY5Bv/RyfV9MT8m4wUClEUqq7EnkgONJN+S+Rlhy 83ygaJ72F9o+fnfVMA62sExA0fdSMw/+N1ouHFPG3/U8FIouL+zodkFGmDSxVmsqqMzu edrQ== 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=9lutK7ck7xntPh2SBXshWA04cPqN7lD0zySaw7Ru2AM=; b=kJvzuU07y/bwcLeE7GivFMUwTubRjzAaHhKEEHCSldCDjG4yyCbS15e1Z3VN4RqE9c QsGcHuY1HFLEwd83xxyUWUVaGv3Z7VbZwCl+JB2kcX63TEpa/a23PHEYNqtLomczWfpX dZdSNHcVchicwyevDJEo10sE6xIeIqcLIDqW8zfyqYG+iGkUazg9OpwIaHdI0jLLIKjx EgPDOA1H3s0ZOtFrsjTuG7r/zKx8cGsC07LqEKjqw4qS83OD/j59LiE7b+bkhXnW1OPX DiDWnHNMvcx/t16hK6MjaWPrAIGTJAUmnPrbWOILeQdqJMs55rV2WIkt716ed6q5rrA+ sm6Q== X-Gm-Message-State: AHYfb5iS4pWdU8zgzHfrCelA8h8gNHAvKObazXWBVl1xhQt2N72dWUKj 0446fnBQppS7hD0+VSQ3kFd0ytpWuQ== X-Received: by 10.101.77.6 with SMTP id i6mr22971297pgt.181.1502692086249; Sun, 13 Aug 2017 23:28:06 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.128.28 with HTTP; Sun, 13 Aug 2017 23:28:05 -0700 (PDT) In-Reply-To: <201708091809.v79I9924028330@repo.freebsd.org> References: <201708091809.v79I9924028330@repo.freebsd.org> From: Sepherosa Ziehau Date: Mon, 14 Aug 2017 14:28:05 +0800 Message-ID: Subject: Re: svn commit: r322323 - in head/sys: amd64/amd64 i386/include x86/include x86/x86 To: Jung-uk Kim Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Aug 2017 06:28:07 -0000 Please MFC this to 10-stable/11-stable. Thanks, sephe On Thu, Aug 10, 2017 at 2:09 AM, Jung-uk Kim wrote: > Author: jkim > Date: Wed Aug 9 18:09:09 2017 > New Revision: 322323 > URL: https://svnweb.freebsd.org/changeset/base/322323 > > Log: > Split identify_cpu() into two functions for amd64 as we do for i386. This > reduces diff between amd64 and i386. Also, it fixes a regression introduced > in r322076, i.e., identify_hypervisor() failed to identify some hypervisors. > This function assumes cpu_feature2 is already initialized. > > Reported by: dexuan > Tested by: dexuan > > Modified: > head/sys/amd64/amd64/machdep.c > head/sys/i386/include/md_var.h > head/sys/x86/include/x86_var.h > head/sys/x86/x86/identcpu.c > > Modified: head/sys/amd64/amd64/machdep.c > ============================================================================== > --- head/sys/amd64/amd64/machdep.c Wed Aug 9 18:06:27 2017 (r322322) > +++ head/sys/amd64/amd64/machdep.c Wed Aug 9 18:09:09 2017 (r322323) > @@ -1537,6 +1537,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) > > kmdp = init_ops.parse_preload_data(modulep); > > + identify_cpu(); > identify_hypervisor(); > > /* Init basic tunables, hz etc */ > @@ -1643,7 +1644,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) > != NULL) > vty_set_preferred(VTY_VT); > > - identify_cpu(); /* Final stage of CPU initialization */ > + finishidentcpu(); /* Final stage of CPU initialization */ > initializecpu(); /* Initialize CPU registers */ > initializecpucache(); > > > Modified: head/sys/i386/include/md_var.h > ============================================================================== > --- head/sys/i386/include/md_var.h Wed Aug 9 18:06:27 2017 (r322322) > +++ head/sys/i386/include/md_var.h Wed Aug 9 18:09:09 2017 (r322323) > @@ -59,7 +59,6 @@ void doreti_popl_es(void) __asm(__STRING(doreti_popl_e > void doreti_popl_es_fault(void) __asm(__STRING(doreti_popl_es_fault)); > void doreti_popl_fs(void) __asm(__STRING(doreti_popl_fs)); > void doreti_popl_fs_fault(void) __asm(__STRING(doreti_popl_fs_fault)); > -void finishidentcpu(void); > void fill_based_sd(struct segment_descriptor *sdp, uint32_t base); > void i686_pagezero(void *addr); > void sse2_pagezero(void *addr); > > Modified: head/sys/x86/include/x86_var.h > ============================================================================== > --- head/sys/x86/include/x86_var.h Wed Aug 9 18:06:27 2017 (r322322) > +++ head/sys/x86/include/x86_var.h Wed Aug 9 18:09:09 2017 (r322323) > @@ -115,6 +115,7 @@ void cpu_probe_amdc1e(void); > void cpu_setregs(void); > void dump_add_page(vm_paddr_t); > void dump_drop_page(vm_paddr_t); > +void finishidentcpu(void); > void identify_cpu(void); > void identify_hypervisor(void); > void initializecpu(void); > > Modified: head/sys/x86/x86/identcpu.c > ============================================================================== > --- head/sys/x86/x86/identcpu.c Wed Aug 9 18:06:27 2017 (r322322) > +++ head/sys/x86/x86/identcpu.c Wed Aug 9 18:09:09 2017 (r322323) > @@ -1372,23 +1372,12 @@ fix_cpuid(void) > return (false); > } > > -/* > - * Final stage of CPU identification. > - */ > -#ifdef __i386__ > +#ifdef __amd64__ > void > -finishidentcpu(void) > -#else > -void > identify_cpu(void) > -#endif > { > - u_int regs[4], cpu_stdext_disable; > -#ifdef __i386__ > - u_char ccr3; > -#endif > + u_int regs[4]; > > -#ifdef __amd64__ > do_cpuid(0, regs); > cpu_high = regs[0]; > ((u_int *)&cpu_vendor)[0] = regs[1]; > @@ -1401,6 +1390,18 @@ identify_cpu(void) > cpu_procinfo = regs[1]; > cpu_feature = regs[3]; > cpu_feature2 = regs[2]; > +} > +#endif > + > +/* > + * Final stage of CPU identification. > + */ > +void > +finishidentcpu(void) > +{ > + u_int regs[4], cpu_stdext_disable; > +#ifdef __i386__ > + u_char ccr3; > #endif > > cpu_vendor_id = find_cpu_vendor_id(); > _______________________________________________ > 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" -- Tomorrow Will Never Die From owner-svn-src-head@freebsd.org Mon Aug 14 06:47:03 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1D4E8DD8B91; Mon, 14 Aug 2017 06:47:03 +0000 (UTC) (envelope-from sepherosa@gmail.com) Received: from mail-pg0-x22c.google.com (mail-pg0-x22c.google.com [IPv6:2607:f8b0:400e:c05::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E2E627055D; Mon, 14 Aug 2017 06:47:02 +0000 (UTC) (envelope-from sepherosa@gmail.com) Received: by mail-pg0-x22c.google.com with SMTP id l64so41032215pge.5; Sun, 13 Aug 2017 23:47:02 -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=n1w1cjqfdSH1dCuIi73a7rCgOQs6bPxBfPKEaTUl9Y8=; b=j5GUbp6kaRcW43oYsSiVYKvEJWIN+De1KPo9ZFrzjn1ZOzrtQBymqIlmBZCpy4tuTL 1SYQsQkZCfPXp/11BqCNcW8lgVforQ7o4y3kpigKlcpcD3ntv2jPMq1B5f6zKqHp4wK5 7+93hNnNtjxVsHCjI3PpXSKVD8VTQstHLANlIzQyDTBEn7k7tGHLWFoW7iur6BQ+ypyj ZumAaYORllTRU/UuUBQfRd7GZ16ABtQUkrlkVx5XoTOJN3qUhHYFkIs0/fLtx4SZ7Ux4 HDqsgObDYYI5u/e/CabWvVVaJ6lAduZCW7yOQqAtPXwX0AgCYywCy1YcRTUPonPFYNm6 Rxdw== 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=n1w1cjqfdSH1dCuIi73a7rCgOQs6bPxBfPKEaTUl9Y8=; b=jpIRzlLaLg55m0DaY24pL1psT26lm/2fwilGcRsItgjWlUkc3KEq/0zHJstsSAd2X3 VfQaaKc6MMcZ+CJs/+RGuNBj+Ly8p7057mfkhXsoSvj2MxbeoVLrjA8DomoyX/q9W2To Zs6GIDznFO03OTnugdlIHdJrEotE1RX43hUW0fEsk3C9TTa0+SmzxpgzjLgRNFzQKzuT T1ViS0kI/whtz1JGxudq3s7prGQA1s8UQeKHWGgYMNJ5g76zW2xEixAMTAqMV6COdLwP rOMBHwBXBGrkuyWtSFnYC7wV2cIYkoaOlms2fcG1PVO2CpoFXfLxiRf3WKuXsKtadYn7 L49g== X-Gm-Message-State: AHYfb5jICWAc5KPxi2DNjWbsTS/ix01PXxVpkL4nw0mt6tBzHzqbvu6h +dn25eXfBsY7s555zb8j24A+UYsDoA== X-Received: by 10.84.231.2 with SMTP id f2mr27136813plk.253.1502693222276; Sun, 13 Aug 2017 23:47:02 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.128.28 with HTTP; Sun, 13 Aug 2017 23:47:01 -0700 (PDT) In-Reply-To: References: <201708091809.v79I9924028330@repo.freebsd.org> From: Sepherosa Ziehau Date: Mon, 14 Aug 2017 14:47:01 +0800 Message-ID: Subject: Re: svn commit: r322323 - in head/sys: amd64/amd64 i386/include x86/include x86/x86 To: Jung-uk Kim Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Aug 2017 06:47:03 -0000 I just MFCed it to stable/11. Please MFC it to stable/10. On Mon, Aug 14, 2017 at 2:28 PM, Sepherosa Ziehau wrote: > Please MFC this to 10-stable/11-stable. > > Thanks, > sephe > > On Thu, Aug 10, 2017 at 2:09 AM, Jung-uk Kim wrote: >> Author: jkim >> Date: Wed Aug 9 18:09:09 2017 >> New Revision: 322323 >> URL: https://svnweb.freebsd.org/changeset/base/322323 >> >> Log: >> Split identify_cpu() into two functions for amd64 as we do for i386. This >> reduces diff between amd64 and i386. Also, it fixes a regression introduced >> in r322076, i.e., identify_hypervisor() failed to identify some hypervisors. >> This function assumes cpu_feature2 is already initialized. >> >> Reported by: dexuan >> Tested by: dexuan >> >> Modified: >> head/sys/amd64/amd64/machdep.c >> head/sys/i386/include/md_var.h >> head/sys/x86/include/x86_var.h >> head/sys/x86/x86/identcpu.c >> >> Modified: head/sys/amd64/amd64/machdep.c >> ============================================================================== >> --- head/sys/amd64/amd64/machdep.c Wed Aug 9 18:06:27 2017 (r322322) >> +++ head/sys/amd64/amd64/machdep.c Wed Aug 9 18:09:09 2017 (r322323) >> @@ -1537,6 +1537,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) >> >> kmdp = init_ops.parse_preload_data(modulep); >> >> + identify_cpu(); >> identify_hypervisor(); >> >> /* Init basic tunables, hz etc */ >> @@ -1643,7 +1644,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) >> != NULL) >> vty_set_preferred(VTY_VT); >> >> - identify_cpu(); /* Final stage of CPU initialization */ >> + finishidentcpu(); /* Final stage of CPU initialization */ >> initializecpu(); /* Initialize CPU registers */ >> initializecpucache(); >> >> >> Modified: head/sys/i386/include/md_var.h >> ============================================================================== >> --- head/sys/i386/include/md_var.h Wed Aug 9 18:06:27 2017 (r322322) >> +++ head/sys/i386/include/md_var.h Wed Aug 9 18:09:09 2017 (r322323) >> @@ -59,7 +59,6 @@ void doreti_popl_es(void) __asm(__STRING(doreti_popl_e >> void doreti_popl_es_fault(void) __asm(__STRING(doreti_popl_es_fault)); >> void doreti_popl_fs(void) __asm(__STRING(doreti_popl_fs)); >> void doreti_popl_fs_fault(void) __asm(__STRING(doreti_popl_fs_fault)); >> -void finishidentcpu(void); >> void fill_based_sd(struct segment_descriptor *sdp, uint32_t base); >> void i686_pagezero(void *addr); >> void sse2_pagezero(void *addr); >> >> Modified: head/sys/x86/include/x86_var.h >> ============================================================================== >> --- head/sys/x86/include/x86_var.h Wed Aug 9 18:06:27 2017 (r322322) >> +++ head/sys/x86/include/x86_var.h Wed Aug 9 18:09:09 2017 (r322323) >> @@ -115,6 +115,7 @@ void cpu_probe_amdc1e(void); >> void cpu_setregs(void); >> void dump_add_page(vm_paddr_t); >> void dump_drop_page(vm_paddr_t); >> +void finishidentcpu(void); >> void identify_cpu(void); >> void identify_hypervisor(void); >> void initializecpu(void); >> >> Modified: head/sys/x86/x86/identcpu.c >> ============================================================================== >> --- head/sys/x86/x86/identcpu.c Wed Aug 9 18:06:27 2017 (r322322) >> +++ head/sys/x86/x86/identcpu.c Wed Aug 9 18:09:09 2017 (r322323) >> @@ -1372,23 +1372,12 @@ fix_cpuid(void) >> return (false); >> } >> >> -/* >> - * Final stage of CPU identification. >> - */ >> -#ifdef __i386__ >> +#ifdef __amd64__ >> void >> -finishidentcpu(void) >> -#else >> -void >> identify_cpu(void) >> -#endif >> { >> - u_int regs[4], cpu_stdext_disable; >> -#ifdef __i386__ >> - u_char ccr3; >> -#endif >> + u_int regs[4]; >> >> -#ifdef __amd64__ >> do_cpuid(0, regs); >> cpu_high = regs[0]; >> ((u_int *)&cpu_vendor)[0] = regs[1]; >> @@ -1401,6 +1390,18 @@ identify_cpu(void) >> cpu_procinfo = regs[1]; >> cpu_feature = regs[3]; >> cpu_feature2 = regs[2]; >> +} >> +#endif >> + >> +/* >> + * Final stage of CPU identification. >> + */ >> +void >> +finishidentcpu(void) >> +{ >> + u_int regs[4], cpu_stdext_disable; >> +#ifdef __i386__ >> + u_char ccr3; >> #endif >> >> cpu_vendor_id = find_cpu_vendor_id(); >> _______________________________________________ >> 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" > > > > -- > Tomorrow Will Never Die -- Tomorrow Will Never Die From owner-svn-src-head@freebsd.org Mon Aug 14 11:19:33 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 481E8DB5057; Mon, 14 Aug 2017 11:19:33 +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 mx1.freebsd.org (Postfix) with ESMTPS id 091067C220; Mon, 14 Aug 2017 11:19:32 +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 v7EBJVd8019523; Mon, 14 Aug 2017 11:19:31 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7EBJVLP019522; Mon, 14 Aug 2017 11:19:31 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708141119.v7EBJVLP019522@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 14 Aug 2017 11:19:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322493 - head/usr.sbin/cpucontrol X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/usr.sbin/cpucontrol X-SVN-Commit-Revision: 322493 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Aug 2017 11:19:33 -0000 Author: kib Date: Mon Aug 14 11:19:31 2017 New Revision: 322493 URL: https://svnweb.freebsd.org/changeset/base/322493 Log: Remove confusion in the line explaining syntax of the msr read. Specify words order in the display. Sponsored by: The FreeBSD Foundation MFC after: 3 days Modified: head/usr.sbin/cpucontrol/cpucontrol.8 Modified: head/usr.sbin/cpucontrol/cpucontrol.8 ============================================================================== --- head/usr.sbin/cpucontrol/cpucontrol.8 Mon Aug 14 11:06:09 2017 (r322492) +++ head/usr.sbin/cpucontrol/cpucontrol.8 Mon Aug 14 11:19:31 2017 (r322493) @@ -90,9 +90,10 @@ The following options are available: .It Fl d Ar datadir Where to look for microcode images. The option can be specified multiple times. -.It Fl m Ar msr Ns Op = Ns Ar value +.It Fl m Ar msr Show value of the specified MSR. MSR register number should be given as a hexadecimal number. +The high word is printed first, then the low word is printed second. .It Fl m Ar msr Ns = Ns Ar value Store the .Ar value From owner-svn-src-head@freebsd.org Mon Aug 14 11:20:13 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 073D7DB5152; Mon, 14 Aug 2017 11:20:13 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A0F677C378; Mon, 14 Aug 2017 11:20:12 +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 v7EBKBfm019610; Mon, 14 Aug 2017 11:20:11 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7EBKBtd019609; Mon, 14 Aug 2017 11:20:11 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708141120.v7EBKBtd019609@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 14 Aug 2017 11:20:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322494 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 322494 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Aug 2017 11:20:13 -0000 Author: kib Date: Mon Aug 14 11:20:10 2017 New Revision: 322494 URL: https://svnweb.freebsd.org/changeset/base/322494 Log: Style. Tested by: pho (as part of the larger patch) Sponsored by: The FreeBSD Foundation MFC after: 3 days Modified: head/sys/amd64/amd64/trap.c Modified: head/sys/amd64/amd64/trap.c ============================================================================== --- head/sys/amd64/amd64/trap.c Mon Aug 14 11:19:31 2017 (r322493) +++ head/sys/amd64/amd64/trap.c Mon Aug 14 11:20:10 2017 (r322494) @@ -166,15 +166,21 @@ trap(struct trapframe *frame) #ifdef KDTRACE_HOOKS struct reg regs; #endif - struct thread *td = curthread; - struct proc *p = td->td_proc; + ksiginfo_t ksi; + struct thread *td; + struct proc *p; + register_t addr; #ifdef KDB register_t dr6; #endif - int i = 0, ucode = 0; + int i, ucode; u_int type; - register_t addr = 0; - ksiginfo_t ksi; + + td = curthread; + p = td->td_proc; + i = 0; + ucode = 0; + addr = 0; VM_CNT_INC(v_trap); type = frame->tf_trapno; From owner-svn-src-head@freebsd.org Mon Aug 14 11:20:56 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2F854DB5399; Mon, 14 Aug 2017 11:20:56 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F15677C51D; Mon, 14 Aug 2017 11:20: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 v7EBKsXG019675; Mon, 14 Aug 2017 11:20:54 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7EBKs9b019674; Mon, 14 Aug 2017 11:20:54 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708141120.v7EBKs9b019674@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 14 Aug 2017 11:20:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322495 - head/sys/amd64/include X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/amd64/include X-SVN-Commit-Revision: 322495 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Aug 2017 11:20:56 -0000 Author: kib Date: Mon Aug 14 11:20:54 2017 New Revision: 322495 URL: https://svnweb.freebsd.org/changeset/base/322495 Log: Add {rd,wr}{fs,gs}base C wrappers for instructions. Tested by: pho (as part of the larger patch) Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/amd64/include/cpufunc.h Modified: head/sys/amd64/include/cpufunc.h ============================================================================== --- head/sys/amd64/include/cpufunc.h Mon Aug 14 11:20:10 2017 (r322494) +++ head/sys/amd64/include/cpufunc.h Mon Aug 14 11:20:54 2017 (r322495) @@ -651,6 +651,38 @@ load_gs(u_short sel) } #endif +static __inline uint64_t +rdfsbase(void) +{ + uint64_t x; + + __asm __volatile("rdfsbase %0" : "=r" (x)); + return (x); +} + +static __inline void +wrfsbase(uint64_t x) +{ + + __asm __volatile("wrfsbase %0" : : "r" (x)); +} + +static __inline uint64_t +rdgsbase(void) +{ + uint64_t x; + + __asm __volatile("rdgsbase %0" : "=r" (x)); + return (x); +} + +static __inline void +wrgsbase(uint64_t x) +{ + + __asm __volatile("wrgsbase %0" : : "r" (x)); +} + static __inline void bare_lgdt(struct region_descriptor *addr) { From owner-svn-src-head@freebsd.org Mon Aug 14 11:23:08 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C579EDB572C; Mon, 14 Aug 2017 11:23:08 +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 mx1.freebsd.org (Postfix) with ESMTPS id 929777C8FD; Mon, 14 Aug 2017 11:23:08 +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 v7EBN7k6023419; Mon, 14 Aug 2017 11:23:07 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7EBN7XF023418; Mon, 14 Aug 2017 11:23:07 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708141123.v7EBN7XF023418@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 14 Aug 2017 11:23:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322496 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 322496 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Aug 2017 11:23:08 -0000 Author: kib Date: Mon Aug 14 11:23:07 2017 New Revision: 322496 URL: https://svnweb.freebsd.org/changeset/base/322496 Log: Print whole machine state on double fault. It is quite useful when double fault is not caused by a stack overflow. Tested by: pho (as part of the larger patch) Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/amd64/amd64/trap.c Modified: head/sys/amd64/amd64/trap.c ============================================================================== --- head/sys/amd64/amd64/trap.c Mon Aug 14 11:20:54 2017 (r322495) +++ head/sys/amd64/amd64/trap.c Mon Aug 14 11:23:07 2017 (r322496) @@ -822,10 +822,24 @@ dblfault_handler(struct trapframe *frame) if (dtrace_doubletrap_func != NULL) (*dtrace_doubletrap_func)(); #endif - printf("\nFatal double fault\n"); - printf("rip = 0x%lx\n", frame->tf_rip); - printf("rsp = 0x%lx\n", frame->tf_rsp); - printf("rbp = 0x%lx\n", frame->tf_rbp); + printf("\nFatal double fault\n" + "rip %#lx rsp %#lx rbp %#lx\n" + "rax %#lx rdx %#lx rbx %#lx\n" + "rcx %#lx rsi %#lx rdi %#lx\n" + "r8 %#lx r9 %#lx r10 %#lx\n" + "r11 %#lx r12 %#lx r13 %#lx\n" + "r14 %#lx r15 %#lx rflags %#lx\n" + "cs %#lx ss %#lx ds %#hx es %#hx fs %#hx gs %#hx\n" + "fsbase %#lx gsbase %#lx kgsbase %#lx\n", + frame->tf_rip, frame->tf_rsp, frame->tf_rbp, + frame->tf_rax, frame->tf_rdx, frame->tf_rbx, + frame->tf_rcx, frame->tf_rdi, frame->tf_rsi, + frame->tf_r8, frame->tf_r9, frame->tf_r10, + frame->tf_r11, frame->tf_r12, frame->tf_r13, + frame->tf_r14, frame->tf_r15, frame->tf_rflags, + frame->tf_cs, frame->tf_ss, frame->tf_ds, frame->tf_es, + frame->tf_fs, frame->tf_gs, + rdmsr(MSR_FSBASE), rdmsr(MSR_GSBASE), rdmsr(MSR_KGSBASE)); #ifdef SMP /* two separate prints in case of a trap on an unmapped page */ printf("cpuid = %d; ", PCPU_GET(cpuid)); From owner-svn-src-head@freebsd.org Mon Aug 14 14:16:57 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 91EBFDCB1C8; Mon, 14 Aug 2017 14:16:57 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 5F0EF83DAD; Mon, 14 Aug 2017 14:16:57 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7EEGuAe094307; Mon, 14 Aug 2017 14:16:56 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7EEGuUY094306; Mon, 14 Aug 2017 14:16:56 GMT (envelope-from br@FreeBSD.org) Message-Id: <201708141416.v7EEGuUY094306@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Mon, 14 Aug 2017 14:16:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322508 - in head/contrib/gcc/config: riscv riscv64 X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: in head/contrib/gcc/config: riscv riscv64 X-SVN-Commit-Revision: 322508 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Aug 2017 14:16:57 -0000 Author: br Date: Mon Aug 14 14:16:56 2017 New Revision: 322508 URL: https://svnweb.freebsd.org/changeset/base/322508 Log: Rename RISC-V GCC config directory: riscv64 -> riscv (to match official RISC-V target for GCC 7.1). This is only a minimal config required to build c start up (csu). This fixes build after r322429 ("Make _TO_CPUARCH macro for ARCH to CPUARCH conversions") Reported by: lwhsu Sponsored by: DARPA, AFRL Added: head/contrib/gcc/config/riscv/ - copied from r322507, head/contrib/gcc/config/riscv64/ head/contrib/gcc/config/riscv/riscv.h - copied unchanged from r322507, head/contrib/gcc/config/riscv64/riscv64.h Deleted: head/contrib/gcc/config/riscv/riscv64.h head/contrib/gcc/config/riscv64/ Copied: head/contrib/gcc/config/riscv/riscv.h (from r322507, head/contrib/gcc/config/riscv64/riscv64.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/gcc/config/riscv/riscv.h Mon Aug 14 14:16:56 2017 (r322508, copy of r322507, head/contrib/gcc/config/riscv64/riscv64.h) @@ -0,0 +1 @@ +/* $FreeBSD$ */ From owner-svn-src-head@freebsd.org Mon Aug 14 18:49:47 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9BF1DDDD2B2; Mon, 14 Aug 2017 18:49:47 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 6A251697D0; Mon, 14 Aug 2017 18:49:47 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7EInk4e004739; Mon, 14 Aug 2017 18:49:46 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7EInk8M004738; Mon, 14 Aug 2017 18:49:46 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201708141849.v7EInk8M004738@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Mon, 14 Aug 2017 18:49:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322510 - head/share/man/man5 X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: head/share/man/man5 X-SVN-Commit-Revision: 322510 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Aug 2017 18:49:47 -0000 Author: ngie Date: Mon Aug 14 18:49:46 2017 New Revision: 322510 URL: https://svnweb.freebsd.org/changeset/base/322510 Log: Regenerate src.conf(5) per LLDB default change made in r322415 Modified: head/share/man/man5/src.conf.5 Modified: head/share/man/man5/src.conf.5 ============================================================================== --- head/share/man/man5/src.conf.5 Mon Aug 14 15:08:49 2017 (r322509) +++ head/share/man/man5/src.conf.5 Mon Aug 14 18:49:46 2017 (r322510) @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd August 2, 2017 +.Dd August 14, 2017 .Dt SRC.CONF 5 .Os .Sh NAME @@ -967,12 +967,12 @@ amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarc Set to not build the LLDB debugger. .Pp This is a default setting on -arm/arm, arm/armeb, arm/armv6, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64, riscv/riscv64sf and sparc64/sparc64. +arm/arm, arm/armeb, arm/armv6, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64, riscv/riscv64sf and sparc64/sparc64. .It Va WITH_LLDB Set to build the LLDB debugger. .Pp This is a default setting on -amd64/amd64 and arm64/aarch64. +amd64/amd64, arm64/aarch64 and i386/i386. .It Va WITHOUT_LLD_BOOTSTRAP Set to not build the LLD linker during the bootstrap phase of the build. @@ -1254,13 +1254,13 @@ Set to not build profiled libraries for use with .Xr gprof 8 . .Pp This is a default setting on -riscv/riscv64 and riscv/riscv64sf. +mips/mips64el, mips/mips64, mips/mips64elhf, mips/mips64hf, riscv/riscv64 and riscv/riscv64sf. .It Va WITH_PROFILE Set to build profiled libraries for use with .Xr gprof 8 . .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mipsn32, mips/mipselhf, mips/mipshf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. .It Va WITHOUT_QUOTAS Set to not build .Xr quota 1 From owner-svn-src-head@freebsd.org Mon Aug 14 19:03:07 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4B0F4DDE166; Mon, 14 Aug 2017 19:03:07 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 2669A6A59B; Mon, 14 Aug 2017 19:03:07 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7EJ36Ap013080; Mon, 14 Aug 2017 19:03:06 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7EJ35LE013073; Mon, 14 Aug 2017 19:03:05 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201708141903.v7EJ35LE013073@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Mon, 14 Aug 2017 19:03:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322511 - in head: share/mk tools/build/options X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: in head: share/mk tools/build/options X-SVN-Commit-Revision: 322511 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Aug 2017 19:03:07 -0000 Author: ngie Date: Mon Aug 14 19:03:05 2017 New Revision: 322511 URL: https://svnweb.freebsd.org/changeset/base/322511 Log: Add limited sandbox capability to "make check" == Rationale == r295380 introduced "make check" and consolidated means for running test code in an attempt to simplify running tests. One could either install files/libraries/programs and run "make check", or run "make check" with an explicit CHECKDIR, e.g., `make check CHECKDIR=$(make -V.OBJDIR)``. One criticism that was received is that "make check" should be run with the intent of making dev->test->commit easier, which means that the target audience's workflow should be developers. One developer pattern available in other opensource projects is to run test code from a developer sandbox, instead of installing to a system. == Method == This approach is slightly different from the standard approach, in the sense that it builds and installs into a deterministic directory under .OBJDIR (as I call it, the "sandbox"), then runs "make check" against that. In the event the test run is successful, the deterministic directory is removed to save space. == Approach == bsd.lib.mk, bsd.prog.mk: To support this functionality, a new variable `HAS_TESTS` is being added. HAS_TESTS enables appropriate behavior with bsd.lib.mk and bsd.prog.mk, as follows: - Add "make check" as an available target from the directory. - Pass down appropriate variables via ${TESTS_ENV}, i.e., ${TESTS_LD_LIBRARY_PATH} and ${TESTS_PATH}. One should add "HAS_TESTS" to directories containing tests in them, e.g. from bin/sh/Makefile, HAS_TESTS= SUBDIR.${MK_TESTS}+= tests HAS_TESTS doesn't automatically add the tests subdirectory for flexibility reasons. bsd.opts.mk, src.opts.mk: - The knob ${MK_MAKE_CHECK_USE_SANDBOX} has been added, both to explicitly direct (internally) when to set a deterministic ${DESTDIR} and to also allow users to disable this behavior globally, i.e., via src.conf. - MK_TESTS has been promoted from src.opts.mk to bsd.opts.mk to leverage syntactic sugar for having MK_TESTS be a dependency for MK_MAKE_CHECK_USE_SANDBOX, but to also ensure that src.opts.mk isn't required to use suite.test.mk (which is a dependency of bsd.test.mk). suite.test.mk: - beforecheck behavior (when MK_MAKE_CHECK_USE_SANDBOX is enabled) is modified from a no-op to: -- Build. -- Run "make hierarchy" on the sandbox dir. -- Install the tests/files to the sandbox dir. - aftercheck behavior (when MK_MAKE_CHECK_USE_SANDBOX is enabled) is modified from a no-op to: -- Remove the sandbox dir. Again, because the dependency order set in bsd.test.mk is beforecheck -> check -> aftercheck, "make check" will not be run unless "beforecheck" completes successfully, and "aftercheck" will not be run unless "beforecheck" and "check" complete successfully. == Caveats == - This target must either be run with MK_INSTALL_AS_USER or as root. Otherwise it will fail when running "make install" as the default user/group for many makefiles when calling INSTALL is root/wheel. - This target must be run from a suitable top-level directory. For example, running tests from `tests/sys/fs/tmpfs` won't work, but `tests/sys/fs` will, because `tests/sys/fs/tmpfs` relies on files installed by `tests/sys/fs`. - Running MK_INSTALL_AS_USER may introduce determinism issues. However, using it could identify deficiences in tests in terms of needing to be run as root, which are not properly articulated in the test requirements. - The doesn't negate the need for running "make installworld" and "make checkworld", etc. Again, this just is intended to simplify the dev->test->commit workflow. == Cleanup done == - CHECKDIR is removed; one can use "MK_MAKE_CHECK_USE_SANDBOX=no" to enable "legacy" (r295380) behavior. MFC after: 2 months Relnotes: yes (CHECKDIR removed; "make check" behavior changed) Requested by: jhb Reviewed by: arch (silence), testing (silence) Differential Revision: D11905 Added: head/tools/build/options/WITHOUT_MAKE_CHECK_USE_SANDBOX - copied, changed from r322452, head/tools/build/options/WITHOUT_TESTS Modified: head/share/mk/bsd.README head/share/mk/bsd.lib.mk head/share/mk/bsd.opts.mk head/share/mk/bsd.prog.mk head/share/mk/src.opts.mk head/share/mk/suite.test.mk Modified: head/share/mk/bsd.README ============================================================================== --- head/share/mk/bsd.README Mon Aug 14 18:49:46 2017 (r322510) +++ head/share/mk/bsd.README Mon Aug 14 19:03:05 2017 (r322511) @@ -566,7 +566,7 @@ It has seven targets: all: build the test programs. check: - runs the test programs from CHECKDIR with kyua test. + runs the test programs with kyua test. The beforecheck and aftercheck targets will be invoked, if defined, to execute commands before and after the realcheck @@ -574,8 +574,6 @@ It has seven targets: The devel/kyua package must be installed before invoking this target. - - See CHECKDIR for more details. clean: remove the test programs and any object files. cleandir: @@ -602,10 +600,6 @@ ATF_TESTS_C The names of the ATF C test programs to bu ATF_TESTS_CXX The names of the ATF C++ test programs to build. ATF_TESTS_SH The names of the ATF sh test programs to build. - -CHECKDIR The directory that 'make check' executes tests from. - - The value of CHECKDIR defaults to .OBJDIR. KYUAFILE If 'auto' (the default), generate a Kyuafile out of the test programs defined in the Makefile. If 'yes', then a Modified: head/share/mk/bsd.lib.mk ============================================================================== --- head/share/mk/bsd.lib.mk Mon Aug 14 18:49:46 2017 (r322510) +++ head/share/mk/bsd.lib.mk Mon Aug 14 19:03:05 2017 (r322511) @@ -442,6 +442,12 @@ OBJS_DEPEND_GUESS.${_S:R}.pico+= ${_S} .endfor .endif +.if defined(HAS_TESTS) +MAKE+= MK_MAKE_CHECK_USE_SANDBOX=yes +SUBDIR_TARGETS+= check +TESTS_LD_LIBRARY_PATH+= ${.OBJDIR} +.endif + .include .include .include Modified: head/share/mk/bsd.opts.mk ============================================================================== --- head/share/mk/bsd.opts.mk Mon Aug 14 18:49:46 2017 (r322510) +++ head/share/mk/bsd.opts.mk Mon Aug 14 19:03:05 2017 (r322511) @@ -55,6 +55,7 @@ __DEFAULT_YES_OPTIONS = \ INCLUDES \ INSTALLLIB \ KERBEROS \ + MAKE_CHECK_USE_SANDBOX \ MAN \ MANCOMPRESS \ NIS \ @@ -63,6 +64,7 @@ __DEFAULT_YES_OPTIONS = \ PROFILE \ SSP \ SYMVER \ + TESTS \ TOOLCHAIN \ WARNS @@ -73,6 +75,7 @@ __DEFAULT_NO_OPTIONS = \ STALE_STAGED __DEFAULT_DEPENDENT_OPTIONS = \ + MAKE_CHECK_USE_SANDBOX/TESTS \ STAGING_MAN/STAGING \ STAGING_PROG/STAGING \ STALE_STAGED/STAGING \ Modified: head/share/mk/bsd.prog.mk ============================================================================== --- head/share/mk/bsd.prog.mk Mon Aug 14 18:49:46 2017 (r322510) +++ head/share/mk/bsd.prog.mk Mon Aug 14 19:03:05 2017 (r322511) @@ -301,6 +301,13 @@ lint: ${SRCS:M*.c} .include .endif +.if defined(HAS_TESTS) +MAKE+= MK_MAKE_CHECK_USE_SANDBOX=yes +SUBDIR_TARGETS+= check +TESTS_LD_LIBRARY_PATH+= ${.OBJDIR} +TESTS_PATH+= ${.OBJDIR} +.endif + .if defined(PROG) OBJS_DEPEND_GUESS+= ${SRCS:M*.h} .endif Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Mon Aug 14 18:49:46 2017 (r322510) +++ head/share/mk/src.opts.mk Mon Aug 14 19:03:05 2017 (r322511) @@ -160,7 +160,6 @@ __DEFAULT_YES_OPTIONS = \ TCP_WRAPPERS \ TCSH \ TELNET \ - TESTS \ TEXTPROC \ TFTP \ TIMED \ Modified: head/share/mk/suite.test.mk ============================================================================== --- head/share/mk/suite.test.mk Mon Aug 14 18:49:46 2017 (r322510) +++ head/share/mk/suite.test.mk Mon Aug 14 19:03:05 2017 (r322511) @@ -8,6 +8,8 @@ .error suite.test.mk cannot be included directly. .endif +.include + # Name of the test suite these tests belong to. Should rarely be changed for # Makefiles built into the FreeBSD src tree. TESTSUITE?= FreeBSD @@ -75,8 +77,6 @@ Kyuafile: Makefile @mv ${.TARGET}.tmp ${.TARGET} .endif -CHECKDIR?= ${DESTDIR}${TESTSDIR} - KYUA= ${LOCALBASE}/bin/kyua # Definition of the "make check" target and supporting variables. @@ -99,4 +99,26 @@ realcheck: .PHONY echo "LOCALBASE=\"${LOCALBASE}\""; \ false; \ fi - @${KYUA} test -k ${CHECKDIR}/Kyuafile + @env ${TESTS_ENV:Q} ${KYUA} test -k ${DESTDIR}${TESTSDIR}/Kyuafile + +MAKE_CHECK_SANDBOX_DIR= ${.OBJDIR}/checkdir +CLEANDIRS+= ${MAKE_CHECK_SANDBOX_DIR} + +.if ${MK_MAKE_CHECK_USE_SANDBOX} != "no" && make(check) +DESTDIR:= ${MAKE_CHECK_SANDBOX_DIR} + +beforecheck: +.for t in clean depend all + @cd ${.CURDIR} && ${MAKE} $t +.endfor + @cd ${SRCTOP} && ${MAKE} hierarchy DESTDIR=${DESTDIR} + @cd ${.CURDIR} && ${MAKE} install \ + DESTDIR=${DESTDIR} + +# NOTE: this is intentional to ensure that "make check" can be run multiple +# times. "aftercheck" won't be run if "make check" fails, is interrupted, +# etc. +aftercheck: + @cd ${.CURDIR} && ${MAKE} clean + +.endif Copied and modified: head/tools/build/options/WITHOUT_MAKE_CHECK_USE_SANDBOX (from r322452, head/tools/build/options/WITHOUT_TESTS) ============================================================================== --- head/tools/build/options/WITHOUT_TESTS Sun Aug 13 01:23:13 2017 (r322452, copy source) +++ head/tools/build/options/WITHOUT_MAKE_CHECK_USE_SANDBOX Mon Aug 14 19:03:05 2017 (r322511) @@ -1,9 +1,10 @@ .\" $FreeBSD$ -Set to not build nor install the -.Fx -Test Suite in -.Pa /usr/tests/ . +Set to not execute +.Dq Li "make check" +in limited sandbox mode. +This option should be paired with +.Va WITH_INSTALL_AS_USER +if executed as an unprivileged user. See .Xr tests 7 for more details. -This also disables the build of all test-related dependencies, including ATF. From owner-svn-src-head@freebsd.org Mon Aug 14 19:03:57 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 56700DDE260; Mon, 14 Aug 2017 19:03:57 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 25A496A711; Mon, 14 Aug 2017 19:03:57 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7EJ3uYD013146; Mon, 14 Aug 2017 19:03:56 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7EJ3uGd013145; Mon, 14 Aug 2017 19:03:56 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201708141903.v7EJ3uGd013145@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Mon, 14 Aug 2017 19:03:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322512 - head/share/man/man5 X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: head/share/man/man5 X-SVN-Commit-Revision: 322512 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Aug 2017 19:03:57 -0000 Author: ngie Date: Mon Aug 14 19:03:55 2017 New Revision: 322512 URL: https://svnweb.freebsd.org/changeset/base/322512 Log: Regenerate src.conf(5) after change made in r322511 to "make check" behavior Modified: head/share/man/man5/src.conf.5 Modified: head/share/man/man5/src.conf.5 ============================================================================== --- head/share/man/man5/src.conf.5 Mon Aug 14 19:03:05 2017 (r322511) +++ head/share/man/man5/src.conf.5 Mon Aug 14 19:03:55 2017 (r322512) @@ -1043,6 +1043,16 @@ MTA selector. Set to not install .Xr make 1 and related support files. +.It Va WITHOUT_MAKE_CHECK_USE_SANDBOX +Set to not execute +.Dq Li "make check" +in limited sandbox mode. +This option should be paired with +.Va WITH_INSTALL_AS_USER +if executed as an unprivileged user. +See +.Xr tests 7 +for more details. .It Va WITHOUT_MAN Set to not build manual pages. When set, these options are also in effect: From owner-svn-src-head@freebsd.org Mon Aug 14 19:18:51 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7513DDDEE93; Mon, 14 Aug 2017 19:18:51 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 42F216B4CF; Mon, 14 Aug 2017 19:18:51 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7EJIoX7018078; Mon, 14 Aug 2017 19:18:50 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7EJIoi7018077; Mon, 14 Aug 2017 19:18:50 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201708141918.v7EJIoi7018077@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Mon, 14 Aug 2017 19:18:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322514 - head X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 322514 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Aug 2017 19:18:51 -0000 Author: ngie Date: Mon Aug 14 19:18:50 2017 New Revision: 322514 URL: https://svnweb.freebsd.org/changeset/base/322514 Log: Add an UPDATING entry for r322511. MFC after: 2 months Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Mon Aug 14 19:12:51 2017 (r322513) +++ head/UPDATING Mon Aug 14 19:18:50 2017 (r322514) @@ -51,6 +51,27 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW: ****************************** SPECIAL WARNING: ****************************** +20170814: + "make check" behavior (made in ^/head@r295380) has been changed to + execute from a limited sandbox, as opposed to executing from + ${TESTSDIR}. + + Behavioral changes: + - The "beforecheck" and "aftercheck" targets are now specified. + - ${CHECKDIR} (added in commit noted above) has been removed. + - Legacy behavior can be enabled by setting + WITHOUT_MAKE_CHECK_USE_SANDBOX in src.conf(5) or the environment. + + If the limited sandbox mode is enabled, "make check" will execute + "make distribution", then install, execute the tests, and clean up the + sandbox if successful. + + The "make distribution" and "make install" targets are typically run as + root to set appropriate permissions and ownership at installation time. + The end-user should set "WITH_INSTALL_AS_USER" in src.conf(5) or the + environment if executing "make check" with limited sandbox mode using + an unprivileged user. + 20170808: Since the switch to GPT disk labels, fsck for UFS/FFS has been unable to automatically find alternate superblocks. As of r322297, From owner-svn-src-head@freebsd.org Mon Aug 14 19:21:48 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ABB3DDDF38D; Mon, 14 Aug 2017 19:21:48 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 552C06B8CA; Mon, 14 Aug 2017 19:21:48 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7EJLlVv019975; Mon, 14 Aug 2017 19:21:47 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7EJLboO019871; Mon, 14 Aug 2017 19:21:37 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201708141921.v7EJLboO019871@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Mon, 14 Aug 2017 19:21:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322515 - in head: bin/cat bin/chmod bin/date bin/dd bin/echo bin/expr bin/ln bin/ls bin/mv bin/pax bin/pkill bin/pwait bin/sh bin/sleep bin/test lib/atf/libatf-c lib/atf/libatf-c++ lib... X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: in head: bin/cat bin/chmod bin/date bin/dd bin/echo bin/expr bin/ln bin/ls bin/mv bin/pax bin/pkill bin/pwait bin/sh bin/sleep bin/test lib/atf/libatf-c lib/atf/libatf-c++ lib/libarchive lib/libc lib/... X-SVN-Commit-Revision: 322515 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Aug 2017 19:21:48 -0000 Author: ngie Date: Mon Aug 14 19:21:37 2017 New Revision: 322515 URL: https://svnweb.freebsd.org/changeset/base/322515 Log: Add supporting changes for `Add limited sandbox capability to "make check"` Non-tests/... changes: - Add HAS_TESTS= to Makefiles with libraries and programs to enable iteration and propagate the appropriate environment down to *.test.mk. tests/... changes: - Add appropriate support Makefile.inc's to set HAS_TESTS in a minimal manner, since tests/... is a special subdirectory tree compared to the others. MFC after: 2 months MFC with: r322511 Reviewed by: arch (silence), testing (silence) Differential Revision: D12014 Added: head/tests/Makefile.inc0 - copied unchanged from r322126, projects/make-check-sandbox/tests/Makefile.inc0 head/tests/etc/Makefile.inc - copied unchanged from r322126, projects/make-check-sandbox/tests/etc/Makefile.inc head/tests/sys/geom/class/Makefile.inc - copied unchanged from r322126, projects/make-check-sandbox/tests/sys/geom/class/Makefile.inc head/tests/sys/pjdfstest/Makefile.inc - copied unchanged from r322126, projects/make-check-sandbox/tests/sys/pjdfstest/Makefile.inc head/tests/sys/pjdfstest/tests/Makefile.inc - copied unchanged from r322126, projects/make-check-sandbox/tests/sys/pjdfstest/tests/Makefile.inc Modified: head/bin/cat/Makefile head/bin/chmod/Makefile head/bin/date/Makefile head/bin/dd/Makefile head/bin/echo/Makefile head/bin/expr/Makefile head/bin/ln/Makefile head/bin/ls/Makefile head/bin/mv/Makefile head/bin/pax/Makefile head/bin/pkill/Makefile head/bin/pwait/Makefile head/bin/sh/Makefile head/bin/sleep/Makefile head/bin/test/Makefile head/lib/atf/libatf-c++/Makefile head/lib/atf/libatf-c/Makefile head/lib/libarchive/Makefile head/lib/libc/Makefile head/lib/libcam/Makefile head/lib/libcasper/services/cap_dns/Makefile head/lib/libcasper/services/cap_grp/Makefile head/lib/libcasper/services/cap_pwd/Makefile head/lib/libcasper/services/cap_sysctl/Makefile head/lib/libcrypt/Makefile head/lib/libkvm/Makefile head/lib/libmp/Makefile head/lib/libnv/Makefile head/lib/libpathconv/Makefile head/lib/libproc/Makefile head/lib/librt/Makefile head/lib/libsbuf/Makefile head/lib/libthr/Makefile head/lib/libutil/Makefile head/lib/libxo/Makefile head/lib/msun/Makefile head/libexec/atf/atf-check/Makefile head/libexec/atf/atf-sh/Makefile head/libexec/rtld-elf/Makefile head/sbin/devd/Makefile head/sbin/dhclient/Makefile head/sbin/growfs/Makefile head/sbin/ifconfig/Makefile head/sbin/mdconfig/Makefile head/sbin/pfctl/Makefile head/share/examples/Makefile head/share/zoneinfo/Makefile head/tests/Makefile head/tests/sys/Makefile.inc head/usr.bin/apply/Makefile head/usr.bin/basename/Makefile head/usr.bin/bsdcat/Makefile head/usr.bin/calendar/Makefile head/usr.bin/cmp/Makefile head/usr.bin/col/Makefile head/usr.bin/comm/Makefile head/usr.bin/compress/Makefile head/usr.bin/cpio/Makefile head/usr.bin/csplit/Makefile head/usr.bin/cut/Makefile head/usr.bin/diff/Makefile head/usr.bin/diff3/Makefile head/usr.bin/dirname/Makefile head/usr.bin/du/Makefile head/usr.bin/file2c/Makefile head/usr.bin/getconf/Makefile head/usr.bin/grep/Makefile head/usr.bin/gzip/Makefile head/usr.bin/hexdump/Makefile head/usr.bin/ident/Makefile head/usr.bin/indent/Makefile head/usr.bin/join/Makefile head/usr.bin/jot/Makefile head/usr.bin/lastcomm/Makefile head/usr.bin/limits/Makefile head/usr.bin/m4/Makefile head/usr.bin/mkimg/Makefile head/usr.bin/ncal/Makefile head/usr.bin/pr/Makefile head/usr.bin/printf/Makefile head/usr.bin/procstat/Makefile head/usr.bin/sdiff/Makefile head/usr.bin/sed/Makefile head/usr.bin/soelim/Makefile head/usr.bin/stat/Makefile head/usr.bin/tail/Makefile head/usr.bin/tar/Makefile head/usr.bin/timeout/Makefile head/usr.bin/tr/Makefile head/usr.bin/truncate/Makefile head/usr.bin/uniq/Makefile head/usr.bin/units/Makefile head/usr.bin/uudecode/Makefile head/usr.bin/uuencode/Makefile head/usr.bin/xargs/Makefile head/usr.bin/xinstall/Makefile head/usr.bin/xo/Makefile head/usr.bin/yacc/Makefile head/usr.sbin/chown/Makefile head/usr.sbin/etcupdate/Makefile head/usr.sbin/extattr/Makefile head/usr.sbin/fstyp/Makefile head/usr.sbin/makefs/Makefile head/usr.sbin/newsyslog/Makefile head/usr.sbin/nmtree/Makefile head/usr.sbin/pw/Makefile head/usr.sbin/rpcbind/Makefile head/usr.sbin/sa/Makefile Modified: head/bin/cat/Makefile ============================================================================== --- head/bin/cat/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/bin/cat/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -6,6 +6,7 @@ PACKAGE=runtime PROG= cat +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/bin/chmod/Makefile ============================================================================== --- head/bin/chmod/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/bin/chmod/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -6,6 +6,7 @@ PACKAGE=runtime PROG= chmod +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/bin/date/Makefile ============================================================================== --- head/bin/date/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/bin/date/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -7,6 +7,7 @@ PACKAGE=runtime PROG= date SRCS= date.c netdate.c vary.c +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/bin/dd/Makefile ============================================================================== --- head/bin/dd/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/bin/dd/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -38,6 +38,7 @@ test: ${PROG} gen @rm -f gen 1M_zeroes* obs_zeroes +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/bin/echo/Makefile ============================================================================== --- head/bin/echo/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/bin/echo/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -6,6 +6,7 @@ PACKAGE=runtime PROG= echo +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/bin/expr/Makefile ============================================================================== --- head/bin/expr/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/bin/expr/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -12,6 +12,7 @@ CFLAGS+= -fwrapv NO_WMISSING_VARIABLE_DECLARATIONS= +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/bin/ln/Makefile ============================================================================== --- head/bin/ln/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/bin/ln/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -10,6 +10,7 @@ MAN= ln.1 symlink.7 LINKS= ${BINDIR}/ln ${BINDIR}/link MLINKS= ln.1 link.1 +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/bin/ls/Makefile ============================================================================== --- head/bin/ls/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/bin/ls/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -14,6 +14,7 @@ CFLAGS+= -DCOLORLS LIBADD+= termcapw .endif +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/bin/mv/Makefile ============================================================================== --- head/bin/mv/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/bin/mv/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -6,6 +6,7 @@ PACKAGE=runtime PROG= mv +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/bin/pax/Makefile ============================================================================== --- head/bin/pax/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/bin/pax/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -33,6 +33,7 @@ SRCS= ar_io.c ar_subs.c buf_subs.c cache.c cpio.c file gen_subs.c getoldopt.c options.c pat_rep.c pax.c sel_subs.c \ tables.c tar.c tty_subs.c +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/bin/pkill/Makefile ============================================================================== --- head/bin/pkill/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/bin/pkill/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -19,6 +19,7 @@ MLINKS= pkill.1 pgrep.1 SYMLINKS= ../..${BINDIR}/pkill /usr/bin/pkill SYMLINKS+= ../..${BINDIR}/pgrep /usr/bin/pgrep +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/bin/pwait/Makefile ============================================================================== --- head/bin/pwait/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/bin/pwait/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -5,6 +5,7 @@ PACKAGE=runtime PROG= pwait +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/bin/sh/Makefile ============================================================================== --- head/bin/sh/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/bin/sh/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -64,6 +64,7 @@ syntax.c syntax.h: mksyntax token.h: mktokens sh ${.CURDIR}/mktokens +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/bin/sleep/Makefile ============================================================================== --- head/bin/sleep/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/bin/sleep/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -6,6 +6,7 @@ PACKAGE=runtime PROG= sleep +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/bin/test/Makefile ============================================================================== --- head/bin/test/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/bin/test/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -8,6 +8,7 @@ PROG= test LINKS= ${BINDIR}/test ${BINDIR}/[ MLINKS= test.1 [.1 +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/lib/atf/libatf-c++/Makefile ============================================================================== --- head/lib/atf/libatf-c++/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/lib/atf/libatf-c++/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -72,6 +72,7 @@ INCSDIR_atf-c++.hpp= ${INCLUDEDIR} MAN= atf-c++.3 MLINKS+= atf-c++.3 atf-c-api++.3 # Backwards compatibility. +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include "../common.mk" Modified: head/lib/atf/libatf-c/Makefile ============================================================================== --- head/lib/atf/libatf-c/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/lib/atf/libatf-c/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -97,6 +97,7 @@ INCSDIR_atf-c.h= ${INCLUDEDIR} MAN= atf-c.3 MLINKS+= atf-c.3 atf-c-api.3 # Backwards compatibility. +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include "../common.mk" Modified: head/lib/libarchive/Makefile ============================================================================== --- head/lib/libarchive/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/lib/libarchive/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -413,6 +413,7 @@ MLINKS+= archive_write_set_options.3 archive_write_set MLINKS+= archive_write_set_options.3 archive_write_set_option.3 MLINKS+= libarchive.3 archive.3 +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/lib/libc/Makefile ============================================================================== --- head/lib/libc/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/lib/libc/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -173,6 +173,7 @@ libkern.${LIBC_ARCH}:: ${KMSRCS} ${CP} ${.ALLSRC} ${DESTDIR}/sys/libkern/${LIBC_ARCH} .endif +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/lib/libcam/Makefile ============================================================================== --- head/lib/libcam/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/lib/libcam/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -47,6 +47,7 @@ SHLIB_MAJOR= 7 .include +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/lib/libcasper/services/cap_dns/Makefile ============================================================================== --- head/lib/libcasper/services/cap_dns/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/lib/libcasper/services/cap_dns/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -18,6 +18,7 @@ LIBADD= nv CFLAGS+=-I${.CURDIR} +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/lib/libcasper/services/cap_grp/Makefile ============================================================================== --- head/lib/libcasper/services/cap_grp/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/lib/libcasper/services/cap_grp/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -18,6 +18,7 @@ LIBADD= nv CFLAGS+=-I${.CURDIR} +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/lib/libcasper/services/cap_pwd/Makefile ============================================================================== --- head/lib/libcasper/services/cap_pwd/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/lib/libcasper/services/cap_pwd/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -18,6 +18,7 @@ LIBADD= nv CFLAGS+=-I${.CURDIR} +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/lib/libcasper/services/cap_sysctl/Makefile ============================================================================== --- head/lib/libcasper/services/cap_sysctl/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/lib/libcasper/services/cap_sysctl/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -18,6 +18,7 @@ LIBADD= nv CFLAGS+=-I${.CURDIR} +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/lib/libcrypt/Makefile ============================================================================== --- head/lib/libcrypt/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/lib/libcrypt/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -43,6 +43,7 @@ WARNS?= 2 PRECIOUSLIB= +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/lib/libkvm/Makefile ============================================================================== --- head/lib/libkvm/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/lib/libkvm/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -38,6 +38,7 @@ MLINKS+=kvm_read.3 kvm_read2.3 kvm_read.3 kvm_write.3 .include +HAS_TESTS= SUBDIR.${MK_TESTS}= tests .include Modified: head/lib/libmp/Makefile ============================================================================== --- head/lib/libmp/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/lib/libmp/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -15,6 +15,7 @@ CFLAGS+= -I${SRCTOP}/crypto VERSION_DEF= ${SRCTOP}/lib/libc/Versions.def SYMBOL_MAPS= ${.CURDIR}/Symbol.map +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/lib/libnv/Makefile ============================================================================== --- head/lib/libnv/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/lib/libnv/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -17,6 +17,7 @@ SRCS+= msgio.c SRCS+= nvlist.c SRCS+= nvpair.c +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/lib/libpathconv/Makefile ============================================================================== --- head/lib/libpathconv/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/lib/libpathconv/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -13,6 +13,7 @@ SRCS= abs2rel.c rel2abs.c #VERSION_DEF= ${SRCTOP/lib/libc/Versions.def #SYMBOL_MAPS= ${.CURDIR}/Symbol.map +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/lib/libproc/Makefile ============================================================================== --- head/lib/libproc/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/lib/libproc/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -41,6 +41,7 @@ SHLIB_MAJOR= 4 MAN= +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/lib/librt/Makefile ============================================================================== --- head/lib/librt/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/lib/librt/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -21,6 +21,7 @@ PRECIOUSLIB= VERSION_DEF=${SRCTOP}/lib/libc/Versions.def SYMBOL_MAPS=${.CURDIR}/Symbol.map +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/lib/libsbuf/Makefile ============================================================================== --- head/lib/libsbuf/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/lib/libsbuf/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -14,6 +14,7 @@ VERSION_DEF= ${.CURDIR}/Version.def .PATH: ${SRCTOP}/sys/kern +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/lib/libthr/Makefile ============================================================================== --- head/lib/libthr/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/lib/libthr/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -69,6 +69,7 @@ SYMLINKS+=lib${LIB}.so ${LIBDIR}/libpthread.so SYMLINKS+=lib${LIB}_p.a ${LIBDIR}/libpthread_p.a .endif +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/lib/libutil/Makefile ============================================================================== --- head/lib/libutil/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/lib/libutil/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -85,6 +85,7 @@ MLINKS+=pw_util.3 pw_copy.3 \ pw_util.3 pw_tempname.3 \ pw_util.3 pw_tmp.3 +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/lib/libxo/Makefile ============================================================================== --- head/lib/libxo/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/lib/libxo/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -110,6 +110,7 @@ MLINKS= xo_attr.3 xo_attr_h.3 \ xo_syslog.3 xo_set_logmask.3 \ xo_syslog.3 xo_vsyslog.3 +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/lib/msun/Makefile ============================================================================== --- head/lib/msun/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/lib/msun/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -228,6 +228,7 @@ MLINKS+=trunc.3 truncf.3 trunc.3 truncl.3 .include +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/libexec/atf/atf-check/Makefile ============================================================================== --- head/libexec/atf/atf-check/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/libexec/atf/atf-check/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -40,6 +40,7 @@ CFLAGS+= -DATF_SHELL='"/bin/sh"' LIBADD= atf_cxx +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/libexec/atf/atf-sh/Makefile ============================================================================== --- head/libexec/atf/atf-sh/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/libexec/atf/atf-sh/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -72,6 +72,7 @@ FILESGROUPS= SUBR SUBRDIR= ${SHAREDIR}/atf SUBR= libatf-sh.subr +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include "../../../lib/atf/common.mk" Modified: head/libexec/rtld-elf/Makefile ============================================================================== --- head/libexec/rtld-elf/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/libexec/rtld-elf/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -85,6 +85,7 @@ beforeinstall: .PATH: ${.CURDIR}/${RTLD_ARCH} +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/sbin/devd/Makefile ============================================================================== --- head/sbin/devd/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/sbin/devd/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -18,6 +18,7 @@ CFLAGS+=-I. -I${.CURDIR} CLEANFILES= y.output +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/sbin/dhclient/Makefile ============================================================================== --- head/sbin/dhclient/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/sbin/dhclient/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -46,6 +46,7 @@ LIBADD= util WARNS?= 2 +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/sbin/growfs/Makefile ============================================================================== --- head/sbin/growfs/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/sbin/growfs/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -22,6 +22,7 @@ NO_WCAST_ALIGN= yes LIBADD= util +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/sbin/ifconfig/Makefile ============================================================================== --- head/sbin/ifconfig/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/sbin/ifconfig/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -67,6 +67,7 @@ MAN= ifconfig.8 CFLAGS+= -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wnested-externs WARNS?= 2 +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/sbin/mdconfig/Makefile ============================================================================== --- head/sbin/mdconfig/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/sbin/mdconfig/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -8,6 +8,7 @@ MAN= mdconfig.8 LIBADD= util geom +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/sbin/pfctl/Makefile ============================================================================== --- head/sbin/pfctl/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/sbin/pfctl/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -31,6 +31,7 @@ YFLAGS= LIBADD= m md +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/share/examples/Makefile ============================================================================== --- head/share/examples/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/share/examples/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -266,6 +266,7 @@ SUBDIR+=pf .endif .endif +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests SUBDIR_PARALLEL= Modified: head/share/zoneinfo/Makefile ============================================================================== --- head/share/zoneinfo/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/share/zoneinfo/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -131,6 +131,7 @@ afterinstall: echo "Run tzsetup(8) manually to update /etc/localtime."; \ fi +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/tests/Makefile ============================================================================== --- head/tests/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/tests/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -17,4 +17,5 @@ afterinstall: install-tests-local install-tests-local: .PHONY ${INSTALL_SYMLINK} ../local/tests ${DESTDIR}${TESTSDIR}/local +.include "Makefile.inc0" .include Copied: head/tests/Makefile.inc0 (from r322126, projects/make-check-sandbox/tests/Makefile.inc0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/Makefile.inc0 Mon Aug 14 19:21:37 2017 (r322515, copy of r322126, projects/make-check-sandbox/tests/Makefile.inc0) @@ -0,0 +1,8 @@ +# $FreeBSD$ + +# tests/... doesn't conform to bsd.lib.mk and bsd.prog.mk, so specify a sane +# default for MK_CHECK_USE_SANDBOX. src.opts.mk will override the value if the +# user sets it to no. +MK_CHECK_USE_SANDBOX= yes + +.include Copied: head/tests/etc/Makefile.inc (from r322126, projects/make-check-sandbox/tests/etc/Makefile.inc) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/etc/Makefile.inc Mon Aug 14 19:21:37 2017 (r322515, copy of r322126, projects/make-check-sandbox/tests/etc/Makefile.inc) @@ -0,0 +1,3 @@ +# $FreeBSD$ + +.include "${SRCTOP}/tests/Makefile.inc0" Modified: head/tests/sys/Makefile.inc ============================================================================== --- head/tests/sys/Makefile.inc Mon Aug 14 19:18:50 2017 (r322514) +++ head/tests/sys/Makefile.inc Mon Aug 14 19:21:37 2017 (r322515) @@ -1,3 +1,5 @@ # $FreeBSD$ WARNS?= 6 + +.include "${SRCTOP}/tests/Makefile.inc0" Copied: head/tests/sys/geom/class/Makefile.inc (from r322126, projects/make-check-sandbox/tests/sys/geom/class/Makefile.inc) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/geom/class/Makefile.inc Mon Aug 14 19:21:37 2017 (r322515, copy of r322126, projects/make-check-sandbox/tests/sys/geom/class/Makefile.inc) @@ -0,0 +1,3 @@ +# $FreeBSD$ + +.include "${SRCTOP}/tests/Makefile.inc0" Copied: head/tests/sys/pjdfstest/Makefile.inc (from r322126, projects/make-check-sandbox/tests/sys/pjdfstest/Makefile.inc) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/pjdfstest/Makefile.inc Mon Aug 14 19:21:37 2017 (r322515, copy of r322126, projects/make-check-sandbox/tests/sys/pjdfstest/Makefile.inc) @@ -0,0 +1,3 @@ +# $FreeBSD$ + +.include "${SRCTOP}/tests/Makefile.inc0" Copied: head/tests/sys/pjdfstest/tests/Makefile.inc (from r322126, projects/make-check-sandbox/tests/sys/pjdfstest/tests/Makefile.inc) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/pjdfstest/tests/Makefile.inc Mon Aug 14 19:21:37 2017 (r322515, copy of r322126, projects/make-check-sandbox/tests/sys/pjdfstest/tests/Makefile.inc) @@ -0,0 +1,3 @@ +# $FreeBSD$ + +.include "../Makefile.inc" Modified: head/usr.bin/apply/Makefile ============================================================================== --- head/usr.bin/apply/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/usr.bin/apply/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -7,6 +7,7 @@ PROG= apply LIBADD= sbuf +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/usr.bin/basename/Makefile ============================================================================== --- head/usr.bin/basename/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/usr.bin/basename/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -6,6 +6,7 @@ PROG= basename MLINKS= basename.1 dirname.1 +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/usr.bin/bsdcat/Makefile ============================================================================== --- head/usr.bin/bsdcat/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/usr.bin/bsdcat/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -24,6 +24,7 @@ LIBADD= archive CFLAGS+= -DHAVE_ICONV=1 -DHAVE_ICONV_H=1 -DICONV_CONST=const .endif +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/usr.bin/calendar/Makefile ============================================================================== --- head/usr.bin/calendar/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/usr.bin/calendar/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -33,6 +33,7 @@ beforeinstall: ${DESTDIR}${SHAREDIR}/calendar/${link} .endfor +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/usr.bin/cmp/Makefile ============================================================================== --- head/usr.bin/cmp/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/usr.bin/cmp/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -6,6 +6,7 @@ PROG= cmp SRCS= cmp.c link.c misc.c regular.c special.c +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/usr.bin/col/Makefile ============================================================================== --- head/usr.bin/col/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/usr.bin/col/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -5,6 +5,7 @@ PROG= col +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/usr.bin/comm/Makefile ============================================================================== --- head/usr.bin/comm/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/usr.bin/comm/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -5,6 +5,7 @@ PROG= comm +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/usr.bin/compress/Makefile ============================================================================== --- head/usr.bin/compress/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/usr.bin/compress/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -11,6 +11,7 @@ MLINKS= compress.1 uncompress.1 # XXX zopen is not part of libc # MAN=zopen.3 +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/usr.bin/cpio/Makefile ============================================================================== --- head/usr.bin/cpio/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/usr.bin/cpio/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -32,6 +32,7 @@ CFLAGS+= -DHAVE_ICONV=1 -DHAVE_ICONV_H=1 -DICONV_CONST SYMLINKS=bsdcpio ${BINDIR}/cpio MLINKS= bsdcpio.1 cpio.1 +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/usr.bin/csplit/Makefile ============================================================================== --- head/usr.bin/csplit/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/usr.bin/csplit/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -4,6 +4,7 @@ PROG= csplit +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/usr.bin/cut/Makefile ============================================================================== --- head/usr.bin/cut/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/usr.bin/cut/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -5,6 +5,7 @@ PROG= cut +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/usr.bin/diff/Makefile ============================================================================== --- head/usr.bin/diff/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/usr.bin/diff/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -5,6 +5,7 @@ PROG= diff SRCS= diff.c diffdir.c diffreg.c xmalloc.c +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/usr.bin/diff3/Makefile ============================================================================== --- head/usr.bin/diff3/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/usr.bin/diff3/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -4,6 +4,7 @@ PROG= diff3 +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/usr.bin/dirname/Makefile ============================================================================== --- head/usr.bin/dirname/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/usr.bin/dirname/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -6,6 +6,7 @@ PROG= dirname MAN= +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/usr.bin/du/Makefile ============================================================================== --- head/usr.bin/du/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/usr.bin/du/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -6,6 +6,7 @@ PROG= du LIBADD= util +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/usr.bin/file2c/Makefile ============================================================================== --- head/usr.bin/file2c/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/usr.bin/file2c/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -4,6 +4,7 @@ PROG= file2c +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/usr.bin/getconf/Makefile ============================================================================== --- head/usr.bin/getconf/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/usr.bin/getconf/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -37,6 +37,7 @@ conflicting.names: confstr.names limits.names sysconf. unique.names: conflicting.names LC_ALL=C sort -u ${.ALLSRC} >${.TARGET} +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/usr.bin/grep/Makefile ============================================================================== --- head/usr.bin/grep/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/usr.bin/grep/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -92,6 +92,7 @@ LIBADD+= gnuregex CFLAGS+= -DWITHOUT_NLS .endif +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/usr.bin/gzip/Makefile ============================================================================== --- head/usr.bin/gzip/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/usr.bin/gzip/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -27,6 +27,7 @@ LINKS+= ${BINDIR}/gzip ${BINDIR}/gunzip \ ${BINDIR}/gzip ${BINDIR}/zcat \ ${BINDIR}/zdiff ${BINDIR}/zcmp +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/usr.bin/hexdump/Makefile ============================================================================== --- head/usr.bin/hexdump/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/usr.bin/hexdump/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -10,6 +10,7 @@ MLINKS= hexdump.1 hd.1 LINKS= ${BINDIR}/hexdump ${BINDIR}/od LINKS+= ${BINDIR}/hexdump ${BINDIR}/hd +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/usr.bin/ident/Makefile ============================================================================== --- head/usr.bin/ident/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/usr.bin/ident/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -6,6 +6,7 @@ PROG= ident LIBADD= sbuf +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/usr.bin/indent/Makefile ============================================================================== --- head/usr.bin/indent/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/usr.bin/indent/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -8,6 +8,7 @@ SRCS= indent.c io.c lexi.c parse.c pr_comment.c args.c NO_WMISSING_VARIABLE_DECLARATIONS= +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/usr.bin/join/Makefile ============================================================================== --- head/usr.bin/join/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/usr.bin/join/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -5,6 +5,7 @@ PROG= join +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/usr.bin/jot/Makefile ============================================================================== --- head/usr.bin/jot/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/usr.bin/jot/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -5,6 +5,7 @@ PROG= jot +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/usr.bin/lastcomm/Makefile ============================================================================== --- head/usr.bin/lastcomm/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/usr.bin/lastcomm/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -8,6 +8,7 @@ PACKAGE=acct PROG= lastcomm SRCS= lastcomm.c readrec.c +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/usr.bin/limits/Makefile ============================================================================== --- head/usr.bin/limits/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/usr.bin/limits/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -5,6 +5,7 @@ PROG= limits LIBADD= util +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/usr.bin/m4/Makefile ============================================================================== --- head/usr.bin/m4/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/usr.bin/m4/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -20,6 +20,7 @@ tokenizer.o: parser.h CLEANFILES+= parser.c parser.h tokenizer.o +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/usr.bin/mkimg/Makefile ============================================================================== --- head/usr.bin/mkimg/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/usr.bin/mkimg/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -35,6 +35,7 @@ LIBADD= util WARNS?= 6 +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/usr.bin/ncal/Makefile ============================================================================== --- head/usr.bin/ncal/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/usr.bin/ncal/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -9,6 +9,7 @@ LIBADD= calendar ncursesw LINKS= ${BINDIR}/ncal ${BINDIR}/cal MLINKS= ncal.1 cal.1 +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/usr.bin/pr/Makefile ============================================================================== --- head/usr.bin/pr/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/usr.bin/pr/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -6,6 +6,7 @@ PROG= pr SRCS= pr.c egetopt.c +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/usr.bin/printf/Makefile ============================================================================== --- head/usr.bin/printf/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/usr.bin/printf/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -5,6 +5,7 @@ PROG= printf +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/usr.bin/procstat/Makefile ============================================================================== --- head/usr.bin/procstat/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/usr.bin/procstat/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -22,6 +22,7 @@ SRCS= procstat.c \ LIBADD+= procstat xo util sbuf +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/usr.bin/sdiff/Makefile ============================================================================== --- head/usr.bin/sdiff/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/usr.bin/sdiff/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -8,6 +8,7 @@ WARNS= 3 MAN1= sdiff.1 +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/usr.bin/sed/Makefile ============================================================================== --- head/usr.bin/sed/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/usr.bin/sed/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -8,6 +8,7 @@ SRCS= compile.c main.c misc.c process.c WARNS?= 2 +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/usr.bin/soelim/Makefile ============================================================================== --- head/usr.bin/soelim/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/usr.bin/soelim/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -4,6 +4,7 @@ PROG= soelim +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/usr.bin/stat/Makefile ============================================================================== --- head/usr.bin/stat/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/usr.bin/stat/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -7,6 +7,7 @@ PROG= stat LINKS= ${BINDIR}/stat ${BINDIR}/readlink MLINKS= stat.1 readlink.1 +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/usr.bin/tail/Makefile ============================================================================== --- head/usr.bin/tail/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/usr.bin/tail/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -6,6 +6,7 @@ PROG= tail SRCS= forward.c misc.c read.c reverse.c tail.c +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/usr.bin/tar/Makefile ============================================================================== --- head/usr.bin/tar/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/usr.bin/tar/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -33,6 +33,7 @@ CFLAGS+= -I${_LIBARCHIVEDIR}/libarchive_fe SYMLINKS= bsdtar ${BINDIR}/tar MLINKS= bsdtar.1 tar.1 +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/usr.bin/timeout/Makefile ============================================================================== --- head/usr.bin/timeout/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/usr.bin/timeout/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -4,6 +4,7 @@ PROG= timeout +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/usr.bin/tr/Makefile ============================================================================== --- head/usr.bin/tr/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/usr.bin/tr/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -6,6 +6,7 @@ PROG= tr SRCS= cmap.c cset.c str.c tr.c +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/usr.bin/truncate/Makefile ============================================================================== --- head/usr.bin/truncate/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/usr.bin/truncate/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -5,6 +5,7 @@ PROG= truncate LIBADD= util +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/usr.bin/uniq/Makefile ============================================================================== --- head/usr.bin/uniq/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/usr.bin/uniq/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -5,6 +5,7 @@ PROG= uniq +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/usr.bin/units/Makefile ============================================================================== --- head/usr.bin/units/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/usr.bin/units/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -8,6 +8,7 @@ FILESDIR= ${SHAREDIR}/misc LIBADD= edit +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/usr.bin/uudecode/Makefile ============================================================================== --- head/usr.bin/uudecode/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/usr.bin/uudecode/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -7,6 +7,7 @@ PROG= uudecode LINKS= ${BINDIR}/uudecode ${BINDIR}/b64decode MAN= +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/usr.bin/uuencode/Makefile ============================================================================== --- head/usr.bin/uuencode/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/usr.bin/uuencode/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -11,6 +11,7 @@ MLINKS= uuencode.1 uudecode.1 \ uuencode.1 b64encode.1 \ b64encode.1 b64decode.1 +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/usr.bin/xargs/Makefile ============================================================================== --- head/usr.bin/xargs/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/usr.bin/xargs/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -6,6 +6,7 @@ PROG= xargs SRCS= xargs.c strnsubst.c +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/usr.bin/xinstall/Makefile ============================================================================== --- head/usr.bin/xinstall/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/usr.bin/xinstall/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -14,6 +14,7 @@ CFLAGS+= -I${SRCTOP}/lib/libnetbsd LIBADD= md +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include Modified: head/usr.bin/xo/Makefile ============================================================================== --- head/usr.bin/xo/Makefile Mon Aug 14 19:18:50 2017 (r322514) +++ head/usr.bin/xo/Makefile Mon Aug 14 19:21:37 2017 (r322515) @@ -18,6 +18,7 @@ CFLAGS+=-I${SRCTOP}/lib/libxo LIBADD= xo util +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Mon Aug 14 22:25:22 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 52749DC4837; Mon, 14 Aug 2017 22:25:22 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2CA35713BC; Mon, 14 Aug 2017 22:25:22 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7EMPLgG094786; Mon, 14 Aug 2017 22:25:21 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7EMPK31094781; Mon, 14 Aug 2017 22:25:20 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201708142225.v7EMPK31094781@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 14 Aug 2017 22:25:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322521 - in head/gnu/usr.bin: binutils binutils/ld binutils/libbfd cc X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/gnu/usr.bin: binutils binutils/ld binutils/libbfd cc X-SVN-Commit-Revision: 322521 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Aug 2017 22:25:22 -0000 Author: imp Date: Mon Aug 14 22:25:20 2017 New Revision: 322521 URL: https://svnweb.freebsd.org/changeset/base/322521 Log: Convert all the arm big endian tests into a regexp rather than a list. Suggested by: emaste@ Modified: head/gnu/usr.bin/binutils/Makefile.inc0 head/gnu/usr.bin/binutils/ld/Makefile.arm head/gnu/usr.bin/binutils/libbfd/Makefile.arm head/gnu/usr.bin/cc/Makefile.inc head/gnu/usr.bin/cc/Makefile.tgt Modified: head/gnu/usr.bin/binutils/Makefile.inc0 ============================================================================== --- head/gnu/usr.bin/binutils/Makefile.inc0 Mon Aug 14 21:48:50 2017 (r322520) +++ head/gnu/usr.bin/binutils/Makefile.inc0 Mon Aug 14 22:25:20 2017 (r322521) @@ -16,7 +16,7 @@ TARGET_VENDOR?= unknown TARGET_OS?= freebsd BINUTILS_ARCH=${TARGET_ARCH:C/amd64/x86_64/} TARGET_TUPLE?= ${BINUTILS_ARCH}-${TARGET_VENDOR}-${TARGET_OS} -.if ${TARGET_ARCH} == "armeb" || ${TARGET_ARCH} == "armv6eb" || \ +.if ${TARGET_ARCH:Marm*eb} != "" || \ (${TARGET_CPUARCH} == "mips" && ${TARGET_ARCH:Mmips*el*} == "") TARGET_BIG_ENDIAN=t .endif Modified: head/gnu/usr.bin/binutils/ld/Makefile.arm ============================================================================== --- head/gnu/usr.bin/binutils/ld/Makefile.arm Mon Aug 14 21:48:50 2017 (r322520) +++ head/gnu/usr.bin/binutils/ld/Makefile.arm Mon Aug 14 22:25:20 2017 (r322521) @@ -1,6 +1,6 @@ # $FreeBSD$ -.if ${TARGET_ARCH} == "armeb" || ${TARGET_ARCH} == "armv6eb" +.if ${TARGET_ARCH:Marm*eb} != "" NATIVE_EMULATION= armelfb_fbsd .else NATIVE_EMULATION= armelf_fbsd Modified: head/gnu/usr.bin/binutils/libbfd/Makefile.arm ============================================================================== --- head/gnu/usr.bin/binutils/libbfd/Makefile.arm Mon Aug 14 21:48:50 2017 (r322520) +++ head/gnu/usr.bin/binutils/libbfd/Makefile.arm Mon Aug 14 22:25:20 2017 (r322521) @@ -1,6 +1,6 @@ # $FreeBSD$ -.if ${TARGET_ARCH} == "armeb" || ${TARGET_ARCH} == "armv6eb" +.if ${TARGET_ARCH:Marm*eb} != "" DEFAULT_VECTOR= bfd_elf32_bigarm_vec .else DEFAULT_VECTOR= bfd_elf32_littlearm_vec @@ -14,7 +14,7 @@ SRCS+= cpu-arm.c \ elflink.c VECS+= ${DEFAULT_VECTOR} -.if ${TARGET_ARCH} == "armeb" || ${TARGET_ARCH} == "armv6eb" +.if ${TARGET_ARCH:Marm*eb} != "" VECS+= bfd_elf32_littlearm_vec .else VECS+= bfd_elf32_bigarm_vec Modified: head/gnu/usr.bin/cc/Makefile.inc ============================================================================== --- head/gnu/usr.bin/cc/Makefile.inc Mon Aug 14 21:48:50 2017 (r322520) +++ head/gnu/usr.bin/cc/Makefile.inc Mon Aug 14 22:25:20 2017 (r322521) @@ -31,7 +31,7 @@ CFLAGS+= -DCROSS_DIRECTORY_STRUCTURE CFLAGS+= -DTARGET_ARM_EABI .endif -.if ${TARGET_ARCH} == "armeb" || ${TARGET_ARCH} == "armv6eb" +.if ${TARGET_ARCH:Marm*eb} != "" CFLAGS += -DTARGET_ENDIAN_DEFAULT=MASK_BIG_END .endif .if ${TARGET_ARCH} == "armv6" || ${TARGET_ARCH} == "armv6eb" Modified: head/gnu/usr.bin/cc/Makefile.tgt ============================================================================== --- head/gnu/usr.bin/cc/Makefile.tgt Mon Aug 14 21:48:50 2017 (r322520) +++ head/gnu/usr.bin/cc/Makefile.tgt Mon Aug 14 22:25:20 2017 (r322521) @@ -14,7 +14,7 @@ GCC_CPU=${TARGET_CPUARCH:C/amd64/i386/:C/powerpc/rs600 .if ${TARGET_ARCH} == "sparc64" TARGET_CPU_DEFAULT= TARGET_CPU_ultrasparc .endif -.if ${TARGET_ARCH} == "armeb" || ${TARGET_ARCH} == "armv6eb" || \ +.if ${TARGET_ARCH:Marm*eb} != "" || \ (${TARGET_CPUARCH} == "mips" && ${TARGET_ARCH:Mmips*el*} == "") TARGET_BIG_ENDIAN=t .endif From owner-svn-src-head@freebsd.org Mon Aug 14 22:38:55 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D26FADC5582; Mon, 14 Aug 2017 22:38:55 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A1BB471B87; Mon, 14 Aug 2017 22:38:55 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7EMcsaE099544; Mon, 14 Aug 2017 22:38:54 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7EMcsWW099543; Mon, 14 Aug 2017 22:38:54 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201708142238.v7EMcsWW099543@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 14 Aug 2017 22:38:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322522 - head/lib/libcompiler_rt X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/lib/libcompiler_rt X-SVN-Commit-Revision: 322522 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Aug 2017 22:38:55 -0000 Author: imp Date: Mon Aug 14 22:38:54 2017 New Revision: 322522 URL: https://svnweb.freebsd.org/changeset/base/322522 Log: There is no MACHINE_CPUARCH == armv6, remove redunant check. Modified: head/lib/libcompiler_rt/Makefile.inc Modified: head/lib/libcompiler_rt/Makefile.inc ============================================================================== --- head/lib/libcompiler_rt/Makefile.inc Mon Aug 14 22:25:20 2017 (r322521) +++ head/lib/libcompiler_rt/Makefile.inc Mon Aug 14 22:38:54 2017 (r322522) @@ -184,7 +184,7 @@ SRCF+= umodsi3 .endif # FreeBSD-specific atomic intrinsics. -.if ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "armv6" +.if ${MACHINE_CPUARCH} == "arm" .PATH: ${SRCTOP}/sys/arm/arm SRCF+= stdatomic From owner-svn-src-head@freebsd.org Tue Aug 15 02:21:03 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F0598DD5061; Tue, 15 Aug 2017 02:21:03 +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 mx1.freebsd.org (Postfix) with ESMTPS id BDE957DF6A; Tue, 15 Aug 2017 02:21:03 +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 v7F2L2b8089190; Tue, 15 Aug 2017 02:21:02 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7F2L2Xg089188; Tue, 15 Aug 2017 02:21:02 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201708150221.v7F2L2Xg089188@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Tue, 15 Aug 2017 02:21:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322526 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 322526 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Aug 2017 02:21:04 -0000 Author: cem Date: Tue Aug 15 02:21:02 2017 New Revision: 322526 URL: https://svnweb.freebsd.org/changeset/base/322526 Log: Fix a couple of comment typos No functional change. Submitted by: Anton Rang Sponsored by: Dell EMC Isilon Modified: head/sys/kern/kern_ktr.c head/sys/kern/subr_smp.c Modified: head/sys/kern/kern_ktr.c ============================================================================== --- head/sys/kern/kern_ktr.c Tue Aug 15 01:22:39 2017 (r322525) +++ head/sys/kern/kern_ktr.c Tue Aug 15 02:21:02 2017 (r322526) @@ -416,7 +416,7 @@ DB_SHOW_COMMAND(ktr, db_ktr_all) tstate.first = -1; db_ktr_verbose = 0; db_ktr_verbose |= (strchr(modif, 'v') != NULL) ? 2 : 0; - db_ktr_verbose |= (strchr(modif, 'V') != NULL) ? 1 : 0; /* just timestap please */ + db_ktr_verbose |= (strchr(modif, 'V') != NULL) ? 1 : 0; /* just timestamp please */ if (strchr(modif, 'a') != NULL) { db_disable_pager(); while (cncheckc() == -1) Modified: head/sys/kern/subr_smp.c ============================================================================== --- head/sys/kern/subr_smp.c Tue Aug 15 01:22:39 2017 (r322525) +++ head/sys/kern/subr_smp.c Tue Aug 15 02:21:02 2017 (r322526) @@ -823,7 +823,7 @@ smp_no_rendezvous_barrier(void *dummy) } /* - * Wait specified idle threads to switch once. This ensures that even + * Wait for specified idle threads to switch once. This ensures that even * preempted threads have cycled through the switch function once, * exiting their codepaths. This allows us to change global pointers * with no other synchronization. From owner-svn-src-head@freebsd.org Tue Aug 15 06:01:37 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B64E0DE4DD8; Tue, 15 Aug 2017 06:01:37 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 80E4C2022; Tue, 15 Aug 2017 06:01:37 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7F61aJ5080918; Tue, 15 Aug 2017 06:01:36 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7F61aPS080917; Tue, 15 Aug 2017 06:01:36 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201708150601.v7F61aPS080917@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 15 Aug 2017 06:01:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322527 - head/sys/mips/atheros X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: head/sys/mips/atheros X-SVN-Commit-Revision: 322527 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Aug 2017 06:01:37 -0000 Author: delphij Date: Tue Aug 15 06:01:36 2017 New Revision: 322527 URL: https://svnweb.freebsd.org/changeset/base/322527 Log: Plug memory leak in arge_encap(). Reported by: Ilja Van Sprundel Submitted by: Domagoj Stolfa Reviewed by: adrian MFC after: 3 days Modified: head/sys/mips/atheros/if_arge.c Modified: head/sys/mips/atheros/if_arge.c ============================================================================== --- head/sys/mips/atheros/if_arge.c Tue Aug 15 02:21:02 2017 (r322526) +++ head/sys/mips/atheros/if_arge.c Tue Aug 15 06:01:36 2017 (r322527) @@ -1516,6 +1516,7 @@ arge_encap(struct arge_softc *sc, struct mbuf **m_head sc->stats.tx_pkts_unaligned++; m = m_defrag(*m_head, M_NOWAIT); if (m == NULL) { + m_freem(*m_head); *m_head = NULL; return (ENOBUFS); } From owner-svn-src-head@freebsd.org Tue Aug 15 08:44:37 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E38E9DC5149; Tue, 15 Aug 2017 08:44:37 +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 mx1.freebsd.org (Postfix) with ESMTPS id B0C8365C21; Tue, 15 Aug 2017 08:44:37 +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 v7F8iamM045636; Tue, 15 Aug 2017 08:44:36 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7F8ia4U045635; Tue, 15 Aug 2017 08:44:36 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708150844.v7F8ia4U045635@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 15 Aug 2017 08:44:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322530 - head/sys/dev/usb/quirk X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/dev/usb/quirk X-SVN-Commit-Revision: 322530 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Aug 2017 08:44:38 -0000 Author: hselasky Date: Tue Aug 15 08:44:36 2017 New Revision: 322530 URL: https://svnweb.freebsd.org/changeset/base/322530 Log: Add new USB quirk. Submitted by: devel@stasyan.com PR: 221328 MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/usb/quirk/usb_quirk.c Modified: head/sys/dev/usb/quirk/usb_quirk.c ============================================================================== --- head/sys/dev/usb/quirk/usb_quirk.c Tue Aug 15 08:29:03 2017 (r322529) +++ head/sys/dev/usb/quirk/usb_quirk.c Tue Aug 15 08:44:36 2017 (r322530) @@ -333,7 +333,7 @@ static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRK UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_IGNORE_RESIDUE, UQ_MSC_NO_START_STOP), USB_QUIRK(PROLIFIC, PL2506, 0x0000, 0xffff, - UQ_MSC_NO_SYNC_CACHE), + UQ_MSC_NO_SYNC_CACHE, UQ_MSC_NO_PREVENT_ALLOW), USB_QUIRK_VP(USB_VENDOR_SAMSUNG_TECHWIN, USB_PRODUCT_SAMSUNG_TECHWIN_DIGIMAX_410, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY), From owner-svn-src-head@freebsd.org Tue Aug 15 14:03:28 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 30126DD5E2F; Tue, 15 Aug 2017 14:03:28 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ED40D7105C; Tue, 15 Aug 2017 14:03:27 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7FE3Rec075953; Tue, 15 Aug 2017 14:03:27 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7FE3R9P075952; Tue, 15 Aug 2017 14:03:27 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201708151403.v7FE3R9P075952@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Tue, 15 Aug 2017 14:03:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322542 - head/sys/boot/efi/loader/arch/amd64 X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/sys/boot/efi/loader/arch/amd64 X-SVN-Commit-Revision: 322542 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Aug 2017 14:03:28 -0000 Author: tsoome Date: Tue Aug 15 14:03:26 2017 New Revision: 322542 URL: https://svnweb.freebsd.org/changeset/base/322542 Log: loader.efi: repace XXX with real comments in trap.c There are two missing comments marked as XXX in trap.c, fix this. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D12035 Modified: head/sys/boot/efi/loader/arch/amd64/trap.c Modified: head/sys/boot/efi/loader/arch/amd64/trap.c ============================================================================== --- head/sys/boot/efi/loader/arch/amd64/trap.c Tue Aug 15 14:02:57 2017 (r322541) +++ head/sys/boot/efi/loader/arch/amd64/trap.c Tue Aug 15 14:03:26 2017 (r322542) @@ -84,7 +84,11 @@ void report_exc(struct trapframe *tf) { - /* XXX using printf */ + /* + * printf() depends on loader runtime and UEFI firmware health + * to produce the console output, in case of exception, the + * loader or firmware runtime may fail to support the printf(). + */ printf("====================================================" "============================\n"); printf("Exception %u\n", tf->tf_trapno); @@ -122,7 +126,13 @@ prepare_exception(unsigned idx, uint64_t my_handler, ist_use_table[fw_idt_e->gd_ist]++; loader_idt_e->gd_looffset = my_handler; loader_idt_e->gd_hioffset = my_handler >> 16; - loader_idt_e->gd_selector = fw_idt_e->gd_selector; /* XXX */ + /* + * We reuse uefi selector for the code segment for the exception + * handler code, while the reason for the fault might be the + * corruption of that gdt entry. On the other hand, allocating + * our own descriptor might be not much better, if gdt is corrupted. + */ + loader_idt_e->gd_selector = fw_idt_e->gd_selector; loader_idt_e->gd_ist = 0; loader_idt_e->gd_type = SDT_SYSIGT; loader_idt_e->gd_dpl = 0; From owner-svn-src-head@freebsd.org Tue Aug 15 15:08:20 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E5802DD9D02; Tue, 15 Aug 2017 15:08:20 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B512B732C9; Tue, 15 Aug 2017 15:08:20 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7FF8JDF000771; Tue, 15 Aug 2017 15:08:19 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7FF8JtQ000770; Tue, 15 Aug 2017 15:08:19 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201708151508.v7FF8JtQ000770@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 15 Aug 2017 15:08:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322544 - head/release X-SVN-Group: head X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: head/release X-SVN-Commit-Revision: 322544 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Aug 2017 15:08:21 -0000 Author: gjb Date: Tue Aug 15 15:08:19 2017 New Revision: 322544 URL: https://svnweb.freebsd.org/changeset/base/322544 Log: Always expand the full path to the configuration file specified with the '-c' flag. MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/release/release.sh Modified: head/release/release.sh ============================================================================== --- head/release/release.sh Tue Aug 15 14:21:44 2017 (r322543) +++ head/release/release.sh Tue Aug 15 15:08:19 2017 (r322544) @@ -397,7 +397,7 @@ main() { while getopts c: opt; do case ${opt} in c) - RELEASECONF="${OPTARG}" + RELEASECONF="$(realpath ${OPTARG})" ;; \?) usage From owner-svn-src-head@freebsd.org Tue Aug 15 15:13:34 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9527CDDA347; Tue, 15 Aug 2017 15:13:34 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6EA31738B9; Tue, 15 Aug 2017 15:13:34 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7FFDXgD004743; Tue, 15 Aug 2017 15:13:33 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7FFDXEQ004740; Tue, 15 Aug 2017 15:13:33 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201708151513.v7FFDXEQ004740@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 15 Aug 2017 15:13:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322545 - in head: . release/packages X-SVN-Group: head X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: in head: . release/packages X-SVN-Commit-Revision: 322545 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Aug 2017 15:13:34 -0000 Author: gjb Date: Tue Aug 15 15:13:33 2017 New Revision: 322545 URL: https://svnweb.freebsd.org/changeset/base/322545 Log: Revert r322327, r322352, r322358: Disconnect the dependency on the kernel package from the runtime package. There are a number of problems here: 1) The runtime package installed into a chroot or a jail would include the kernel package, changing the behavior of how jails work now [1]; 2) As result of (1), it is possible a binary may incorrectly resolve kernel symbols [2]; in addition, it is possible there will be unexpected fallout with 32-bit jails on a 64-bit host kernel [2]. Noticed by: brd [1] Discussed with: kib [2] MFC after: 3 days MFC note: record-only to wipe from the merge tracker Sponsored by: The FreeBSD Foundation Modified: head/Makefile.inc1 head/release/packages/kernel.ucl head/release/packages/runtime.ucl Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Tue Aug 15 15:08:19 2017 (r322544) +++ head/Makefile.inc1 Tue Aug 15 15:13:33 2017 (r322545) @@ -1634,7 +1634,6 @@ create-world-package-${pkgname}: .PHONY /^version/ { print $$2; next } \ ' ${WSTAGEDIR}/${pkgname}.ucl @if [ "${pkgname}" == "runtime" ]; then \ - sed -i '' -e "s/%KERNCONF%/${INSTALLKERNEL:tl}/" ${WSTAGEDIR}/${pkgname}.ucl ; \ sed -i '' -e "s/%VCS_REVISION%/${VCS_REVISION}/" ${WSTAGEDIR}/${pkgname}.ucl ; \ fi ${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh -o ALLOW_BASE_SHLIBS=yes \ Modified: head/release/packages/kernel.ucl ============================================================================== --- head/release/packages/kernel.ucl Tue Aug 15 15:08:19 2017 (r322544) +++ head/release/packages/kernel.ucl Tue Aug 15 15:13:33 2017 (r322545) @@ -16,43 +16,6 @@ desc = < Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E11BBDDA858; Tue, 15 Aug 2017 15:20:05 +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 mx1.freebsd.org (Postfix) with ESMTPS id AFC5A73B68; Tue, 15 Aug 2017 15:20:05 +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 v7FFK4hJ005010; Tue, 15 Aug 2017 15:20:04 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7FFK49Q005009; Tue, 15 Aug 2017 15:20:04 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201708151520.v7FFK49Q005009@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Tue, 15 Aug 2017 15:20:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322546 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 322546 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Aug 2017 15:20:06 -0000 Author: asomers Date: Tue Aug 15 15:20:04 2017 New Revision: 322546 URL: https://svnweb.freebsd.org/changeset/base/322546 Log: Fix some ZFS debugging messages sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Be more careful about the use of provider names vs vdev names in ZFS_LOG statements. MFC after: 3 weeks Sponsored by: Spectra Logic Corp Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Tue Aug 15 15:13:33 2017 (r322545) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Tue Aug 15 15:20:04 2017 (r322546) @@ -745,7 +745,7 @@ vdev_geom_open_by_guids(vdev_t *vd) ZFS_LOG(1, "Attach by guid [%ju:%ju] succeeded, provider %s.", (uintmax_t)spa_guid(vd->vdev_spa), - (uintmax_t)vd->vdev_guid, vd->vdev_path); + (uintmax_t)vd->vdev_guid, cp->provider->name); } else { ZFS_LOG(1, "Search by guid [%ju:%ju] failed.", (uintmax_t)spa_guid(vd->vdev_spa), @@ -847,12 +847,12 @@ vdev_geom_open(vdev_t *vd, uint64_t *psize, uint64_t * VERIFY(tsd_set(zfs_geom_probe_vdev_key, NULL) == 0); if (cp == NULL) { - ZFS_LOG(1, "Provider %s not found.", vd->vdev_path); + ZFS_LOG(1, "Vdev %s not found.", vd->vdev_path); error = ENOENT; } else if (cp->provider->sectorsize > VDEV_PAD_SIZE || !ISP2(cp->provider->sectorsize)) { ZFS_LOG(1, "Provider %s has unsupported sectorsize.", - vd->vdev_path); + cp->provider->name); vdev_geom_close_locked(vd); error = EINVAL; @@ -870,7 +870,7 @@ vdev_geom_open(vdev_t *vd, uint64_t *psize, uint64_t * } if (error != 0) { printf("ZFS WARNING: Unable to open %s for writing (error=%d).\n", - vd->vdev_path, error); + cp->provider->name, error); vdev_geom_close_locked(vd); cp = NULL; } From owner-svn-src-head@freebsd.org Tue Aug 15 16:39:50 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CBCB5DDEF1D; Tue, 15 Aug 2017 16:39:50 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A11DF76562; Tue, 15 Aug 2017 16:39:50 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7FGdnmw037032; Tue, 15 Aug 2017 16:39:49 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7FGdnsm037029; Tue, 15 Aug 2017 16:39:49 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201708151639.v7FGdnsm037029@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 15 Aug 2017 16:39:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322547 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 322547 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Aug 2017 16:39:50 -0000 Author: markj Date: Tue Aug 15 16:39:49 2017 New Revision: 322547 URL: https://svnweb.freebsd.org/changeset/base/322547 Log: Add vm_page_alloc_after(). This is a variant of vm_page_alloc() which accepts an additional parameter: the page in the object with largest index that is smaller than the requested index. vm_page_alloc() finds this page using a lookup in the object's radix tree, but in some cases its identity is already known, allowing the lookup to be elided. Modify kmem_back() and vm_page_grab_pages() to use vm_page_alloc_after(). vm_page_alloc() is converted into a trivial wrapper of vm_page_alloc_after(). Suggested by: alc Reviewed by: alc, kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D11984 Modified: head/sys/vm/vm_kern.c head/sys/vm/vm_page.c head/sys/vm/vm_page.h Modified: head/sys/vm/vm_kern.c ============================================================================== --- head/sys/vm/vm_kern.c Tue Aug 15 15:20:04 2017 (r322546) +++ head/sys/vm/vm_kern.c Tue Aug 15 16:39:49 2017 (r322547) @@ -84,6 +84,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -332,7 +333,7 @@ int kmem_back(vm_object_t object, vm_offset_t addr, vm_size_t size, int flags) { vm_offset_t offset, i; - vm_page_t m; + vm_page_t m, mpred; int pflags; KASSERT(object == kmem_object || object == kernel_object, @@ -341,10 +342,13 @@ kmem_back(vm_object_t object, vm_offset_t addr, vm_siz offset = addr - VM_MIN_KERNEL_ADDRESS; pflags = malloc2vm_flags(flags) | VM_ALLOC_NOBUSY | VM_ALLOC_WIRED; - VM_OBJECT_WLOCK(object); - for (i = 0; i < size; i += PAGE_SIZE) { + i = 0; retry: - m = vm_page_alloc(object, atop(offset + i), pflags); + VM_OBJECT_WLOCK(object); + mpred = vm_radix_lookup_le(&object->rtree, atop(offset + i)); + for (; i < size; i += PAGE_SIZE, mpred = m) { + m = vm_page_alloc_after(object, atop(offset + i), pflags, + mpred); /* * Ran out of space, free everything up and return. Don't need @@ -355,7 +359,6 @@ retry: VM_OBJECT_WUNLOCK(object); if ((flags & M_NOWAIT) == 0) { VM_WAIT; - VM_OBJECT_WLOCK(object); goto retry; } kmem_unback(object, addr, i); Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Tue Aug 15 15:20:04 2017 (r322546) +++ head/sys/vm/vm_page.c Tue Aug 15 16:39:49 2017 (r322547) @@ -1540,15 +1540,32 @@ vm_page_rename(vm_page_t m, vm_object_t new_object, vm vm_page_t vm_page_alloc(vm_object_t object, vm_pindex_t pindex, int req) { - vm_page_t m, mpred; + + return (vm_page_alloc_after(object, pindex, req, object != NULL ? + vm_radix_lookup_le(&object->rtree, pindex) : NULL)); +} + +/* + * Allocate a page in the specified object with the given page index. To + * optimize insertion of the page into the object, the caller must also specifiy + * the resident page in the object with largest index smaller than the given + * page index, or NULL if no such page exists. + */ +vm_page_t +vm_page_alloc_after(vm_object_t object, vm_pindex_t pindex, int req, + vm_page_t mpred) +{ + vm_page_t m; int flags, req_class; - mpred = NULL; /* XXX: pacify gcc */ KASSERT((object != NULL) == ((req & VM_ALLOC_NOOBJ) == 0) && (object != NULL || (req & VM_ALLOC_SBUSY) == 0) && ((req & (VM_ALLOC_NOBUSY | VM_ALLOC_SBUSY)) != (VM_ALLOC_NOBUSY | VM_ALLOC_SBUSY)), - ("vm_page_alloc: inconsistent object(%p)/req(%x)", object, req)); + ("inconsistent object(%p)/req(%x)", object, req)); + KASSERT(mpred == NULL || mpred->pindex < pindex, + ("mpred %p doesn't precede pindex 0x%jx", mpred, + (uintmax_t)pindex)); if (object != NULL) VM_OBJECT_ASSERT_WLOCKED(object); @@ -1560,12 +1577,6 @@ vm_page_alloc(vm_object_t object, vm_pindex_t pindex, if (curproc == pageproc && req_class != VM_ALLOC_INTERRUPT) req_class = VM_ALLOC_SYSTEM; - if (object != NULL) { - mpred = vm_radix_lookup_le(&object->rtree, pindex); - KASSERT(mpred == NULL || mpred->pindex != pindex, - ("vm_page_alloc: pindex already allocated")); - } - /* * Allocate a page if the number of free pages exceeds the minimum * for the request class. @@ -1612,7 +1623,7 @@ vm_page_alloc(vm_object_t object, vm_pindex_t pindex, /* * At this point we had better have found a good page. */ - KASSERT(m != NULL, ("vm_page_alloc: missing page")); + KASSERT(m != NULL, ("missing page")); vm_phys_freecnt_adj(m, -1); mtx_unlock(&vm_page_queue_free_mtx); vm_page_alloc_check(m); @@ -3185,7 +3196,7 @@ int vm_page_grab_pages(vm_object_t object, vm_pindex_t pindex, int allocflags, vm_page_t *ma, int count) { - vm_page_t m; + vm_page_t m, mpred; int i; bool sleep; @@ -3202,7 +3213,12 @@ vm_page_grab_pages(vm_object_t object, vm_pindex_t pin return (0); i = 0; retrylookup: - m = vm_page_lookup(object, pindex + i); + m = vm_radix_lookup_le(&object->rtree, pindex + i); + if (m == NULL || m->pindex != pindex + i) { + mpred = m; + m = NULL; + } else + mpred = TAILQ_PREV(m, pglist, listq); for (; i < count; i++) { if (m != NULL) { sleep = (allocflags & VM_ALLOC_IGN_SBUSY) != 0 ? @@ -3234,8 +3250,9 @@ retrylookup: if ((allocflags & VM_ALLOC_SBUSY) != 0) vm_page_sbusy(m); } else { - m = vm_page_alloc(object, pindex + i, (allocflags & - ~VM_ALLOC_IGN_SBUSY) | VM_ALLOC_COUNT(count - i)); + m = vm_page_alloc_after(object, pindex + i, + (allocflags & ~VM_ALLOC_IGN_SBUSY) | + VM_ALLOC_COUNT(count - i), mpred); if (m == NULL) { if ((allocflags & VM_ALLOC_NOWAIT) != 0) break; @@ -3250,7 +3267,7 @@ retrylookup: pmap_zero_page(m); m->valid = VM_PAGE_BITS_ALL; } - ma[i] = m; + ma[i] = mpred = m; m = vm_page_next(m); } return (i); Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Tue Aug 15 15:20:04 2017 (r322546) +++ head/sys/vm/vm_page.h Tue Aug 15 16:39:49 2017 (r322547) @@ -464,7 +464,8 @@ void vm_page_free_zero(vm_page_t m); void vm_page_activate (vm_page_t); void vm_page_advise(vm_page_t m, int advice); -vm_page_t vm_page_alloc (vm_object_t, vm_pindex_t, int); +vm_page_t vm_page_alloc(vm_object_t, vm_pindex_t, int); +vm_page_t vm_page_alloc_after(vm_object_t, vm_pindex_t, int, vm_page_t); vm_page_t vm_page_alloc_contig(vm_object_t object, vm_pindex_t pindex, int req, u_long npages, vm_paddr_t low, vm_paddr_t high, u_long alignment, vm_paddr_t boundary, vm_memattr_t memattr); From owner-svn-src-head@freebsd.org Tue Aug 15 17:52:38 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DFE93DE2B66; Tue, 15 Aug 2017 17:52:38 +0000 (UTC) (envelope-from mjoras@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 962CA7CADC; Tue, 15 Aug 2017 17:52:38 +0000 (UTC) (envelope-from mjoras@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7FHqbTP068598; Tue, 15 Aug 2017 17:52:37 GMT (envelope-from mjoras@FreeBSD.org) Received: (from mjoras@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7FHqbK9068597; Tue, 15 Aug 2017 17:52:37 GMT (envelope-from mjoras@FreeBSD.org) Message-Id: <201708151752.v7FHqbK9068597@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjoras set sender to mjoras@FreeBSD.org using -f From: Matt Joras Date: Tue, 15 Aug 2017 17:52:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322548 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: mjoras X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 322548 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Aug 2017 17:52:39 -0000 Author: mjoras Date: Tue Aug 15 17:52:37 2017 New Revision: 322548 URL: https://svnweb.freebsd.org/changeset/base/322548 Log: Rework vlan(4) locking. Previously the locking of vlan(4) interfaces was not very comprehensive. Particularly there was very little protection against the destruction of active vlan(4) interfaces or concurrent modification of a vlan(4) interface. The former readily produced several different panics. The changes can be summarized as using two global vlan locks (an rmlock(9) and an sx(9)) to protect accesses to the if_vlantrunk field of struct ifnet, in addition to other places where global exclusive access is required. vlan(4) should now be much more resilient to the destruction of active interfaces and concurrent calls into the configuration path. PR: 220980 Reviewed by: ae, markj, mav, rstone Approved by: rstone (mentor) MFC after: 4 weeks Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D11370 Modified: head/sys/net/if_vlan.c Modified: head/sys/net/if_vlan.c ============================================================================== --- head/sys/net/if_vlan.c Tue Aug 15 16:39:49 2017 (r322547) +++ head/sys/net/if_vlan.c Tue Aug 15 17:52:37 2017 (r322548) @@ -1,6 +1,7 @@ /*- * Copyright 1998 Massachusetts Institute of Technology * Copyright 2012 ADARA Networks, Inc. + * Copyright 2017 Dell EMC Isilon * * Portions of this software were developed by Robert N. M. Watson under * contract to ADARA Networks, Inc. @@ -63,6 +64,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -101,6 +103,53 @@ struct ifvlantrunk { int refcnt; }; +/* + * This macro provides a facility to iterate over every vlan on a trunk with + * the assumption that none will be added/removed during iteration. + */ +#ifdef VLAN_ARRAY +#define VLAN_FOREACH(_ifv, _trunk) \ + size_t _i; \ + for (_i = 0; _i < VLAN_ARRAY_SIZE; _i++) \ + if (((_ifv) = (_trunk)->vlans[_i]) != NULL) +#else /* VLAN_ARRAY */ +#define VLAN_FOREACH(_ifv, _trunk) \ + struct ifvlan *_next; \ + size_t _i; \ + for (_i = 0; _i < (1 << (_trunk)->hwidth); _i++) \ + LIST_FOREACH_SAFE((_ifv), &(_trunk)->hash[_i], ifv_list, _next) +#endif /* VLAN_ARRAY */ + +/* + * This macro provides a facility to iterate over every vlan on a trunk while + * also modifying the number of vlans on the trunk. The iteration continues + * until some condition is met or there are no more vlans on the trunk. + */ +#ifdef VLAN_ARRAY +/* The VLAN_ARRAY case is simple -- just a for loop using the condition. */ +#define VLAN_FOREACH_UNTIL_SAFE(_ifv, _trunk, _cond) \ + size_t _i; \ + for (_i = 0; !(_cond) && _i < VLAN_ARRAY_SIZE; _i++) \ + if (((_ifv) = (_trunk)->vlans[_i])) +#else /* VLAN_ARRAY */ +/* + * The hash table case is more complicated. We allow for the hash table to be + * modified (i.e. vlans removed) while we are iterating over it. To allow for + * this we must restart the iteration every time we "touch" something during + * the iteration, since removal will resize the hash table and invalidate our + * current position. If acting on the touched element causes the trunk to be + * emptied, then iteration also stops. + */ +#define VLAN_FOREACH_UNTIL_SAFE(_ifv, _trunk, _cond) \ + size_t _i; \ + bool _touch = false; \ + for (_i = 0; \ + !(_cond) && _i < (1 << (_trunk)->hwidth); \ + _i = (_touch && ((_trunk) != NULL) ? 0 : _i + 1), _touch = false) \ + if (((_ifv) = LIST_FIRST(&(_trunk)->hash[_i])) != NULL && \ + (_touch = true)) +#endif /* VLAN_ARRAY */ + struct vlan_mc_entry { struct sockaddr_dl mc_addr; SLIST_ENTRY(vlan_mc_entry) mc_entries; @@ -123,6 +172,7 @@ struct ifvlan { uint16_t ifvm_vid; /* VLAN ID */ uint8_t ifvm_pcp; /* Priority Code Point (PCP). */ } ifv_mib; + struct task lladdr_task; SLIST_HEAD(, vlan_mc_entry) vlan_mc_listhead; #ifndef VLAN_ARRAY LIST_ENTRY(ifvlan) ifv_list; @@ -173,33 +223,92 @@ static eventhandler_tag ifdetach_tag; static eventhandler_tag iflladdr_tag; /* - * We have a global mutex, that is used to serialize configuration - * changes and isn't used in normal packet delivery. + * if_vlan uses two module-level locks to allow concurrent modification of vlan + * interfaces and (mostly) allow for vlans to be destroyed while they are being + * used for tx/rx. To accomplish this in a way that has acceptable performance + * and cooperation with other parts of the network stack there is a + * non-sleepable rmlock(9) and an sx(9). Both locks are exclusively acquired + * when destroying a vlan interface, i.e. when the if_vlantrunk field of struct + * ifnet is de-allocated and NULL'd. Thus a reader holding either lock has a + * guarantee that the struct ifvlantrunk references a valid vlan trunk. * - * We also have a per-trunk rmlock(9), that is locked shared on packet - * processing and exclusive when configuration is changed. + * The performance-sensitive paths that warrant using the rmlock(9) are + * vlan_transmit and vlan_input. Both have to check for the vlan interface's + * existence using if_vlantrunk, and being in the network tx/rx paths the use + * of an rmlock(9) gives a measureable improvement in performance. * + * The reason for having an sx(9) is mostly because there are still areas that + * must be sleepable and also have safe concurrent access to a vlan interface. + * Since the sx(9) exists, it is used by default in most paths unless sleeping + * is not permitted, or if it is not clear whether sleeping is permitted. + * + * Note that despite these protections, there is still an inherent race in the + * destruction of vlans since there's no guarantee that the ifnet hasn't been + * freed/reused when the tx/rx functions are called by the stack. This can only + * be fixed by addressing ifnet's lifetime issues. + */ +#define _VLAN_RM_ID ifv_rm_lock +#define _VLAN_SX_ID ifv_sx + +static struct rmlock _VLAN_RM_ID; +static struct sx _VLAN_SX_ID; + +#define VLAN_LOCKING_INIT() \ + rm_init(&_VLAN_RM_ID, "vlan_rm"); \ + sx_init(&_VLAN_SX_ID, "vlan_sx") + +#define VLAN_LOCKING_DESTROY() \ + rm_destroy(&_VLAN_RM_ID); \ + sx_destroy(&_VLAN_SX_ID) + +#define _VLAN_RM_TRACKER _vlan_rm_tracker +#define VLAN_RLOCK() rm_rlock(&_VLAN_RM_ID, \ + &_VLAN_RM_TRACKER) +#define VLAN_RUNLOCK() rm_runlock(&_VLAN_RM_ID, \ + &_VLAN_RM_TRACKER) +#define VLAN_WLOCK() rm_wlock(&_VLAN_RM_ID) +#define VLAN_WUNLOCK() rm_wunlock(&_VLAN_RM_ID) +#define VLAN_RLOCK_ASSERT() rm_assert(&_VLAN_RM_ID, RA_RLOCKED) +#define VLAN_WLOCK_ASSERT() rm_assert(&_VLAN_RM_ID, RA_WLOCKED) +#define VLAN_RWLOCK_ASSERT() rm_assert(&_VLAN_RM_ID, RA_LOCKED) +#define VLAN_LOCK_READER struct rm_priotracker _VLAN_RM_TRACKER + +#define VLAN_SLOCK() sx_slock(&_VLAN_SX_ID) +#define VLAN_SUNLOCK() sx_sunlock(&_VLAN_SX_ID) +#define VLAN_XLOCK() sx_xlock(&_VLAN_SX_ID) +#define VLAN_XUNLOCK() sx_xunlock(&_VLAN_SX_ID) +#define VLAN_SLOCK_ASSERT() sx_assert(&_VLAN_SX_ID, SA_SLOCKED) +#define VLAN_XLOCK_ASSERT() sx_assert(&_VLAN_SX_ID, SA_XLOCKED) +#define VLAN_SXLOCK_ASSERT() sx_assert(&_VLAN_SX_ID, SA_LOCKED) + + +/* + * We also have a per-trunk rmlock(9), that is locked shared on packet + * processing and exclusive when configuration is changed. Note: This should + * only be acquired while there is a shared lock on either of the global locks + * via VLAN_SLOCK or VLAN_RLOCK. Thus, an exclusive lock on the global locks + * makes a call to TRUNK_RLOCK/TRUNK_WLOCK technically superfluous. + */ +#define _TRUNK_RM_TRACKER _trunk_rm_tracker +#define TRUNK_LOCK_INIT(trunk) rm_init(&(trunk)->lock, vlanname) +#define TRUNK_LOCK_DESTROY(trunk) rm_destroy(&(trunk)->lock) +#define TRUNK_RLOCK(trunk) rm_rlock(&(trunk)->lock, \ + &_TRUNK_RM_TRACKER) +#define TRUNK_WLOCK(trunk) rm_wlock(&(trunk)->lock) +#define TRUNK_RUNLOCK(trunk) rm_runlock(&(trunk)->lock, \ + &_TRUNK_RM_TRACKER) +#define TRUNK_WUNLOCK(trunk) rm_wunlock(&(trunk)->lock) +#define TRUNK_RLOCK_ASSERT(trunk) rm_assert(&(trunk)->lock, RA_RLOCKED) +#define TRUNK_LOCK_ASSERT(trunk) rm_assert(&(trunk)->lock, RA_LOCKED) +#define TRUNK_WLOCK_ASSERT(trunk) rm_assert(&(trunk)->lock, RA_WLOCKED) +#define TRUNK_LOCK_READER struct rm_priotracker _TRUNK_RM_TRACKER + +/* * The VLAN_ARRAY substitutes the dynamic hash with a static array * with 4096 entries. In theory this can give a boost in processing, - * however on practice it does not. Probably this is because array + * however in practice it does not. Probably this is because the array * is too big to fit into CPU cache. */ -static struct sx ifv_lock; -#define VLAN_LOCK_INIT() sx_init(&ifv_lock, "vlan_global") -#define VLAN_LOCK_DESTROY() sx_destroy(&ifv_lock) -#define VLAN_LOCK_ASSERT() sx_assert(&ifv_lock, SA_LOCKED) -#define VLAN_LOCK() sx_xlock(&ifv_lock) -#define VLAN_UNLOCK() sx_xunlock(&ifv_lock) -#define TRUNK_LOCK_INIT(trunk) rm_init(&(trunk)->lock, vlanname) -#define TRUNK_LOCK_DESTROY(trunk) rm_destroy(&(trunk)->lock) -#define TRUNK_LOCK(trunk) rm_wlock(&(trunk)->lock) -#define TRUNK_UNLOCK(trunk) rm_wunlock(&(trunk)->lock) -#define TRUNK_LOCK_ASSERT(trunk) rm_assert(&(trunk)->lock, RA_WLOCKED) -#define TRUNK_RLOCK(trunk) rm_rlock(&(trunk)->lock, &tracker) -#define TRUNK_RUNLOCK(trunk) rm_runlock(&(trunk)->lock, &tracker) -#define TRUNK_LOCK_RASSERT(trunk) rm_assert(&(trunk)->lock, RA_RLOCKED) -#define TRUNK_LOCK_READER struct rm_priotracker tracker - #ifndef VLAN_ARRAY static void vlan_inithash(struct ifvlantrunk *trunk); static void vlan_freehash(struct ifvlantrunk *trunk); @@ -239,6 +348,8 @@ static int vlan_clone_destroy(struct if_clone *, struc static void vlan_ifdetach(void *arg, struct ifnet *ifp); static void vlan_iflladdr(void *arg, struct ifnet *ifp); +static void vlan_lladdr_fn(void *arg, int pending); + static struct if_clone *vlan_cloner; #ifdef VIMAGE @@ -293,7 +404,7 @@ vlan_inshash(struct ifvlantrunk *trunk, struct ifvlan int i, b; struct ifvlan *ifv2; - TRUNK_LOCK_ASSERT(trunk); + TRUNK_WLOCK_ASSERT(trunk); KASSERT(trunk->hwidth > 0, ("%s: hwidth not positive", __func__)); b = 1 << trunk->hwidth; @@ -323,7 +434,7 @@ vlan_remhash(struct ifvlantrunk *trunk, struct ifvlan int i, b; struct ifvlan *ifv2; - TRUNK_LOCK_ASSERT(trunk); + TRUNK_WLOCK_ASSERT(trunk); KASSERT(trunk->hwidth > 0, ("%s: hwidth not positive", __func__)); b = 1 << trunk->hwidth; @@ -351,7 +462,7 @@ vlan_growhash(struct ifvlantrunk *trunk, int howmuch) struct ifvlanhead *hash2; int hwidth2, i, j, n, n2; - TRUNK_LOCK_ASSERT(trunk); + TRUNK_WLOCK_ASSERT(trunk); KASSERT(trunk->hwidth > 0, ("%s: hwidth not positive", __func__)); if (howmuch == 0) { @@ -397,7 +508,7 @@ vlan_gethash(struct ifvlantrunk *trunk, uint16_t vid) { struct ifvlan *ifv; - TRUNK_LOCK_RASSERT(trunk); + TRUNK_RLOCK_ASSERT(trunk); LIST_FOREACH(ifv, &trunk->hash[HASH(vid, trunk->hmask)], ifv_list) if (ifv->ifv_vid == vid) @@ -467,12 +578,11 @@ vlan_inithash(struct ifvlantrunk *trunk) static void trunk_destroy(struct ifvlantrunk *trunk) { - VLAN_LOCK_ASSERT(); + VLAN_XLOCK_ASSERT(); + VLAN_WLOCK_ASSERT(); - TRUNK_LOCK(trunk); vlan_freehash(trunk); trunk->parent->if_vlantrunk = NULL; - TRUNK_UNLOCK(trunk); TRUNK_LOCK_DESTROY(trunk); if_rele(trunk->parent); free(trunk, M_VLAN); @@ -495,9 +605,15 @@ vlan_setmulti(struct ifnet *ifp) struct vlan_mc_entry *mc; int error; + /* + * XXX This stupidly needs the rmlock to avoid sleeping while holding + * the in6_multi_mtx (see in6_mc_join_locked). + */ + VLAN_RWLOCK_ASSERT(); + /* Find the parent. */ sc = ifp->if_softc; - TRUNK_LOCK_ASSERT(TRUNK(sc)); + TRUNK_WLOCK_ASSERT(TRUNK(sc)); ifp_p = PARENT(sc); CURVNET_SET_QUIET(ifp_p->if_vnet); @@ -544,36 +660,42 @@ static void vlan_iflladdr(void *arg __unused, struct ifnet *ifp) { struct ifvlan *ifv; -#ifndef VLAN_ARRAY - struct ifvlan *next; -#endif - int i; + struct ifnet *ifv_ifp; + struct ifvlantrunk *trunk; + struct sockaddr_dl *sdl; + VLAN_LOCK_READER; - /* - * Check if it's a trunk interface first of all - * to avoid needless locking. - */ - if (ifp->if_vlantrunk == NULL) + /* Need the rmlock since this is run on taskqueue_swi. */ + VLAN_RLOCK(); + trunk = ifp->if_vlantrunk; + if (trunk == NULL) { + VLAN_RUNLOCK(); return; + } - VLAN_LOCK(); /* * OK, it's a trunk. Loop over and change all vlan's lladdrs on it. + * We need an exclusive lock here to prevent concurrent SIOCSIFLLADDR + * ioctl calls on the parent garbling the lladdr of the child vlan. */ -#ifdef VLAN_ARRAY - for (i = 0; i < VLAN_ARRAY_SIZE; i++) - if ((ifv = ifp->if_vlantrunk->vlans[i])) { -#else /* VLAN_ARRAY */ - for (i = 0; i < (1 << ifp->if_vlantrunk->hwidth); i++) - LIST_FOREACH_SAFE(ifv, &ifp->if_vlantrunk->hash[i], ifv_list, next) { -#endif /* VLAN_ARRAY */ - VLAN_UNLOCK(); - if_setlladdr(ifv->ifv_ifp, IF_LLADDR(ifp), - ifp->if_addrlen); - VLAN_LOCK(); - } - VLAN_UNLOCK(); - + TRUNK_WLOCK(trunk); + VLAN_FOREACH(ifv, trunk) { + /* + * Copy new new lladdr into the ifv_ifp, enqueue a task + * to actually call if_setlladdr. if_setlladdr needs to + * be deferred to a taskqueue because it will call into + * the if_vlan ioctl path and try to acquire the global + * lock. + */ + ifv_ifp = ifv->ifv_ifp; + bcopy(IF_LLADDR(ifp), IF_LLADDR(ifv_ifp), + ifp->if_addrlen); + sdl = (struct sockaddr_dl *)ifv_ifp->if_addr->ifa_addr; + sdl->sdl_alen = ifp->if_addrlen; + taskqueue_enqueue(taskqueue_thread, &ifv->lladdr_task); + } + TRUNK_WUNLOCK(trunk); + VLAN_RUNLOCK(); } /* @@ -587,46 +709,30 @@ static void vlan_ifdetach(void *arg __unused, struct ifnet *ifp) { struct ifvlan *ifv; - int i; + struct ifvlantrunk *trunk; - /* - * Check if it's a trunk interface first of all - * to avoid needless locking. - */ - if (ifp->if_vlantrunk == NULL) - return; - /* If the ifnet is just being renamed, don't do anything. */ if (ifp->if_flags & IFF_RENAMING) return; + VLAN_XLOCK(); + trunk = ifp->if_vlantrunk; + if (trunk == NULL) { + VLAN_XUNLOCK(); + return; + } - VLAN_LOCK(); /* * OK, it's a trunk. Loop over and detach all vlan's on it. * Check trunk pointer after each vlan_unconfig() as it will * free it and set to NULL after the last vlan was detached. */ -#ifdef VLAN_ARRAY - for (i = 0; i < VLAN_ARRAY_SIZE; i++) - if ((ifv = ifp->if_vlantrunk->vlans[i])) { - vlan_unconfig_locked(ifv->ifv_ifp, 1); - if (ifp->if_vlantrunk == NULL) - break; - } -#else /* VLAN_ARRAY */ -restart: - for (i = 0; i < (1 << ifp->if_vlantrunk->hwidth); i++) - if ((ifv = LIST_FIRST(&ifp->if_vlantrunk->hash[i]))) { - vlan_unconfig_locked(ifv->ifv_ifp, 1); - if (ifp->if_vlantrunk) - goto restart; /* trunk->hwidth can change */ - else - break; - } -#endif /* VLAN_ARRAY */ + VLAN_FOREACH_UNTIL_SAFE(ifv, ifp->if_vlantrunk, + ifp->if_vlantrunk == NULL) + vlan_unconfig_locked(ifv->ifv_ifp, 1); + /* Trunk should have been destroyed in vlan_unconfig(). */ KASSERT(ifp->if_vlantrunk == NULL, ("%s: purge failed", __func__)); - VLAN_UNLOCK(); + VLAN_XUNLOCK(); } /* @@ -636,15 +742,18 @@ static struct ifnet * vlan_trunkdev(struct ifnet *ifp) { struct ifvlan *ifv; + VLAN_LOCK_READER; if (ifp->if_type != IFT_L2VLAN) return (NULL); + + /* Not clear if callers are sleepable, so acquire the rmlock. */ + VLAN_RLOCK(); ifv = ifp->if_softc; ifp = NULL; - VLAN_LOCK(); if (ifv->ifv_trunk) ifp = PARENT(ifv); - VLAN_UNLOCK(); + VLAN_RUNLOCK(); return (ifp); } @@ -706,17 +815,23 @@ vlan_devat(struct ifnet *ifp, uint16_t vid) { struct ifvlantrunk *trunk; struct ifvlan *ifv; + VLAN_LOCK_READER; TRUNK_LOCK_READER; + /* Not clear if callers are sleepable, so acquire the rmlock. */ + VLAN_RLOCK(); trunk = ifp->if_vlantrunk; - if (trunk == NULL) + if (trunk == NULL) { + VLAN_RUNLOCK(); return (NULL); + } ifp = NULL; TRUNK_RLOCK(trunk); ifv = vlan_gethash(trunk, vid); if (ifv) ifp = ifv->ifv_ifp; TRUNK_RUNLOCK(trunk); + VLAN_RUNLOCK(); return (ifp); } @@ -756,7 +871,7 @@ vlan_modevent(module_t mod, int type, void *data) vlan_iflladdr, NULL, EVENTHANDLER_PRI_ANY); if (iflladdr_tag == NULL) return (ENOMEM); - VLAN_LOCK_INIT(); + VLAN_LOCKING_INIT(); vlan_input_p = vlan_input; vlan_link_state_p = vlan_link_state; vlan_trunk_cap_p = vlan_trunk_capabilities; @@ -793,7 +908,7 @@ vlan_modevent(module_t mod, int type, void *data) vlan_cookie_p = NULL; vlan_setcookie_p = NULL; vlan_devat_p = NULL; - VLAN_LOCK_DESTROY(); + VLAN_LOCKING_DESTROY(); if (bootverbose) printf("vlan: unloaded\n"); break; @@ -1014,9 +1129,6 @@ vlan_clone_create(struct if_clone *ifc, char *name, si return (error); } - - /* Update flags on the parent, if necessary. */ - vlan_setflags(ifp, 1); } return (0); @@ -1030,6 +1142,12 @@ vlan_clone_destroy(struct if_clone *ifc, struct ifnet ether_ifdetach(ifp); /* first, remove it from system-wide lists */ vlan_unconfig(ifp); /* now it can be unconfigured and freed */ + /* + * We should have the only reference to the ifv now, so we can now + * drain any remaining lladdr task before freeing the ifnet and the + * ifvlan. + */ + taskqueue_drain(taskqueue_thread, &ifv->lladdr_task); if_free(ifp); free(ifv, M_VLAN); ifc_free_unit(ifc, unit); @@ -1056,8 +1174,16 @@ vlan_transmit(struct ifnet *ifp, struct mbuf *m) struct m_tag *mtag; uint16_t tag; int error, len, mcast; + VLAN_LOCK_READER; + VLAN_RLOCK(); ifv = ifp->if_softc; + if (TRUNK(ifv) == NULL) { + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); + VLAN_RUNLOCK(); + m_freem(m); + return (ENETDOWN); + } p = PARENT(ifv); len = m->m_pkthdr.len; mcast = (m->m_flags & (M_MCAST | M_BCAST)) ? 1 : 0; @@ -1069,8 +1195,9 @@ vlan_transmit(struct ifnet *ifp, struct mbuf *m) * or parent's driver will cause a system crash. */ if (!UP_AND_RUNNING(p)) { - m_freem(m); if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); + VLAN_RUNLOCK(); + m_freem(m); return (ENETDOWN); } @@ -1098,6 +1225,7 @@ vlan_transmit(struct ifnet *ifp, struct mbuf *m) if (n > 0) { if_printf(ifp, "cannot pad short frame\n"); if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); + VLAN_RUNLOCK(); m_freem(m); return (0); } @@ -1123,6 +1251,7 @@ vlan_transmit(struct ifnet *ifp, struct mbuf *m) if (m == NULL) { if_printf(ifp, "unable to prepend VLAN header\n"); if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); + VLAN_RUNLOCK(); return (0); } } @@ -1137,6 +1266,7 @@ vlan_transmit(struct ifnet *ifp, struct mbuf *m) if_inc_counter(ifp, IFCOUNTER_OMCASTS, mcast); } else if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); + VLAN_RUNLOCK(); return (error); } @@ -1151,13 +1281,20 @@ vlan_qflush(struct ifnet *ifp __unused) static void vlan_input(struct ifnet *ifp, struct mbuf *m) { - struct ifvlantrunk *trunk = ifp->if_vlantrunk; + struct ifvlantrunk *trunk; struct ifvlan *ifv; + VLAN_LOCK_READER; TRUNK_LOCK_READER; struct m_tag *mtag; uint16_t vid, tag; - KASSERT(trunk != NULL, ("%s: no trunk", __func__)); + VLAN_RLOCK(); + trunk = ifp->if_vlantrunk; + if (trunk == NULL) { + VLAN_RUNLOCK(); + m_freem(m); + return; + } if (m->m_flags & M_VLANTAG) { /* @@ -1177,6 +1314,7 @@ vlan_input(struct ifnet *ifp, struct mbuf *m) if (m->m_len < sizeof(*evl) && (m = m_pullup(m, sizeof(*evl))) == NULL) { if_printf(ifp, "cannot pullup VLAN header\n"); + VLAN_RUNLOCK(); return; } evl = mtod(m, struct ether_vlan_header *); @@ -1198,8 +1336,9 @@ vlan_input(struct ifnet *ifp, struct mbuf *m) panic("%s: %s has unsupported if_type %u", __func__, ifp->if_xname, ifp->if_type); #endif - m_freem(m); if_inc_counter(ifp, IFCOUNTER_NOPROTO, 1); + VLAN_RUNLOCK(); + m_freem(m); return; } } @@ -1210,8 +1349,9 @@ vlan_input(struct ifnet *ifp, struct mbuf *m) ifv = vlan_gethash(trunk, vid); if (ifv == NULL || !UP_AND_RUNNING(ifv->ifv_ifp)) { TRUNK_RUNLOCK(trunk); - m_freem(m); if_inc_counter(ifp, IFCOUNTER_NOPROTO, 1); + VLAN_RUNLOCK(); + m_freem(m); return; } TRUNK_RUNLOCK(trunk); @@ -1229,8 +1369,9 @@ vlan_input(struct ifnet *ifp, struct mbuf *m) mtag = m_tag_alloc(MTAG_8021Q, MTAG_8021Q_PCP_IN, sizeof(uint8_t), M_NOWAIT); if (mtag == NULL) { - m_freem(m); if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); + VLAN_RUNLOCK(); + m_freem(m); return; } m_tag_prepend(m, mtag); @@ -1240,11 +1381,24 @@ vlan_input(struct ifnet *ifp, struct mbuf *m) m->m_pkthdr.rcvif = ifv->ifv_ifp; if_inc_counter(ifv->ifv_ifp, IFCOUNTER_IPACKETS, 1); + VLAN_RUNLOCK(); /* Pass it back through the parent's input routine. */ (*ifp->if_input)(ifv->ifv_ifp, m); } +static void +vlan_lladdr_fn(void *arg, int pending __unused) +{ + struct ifvlan *ifv; + struct ifnet *ifp; + + ifv = (struct ifvlan *)arg; + ifp = ifv->ifv_ifp; + /* The ifv_ifp already has the lladdr copied in. */ + if_setlladdr(ifp, IF_LLADDR(ifp), ifp->if_addrlen); +} + static int vlan_config(struct ifvlan *ifv, struct ifnet *p, uint16_t vid) { @@ -1271,27 +1425,22 @@ vlan_config(struct ifvlan *ifv, struct ifnet *p, uint1 if (ifv->ifv_trunk) return (EBUSY); + /* Acquire rmlock after the branch so we can M_WAITOK. */ + VLAN_XLOCK(); if (p->if_vlantrunk == NULL) { trunk = malloc(sizeof(struct ifvlantrunk), M_VLAN, M_WAITOK | M_ZERO); vlan_inithash(trunk); - VLAN_LOCK(); - if (p->if_vlantrunk != NULL) { - /* A race that is very unlikely to be hit. */ - vlan_freehash(trunk); - free(trunk, M_VLAN); - goto exists; - } TRUNK_LOCK_INIT(trunk); - TRUNK_LOCK(trunk); + VLAN_WLOCK(); + TRUNK_WLOCK(trunk); p->if_vlantrunk = trunk; trunk->parent = p; if_ref(trunk->parent); } else { - VLAN_LOCK(); -exists: + VLAN_WLOCK(); trunk = p->if_vlantrunk; - TRUNK_LOCK(trunk); + TRUNK_WLOCK(trunk); } ifv->ifv_vid = vid; /* must set this before vlan_inshash() */ @@ -1368,15 +1517,25 @@ exists: * Configure multicast addresses that may already be * joined on the vlan device. */ - (void)vlan_setmulti(ifp); /* XXX: VLAN lock held */ + (void)vlan_setmulti(ifp); + TASK_INIT(&ifv->lladdr_task, 0, vlan_lladdr_fn, ifv); + /* We are ready for operation now. */ ifp->if_drv_flags |= IFF_DRV_RUNNING; + + /* Update flags on the parent, if necessary. */ + vlan_setflags(ifp, 1); done: - TRUNK_UNLOCK(trunk); + /* + * We need to drop the non-sleepable rmlock so that the underlying + * devices can sleep in their vlan_config hooks. + */ + TRUNK_WUNLOCK(trunk); + VLAN_WUNLOCK(); if (error == 0) EVENTHANDLER_INVOKE(vlan_config, p, ifv->ifv_vid); - VLAN_UNLOCK(); + VLAN_XUNLOCK(); return (error); } @@ -1385,9 +1544,9 @@ static void vlan_unconfig(struct ifnet *ifp) { - VLAN_LOCK(); + VLAN_XLOCK(); vlan_unconfig_locked(ifp, 0); - VLAN_UNLOCK(); + VLAN_XUNLOCK(); } static void @@ -1399,15 +1558,20 @@ vlan_unconfig_locked(struct ifnet *ifp, int departing) struct ifnet *parent; int error; - VLAN_LOCK_ASSERT(); + VLAN_XLOCK_ASSERT(); ifv = ifp->if_softc; trunk = ifv->ifv_trunk; parent = NULL; if (trunk != NULL) { - - TRUNK_LOCK(trunk); + /* + * Both vlan_transmit and vlan_input rely on the trunk fields + * being NULL to determine whether to bail, so we need to get + * an exclusive lock here to prevent them from using bad + * ifvlans. + */ + VLAN_WLOCK(); parent = trunk->parent; /* @@ -1437,7 +1601,14 @@ vlan_unconfig_locked(struct ifnet *ifp, int departing) } vlan_setflags(ifp, 0); /* clear special flags on parent */ + + /* + * The trunk lock isn't actually required here, but + * vlan_remhash expects it. + */ + TRUNK_WLOCK(trunk); vlan_remhash(trunk, ifv); + TRUNK_WUNLOCK(trunk); ifv->ifv_trunk = NULL; /* @@ -1445,17 +1616,9 @@ vlan_unconfig_locked(struct ifnet *ifp, int departing) */ if (trunk->refcnt == 0) { parent->if_vlantrunk = NULL; - /* - * XXXGL: If some ithread has already entered - * vlan_input() and is now blocked on the trunk - * lock, then it should preempt us right after - * unlock and finish its work. Then we will acquire - * lock again in trunk_destroy(). - */ - TRUNK_UNLOCK(trunk); trunk_destroy(trunk); - } else - TRUNK_UNLOCK(trunk); + } + VLAN_WUNLOCK(); } /* Disconnect from parent. */ @@ -1482,7 +1645,7 @@ vlan_setflag(struct ifnet *ifp, int flag, int status, struct ifvlan *ifv; int error; - /* XXX VLAN_LOCK_ASSERT(); */ + VLAN_SXLOCK_ASSERT(); ifv = ifp->if_softc; status = status ? (ifp->if_flags & flag) : 0; @@ -1530,36 +1693,41 @@ vlan_setflags(struct ifnet *ifp, int status) static void vlan_link_state(struct ifnet *ifp) { - struct ifvlantrunk *trunk = ifp->if_vlantrunk; + struct ifvlantrunk *trunk; struct ifvlan *ifv; - int i; + VLAN_LOCK_READER; - TRUNK_LOCK(trunk); -#ifdef VLAN_ARRAY - for (i = 0; i < VLAN_ARRAY_SIZE; i++) - if (trunk->vlans[i] != NULL) { - ifv = trunk->vlans[i]; -#else - for (i = 0; i < (1 << trunk->hwidth); i++) - LIST_FOREACH(ifv, &trunk->hash[i], ifv_list) { -#endif - ifv->ifv_ifp->if_baudrate = trunk->parent->if_baudrate; - if_link_state_change(ifv->ifv_ifp, - trunk->parent->if_link_state); - } - TRUNK_UNLOCK(trunk); + /* Called from a taskqueue_swi task, so we cannot sleep. */ + VLAN_RLOCK(); + trunk = ifp->if_vlantrunk; + if (trunk == NULL) { + VLAN_RUNLOCK(); + return; + } + + TRUNK_WLOCK(trunk); + VLAN_FOREACH(ifv, trunk) { + ifv->ifv_ifp->if_baudrate = trunk->parent->if_baudrate; + if_link_state_change(ifv->ifv_ifp, + trunk->parent->if_link_state); + } + TRUNK_WUNLOCK(trunk); + VLAN_RUNLOCK(); } static void vlan_capabilities(struct ifvlan *ifv) { - struct ifnet *p = PARENT(ifv); - struct ifnet *ifp = ifv->ifv_ifp; + struct ifnet *p; + struct ifnet *ifp; struct ifnet_hw_tsomax hw_tsomax; int cap = 0, ena = 0, mena; u_long hwa = 0; - TRUNK_LOCK_ASSERT(TRUNK(ifv)); + VLAN_SXLOCK_ASSERT(); + TRUNK_WLOCK_ASSERT(TRUNK(ifv)); + p = PARENT(ifv); + ifp = ifv->ifv_ifp; /* Mask parent interface enabled capabilities disabled by user. */ mena = p->if_capenable & ifv->ifv_capenable; @@ -1649,22 +1817,21 @@ vlan_capabilities(struct ifvlan *ifv) static void vlan_trunk_capabilities(struct ifnet *ifp) { - struct ifvlantrunk *trunk = ifp->if_vlantrunk; + struct ifvlantrunk *trunk; struct ifvlan *ifv; - int i; - TRUNK_LOCK(trunk); -#ifdef VLAN_ARRAY - for (i = 0; i < VLAN_ARRAY_SIZE; i++) - if (trunk->vlans[i] != NULL) { - ifv = trunk->vlans[i]; -#else - for (i = 0; i < (1 << trunk->hwidth); i++) { - LIST_FOREACH(ifv, &trunk->hash[i], ifv_list) -#endif - vlan_capabilities(ifv); + VLAN_SLOCK(); + trunk = ifp->if_vlantrunk; + if (trunk == NULL) { + VLAN_SUNLOCK(); + return; } - TRUNK_UNLOCK(trunk); + TRUNK_WLOCK(trunk); + VLAN_FOREACH(ifv, trunk) { + vlan_capabilities(ifv); + } + TRUNK_WUNLOCK(trunk); + VLAN_SUNLOCK(); } static int @@ -1677,6 +1844,7 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data struct ifvlantrunk *trunk; struct vlanreq vlr; int error = 0; + VLAN_LOCK_READER; ifr = (struct ifreq *)data; ifa = (struct ifaddr *) data; @@ -1699,11 +1867,10 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data } break; case SIOCGIFMEDIA: - VLAN_LOCK(); + VLAN_SLOCK(); if (TRUNK(ifv) != NULL) { p = PARENT(ifv); if_ref(p); - VLAN_UNLOCK(); error = (*p->if_ioctl)(p, SIOCGIFMEDIA, data); if_rele(p); /* Limit the result to the parent's current config. */ @@ -1719,9 +1886,9 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data } } } else { - VLAN_UNLOCK(); error = EINVAL; } + VLAN_SUNLOCK(); break; case SIOCSIFMEDIA: @@ -1732,8 +1899,10 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data /* * Set the interface MTU. */ - VLAN_LOCK(); - if (TRUNK(ifv) != NULL) { + VLAN_SLOCK(); + trunk = TRUNK(ifv); + if (trunk != NULL) { + TRUNK_WLOCK(trunk); if (ifr->ifr_mtu > (PARENT(ifv)->if_mtu - ifv->ifv_mtufudge) || ifr->ifr_mtu < @@ -1741,9 +1910,10 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data error = EINVAL; else ifp->if_mtu = ifr->ifr_mtu; + TRUNK_WUNLOCK(trunk); } else error = EINVAL; - VLAN_UNLOCK(); + VLAN_SUNLOCK(); break; case SIOCSETVLAN: @@ -1774,11 +1944,6 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data } error = vlan_config(ifv, p, vlr.vlr_tag); if_rele(p); - if (error) - break; - - /* Update flags on the parent, if necessary. */ - vlan_setflags(ifp, 1); break; case SIOCGETVLAN: @@ -1789,13 +1954,13 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data } #endif bzero(&vlr, sizeof(vlr)); - VLAN_LOCK(); + VLAN_SLOCK(); if (TRUNK(ifv) != NULL) { strlcpy(vlr.vlr_parent, PARENT(ifv)->if_xname, sizeof(vlr.vlr_parent)); vlr.vlr_tag = ifv->ifv_vid; } - VLAN_UNLOCK(); + VLAN_SUNLOCK(); error = copyout(&vlr, ifr->ifr_data, sizeof(vlr)); break; @@ -1804,8 +1969,10 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data * We should propagate selected flags to the parent, * e.g., promiscuous mode. */ + VLAN_XLOCK(); if (TRUNK(ifv) != NULL) error = vlan_setflags(ifp, 1); + VLAN_XUNLOCK(); break; case SIOCADDMULTI: @@ -1813,13 +1980,18 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data /* * If we don't have a parent, just remember the membership for * when we do. + * + * XXX We need the rmlock here to avoid sleeping while + * holding in6_multi_mtx. */ + VLAN_RLOCK(); trunk = TRUNK(ifv); if (trunk != NULL) { - TRUNK_LOCK(trunk); + TRUNK_WLOCK(trunk); error = vlan_setmulti(ifp); - TRUNK_UNLOCK(trunk); + TRUNK_WUNLOCK(trunk); } + VLAN_RUNLOCK(); break; case SIOCGVLANPCP: @@ -1851,15 +2023,15 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data break; case SIOCSIFCAP: - VLAN_LOCK(); + VLAN_SLOCK(); ifv->ifv_capenable = ifr->ifr_reqcap; trunk = TRUNK(ifv); if (trunk != NULL) { - TRUNK_LOCK(trunk); + TRUNK_WLOCK(trunk); vlan_capabilities(ifv); - TRUNK_UNLOCK(trunk); + TRUNK_WUNLOCK(trunk); } - VLAN_UNLOCK(); + VLAN_SUNLOCK(); break; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Tue Aug 15 19:21:29 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0A19CDC2FD0; Tue, 15 Aug 2017 19:21:29 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C31BF8022B; Tue, 15 Aug 2017 19:21:28 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7FJLRIA003062; Tue, 15 Aug 2017 19:21:27 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7FJLRHF003061; Tue, 15 Aug 2017 19:21:27 GMT (envelope-from np@FreeBSD.org) Message-Id: <201708151921.v7FJLRHF003061@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Tue, 15 Aug 2017 19:21:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322549 - head/sys/dev/cxgbe/tom X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe/tom X-SVN-Commit-Revision: 322549 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Aug 2017 19:21:29 -0000 Author: np Date: Tue Aug 15 19:21:27 2017 New Revision: 322549 URL: https://svnweb.freebsd.org/changeset/base/322549 Log: cxgbe/t4_tom: Use correct name for the ISS-valid bit in options2. MFC after: 3 days Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/tom/t4_listen.c Modified: head/sys/dev/cxgbe/tom/t4_listen.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_listen.c Tue Aug 15 17:52:37 2017 (r322548) +++ head/sys/dev/cxgbe/tom/t4_listen.c Tue Aug 15 19:21:27 2017 (r322549) @@ -1042,7 +1042,7 @@ calc_opt2p(struct adapter *sc, struct port_info *pi, i opt2 |= F_RX_COALESCE_VALID; else { opt2 |= F_T5_OPT_2_VALID; - opt2 |= F_CONG_CNTRL_VALID; /* OPT_2_ISS really, for T5 */ + opt2 |= F_T5_ISS; } if (sc->tt.rx_coalesce) opt2 |= V_RX_COALESCE(M_RX_COALESCE); From owner-svn-src-head@freebsd.org Tue Aug 15 19:29:12 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 088B6DC3E22; Tue, 15 Aug 2017 19:29:12 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C976480C8A; Tue, 15 Aug 2017 19:29:11 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7FJTAQn007361; Tue, 15 Aug 2017 19:29:10 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7FJTAIm007360; Tue, 15 Aug 2017 19:29:10 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708151929.v7FJTAIm007360@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 15 Aug 2017 19:29:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322550 - head/sbin/route X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sbin/route X-SVN-Commit-Revision: 322550 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Aug 2017 19:29:12 -0000 Author: kib Date: Tue Aug 15 19:29:10 2017 New Revision: 322550 URL: https://svnweb.freebsd.org/changeset/base/322550 Log: Typo, the '-6' option selects inet6. Sponsored by: The FreeBSD Foundation MFC after: 3 days Modified: head/sbin/route/route.8 Modified: head/sbin/route/route.8 ============================================================================== --- head/sbin/route/route.8 Tue Aug 15 19:21:27 2017 (r322549) +++ head/sbin/route/route.8 Tue Aug 15 19:29:10 2017 (r322550) @@ -68,7 +68,7 @@ Specify address family as family hint for subcommands. .It Fl 6 Specify -.Cm inet +.Cm inet6 address family as family hint for subcommands. .It Fl d Run in debug-only mode, i.e., do not actually modify the routing table. From owner-svn-src-head@freebsd.org Tue Aug 15 22:16:17 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0636DDCFD8A; Tue, 15 Aug 2017 22:16:17 +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 mx1.freebsd.org (Postfix) with ESMTPS id C7E6F2E88; Tue, 15 Aug 2017 22:16:16 +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 v7FMGG5Q076811; Tue, 15 Aug 2017 22:16:16 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7FMGFdA076809; Tue, 15 Aug 2017 22:16:15 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201708152216.v7FMGFdA076809@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 15 Aug 2017 22:16:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322552 - in head/etc: periodic/daily rc.d X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/etc: periodic/daily rc.d X-SVN-Commit-Revision: 322552 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Aug 2017 22:16:17 -0000 Author: jhb Date: Tue Aug 15 22:16:15 2017 New Revision: 322552 URL: https://svnweb.freebsd.org/changeset/base/322552 Log: Unconditionally install rwhod support scripts. r322277 moved rwho* and ruptime out of the MK_RCMDS conditional including updating the obsolete files entries to not remove these scripts due to WITHOUT_RCMDS=yes. However, the initial installation was still conditional on MK_RCMDS, so new installs did not include these scripts and upgrades via mergemaster or etcupdate removed them. PR: 220953 MFC after: 1 month Modified: head/etc/periodic/daily/Makefile head/etc/rc.d/Makefile Modified: head/etc/periodic/daily/Makefile ============================================================================== --- head/etc/periodic/daily/Makefile Tue Aug 15 20:27:07 2017 (r322551) +++ head/etc/periodic/daily/Makefile Tue Aug 15 22:16:15 2017 (r322552) @@ -7,6 +7,7 @@ FILESGROUPS=FILES FILES= 100.clean-disks \ 110.clean-tmps \ 120.clean-preserve \ + 140.clean-rwho \ 200.backup-passwd \ 210.backup-aliases \ 330.news \ @@ -45,14 +46,6 @@ FILES+= 130.clean-msgs FILES+= 480.status-ntpd \ 480.leapfile-ntpd .endif - -.if ${MK_RCMDS} != "no" -FILESGROUPS+= RCMDS -RCMDS+= 140.clean-rwho -.endif -RCMDSDIR= /etc/periodic/daily -RCMDSMODE= ${BINMODE} -RCMDSPACKAGE= rcmds .if ${MK_SENDMAIL} != "no" FILES+= 150.clean-hoststat \ Modified: head/etc/rc.d/Makefile ============================================================================== --- head/etc/rc.d/Makefile Tue Aug 15 20:27:07 2017 (r322551) +++ head/etc/rc.d/Makefile Tue Aug 15 22:16:15 2017 (r322552) @@ -100,6 +100,7 @@ FILES= DAEMON \ rpcbind \ rtadvd \ rtsold \ + rwho \ savecore \ securelevel \ serial \ @@ -269,12 +270,6 @@ SSHPACKAGE= ssh .if ${MK_PF} != "no" FILES+= ftp-proxy -.endif - -.if ${MK_RCMDS} != "no" -FILESGROUPS+= RCMDS -RCMDS+= rwho -RCMDSPACKAGE= rcmds .endif .if ${MK_ROUTED} != "no" From owner-svn-src-head@freebsd.org Tue Aug 15 22:49:31 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D8CFDD1F75; Tue, 15 Aug 2017 22:49:31 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (glebi.us [96.95.210.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 54600632EC; Tue, 15 Aug 2017 22:49:30 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id v7FMnTnf011236 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 15 Aug 2017 15:49:29 -0700 (PDT) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id v7FMnTVQ011235; Tue, 15 Aug 2017 15:49:29 -0700 (PDT) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@FreeBSD.org using -f Date: Tue, 15 Aug 2017 15:49:29 -0700 From: Gleb Smirnoff To: Emmanuel Vadot Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r320944 - head/etc/rc.d Message-ID: <20170815224929.GC1113@FreeBSD.org> References: <201707131340.v6DDeIE9086139@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201707131340.v6DDeIE9086139@repo.freebsd.org> User-Agent: Mutt/1.8.3 (2017-05-23) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Aug 2017 22:49:31 -0000 Emmanuel, On Thu, Jul 13, 2017 at 01:40:18PM +0000, Emmanuel Vadot wrote: E> Author: manu E> Date: Thu Jul 13 13:40:18 2017 E> New Revision: 320944 E> URL: https://svnweb.freebsd.org/changeset/base/320944 E> E> Log: E> Add an rc.d script to setup a netflow export via ng_netflow E> The default is to export netflow data on localhost on the netflow port. E> ngtee is used to have the lowest overhead possible. E> The ipfw ng hook is the netflow port (it can only be numeric) E> Default is netflow version 5. E> E> Sponsored-By: Gandi.net E> Reviewed by: bapt (earlier version), olivier (earlier version) It could be that using "netgraph" action instead of "ngtee" and then returning packet back from netgraph to ipfw would show lower overhead. However, this setup is definitely going to be less robust and more prone to bugs in case of complex ipfw configurations. -- Totus tuus, Glebius. From owner-svn-src-head@freebsd.org Tue Aug 15 22:50:09 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 52511DD201A; Tue, 15 Aug 2017 22:50:09 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (glebi.us [96.95.210.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 36A2963442; Tue, 15 Aug 2017 22:50:08 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id v7FMo8Mn011252 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 15 Aug 2017 15:50:08 -0700 (PDT) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id v7FMo8fh011251; Tue, 15 Aug 2017 15:50:08 -0700 (PDT) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@FreeBSD.org using -f Date: Tue, 15 Aug 2017 15:50:08 -0700 From: Gleb Smirnoff To: Emmanuel Vadot Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r320944 - head/etc/rc.d Message-ID: <20170815225008.GD1113@FreeBSD.org> References: <201707131340.v6DDeIE9086139@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201707131340.v6DDeIE9086139@repo.freebsd.org> User-Agent: Mutt/1.8.3 (2017-05-23) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Aug 2017 22:50:09 -0000 Emmanuel, On Thu, Jul 13, 2017 at 01:40:18PM +0000, Emmanuel Vadot wrote: E> Author: manu E> Date: Thu Jul 13 13:40:18 2017 E> New Revision: 320944 E> URL: https://svnweb.freebsd.org/changeset/base/320944 E> E> Log: E> Add an rc.d script to setup a netflow export via ng_netflow E> The default is to export netflow data on localhost on the netflow port. E> ngtee is used to have the lowest overhead possible. E> The ipfw ng hook is the netflow port (it can only be numeric) E> Default is netflow version 5. E> E> Sponsored-By: Gandi.net E> Reviewed by: bapt (earlier version), olivier (earlier version) And great thanks for doing that! I should have done it 10 years ago. -- Totus tuus, Glebius. From owner-svn-src-head@freebsd.org Wed Aug 16 05:02:32 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BD640DC3758; Wed, 16 Aug 2017 05:02:32 +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 mx1.freebsd.org (Postfix) with ESMTPS id 8A9F36FF5F; Wed, 16 Aug 2017 05:02:32 +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 v7G52VR6043816; Wed, 16 Aug 2017 05:02:31 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7G52VeX043815; Wed, 16 Aug 2017 05:02:31 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201708160502.v7G52VeX043815@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Wed, 16 Aug 2017 05:02:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322565 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 322565 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2017 05:02:32 -0000 Author: bdrewery Date: Wed Aug 16 05:02:31 2017 New Revision: 322565 URL: https://svnweb.freebsd.org/changeset/base/322565 Log: Use -S for library installations except for -DNO_ROOT builds. Also disable this if NO_SAFE_LIBINSTALL is defined. There is little harm in always using -S and it fixes several issues: - A race during 'make libraries' where, for example, libgcc_s is being installed while another library is trying to link against it. This is possible because libgcc_s is connected in both _prereq_libs and _startup_libs. The first build (_prereq_libs) sets MK_PROFILE=no while the 2nd pass (_startup_libs) enables MK_PROFILE. Thus the libgcc_s library *is* present in WORLDTMP for other libraries to link to, so serializing further items in _startup_libs is not required. Just ensuring that libgcc_s is installed atomically (via rename(2)) is enough. [1] - Installation to a running system where some library that cannot be detected, copied and used from the temporary INSTALLTMP with LD_LIBRARY_PATH that the build itself uses for installation. Such an example is having the install an NSS module for user lookups that install(1) uses while concurrently installing the module in another process. This is not a problem for the FreeBSD base build but can be for downstream vendors. While this is a very specific case, installation to a running system with non-atomic library installation is prone to many problems. A further step still is to install in proper dependency ordering. Reported by: dhw many times [1] Sponsored by: Dell EMC Isilon MFC after: 2 weeks Modified: head/share/mk/bsd.lib.mk Modified: head/share/mk/bsd.lib.mk ============================================================================== --- head/share/mk/bsd.lib.mk Wed Aug 16 01:45:53 2017 (r322564) +++ head/share/mk/bsd.lib.mk Wed Aug 16 05:02:31 2017 (r322565) @@ -326,6 +326,11 @@ _EXTRADEPEND: .if !defined(NO_FSCHG) SHLINSTALLFLAGS+= -fschg .endif +.endif +# Install libraries with -S to avoid linker races with WORLDTMP and risk +# of modifying in-use libraries when installing to a running system. +# It is safe to avoid this for NO_ROOT builds that are only creating an image. +.if !defined(NO_SAFE_LIBINSTALL) && !defined(NO_ROOT) SHLINSTALLFLAGS+= -S .endif From owner-svn-src-head@freebsd.org Wed Aug 16 06:33:49 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8007CDC8721; Wed, 16 Aug 2017 06:33: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 mx1.freebsd.org (Postfix) with ESMTPS id 4F0FB72693; Wed, 16 Aug 2017 06:33: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 v7G6XmWM080154; Wed, 16 Aug 2017 06:33:48 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7G6XmH8080153; Wed, 16 Aug 2017 06:33:48 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201708160633.v7G6XmH8080153@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 16 Aug 2017 06:33:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322567 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 322567 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2017 06:33:49 -0000 Author: markj Date: Wed Aug 16 06:33:48 2017 New Revision: 322567 URL: https://svnweb.freebsd.org/changeset/base/322567 Log: Add device resource management fields to struct device. MFC after: 1 week Modified: head/sys/compat/linuxkpi/common/include/linux/device.h Modified: head/sys/compat/linuxkpi/common/include/linux/device.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/device.h Wed Aug 16 05:51:05 2017 (r322566) +++ head/sys/compat/linuxkpi/common/include/linux/device.h Wed Aug 16 06:33:48 2017 (r322567) @@ -113,6 +113,9 @@ struct device { unsigned int msix; unsigned int msix_max; const struct attribute_group **groups; + + spinlock_t devres_lock; + struct list_head devres_head; }; extern struct device linux_root_device; @@ -290,6 +293,9 @@ device_initialize(struct device *dev) dev->bsddev = bsddev; MPASS(dev->bsddev != NULL); kobject_init(&dev->kobj, &linux_dev_ktype); + + spin_lock_init(&dev->devres_lock); + INIT_LIST_HEAD(&dev->devres_head); } static inline int From owner-svn-src-head@freebsd.org Wed Aug 16 08:49:13 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 39865DCDA2B; Wed, 16 Aug 2017 08:49:13 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 1508976214; Wed, 16 Aug 2017 08:49:13 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7G8nCtE033284; Wed, 16 Aug 2017 08:49:12 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7G8nC5f033282; Wed, 16 Aug 2017 08:49:12 GMT (envelope-from br@FreeBSD.org) Message-Id: <201708160849.v7G8nC5f033282@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Wed, 16 Aug 2017 08:49:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322571 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 322571 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2017 08:49:13 -0000 Author: br Date: Wed Aug 16 08:49:11 2017 New Revision: 322571 URL: https://svnweb.freebsd.org/changeset/base/322571 Log: Add OBJ_PG_DTOR flag to VM object. Setting this flag allows us to skip pages removal from VM object queue during object termination and to leave that for cdev_pg_dtor function. Move pages removal code to separate function vm_object_terminate_pages() as comments does not survive indentation. This will be required for Intel SGX support where we will have to remove pages from VM object manually. Reviewed by: kib, alc Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D11688 Modified: head/sys/vm/vm_object.c head/sys/vm/vm_object.h Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Wed Aug 16 08:19:44 2017 (r322570) +++ head/sys/vm/vm_object.c Wed Aug 16 08:49:11 2017 (r322571) @@ -694,6 +694,54 @@ vm_object_destroy(vm_object_t object) } /* + * vm_object_terminate_pages removes any remaining pageable pages + * from the object and resets the object to an empty state. + */ +static void +vm_object_terminate_pages(vm_object_t object) +{ + vm_page_t p, p_next; + + VM_OBJECT_ASSERT_WLOCKED(object); + + /* + * Free any remaining pageable pages. This also removes them from the + * paging queues. However, don't free wired pages, just remove them + * from the object. Rather than incrementally removing each page from + * the object, the page and object are reset to any empty state. + */ + TAILQ_FOREACH_SAFE(p, &object->memq, listq, p_next) { + vm_page_assert_unbusied(p); + vm_page_lock(p); + /* + * Optimize the page's removal from the object by resetting + * its "object" field. Specifically, if the page is not + * wired, then the effect of this assignment is that + * vm_page_free()'s call to vm_page_remove() will return + * immediately without modifying the page or the object. + */ + p->object = NULL; + if (p->wire_count == 0) { + vm_page_free(p); + VM_CNT_INC(v_pfree); + } + vm_page_unlock(p); + } + /* + * If the object contained any pages, then reset it to an empty state. + * None of the object's fields, including "resident_page_count", were + * modified by the preceding loop. + */ + if (object->resident_page_count != 0) { + vm_radix_reclaim_allnodes(&object->rtree); + TAILQ_INIT(&object->memq); + object->resident_page_count = 0; + if (object->type == OBJT_VNODE) + vdrop(object->handle); + } +} + +/* * vm_object_terminate actually destroys the specified object, freeing * up all previously used resources. * @@ -703,7 +751,6 @@ vm_object_destroy(vm_object_t object) void vm_object_terminate(vm_object_t object) { - vm_page_t p, p_next; VM_OBJECT_ASSERT_WLOCKED(object); @@ -746,41 +793,8 @@ vm_object_terminate(vm_object_t object) ("vm_object_terminate: object with references, ref_count=%d", object->ref_count)); - /* - * Free any remaining pageable pages. This also removes them from the - * paging queues. However, don't free wired pages, just remove them - * from the object. Rather than incrementally removing each page from - * the object, the page and object are reset to any empty state. - */ - TAILQ_FOREACH_SAFE(p, &object->memq, listq, p_next) { - vm_page_assert_unbusied(p); - vm_page_lock(p); - /* - * Optimize the page's removal from the object by resetting - * its "object" field. Specifically, if the page is not - * wired, then the effect of this assignment is that - * vm_page_free()'s call to vm_page_remove() will return - * immediately without modifying the page or the object. - */ - p->object = NULL; - if (p->wire_count == 0) { - vm_page_free(p); - VM_CNT_INC(v_pfree); - } - vm_page_unlock(p); - } - /* - * If the object contained any pages, then reset it to an empty state. - * None of the object's fields, including "resident_page_count", were - * modified by the preceding loop. - */ - if (object->resident_page_count != 0) { - vm_radix_reclaim_allnodes(&object->rtree); - TAILQ_INIT(&object->memq); - object->resident_page_count = 0; - if (object->type == OBJT_VNODE) - vdrop(object->handle); - } + if ((object->flags & OBJ_PG_DTOR) == 0) + vm_object_terminate_pages(object); #if VM_NRESERVLEVEL > 0 if (__predict_false(!LIST_EMPTY(&object->rvq))) Modified: head/sys/vm/vm_object.h ============================================================================== --- head/sys/vm/vm_object.h Wed Aug 16 08:19:44 2017 (r322570) +++ head/sys/vm/vm_object.h Wed Aug 16 08:49:11 2017 (r322571) @@ -175,6 +175,7 @@ struct vm_object { #define OBJ_NOSPLIT 0x0010 /* dont split this object */ #define OBJ_UMTXDEAD 0x0020 /* umtx pshared was terminated */ #define OBJ_PIPWNT 0x0040 /* paging in progress wanted */ +#define OBJ_PG_DTOR 0x0080 /* dont reset object, leave that for dtor */ #define OBJ_MIGHTBEDIRTY 0x0100 /* object might be dirty, only for vnode */ #define OBJ_TMPFS_NODE 0x0200 /* object belongs to tmpfs VREG node */ #define OBJ_TMPFS_DIRTY 0x0400 /* dirty tmpfs obj */ From owner-svn-src-head@freebsd.org Wed Aug 16 10:38:07 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BD015DD3056; Wed, 16 Aug 2017 10:38:07 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 820D57D87D; Wed, 16 Aug 2017 10:38:07 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7GAc6s8077857; Wed, 16 Aug 2017 10:38:06 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7GAc6jQ077852; Wed, 16 Aug 2017 10:38:06 GMT (envelope-from br@FreeBSD.org) Message-Id: <201708161038.v7GAc6jQ077852@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Wed, 16 Aug 2017 10:38:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322574 - in head/sys: amd64/include amd64/sgx modules modules/sgx modules/sgx_linux X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: in head/sys: amd64/include amd64/sgx modules modules/sgx modules/sgx_linux X-SVN-Commit-Revision: 322574 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2017 10:38:07 -0000 Author: br Date: Wed Aug 16 10:38:06 2017 New Revision: 322574 URL: https://svnweb.freebsd.org/changeset/base/322574 Log: Add support for Intel Software Guard Extensions (Intel SGX). Intel SGX allows to manage isolated compartments "Enclaves" in user VA space. Enclaves memory is part of processor reserved memory (PRM) and always encrypted. This allows to protect user application code and data from upper privilege levels including OS kernel. This includes SGX driver and optional linux ioctl compatibility layer. Intel SGX SDK for FreeBSD is also available. Note this requires support from hardware (available since late Intel Skylake CPUs). Many thanks to Robert Watson for support and Konstantin Belousov for code review. Project wiki: https://wiki.freebsd.org/Intel_SGX. Reviewed by: kib Relnotes: yes Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D11113 Added: head/sys/amd64/include/sgx.h (contents, props changed) head/sys/amd64/include/sgxreg.h (contents, props changed) head/sys/amd64/sgx/ head/sys/amd64/sgx/sgx.c (contents, props changed) head/sys/amd64/sgx/sgx_linux.c (contents, props changed) head/sys/amd64/sgx/sgx_support.S (contents, props changed) head/sys/amd64/sgx/sgxvar.h (contents, props changed) head/sys/modules/sgx/ head/sys/modules/sgx/Makefile (contents, props changed) head/sys/modules/sgx_linux/ head/sys/modules/sgx_linux/Makefile (contents, props changed) Modified: head/sys/amd64/include/cpufunc.h head/sys/modules/Makefile Modified: head/sys/amd64/include/cpufunc.h ============================================================================== --- head/sys/amd64/include/cpufunc.h Wed Aug 16 10:30:23 2017 (r322573) +++ head/sys/amd64/include/cpufunc.h Wed Aug 16 10:38:06 2017 (r322574) @@ -834,6 +834,85 @@ intr_restore(register_t rflags) write_rflags(rflags); } +enum { + SGX_ECREATE = 0x0, + SGX_EADD = 0x1, + SGX_EINIT = 0x2, + SGX_EREMOVE = 0x3, + SGX_EDGBRD = 0x4, + SGX_EDGBWR = 0x5, + SGX_EEXTEND = 0x6, + SGX_ELDU = 0x8, + SGX_EBLOCK = 0x9, + SGX_EPA = 0xA, + SGX_EWB = 0xB, + SGX_ETRACK = 0xC, +}; + +enum { + SGX_PT_SECS = 0x00, + SGX_PT_TCS = 0x01, + SGX_PT_REG = 0x02, + SGX_PT_VA = 0x03, + SGX_PT_TRIM = 0x04, +}; + +int sgx_encls(uint32_t eax, uint64_t rbx, uint64_t rcx, uint64_t rdx); + +static __inline int +sgx_ecreate(void *pginfo, void *secs) +{ + + return (sgx_encls(SGX_ECREATE, (uint64_t)pginfo, + (uint64_t)secs, 0)); +} + +static __inline int +sgx_eadd(void *pginfo, void *epc) +{ + + return (sgx_encls(SGX_EADD, (uint64_t)pginfo, + (uint64_t)epc, 0)); +} + +static __inline int +sgx_einit(void *sigstruct, void *secs, void *einittoken) +{ + + return (sgx_encls(SGX_EINIT, (uint64_t)sigstruct, + (uint64_t)secs, (uint64_t)einittoken)); +} + +static __inline int +sgx_eextend(void *secs, void *epc) +{ + + return (sgx_encls(SGX_EEXTEND, (uint64_t)secs, + (uint64_t)epc, 0)); +} + +static __inline int +sgx_epa(void *epc) +{ + + return (sgx_encls(SGX_EPA, SGX_PT_VA, (uint64_t)epc, 0)); +} + +static __inline int +sgx_eldu(uint64_t rbx, uint64_t rcx, + uint64_t rdx) +{ + + return (sgx_encls(SGX_ELDU, rbx, rcx, rdx)); +} + +static __inline int +sgx_eremove(void *epc) +{ + + return (sgx_encls(SGX_EREMOVE, 0, (uint64_t)epc, 0)); +} + #else /* !(__GNUCLIKE_ASM && __CC_SUPPORTS___INLINE) */ int breakpoint(void); Added: head/sys/amd64/include/sgx.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/amd64/include/sgx.h Wed Aug 16 10:38:06 2017 (r322574) @@ -0,0 +1,64 @@ +/*- + * Copyright (c) 2017 Ruslan Bukin + * All rights reserved. + * + * This software was developed by BAE Systems, the University of Cambridge + * Computer Laboratory, and Memorial University under DARPA/AFRL contract + * FA8650-15-C-7558 ("CADETS"), as part of the DARPA Transparent Computing + * (TC) research program. + * + * 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$ + */ + +/* User-visible header. */ + +#ifndef _MACHINE_SGX_H_ +#define _MACHINE_SGX_H_ + +#define SGX_MAGIC 0xA4 +#define SGX_IOC_ENCLAVE_CREATE \ + _IOW(SGX_MAGIC, 0x00, struct sgx_enclave_create) +#define SGX_IOC_ENCLAVE_ADD_PAGE \ + _IOW(SGX_MAGIC, 0x01, struct sgx_enclave_add_page) +#define SGX_IOC_ENCLAVE_INIT \ + _IOW(SGX_MAGIC, 0x02, struct sgx_enclave_init) + +struct sgx_enclave_create { + uint64_t src; +} __packed; + +struct sgx_enclave_add_page { + uint64_t addr; + uint64_t src; + uint64_t secinfo; + uint16_t mrmask; +} __packed; + +struct sgx_enclave_init { + uint64_t addr; + uint64_t sigstruct; + uint64_t einittoken; +} __packed; + +#endif /* !_MACHINE_SGX_H_ */ Added: head/sys/amd64/include/sgxreg.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/amd64/include/sgxreg.h Wed Aug 16 10:38:06 2017 (r322574) @@ -0,0 +1,155 @@ +/*- + * Copyright (c) 2017 Ruslan Bukin + * All rights reserved. + * + * This software was developed by BAE Systems, the University of Cambridge + * Computer Laboratory, and Memorial University under DARPA/AFRL contract + * FA8650-15-C-7558 ("CADETS"), as part of the DARPA Transparent Computing + * (TC) research program. + * + * 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$ + */ + +/* Machine-defined variables. */ + +#ifndef _MACHINE_SGXREG_H_ +#define _MACHINE_SGXREG_H_ + +/* Error codes. */ +#define SGX_SUCCESS 0 +#define SGX_INVALID_SIG_STRUCT 1 /* EINIT */ +#define SGX_INVALID_ATTRIBUTE 2 /* EINIT, EGETKEY */ +#define SGX_BLSTATE 3 /* EBLOCK */ +#define SGX_INVALID_MEASUREMENT 4 /* EINIT */ +#define SGX_NOTBLOCKABLE 5 /* EBLOCK */ +#define SGX_PG_INVLD 6 /* EBLOCK */ +#define SGX_LOCKFAIL 7 /* EBLOCK, EMODPR, EMODT */ +#define SGX_INVALID_SIGNATURE 8 /* EINIT */ +#define SGX_MAC_COMPARE_FAIL 9 /* ELDB, ELDU */ +#define SGX_PAGE_NOT_BLOCKED 10 /* EWB */ +#define SGX_NOT_TRACKED 11 /* EWB, EACCEPT */ +#define SGX_VA_SLOT_OCCUPIED 12 /* EWB */ +#define SGX_CHILD_PRESENT 13 /* EWB, EREMOVE */ +#define SGX_ENCLAVE_ACT 14 /* EREMOVE */ +#define SGX_ENTRYEPOCH_LOCKED 15 /* EBLOCK */ +#define SGX_INVALID_EINIT_TOKEN 16 /* EINIT */ +#define SGX_PREV_TRK_INCMPL 17 /* ETRACK */ +#define SGX_PG_IS_SECS 18 /* EBLOCK */ +#define SGX_PAGE_ATTRIBUTES_MISMATCH 19 /* EACCEPT, EACCEPTCOPY */ +#define SGX_PAGE_NOT_MODIFIABLE 20 /* EMODPR, EMODT */ +#define SGX_INVALID_CPUSVN 32 /* EINIT, EGETKEY */ +#define SGX_INVALID_ISVSVN 64 /* EGETKEY */ +#define SGX_UNMASKED_EVENT 128 /* EINIT */ +#define SGX_INVALID_KEYNAME 256 /* EGETKEY */ + +/* + * 2.10 Page Information (PAGEINFO) + * PAGEINFO is an architectural data structure that is used as a parameter + * to the EPC-management instructions. It requires 32-Byte alignment. + */ +struct page_info { + uint64_t linaddr; + uint64_t srcpge; + union { + struct secinfo *secinfo; + uint64_t pcmd; + }; + uint64_t secs; +} __aligned(32); + +/* + * 2.11 Security Information (SECINFO) + * The SECINFO data structure holds meta-data about an enclave page. + */ +struct secinfo { + uint64_t flags; +#define SECINFO_FLAGS_PT_S 8 /* Page type shift */ +#define SECINFO_FLAGS_PT_M (0xff << SECINFO_FLAGS_PT_S) + uint64_t reserved[7]; +} __aligned(64); + +/* + * 2.7.1 ATTRIBUTES + * The ATTRIBUTES data structure is comprised of bit-granular fields that + * are used in the SECS, CPUID enumeration, the REPORT and the KEYREQUEST + * structures. + */ +struct secs_attr { + uint8_t reserved1: 1; + uint8_t debug: 1; + uint8_t mode64bit: 1; + uint8_t reserved2: 1; + uint8_t provisionkey: 1; + uint8_t einittokenkey: 1; + uint8_t reserved3: 2; +#define SECS_ATTR_RSV4_SIZE 7 + uint8_t reserved4[SECS_ATTR_RSV4_SIZE]; + uint64_t xfrm; /* X-Feature Request Mask */ +}; + +/* + * 2.7 SGX Enclave Control Structure (SECS) + * The SECS data structure requires 4K-Bytes alignment. + */ +struct secs { + uint64_t size; + uint64_t base; + uint32_t ssa_frame_size; + uint32_t misc_select; +#define SECS_RSV1_SIZE 24 + uint8_t reserved1[SECS_RSV1_SIZE]; + struct secs_attr attributes; + uint8_t mr_enclave[32]; +#define SECS_RSV2_SIZE 32 + uint8_t reserved2[SECS_RSV2_SIZE]; + uint8_t mr_signer[32]; +#define SECS_RSV3_SIZE 96 + uint8_t reserved3[SECS_RSV3_SIZE]; + uint16_t isv_prod_id; + uint16_t isv_svn; +#define SECS_RSV4_SIZE 3836 + uint8_t reserved4[SECS_RSV4_SIZE]; +}; + +/* + * 2.8 Thread Control Structure (TCS) + * Each executing thread in the enclave is associated with a + * Thread Control Structure. It requires 4K-Bytes alignment. + */ +struct tcs { + uint64_t reserved1; + uint64_t flags; + uint64_t ossa; + uint32_t cssa; + uint32_t nssa; + uint64_t oentry; + uint64_t reserved2; + uint64_t ofsbasgx; + uint64_t ogsbasgx; + uint32_t fslimit; + uint32_t gslimit; + uint64_t reserved3[503]; +}; + +#endif /* !_MACHINE_SGXREG_H_ */ Added: head/sys/amd64/sgx/sgx.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/amd64/sgx/sgx.c Wed Aug 16 10:38:06 2017 (r322574) @@ -0,0 +1,1211 @@ +/*- + * Copyright (c) 2017 Ruslan Bukin + * All rights reserved. + * + * This software was developed by BAE Systems, the University of Cambridge + * Computer Laboratory, and Memorial University under DARPA/AFRL contract + * FA8650-15-C-7558 ("CADETS"), as part of the DARPA Transparent Computing + * (TC) research program. + * + * 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. + */ + +/* + * Design overview. + * + * The driver provides character device for mmap(2) and ioctl(2) system calls + * allowing user to manage isolated compartments ("enclaves") in user VA space. + * + * The driver duties is EPC pages management, enclave management, user data + * validation. + * + * This driver requires Intel SGX support from hardware. + * + * /dev/sgx: + * .mmap: + * sgx_mmap_single() allocates VM object with following pager + * operations: + * a) sgx_pg_ctor(): + * VM object constructor does nothing + * b) sgx_pg_dtor(): + * VM object destructor destroys the SGX enclave associated + * with the object: it frees all the EPC pages allocated for + * enclave and removes the enclave. + * c) sgx_pg_fault(): + * VM object fault handler does nothing + * + * .ioctl: + * sgx_ioctl(): + * a) SGX_IOC_ENCLAVE_CREATE + * Adds Enclave SECS page: initial step of enclave creation. + * b) SGX_IOC_ENCLAVE_ADD_PAGE + * Adds TCS, REG pages to the enclave. + * c) SGX_IOC_ENCLAVE_INIT + * Finalizes enclave creation. + * + * Enclave lifecycle: + * .-- ECREATE -- Add SECS page + * Kernel | EADD -- Add TCS, REG pages + * space | EEXTEND -- Measure the page (take unique hash) + * ENCLS | EPA -- Allocate version array page + * '-- EINIT -- Finalize enclave creation + * User .-- EENTER -- Go to entry point of enclave + * space | EEXIT -- Exit back to main application + * ENCLU '-- ERESUME -- Resume enclave execution (e.g. after exception) + * + * Enclave lifecycle from driver point of view: + * 1) User calls mmap() on /dev/sgx: we allocate a VM object + * 2) User calls ioctl SGX_IOC_ENCLAVE_CREATE: we look for the VM object + * associated with user process created on step 1, create SECS physical + * page and store it in enclave's VM object queue by special index + * SGX_SECS_VM_OBJECT_INDEX. + * 3) User calls ioctl SGX_IOC_ENCLAVE_ADD_PAGE: we look for enclave created + * on step 2, create TCS or REG physical page and map it to specified by + * user address of enclave VM object. + * 4) User finalizes enclave creation with ioctl SGX_IOC_ENCLAVE_INIT call. + * 5) User can freely enter to and exit from enclave using ENCLU instructions + * from userspace: the driver does nothing here. + * 6) User proceed munmap(2) system call (or the process with enclave dies): + * we destroy the enclave associated with the object. + * + * EPC page types and their indexes in VM object queue: + * - PT_SECS index is special and equals SGX_SECS_VM_OBJECT_INDEX (-1); + * - PT_TCS and PT_REG indexes are specified by user in addr field of ioctl + * request data and determined as follows: + * pidx = OFF_TO_IDX(addp->addr - vmh->base); + * - PT_VA index is special, created for PT_REG, PT_TCS and PT_SECS pages + * and determined by formula: + * va_page_idx = - SGX_VA_PAGES_OFFS - (page_idx / SGX_VA_PAGE_SLOTS); + * PT_VA page can hold versions of up to 512 pages, and slot for each + * page in PT_VA page is determined as follows: + * va_slot_idx = page_idx % SGX_VA_PAGE_SLOTS; + * - PT_TRIM is unused. + * + * Locking: + * SGX ENCLS set of instructions have limitations on concurrency: + * some instructions can't be executed same time on different CPUs. + * We use sc->mtx_encls lock around them to prevent concurrent execution. + * sc->mtx lock is used to manage list of created enclaves and the state of + * SGX driver. + * + * Eviction of EPC pages: + * Eviction support is not implemented in this driver, however the driver + * manages VA (version array) pages: it allocates a VA slot for each EPC + * page. This will be required for eviction support in future. + * VA pages and slots are currently unused. + * + * Intel® 64 and IA-32 Architectures Software Developer's Manual + * https://software.intel.com/en-us/articles/intel-sdm + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +#define DEBUG +#undef DEBUG + +#ifdef DEBUG +#define dprintf(fmt, ...) printf(fmt, ##__VA_ARGS__) +#else +#define dprintf(fmt, ...) +#endif + +static struct cdev_pager_ops sgx_pg_ops; +struct sgx_softc sgx_sc; + +static int +sgx_get_epc_page(struct sgx_softc *sc, struct epc_page **epc) +{ + vmem_addr_t addr; + int i; + + if (vmem_alloc(sc->vmem_epc, PAGE_SIZE, M_FIRSTFIT | M_NOWAIT, + &addr) == 0) { + i = (addr - sc->epc_base) / PAGE_SIZE; + *epc = &sc->epc_pages[i]; + return (0); + } + + return (ENOMEM); +} + +static void +sgx_put_epc_page(struct sgx_softc *sc, struct epc_page *epc) +{ + vmem_addr_t addr; + + if (epc == NULL) + return; + + addr = (epc->index * PAGE_SIZE) + sc->epc_base; + vmem_free(sc->vmem_epc, addr, PAGE_SIZE); +} + +static int +sgx_va_slot_init_by_index(struct sgx_softc *sc, vm_object_t object, + uint64_t idx) +{ + struct epc_page *epc; + vm_page_t page; + vm_page_t p; + int ret; + + VM_OBJECT_ASSERT_WLOCKED(object); + + p = vm_page_lookup(object, idx); + if (p == NULL) { + ret = sgx_get_epc_page(sc, &epc); + if (ret) { + dprintf("%s: No free EPC pages available.\n", + __func__); + return (ret); + } + + mtx_lock(&sc->mtx_encls); + sgx_epa((void *)epc->base); + mtx_unlock(&sc->mtx_encls); + + page = PHYS_TO_VM_PAGE(epc->phys); + + vm_page_insert(page, object, idx); + page->valid = VM_PAGE_BITS_ALL; + } + + return (0); +} + +static int +sgx_va_slot_init(struct sgx_softc *sc, + struct sgx_enclave *enclave, + uint64_t addr) +{ + vm_pindex_t pidx; + uint64_t va_page_idx; + uint64_t idx; + vm_object_t object; + int va_slot; + int ret; + + object = enclave->object; + + VM_OBJECT_ASSERT_WLOCKED(object); + + pidx = OFF_TO_IDX(addr); + + va_slot = pidx % SGX_VA_PAGE_SLOTS; + va_page_idx = pidx / SGX_VA_PAGE_SLOTS; + idx = - SGX_VA_PAGES_OFFS - va_page_idx; + + ret = sgx_va_slot_init_by_index(sc, object, idx); + + return (ret); +} + +static int +sgx_mem_find(struct sgx_softc *sc, uint64_t addr, + vm_map_entry_t *entry0, vm_object_t *object0) +{ + vm_map_t map; + vm_map_entry_t entry; + vm_object_t object; + + map = &curproc->p_vmspace->vm_map; + + vm_map_lock_read(map); + if (!vm_map_lookup_entry(map, addr, &entry)) { + vm_map_unlock_read(map); + dprintf("%s: Can't find enclave.\n", __func__); + return (EINVAL); + } + + object = entry->object.vm_object; + if (object == NULL || object->handle == NULL) { + vm_map_unlock_read(map); + return (EINVAL); + } + + if (object->type != OBJT_MGTDEVICE || + object->un_pager.devp.ops != &sgx_pg_ops) { + vm_map_unlock_read(map); + return (EINVAL); + } + + vm_object_reference(object); + + *object0 = object; + *entry0 = entry; + vm_map_unlock_read(map); + + return (0); +} + +static int +sgx_enclave_find(struct sgx_softc *sc, uint64_t addr, + struct sgx_enclave **encl) +{ + struct sgx_vm_handle *vmh; + struct sgx_enclave *enclave; + vm_map_entry_t entry; + vm_object_t object; + int ret; + + ret = sgx_mem_find(sc, addr, &entry, &object); + if (ret) + return (ret); + + vmh = object->handle; + if (vmh == NULL) { + vm_object_deallocate(object); + return (EINVAL); + } + + enclave = vmh->enclave; + if (enclave == NULL || enclave->object == NULL) { + vm_object_deallocate(object); + return (EINVAL); + } + + *encl = enclave; + + return (0); +} + +static int +sgx_enclave_alloc(struct sgx_softc *sc, struct secs *secs, + struct sgx_enclave **enclave0) +{ + struct sgx_enclave *enclave; + + enclave = malloc(sizeof(struct sgx_enclave), + M_SGX, M_WAITOK | M_ZERO); + + enclave->base = secs->base; + enclave->size = secs->size; + + *enclave0 = enclave; + + return (0); +} + +static void +sgx_epc_page_remove(struct sgx_softc *sc, + struct epc_page *epc) +{ + + mtx_lock(&sc->mtx_encls); + sgx_eremove((void *)epc->base); + mtx_unlock(&sc->mtx_encls); +} + +static void +sgx_page_remove(struct sgx_softc *sc, vm_page_t p) +{ + struct epc_page *epc; + vm_paddr_t pa; + uint64_t offs; + + vm_page_lock(p); + vm_page_remove(p); + vm_page_unlock(p); + + dprintf("%s: p->pidx %ld\n", __func__, p->pindex); + + pa = VM_PAGE_TO_PHYS(p); + epc = &sc->epc_pages[0]; + offs = (pa - epc->phys) / PAGE_SIZE; + epc = &sc->epc_pages[offs]; + + sgx_epc_page_remove(sc, epc); + sgx_put_epc_page(sc, epc); +} + +static void +sgx_enclave_remove(struct sgx_softc *sc, + struct sgx_enclave *enclave) +{ + vm_object_t object; + vm_page_t p, p_secs, p_next; + + mtx_lock(&sc->mtx); + TAILQ_REMOVE(&sc->enclaves, enclave, next); + mtx_unlock(&sc->mtx); + + object = enclave->object; + + VM_OBJECT_WLOCK(object); + + /* + * First remove all the pages except SECS, + * then remove SECS page. + */ + p_secs = NULL; + TAILQ_FOREACH_SAFE(p, &object->memq, listq, p_next) { + if (p->pindex == SGX_SECS_VM_OBJECT_INDEX) { + p_secs = p; + continue; + } + sgx_page_remove(sc, p); + } + /* Now remove SECS page */ + if (p_secs != NULL) + sgx_page_remove(sc, p_secs); + + KASSERT(TAILQ_EMPTY(&object->memq) == 1, ("not empty")); + KASSERT(object->resident_page_count == 0, ("count")); + + VM_OBJECT_WUNLOCK(object); +} + +static int +sgx_measure_page(struct sgx_softc *sc, struct epc_page *secs, + struct epc_page *epc, uint16_t mrmask) +{ + int i, j; + int ret; + + mtx_lock(&sc->mtx_encls); + + for (i = 0, j = 1; i < PAGE_SIZE; i += 0x100, j <<= 1) { + if (!(j & mrmask)) + continue; + + ret = sgx_eextend((void *)secs->base, + (void *)(epc->base + i)); + if (ret == SGX_EFAULT) { + mtx_unlock(&sc->mtx_encls); + return (ret); + } + } + + mtx_unlock(&sc->mtx_encls); + + return (0); +} + +static int +sgx_secs_validate(struct sgx_softc *sc, struct secs *secs) +{ + struct secs_attr *attr; + int i; + + if (secs->size == 0) + return (EINVAL); + + /* BASEADDR must be naturally aligned on an SECS.SIZE boundary. */ + if (secs->base & (secs->size - 1)) + return (EINVAL); + + /* SECS.SIZE must be at least 2 pages. */ + if (secs->size < 2 * PAGE_SIZE) + return (EINVAL); + + if ((secs->size & (secs->size - 1)) != 0) + return (EINVAL); + + attr = &secs->attributes; + + if (attr->reserved1 != 0 || + attr->reserved2 != 0 || + attr->reserved3 != 0) + return (EINVAL); + + for (i = 0; i < SECS_ATTR_RSV4_SIZE; i++) + if (attr->reserved4[i]) + return (EINVAL); + + /* + * Intel® Software Guard Extensions Programming Reference + * 6.7.2 Relevant Fields in Various Data Structures + * 6.7.2.1 SECS.ATTRIBUTES.XFRM + * XFRM[1:0] must be set to 0x3. + */ + if ((attr->xfrm & 0x3) != 0x3) + return (EINVAL); + + if (!attr->mode64bit) + return (EINVAL); + + if (secs->size > sc->enclave_size_max) + return (EINVAL); + + for (i = 0; i < SECS_RSV1_SIZE; i++) + if (secs->reserved1[i]) + return (EINVAL); + + for (i = 0; i < SECS_RSV2_SIZE; i++) + if (secs->reserved2[i]) + return (EINVAL); + + for (i = 0; i < SECS_RSV3_SIZE; i++) + if (secs->reserved3[i]) + return (EINVAL); + + for (i = 0; i < SECS_RSV4_SIZE; i++) + if (secs->reserved4[i]) + return (EINVAL); + + return (0); +} + +static int +sgx_tcs_validate(struct tcs *tcs) +{ + int i; + + if ((tcs->flags) || + (tcs->ossa & (PAGE_SIZE - 1)) || + (tcs->ofsbasgx & (PAGE_SIZE - 1)) || + (tcs->ogsbasgx & (PAGE_SIZE - 1)) || + ((tcs->fslimit & 0xfff) != 0xfff) || + ((tcs->gslimit & 0xfff) != 0xfff)) + return (EINVAL); + + for (i = 0; i < nitems(tcs->reserved3); i++) + if (tcs->reserved3[i]) + return (EINVAL); + + return (0); +} + +static void +sgx_tcs_dump(struct sgx_softc *sc, struct tcs *t) +{ + + dprintf("t->flags %lx\n", t->flags); + dprintf("t->ossa %lx\n", t->ossa); + dprintf("t->cssa %x\n", t->cssa); + dprintf("t->nssa %x\n", t->nssa); + dprintf("t->oentry %lx\n", t->oentry); + dprintf("t->ofsbasgx %lx\n", t->ofsbasgx); + dprintf("t->ogsbasgx %lx\n", t->ogsbasgx); + dprintf("t->fslimit %x\n", t->fslimit); + dprintf("t->gslimit %x\n", t->gslimit); +} + +static int +sgx_pg_ctor(void *handle, vm_ooffset_t size, vm_prot_t prot, + vm_ooffset_t foff, struct ucred *cred, u_short *color) +{ + struct sgx_vm_handle *vmh; + + vmh = handle; + if (vmh == NULL) { + dprintf("%s: vmh not found.\n", __func__); + return (0); + } + + dprintf("%s: vmh->base %lx foff 0x%lx size 0x%lx\n", + __func__, vmh->base, foff, size); + + return (0); +} + +static void +sgx_pg_dtor(void *handle) +{ + struct sgx_vm_handle *vmh; + struct sgx_softc *sc; + + vmh = handle; + if (vmh == NULL) { + dprintf("%s: vmh not found.\n", __func__); + return; + } + + sc = vmh->sc; + if (sc == NULL) { + dprintf("%s: sc is NULL\n", __func__); + return; + } + + if (vmh->enclave == NULL) { + dprintf("%s: Enclave not found.\n", __func__); + return; + } + + sgx_enclave_remove(sc, vmh->enclave); + + free(vmh->enclave, M_SGX); + free(vmh, M_SGX); +} + +static int +sgx_pg_fault(vm_object_t object, vm_ooffset_t offset, + int prot, vm_page_t *mres) +{ + + /* + * The purpose of this trivial handler is to handle the race + * when user tries to access mmaped region before or during + * enclave creation ioctl calls. + */ + + dprintf("%s: offset 0x%lx\n", __func__, offset); + + return (VM_PAGER_FAIL); +} + +static struct cdev_pager_ops sgx_pg_ops = { + .cdev_pg_ctor = sgx_pg_ctor, + .cdev_pg_dtor = sgx_pg_dtor, + .cdev_pg_fault = sgx_pg_fault, +}; + + +static void +sgx_insert_epc_page_by_index(vm_page_t page, vm_object_t object, + vm_pindex_t pidx) +{ + + VM_OBJECT_ASSERT_WLOCKED(object); + + vm_page_insert(page, object, pidx); + page->valid = VM_PAGE_BITS_ALL; +} + +static void +sgx_insert_epc_page(struct sgx_enclave *enclave, + struct epc_page *epc, uint64_t addr) +{ + vm_pindex_t pidx; + vm_page_t page; + + VM_OBJECT_ASSERT_WLOCKED(enclave->object); + + pidx = OFF_TO_IDX(addr); + page = PHYS_TO_VM_PAGE(epc->phys); + + sgx_insert_epc_page_by_index(page, enclave->object, pidx); +} + +static int +sgx_ioctl_create(struct sgx_softc *sc, struct sgx_enclave_create *param) +{ + struct sgx_vm_handle *vmh; + vm_map_entry_t entry; + vm_page_t p; + struct page_info pginfo; + struct secinfo secinfo; + struct sgx_enclave *enclave; + struct epc_page *epc; + struct secs *secs; + vm_object_t object; + vm_page_t page; + int ret; + + epc = NULL; + secs = NULL; + enclave = NULL; + object = NULL; + + /* SGX Enclave Control Structure (SECS) */ + secs = malloc(PAGE_SIZE, M_SGX, M_WAITOK | M_ZERO); + ret = copyin((void *)param->src, secs, sizeof(struct secs)); + if (ret) { + dprintf("%s: Can't copy SECS.\n", __func__); + goto error; + } + + ret = sgx_secs_validate(sc, secs); + if (ret) { + dprintf("%s: SECS validation failed.\n", __func__); + goto error; + } + + ret = sgx_mem_find(sc, secs->base, &entry, &object); + if (ret) { + dprintf("%s: Can't find vm_map.\n", __func__); + goto error; + } + + vmh = object->handle; + if (!vmh) { + dprintf("%s: Can't find vmh.\n", __func__); + ret = ENXIO; + goto error; + } + + dprintf("%s: entry start %lx offset %lx\n", + __func__, entry->start, entry->offset); + vmh->base = (entry->start - entry->offset); + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Wed Aug 16 10:59:38 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CF077DD3EC6; Wed, 16 Aug 2017 10:59:38 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9B87B7E2BA; Wed, 16 Aug 2017 10:59:38 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7GAxbRD086064; Wed, 16 Aug 2017 10:59:37 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7GAxbal086062; Wed, 16 Aug 2017 10:59:37 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201708161059.v7GAxbal086062@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Wed, 16 Aug 2017 10:59:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322575 - in head/sys: dev/syscons sys X-SVN-Group: head X-SVN-Commit-Author: bde X-SVN-Commit-Paths: in head/sys: dev/syscons sys X-SVN-Commit-Revision: 322575 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2017 10:59:38 -0000 Author: bde Date: Wed Aug 16 10:59:37 2017 New Revision: 322575 URL: https://svnweb.freebsd.org/changeset/base/322575 Log: Undeprecate the CONS_CURSORTYPE ioctl. It was "deprecated" in 2001, but it was actually extended then and it is still used (just once) in /usr/src by its primary user (vidcontrol), while its replacement is still not used in /usr/src. yokota became inactive soon after deprecating CONS_CURSORTYPE (this was part of a large change to make cursor attributes per-vty). vidcontrol has incomplete support even for the old ioctl. I will update it soon. Then there are many broken escape sequences to fix. This is just to prepare for setting cursor colors using vidcontrol. Modified: head/sys/dev/syscons/syscons.c head/sys/sys/consio.h Modified: head/sys/dev/syscons/syscons.c ============================================================================== --- head/sys/dev/syscons/syscons.c Wed Aug 16 10:38:06 2017 (r322574) +++ head/sys/dev/syscons/syscons.c Wed Aug 16 10:59:37 2017 (r322575) @@ -934,7 +934,7 @@ sctty_ioctl(struct tty *tp, u_long cmd, caddr_t data, splx(s); return 0; - case CONS_CURSORTYPE: /* set cursor type (obsolete) */ + case CONS_CURSORTYPE: /* set cursor type (old interface + HIDDEN) */ s = spltty(); *(int *)data &= CONS_CURSOR_ATTRS; sc_change_cursor_shape(scp, *(int *)data, -1, -1); Modified: head/sys/sys/consio.h ============================================================================== --- head/sys/sys/consio.h Wed Aug 16 10:38:06 2017 (r322574) +++ head/sys/sys/consio.h Wed Aug 16 10:59:37 2017 (r322575) @@ -103,11 +103,15 @@ typedef struct ssaver ssaver_t; #define CONS_SSAVER _IOW('c', 5, ssaver_t) #define CONS_GSAVER _IOWR('c', 6, ssaver_t) -/* set the text cursor type (obsolete, see CONS_CURSORSHAPE below) */ /* -#define CONS_BLINK_CURSOR (1 << 0) -#define CONS_CHAR_CURSOR (1 << 1) -*/ + * Set the text cursor type. + * + * This is an old interface extended to support the CONS_HIDDEN_CURSOR bit. + * New code should use CONS_CURSORSHAPE. CONS_CURSOR_ATTRS gives the 3 + * bits supported by the (extended) old interface. The old interface is + * especially unusable for hiding the cursor (even with its extension) + * since it changes the cursor on all vtys. + */ #define CONS_CURSORTYPE _IOW('c', 7, int) /* set the bell type to audible or visual */ From owner-svn-src-head@freebsd.org Wed Aug 16 13:44:47 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 980A5DDC9C4; Wed, 16 Aug 2017 13:44:47 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 6200F83EB3; Wed, 16 Aug 2017 13:44:47 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7GDikS4054859; Wed, 16 Aug 2017 13:44:46 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7GDikSs054858; Wed, 16 Aug 2017 13:44:46 GMT (envelope-from br@FreeBSD.org) Message-Id: <201708161344.v7GDikSs054858@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Wed, 16 Aug 2017 13:44:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322578 - head/sys/amd64/sgx X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: head/sys/amd64/sgx X-SVN-Commit-Revision: 322578 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2017 13:44:47 -0000 Author: br Date: Wed Aug 16 13:44:46 2017 New Revision: 322578 URL: https://svnweb.freebsd.org/changeset/base/322578 Log: Rename macro DEBUG to SGX_DEBUG. This fixes LINT kernel build. Reported by: lwhsu Sponsored by: DARPA, AFRL Modified: head/sys/amd64/sgx/sgx.c Modified: head/sys/amd64/sgx/sgx.c ============================================================================== --- head/sys/amd64/sgx/sgx.c Wed Aug 16 13:06:26 2017 (r322577) +++ head/sys/amd64/sgx/sgx.c Wed Aug 16 13:44:46 2017 (r322578) @@ -154,10 +154,10 @@ __FBSDID("$FreeBSD$"); #include -#define DEBUG -#undef DEBUG +#define SGX_DEBUG +#undef SGX_DEBUG -#ifdef DEBUG +#ifdef SGX_DEBUG #define dprintf(fmt, ...) printf(fmt, ##__VA_ARGS__) #else #define dprintf(fmt, ...) From owner-svn-src-head@freebsd.org Wed Aug 16 14:15:38 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9DC74DDDF17; Wed, 16 Aug 2017 14:15:38 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.blih.net", Issuer "mail.blih.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4AD2C84EC3; Wed, 16 Aug 2017 14:15:36 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) by mail.blih.net (OpenSMTPD) with ESMTP id 09b9f04f; Wed, 16 Aug 2017 16:08:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=mail; bh=kZDJpIEJfzHephZNl5e/ungObCg=; b=kVJZuXlzj/o71Jih6vRi/9GUCHzU 5uSh5+snr8eNTOd8hrHH8PK9tyPF7xhxcD2L7qybIjX+IsZ+3oFh68Fcgu3gtBj6 xvS0JY/D6zQZWB25IvGkDkPEOwhnrmeqnqUMm+3pWeHP8EWTbLigO/6ycLMSneGd zRZH1zIVFAU5zcU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; q=dns; s= mail; b=YrnMZvOnkqYQCc48fjcQnlBzkjGhY3Q+PwFM0P6RTmudOfiCCfHieq5i pNDTK+Kwwp3+OcELQ0f9pOregzxj87bv83u1Z/GADymfHOEX9maVdxmBMeuYzjrO CpSDOCrYPpteHCOFj41Ed8StTNcqTYMur6xnZaGJXv2owdkCQag= Received: from knuckles.blih.net (ip-54.net-82-216-203.roubaix.rev.numericable.fr [82.216.203.54]) by mail.blih.net (OpenSMTPD) with ESMTPSA id 33136657 TLS version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO; Wed, 16 Aug 2017 16:08:53 +0200 (CEST) Date: Wed, 16 Aug 2017 16:08:50 +0200 From: Emmanuel Vadot To: Gleb Smirnoff Cc: Emmanuel Vadot , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r320944 - head/etc/rc.d Message-Id: <20170816160850.1b695e1e292f46f892301db5@bidouilliste.com> In-Reply-To: <20170815224929.GC1113@FreeBSD.org> References: <201707131340.v6DDeIE9086139@repo.freebsd.org> <20170815224929.GC1113@FreeBSD.org> X-Mailer: Sylpheed 3.6.0 (GTK+ 2.24.31; amd64-portbld-freebsd12.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2017 14:15:38 -0000 Hi Gleb, On Tue, 15 Aug 2017 15:49:29 -0700 Gleb Smirnoff wrote: > Emmanuel, > > On Thu, Jul 13, 2017 at 01:40:18PM +0000, Emmanuel Vadot wrote: > E> Author: manu > E> Date: Thu Jul 13 13:40:18 2017 > E> New Revision: 320944 > E> URL: https://svnweb.freebsd.org/changeset/base/320944 > E> > E> Log: > E> Add an rc.d script to setup a netflow export via ng_netflow > E> The default is to export netflow data on localhost on the netflow port. > E> ngtee is used to have the lowest overhead possible. > E> The ipfw ng hook is the netflow port (it can only be numeric) > E> Default is netflow version 5. > E> > E> Sponsored-By: Gandi.net > E> Reviewed by: bapt (earlier version), olivier (earlier version) > > It could be that using "netgraph" action instead of "ngtee" and then > returning packet back from netgraph to ipfw would show lower overhead. > However, this setup is definitely going to be less robust and more prone > to bugs in case of complex ipfw configurations. > > -- > Totus tuus, Glebius. I should have been more clear, I didn't mean that it would have less overhead in memory but in process time. Reading the source code I saw that ngtee simply m_dup the packet and then ipfw directly continue with the original one, so it seems to me that this would be the the fastest way to process packets. Could you expand on "less robust and more prone to bugs" for the "netgraph" case ? Cheers, -- Emmanuel Vadot From owner-svn-src-head@freebsd.org Wed Aug 16 15:14:47 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 57C4ADE1807; Wed, 16 Aug 2017 15:14:47 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 213F527C3; Wed, 16 Aug 2017 15:14:47 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7GFEkZv091038; Wed, 16 Aug 2017 15:14:46 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7GFEkMw091037; Wed, 16 Aug 2017 15:14:46 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201708161514.v7GFEkMw091037@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Wed, 16 Aug 2017 15:14:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322579 - head/usr.sbin/vidcontrol X-SVN-Group: head X-SVN-Commit-Author: bde X-SVN-Commit-Paths: head/usr.sbin/vidcontrol X-SVN-Commit-Revision: 322579 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2017 15:14:47 -0000 Author: bde Date: Wed Aug 16 15:14:46 2017 New Revision: 322579 URL: https://svnweb.freebsd.org/changeset/base/322579 Log: Fix setting of the border color. Teken doesn't support syscons' escape sequence "ESC [ %d A" for this although that was used here. I will fix teken later, but use the more portable ioctl KDSBORDER here. The ioctl is also much easier to use if you check that it works. For -b, check it and complain and exit if it failed, so that it is more obvious that that vt doesn't support border colors. Don't check it when restoring the border color in revert(), since revert() is used on vt for handling other errors. Fix nearby error handling and style. For the error of an invalid color, revert() and print a specific error message using err() instead of not revert()ing and printing spam using usage(). Modified: head/usr.sbin/vidcontrol/vidcontrol.c Modified: head/usr.sbin/vidcontrol/vidcontrol.c ============================================================================== --- head/usr.sbin/vidcontrol/vidcontrol.c Wed Aug 16 13:44:46 2017 (r322578) +++ head/usr.sbin/vidcontrol/vidcontrol.c Wed Aug 16 15:14:46 2017 (r322579) @@ -154,7 +154,7 @@ revert(void) ioctl(0, VT_ACTIVATE, cur_info.active_vty); - fprintf(stderr, "\033[=%dA", cur_info.console_info.mv_ovscan); + ioctl(0, KDSBORDER, cur_info.console_info.mv_ovscan); fprintf(stderr, "\033[=%dH", cur_info.console_info.mv_rev.fore); fprintf(stderr, "\033[=%dI", cur_info.console_info.mv_rev.back); @@ -910,11 +910,15 @@ set_border_color(char *arg) { int color; - if ((color = get_color_number(arg)) != -1) { - fprintf(stderr, "\033[=%dA", color); + color = get_color_number(arg); + if (color == -1) { + revert(); + errx(1, "invalid color '%s'", arg); } - else - usage(); + if (ioctl(0, KDSBORDER, color) != 0) { + revert(); + err(1, "ioctl(KD_SBORDER)"); + } } static void From owner-svn-src-head@freebsd.org Wed Aug 16 16:51:56 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 87CCEDE64AF; Wed, 16 Aug 2017 16:51:56 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 52CDD65C02; Wed, 16 Aug 2017 16:51:56 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7GGptq7032423; Wed, 16 Aug 2017 16:51:55 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7GGptSg032422; Wed, 16 Aug 2017 16:51:55 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201708161651.v7GGptSg032422@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Wed, 16 Aug 2017 16:51:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322580 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 322580 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2017 16:51:56 -0000 Author: ian Date: Wed Aug 16 16:51:55 2017 New Revision: 322580 URL: https://svnweb.freebsd.org/changeset/base/322580 Log: Fix compile error with option DEBUG. This is fallout from some long-ago INTRNG refactoring that didn't get caught at the time because code in a debugf() statement isn't compiled unless DEBUG is defined. PR: 221557 Modified: head/sys/kern/subr_intr.c Modified: head/sys/kern/subr_intr.c ============================================================================== --- head/sys/kern/subr_intr.c Wed Aug 16 15:14:46 2017 (r322579) +++ head/sys/kern/subr_intr.c Wed Aug 16 16:51:55 2017 (r322580) @@ -1031,14 +1031,14 @@ intr_setup_irq(device_t dev, struct resource *res, dri if (flags & INTR_SOLO) { error = iscr_setup_filter(isrc, name, (intr_irq_filter_t *)filt, arg, cookiep); - debugf("irq %u setup filter error %d on %s\n", irq, error, + debugf("irq %u setup filter error %d on %s\n", isrc->isrc_irq, error, name); } else #endif { error = isrc_add_handler(isrc, name, filt, hand, arg, flags, cookiep); - debugf("irq %u add handler error %d on %s\n", irq, error, name); + debugf("irq %u add handler error %d on %s\n", isrc->isrc_irq, error, name); } if (error != 0) return (error); From owner-svn-src-head@freebsd.org Wed Aug 16 17:22:43 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6FC7DDC235D; Wed, 16 Aug 2017 17:22:43 +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 mx1.freebsd.org (Postfix) with ESMTPS id 3CB31670B4; Wed, 16 Aug 2017 17:22:43 +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 v7GHMg3f046599; Wed, 16 Aug 2017 17:22:42 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7GHMgOU046598; Wed, 16 Aug 2017 17:22:42 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201708161722.v7GHMgOU046598@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 16 Aug 2017 17:22:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322581 - head/tools/build/mk X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/tools/build/mk X-SVN-Commit-Revision: 322581 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2017 17:22:43 -0000 Author: emaste Date: Wed Aug 16 17:22:42 2017 New Revision: 322581 URL: https://svnweb.freebsd.org/changeset/base/322581 Log: remove debug files in delete-old* when WITHOUT_DEBUG_FILES Reported by: brd Reviewed by: bdrewery, brd MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D12044 Modified: head/tools/build/mk/OptionalObsoleteFiles.inc Modified: head/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- head/tools/build/mk/OptionalObsoleteFiles.inc Wed Aug 16 16:51:55 2017 (r322580) +++ head/tools/build/mk/OptionalObsoleteFiles.inc Wed Aug 16 17:22:42 2017 (r322581) @@ -1557,6 +1557,22 @@ OLD_FILES+=usr/bin/g++ OLD_FILES+=usr/libexec/cc1plus .endif +.if ${MK_DEBUG_FILES} == no +.if exists(${DESTDIR}/usr/lib/debug) +DEBUG_DIRS!=find ${DESTDIR}/usr/lib/debug -mindepth 1 \ + -type d \! -path "${DESTDIR}/usr/lib/debug/boot/*" \ + | sed -e 's,^${DESTDIR}/,,'; echo +DEBUG_FILES!=find ${DESTDIR}/usr/lib/debug \ + \! -type d \! -path "${DESTDIR}/usr/lib/debug/boot/*" \! -name "lib*.so*" \ + | sed -e 's,^${DESTDIR}/,,'; echo +DEBUG_LIBS!=find ${DESTDIR}/usr/lib/debug \! -type d -name "lib*.so*" \ + | sed -e 's,^${DESTDIR}/,,'; echo +OLD_DIRS+=${DEBUG_DIRS} +OLD_FILES+=${DEBUG_FILES} +OLD_LIBS+=${DEBUG_LIBS} +.endif +.endif + .if ${MK_DIALOG} == no OLD_FILES+=usr/bin/dialog OLD_FILES+=usr/bin/dpv From owner-svn-src-head@freebsd.org Wed Aug 16 17:54:26 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 67E70DC54AA; Wed, 16 Aug 2017 17:54:26 +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 mx1.freebsd.org (Postfix) with ESMTPS id 34F83687AF; Wed, 16 Aug 2017 17:54:26 +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 v7GHsPOO059189; Wed, 16 Aug 2017 17:54:25 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7GHsO5a059186; Wed, 16 Aug 2017 17:54:24 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201708161754.v7GHsO5a059186@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Wed, 16 Aug 2017 17:54:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322585 - in head: . share/mk sys/conf X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: in head: . share/mk sys/conf X-SVN-Commit-Revision: 322585 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2017 17:54:26 -0000 Author: bdrewery Date: Wed Aug 16 17:54:24 2017 New Revision: 322585 URL: https://svnweb.freebsd.org/changeset/base/322585 Log: Quote ${MAKE} when passing in env in case it contains spaces. Downstream we are wrapping MAKE with a limits(1) call which interferes with these non-quoted cases. Sponsored by: Dell EMC Isilon Modified: head/Makefile head/share/mk/bsd.crunchgen.mk head/sys/conf/kern.post.mk Modified: head/Makefile ============================================================================== --- head/Makefile Wed Aug 16 17:46:45 2017 (r322584) +++ head/Makefile Wed Aug 16 17:54:24 2017 (r322585) @@ -221,7 +221,7 @@ SUB_MAKE= `test -x ${MYMAKE} && echo ${MYMAKE} || echo SUB_MAKE= ${MAKE} -m ${.CURDIR}/share/mk .endif -_MAKE= PATH=${PATH} MAKE_CMD=${MAKE} ${SUB_MAKE} -f Makefile.inc1 \ +_MAKE= PATH=${PATH} MAKE_CMD="${MAKE}" ${SUB_MAKE} -f Makefile.inc1 \ TARGET=${_TARGET} TARGET_ARCH=${_TARGET_ARCH} # Only allow meta mode for the whitelisted targets. See META_TGT_WHITELIST Modified: head/share/mk/bsd.crunchgen.mk ============================================================================== --- head/share/mk/bsd.crunchgen.mk Wed Aug 16 17:46:45 2017 (r322584) +++ head/share/mk/bsd.crunchgen.mk Wed Aug 16 17:54:24 2017 (r322585) @@ -114,7 +114,7 @@ CRUNCHENV+= MK_TESTS=no \ ${OUTPUTS:[1]}: .META ${OUTPUTS:[2..-1]}: .NOMETA ${OUTPUTS}: ${CONF} - MAKE=${MAKE} ${CRUNCHENV:NMK_AUTO_OBJ=*} MAKEOBJDIRPREFIX=${CRUNCHOBJS} \ + MAKE="${MAKE}" ${CRUNCHENV:NMK_AUTO_OBJ=*} MAKEOBJDIRPREFIX=${CRUNCHOBJS} \ MK_AUTO_OBJ=${MK_AUTO_OBJ} \ ${CRUNCHGEN} -fq -m ${OUTMK} -c ${OUTC} ${CONF} # Avoid redundantly calling 'make objs' which we've done by our Modified: head/sys/conf/kern.post.mk ============================================================================== --- head/sys/conf/kern.post.mk Wed Aug 16 17:46:45 2017 (r322584) +++ head/sys/conf/kern.post.mk Wed Aug 16 17:54:24 2017 (r322585) @@ -372,7 +372,7 @@ config.ln env.ln hints.ln vers.ln vnode_if.ln: REPRO_FLAG="-r" .endif vers.c: $S/conf/newvers.sh $S/sys/param.h ${SYSTEM_DEP} - MAKE=${MAKE} sh $S/conf/newvers.sh ${REPRO_FLAG} ${KERN_IDENT} + MAKE="${MAKE}" sh $S/conf/newvers.sh ${REPRO_FLAG} ${KERN_IDENT} vnode_if.c: $S/tools/vnode_if.awk $S/kern/vnode_if.src ${AWK} -f $S/tools/vnode_if.awk $S/kern/vnode_if.src -c From owner-svn-src-head@freebsd.org Wed Aug 16 18:48:55 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7311BDC88CA; Wed, 16 Aug 2017 18:48:55 +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 mx1.freebsd.org (Postfix) with ESMTPS id 4A8156AB40; Wed, 16 Aug 2017 18:48:55 +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 v7GImsrF079415; Wed, 16 Aug 2017 18:48:54 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7GImsDv079412; Wed, 16 Aug 2017 18:48:54 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201708161848.v7GImsDv079412@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 16 Aug 2017 18:48:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322588 - in head/sys: amd64/include i386/include x86/x86 X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/sys: amd64/include i386/include x86/x86 X-SVN-Commit-Revision: 322588 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2017 18:48:55 -0000 Author: cem Date: Wed Aug 16 18:48:53 2017 New Revision: 322588 URL: https://svnweb.freebsd.org/changeset/base/322588 Log: x86: Add dynamic interrupt rebalancing Add an option to dynamically rebalance interrupts across cores (hw.intrbalance); off by default. The goal is to minimize preemption. By placing interrupt sources on distinct CPUs, ithreads get preferentially scheduled on distinct CPUs. Overall preemption is reduced and latency is reduced. In our workflow it reduced "fighting" between two high-frequency interrupt sources. Reduced latency was proven by, e.g., SPEC2008. Submitted by: jeff@ (earlier version) Reviewed by: kib@ Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D10435 Modified: head/sys/amd64/include/intr_machdep.h head/sys/i386/include/intr_machdep.h head/sys/x86/x86/intr_machdep.c Modified: head/sys/amd64/include/intr_machdep.h ============================================================================== --- head/sys/amd64/include/intr_machdep.h Wed Aug 16 18:00:32 2017 (r322587) +++ head/sys/amd64/include/intr_machdep.h Wed Aug 16 18:48:53 2017 (r322588) @@ -130,6 +130,7 @@ struct intsrc { u_long *is_straycount; u_int is_index; u_int is_handlers; + u_int is_cpu; }; struct trapframe; Modified: head/sys/i386/include/intr_machdep.h ============================================================================== --- head/sys/i386/include/intr_machdep.h Wed Aug 16 18:00:32 2017 (r322587) +++ head/sys/i386/include/intr_machdep.h Wed Aug 16 18:48:53 2017 (r322588) @@ -130,6 +130,7 @@ struct intsrc { u_long *is_straycount; u_int is_index; u_int is_handlers; + u_int is_cpu; }; struct trapframe; Modified: head/sys/x86/x86/intr_machdep.c ============================================================================== --- head/sys/x86/x86/intr_machdep.c Wed Aug 16 18:00:32 2017 (r322587) +++ head/sys/x86/x86/intr_machdep.c Wed Aug 16 18:48:53 2017 (r322588) @@ -45,10 +45,14 @@ #include #include #include +#include +#include #include #include +#include #include #include +#include #include #include #include @@ -71,6 +75,12 @@ typedef void (*mask_fn)(void *); static int intrcnt_index; static struct intsrc *interrupt_sources[NUM_IO_INTS]; +static struct intsrc *interrupt_sorted[NUM_IO_INTS]; +CTASSERT(sizeof(interrupt_sources) == sizeof(interrupt_sorted)); +static int intrbalance; +SYSCTL_INT(_hw, OID_AUTO, intrbalance, CTLFLAG_RW, &intrbalance, 0, + "Interrupt auto-balance interval (seconds). Zero disables."); +static struct timeout_task intrbalance_task; static struct sx intrsrc_lock; static struct mtx intrpic_lock; static struct mtx intrcnt_lock; @@ -325,6 +335,8 @@ intr_assign_cpu(void *arg, int cpu) isrc = arg; sx_xlock(&intrsrc_lock); error = isrc->is_pic->pic_assign_cpu(isrc, cpu_apic_ids[cpu]); + if (error == 0) + isrc->is_cpu = cpu; sx_xunlock(&intrsrc_lock); } else error = 0; @@ -559,6 +571,7 @@ static void intr_shuffle_irqs(void *arg __unused) { struct intsrc *isrc; + u_int cpu; int i; /* Don't bother on UP. */ @@ -578,13 +591,15 @@ intr_shuffle_irqs(void *arg __unused) * this is careful to only advance the * round-robin if the CPU assignment succeeds. */ - if (isrc->is_event->ie_cpu != NOCPU) - (void)isrc->is_pic->pic_assign_cpu(isrc, - cpu_apic_ids[isrc->is_event->ie_cpu]); - else if (isrc->is_pic->pic_assign_cpu(isrc, - cpu_apic_ids[current_cpu]) == 0) - (void)intr_next_cpu(); - + cpu = isrc->is_event->ie_cpu; + if (cpu == NOCPU) + cpu = current_cpu; + if (isrc->is_pic->pic_assign_cpu(isrc, + cpu_apic_ids[cpu]) == 0) { + isrc->is_cpu = cpu; + if (isrc->is_event->ie_cpu == NOCPU) + intr_next_cpu(); + } } } sx_xunlock(&intrsrc_lock); @@ -592,6 +607,123 @@ intr_shuffle_irqs(void *arg __unused) SYSINIT(intr_shuffle_irqs, SI_SUB_SMP, SI_ORDER_SECOND, intr_shuffle_irqs, NULL); #endif + +/* + * TODO: Export this information in a non-MD fashion, integrate with vmstat -i. + */ +static int +sysctl_hw_intrs(SYSCTL_HANDLER_ARGS) +{ + struct sbuf sbuf; + struct intsrc *isrc; + int error; + int i; + + error = sysctl_wire_old_buffer(req, 0); + if (error != 0) + return (error); + + sbuf_new_for_sysctl(&sbuf, NULL, 128, req); + sx_slock(&intrsrc_lock); + for (i = 0; i < NUM_IO_INTS; i++) { + isrc = interrupt_sources[i]; + if (isrc == NULL) + continue; + sbuf_printf(&sbuf, "%s:%d @%d: %ld\n", + isrc->is_event->ie_fullname, + isrc->is_index, + isrc->is_cpu, + *isrc->is_count); + } + + sx_sunlock(&intrsrc_lock); + error = sbuf_finish(&sbuf); + sbuf_delete(&sbuf); + return (error); +} +SYSCTL_PROC(_hw, OID_AUTO, intrs, CTLTYPE_STRING | CTLFLAG_RW, + 0, 0, sysctl_hw_intrs, "A", "interrupt:number @cpu: count"); + +/* + * Compare two, possibly NULL, entries in the interrupt source array + * by load. + */ +static int +intrcmp(const void *one, const void *two) +{ + const struct intsrc *i1, *i2; + + i1 = *(const struct intsrc * const *)one; + i2 = *(const struct intsrc * const *)two; + if (i1 != NULL && i2 != NULL) + return (*i1->is_count - *i2->is_count); + if (i1 != NULL) + return (1); + if (i2 != NULL) + return (-1); + return (0); +} + +/* + * Balance IRQs across available CPUs according to load. + */ +static void +intr_balance(void *dummy __unused, int pending __unused) +{ + struct intsrc *isrc; + int interval; + u_int cpu; + int i; + + interval = intrbalance; + if (interval == 0) + goto out; + + /* + * Sort interrupts according to count. + */ + sx_xlock(&intrsrc_lock); + memcpy(interrupt_sorted, interrupt_sources, sizeof(interrupt_sorted)); + qsort(interrupt_sorted, NUM_IO_INTS, sizeof(interrupt_sorted[0]), + intrcmp); + + /* + * Restart the scan from the same location to avoid moving in the + * common case. + */ + current_cpu = 0; + + /* + * Assign round-robin from most loaded to least. + */ + for (i = NUM_IO_INTS - 1; i >= 0; i--) { + isrc = interrupt_sorted[i]; + if (isrc == NULL || isrc->is_event->ie_cpu != NOCPU) + continue; + cpu = current_cpu; + intr_next_cpu(); + if (isrc->is_cpu != cpu && + isrc->is_pic->pic_assign_cpu(isrc, + cpu_apic_ids[cpu]) == 0) + isrc->is_cpu = cpu; + } + sx_xunlock(&intrsrc_lock); +out: + taskqueue_enqueue_timeout(taskqueue_thread, &intrbalance_task, + interval ? hz * interval : hz * 60); + +} + +static void +intr_balance_init(void *dummy __unused) +{ + + TIMEOUT_TASK_INIT(taskqueue_thread, &intrbalance_task, 0, intr_balance, + NULL); + taskqueue_enqueue_timeout(taskqueue_thread, &intrbalance_task, hz); +} +SYSINIT(intr_balance_init, SI_SUB_SMP, SI_ORDER_ANY, intr_balance_init, NULL); + #else /* * Always route interrupts to the current processor in the UP case. From owner-svn-src-head@freebsd.org Wed Aug 16 18:55:40 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6B188DC8F66; Wed, 16 Aug 2017 18:55:40 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 33A9A6B1A5; Wed, 16 Aug 2017 18:55:40 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7GItdHb083728; Wed, 16 Aug 2017 18:55:39 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7GItdFB083727; Wed, 16 Aug 2017 18:55:39 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201708161855.v7GItdFB083727@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 16 Aug 2017 18:55:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322589 - head/lib/libc/i386 X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/lib/libc/i386 X-SVN-Commit-Revision: 322589 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2017 18:55:40 -0000 Author: emaste Date: Wed Aug 16 18:55:39 2017 New Revision: 322589 URL: https://svnweb.freebsd.org/changeset/base/322589 Log: force use of ld.bfd for linking i386 libc, even when using lld lld can successfully link most of a working i386 userland and kernel, but produces a broken libc. For now if we're otherwise using lld, and ld.bfd is available, explicitly use it for libc. Sponsored by: The FreeBSD Foundation Modified: head/lib/libc/i386/Makefile.inc Modified: head/lib/libc/i386/Makefile.inc ============================================================================== --- head/lib/libc/i386/Makefile.inc Wed Aug 16 18:48:53 2017 (r322588) +++ head/lib/libc/i386/Makefile.inc Wed Aug 16 18:55:39 2017 (r322589) @@ -4,3 +4,13 @@ GDTOASRCS+=strtorx.c SRCS+=machdep_ldisx.c SYM_MAPS+=${LIBC_SRCTOP}/i386/Symbol.map + +# XXX force use of ld.bfd for linking i386 libc +# +# lld can successfully link most of a working i386 userland and kernel, +# but produces a broken libc. For now if we're otherwise using lld, and +# ld.bfd is available, explicitly use it for libc. +.include +.if ${LINKER_TYPE} == "lld" && ${MK_BINUTILS_BOOTSTRAP} != "no" +LDFLAGS+=-fuse-ld=bfd +.endif From owner-svn-src-head@freebsd.org Wed Aug 16 19:40:08 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D75F1DCBBF3; Wed, 16 Aug 2017 19:40:08 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A1DAE6C6FD; Wed, 16 Aug 2017 19:40:08 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7GJe7G7099849; Wed, 16 Aug 2017 19:40:07 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7GJe7OI099848; Wed, 16 Aug 2017 19:40:07 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201708161940.v7GJe7OI099848@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Wed, 16 Aug 2017 19:40:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322590 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 322590 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2017 19:40:09 -0000 Author: kp Date: Wed Aug 16 19:40:07 2017 New Revision: 322590 URL: https://svnweb.freebsd.org/changeset/base/322590 Log: bpf: Fix incorrect cleanup Cleaning up a bpf_if is a two stage process. We first move it to the bpf_freelist (in bpfdetach()) and only later do we actually free it (in bpf_ifdetach()). We cannot set the ifp->if_bpf to NULL from bpf_ifdetach() because it's possible that the ifnet has already gone away, or that it has been assigned a new bpf_if. This can lead to a struct ifnet which is up, but has if_bpf set to NULL, which will panic when we try to send the next packet. Keep track of the pointer to the bpf_if (because it's not always ifp->if_bpf), and NULL it immediately in bpfdetach(). PR: 213896 MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D11782 Modified: head/sys/net/bpf.c Modified: head/sys/net/bpf.c ============================================================================== --- head/sys/net/bpf.c Wed Aug 16 18:55:39 2017 (r322589) +++ head/sys/net/bpf.c Wed Aug 16 19:40:07 2017 (r322590) @@ -106,6 +106,7 @@ struct bpf_if { struct rwlock bif_lock; /* interface lock */ LIST_HEAD(, bpf_d) bif_wlist; /* writer-only list */ int bif_flags; /* Interface flags */ + struct bpf_if **bif_bpf; /* Pointer to pointer to us */ }; CTASSERT(offsetof(struct bpf_if, bif_ext) == 0); @@ -2563,6 +2564,7 @@ bpfattach2(struct ifnet *ifp, u_int dlt, u_int hdrlen, bp->bif_dlt = dlt; rw_init(&bp->bif_lock, "bpf interface lock"); KASSERT(*driverp == NULL, ("bpfattach2: driverp already initialized")); + bp->bif_bpf = driverp; *driverp = bp; BPF_LOCK(); @@ -2633,6 +2635,7 @@ bpfdetach(struct ifnet *ifp) */ BPFIF_WLOCK(bp); bp->bif_flags |= BPFIF_FLAG_DYING; + *bp->bif_bpf = NULL; BPFIF_WUNLOCK(bp); CTR4(KTR_NET, "%s: sheduling free for encap %d (%p) for if %p", @@ -2702,13 +2705,6 @@ bpf_ifdetach(void *arg __unused, struct ifnet *ifp) nmatched++; } BPF_UNLOCK(); - - /* - * Note that we cannot zero other pointers to - * custom DLTs possibly used by given interface. - */ - if (nmatched != 0) - ifp->if_bpf = NULL; } /* From owner-svn-src-head@freebsd.org Wed Aug 16 20:06:39 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8B41CDCD5EC; Wed, 16 Aug 2017 20:06:39 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5510B6D757; Wed, 16 Aug 2017 20:06:39 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7GK6cbB012087; Wed, 16 Aug 2017 20:06:38 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7GK6cp5012086; Wed, 16 Aug 2017 20:06:38 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201708162006.v7GK6cp5012086@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 16 Aug 2017 20:06:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322592 - head/sys/boot/efi/include X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/boot/efi/include X-SVN-Commit-Revision: 322592 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2017 20:06:39 -0000 Author: imp Date: Wed Aug 16 20:06:38 2017 New Revision: 322592 URL: https://svnweb.freebsd.org/changeset/base/322592 Log: Remove unused defines. Modified: head/sys/boot/efi/include/efi.h Modified: head/sys/boot/efi/include/efi.h ============================================================================== --- head/sys/boot/efi/include/efi.h Wed Aug 16 19:52:31 2017 (r322591) +++ head/sys/boot/efi/include/efi.h Wed Aug 16 20:06:38 2017 (r322592) @@ -54,10 +54,4 @@ Revision History #include "efierr.h" #include "efigop.h" -#define EFI_STRINGIZE(a) #a -#define EFI_PROTOCOL_DEFINITION(a) EFI_STRINGIZE(Protocol/a/a.h) - -#define EFI_GUID_DEFINITION(a) EFI_STRINGIZE(Guid/a/a##.h) -#define EFI_GUID_STRING(guidpointer, shortstring, longstring) - #endif From owner-svn-src-head@freebsd.org Wed Aug 16 20:08:57 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D2720DCD82F; Wed, 16 Aug 2017 20:08:57 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (glebi.us [96.95.210.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id BA1856D8D4; Wed, 16 Aug 2017 20:08:56 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id v7GK8ldx017181 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 16 Aug 2017 13:08:47 -0700 (PDT) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id v7GK8lsL017180; Wed, 16 Aug 2017 13:08:47 -0700 (PDT) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@FreeBSD.org using -f Date: Wed, 16 Aug 2017 13:08:47 -0700 From: Gleb Smirnoff To: Emmanuel Vadot Cc: Emmanuel Vadot , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r320944 - head/etc/rc.d Message-ID: <20170816200847.GJ1113@FreeBSD.org> References: <201707131340.v6DDeIE9086139@repo.freebsd.org> <20170815224929.GC1113@FreeBSD.org> <20170816160850.1b695e1e292f46f892301db5@bidouilliste.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170816160850.1b695e1e292f46f892301db5@bidouilliste.com> User-Agent: Mutt/1.8.3 (2017-05-23) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2017 20:08:57 -0000 Emmanuel, On Wed, Aug 16, 2017 at 04:08:50PM +0200, Emmanuel Vadot wrote: E> > It could be that using "netgraph" action instead of "ngtee" and then E> > returning packet back from netgraph to ipfw would show lower overhead. E> > However, this setup is definitely going to be less robust and more prone E> > to bugs in case of complex ipfw configurations. E> E> I should have been more clear, I didn't mean that it would have less E> overhead in memory but in process time. E> Reading the source code I saw that ngtee simply m_dup the packet E> and then ipfw directly continue with the original one, so it seems to E> me that this would be the the fastest way to process packets. Allocating memory, doing a memory copy, and freeing memory is also process time. E> Could you expand on "less robust and more prone to bugs" for the E> "netgraph" case ? The "netgraph" action send packet to netgraph allocating a tag so that if later the ng_ipfw node receives the tagged packet back, it can inject it to the next rule after the rule with "netgraph" action. This all is documented. -- Totus tuus, Glebius. From owner-svn-src-head@freebsd.org Wed Aug 16 20:09:41 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 04B94DCD909; Wed, 16 Aug 2017 20:09:41 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C0BB76DA41; Wed, 16 Aug 2017 20:09:40 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7GK9dQL012232; Wed, 16 Aug 2017 20:09:39 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7GK9dx9012231; Wed, 16 Aug 2017 20:09:39 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201708162009.v7GK9dx9012231@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 16 Aug 2017 20:09:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322593 - head/sys/boot/efi/include X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/boot/efi/include X-SVN-Commit-Revision: 322593 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2017 20:09:41 -0000 Author: imp Date: Wed Aug 16 20:09:39 2017 New Revision: 322593 URL: https://svnweb.freebsd.org/changeset/base/322593 Log: Define proposed GUID for FreeBSD boot loader variables. Modified: head/sys/boot/efi/include/efi.h Modified: head/sys/boot/efi/include/efi.h ============================================================================== --- head/sys/boot/efi/include/efi.h Wed Aug 16 20:06:38 2017 (r322592) +++ head/sys/boot/efi/include/efi.h Wed Aug 16 20:09:39 2017 (r322593) @@ -54,4 +54,10 @@ Revision History #include "efierr.h" #include "efigop.h" +/* + * FreeBSD UUID + */ +#define FREEBSD_BOOT_VAR_GUID \ + { 0xCFEE69AD, 0xA0DE, 0x47A9, {0x93, 0xA8, 0xF6, 0x31, 0x06, 0xF8, 0xAE, 0x99} } + #endif From owner-svn-src-head@freebsd.org Wed Aug 16 20:43:29 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6428DDD01F1; Wed, 16 Aug 2017 20:43:29 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (glebi.us [96.95.210.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 3A33B6F331; Wed, 16 Aug 2017 20:43:28 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id v7GKhRfT017397 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 16 Aug 2017 13:43:27 -0700 (PDT) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id v7GKhRLj017396; Wed, 16 Aug 2017 13:43:27 -0700 (PDT) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@FreeBSD.org using -f Date: Wed, 16 Aug 2017 13:43:27 -0700 From: Gleb Smirnoff To: Sean Bruno , Matt Macy Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r322338 - head/sys/net Message-ID: <20170816204327.GK1113@FreeBSD.org> References: <201708100343.v7A3hNwR068837@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201708100343.v7A3hNwR068837@repo.freebsd.org> User-Agent: Mutt/1.8.3 (2017-05-23) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2017 20:43:29 -0000 Hi, On Thu, Aug 10, 2017 at 03:43:23AM +0000, Sean Bruno wrote: S> Author: sbruno S> Date: Thu Aug 10 03:43:23 2017 S> New Revision: 322338 S> URL: https://svnweb.freebsd.org/changeset/base/322338 S> S> Log: S> Don't leak mbufs if clusers exceeds the number of segments. This would S> leak mbufs over time causing crashes. S> S> PR: 221202 S> Submitted by: Matt Macy S> Reported by: gergely.czuczy@harmless.hu S> Sponsored by: Limelight Networks S> S> Modified: S> head/sys/net/iflib.c S> S> Modified: head/sys/net/iflib.c S> ============================================================================== S> --- head/sys/net/iflib.c Thu Aug 10 03:11:05 2017 (r322337) S> +++ head/sys/net/iflib.c Thu Aug 10 03:43:23 2017 (r322338) S> @@ -267,6 +267,8 @@ iflib_get_sctx(if_ctx_t ctx) S> #define RX_SW_DESC_INUSE (1 << 3) S> #define TX_SW_DESC_MAPPED (1 << 4) S> S> +#define M_TOOBIG M_UNUSED_8 If you DO use something, then please don't pretent it is unused. This creates mess, when someone else will look into sys/mbuf.h and find M_UNUSED_8 there clearly marked as available and will start using it. However, my reading of the change is that only packets in a TX ring are marked with this flag. And later they are checked in the same place, and they don't travel out of iflib. So, it is a local flag, and in this case you don't need to grab a global mbuf flag, and take any of the M_PROTO flags. S> typedef struct iflib_sw_rx_desc_array { S> bus_dmamap_t *ifsd_map; /* bus_dma maps for packet */ S> struct mbuf **ifsd_m; /* pkthdr mbufs */ S> @@ -2930,8 +2932,11 @@ iflib_busdma_load_mbuf_sg(iflib_txq_t txq, bus_dma_tag S> m = m->m_next; S> count++; S> } while (m != NULL); S> - if (count > *nsegs) S> + if (count > *nsegs) { S> + ifsd_m[pidx] = *m0; S> + ifsd_m[pidx]->m_flags |= M_TOOBIG; S> return (0); S> + } S> m = *m0; S> count = 0; S> do { S> @@ -3241,8 +3246,15 @@ iflib_tx_desc_free(iflib_txq_t txq, int n) S> if ((m = ifsd_m[cidx]) != NULL) { S> /* XXX we don't support any drivers that batch packets yet */ S> MPASS(m->m_nextpkt == NULL); S> - S> - m_free(m); S> + /* if the number of clusters exceeds the number of segments S> + * there won't be space on the ring to save a pointer to each S> + * cluster so we simply free the list here S> + */ S> + if (m->m_flags & M_TOOBIG) { S> + m_freem(m); S> + } else { S> + m_free(m); S> + } S> ifsd_m[cidx] = NULL; S> #if MEMORY_LOGGING S> txq->ift_dequeued++; Can you please explain the goal of the change? AFAIK, the problem could be fixed with one liner: - m_free(m); + m_freem(m); n the iflib_tx_desc_free(). -- Totus tuus, Glebius. From owner-svn-src-head@freebsd.org Wed Aug 16 20:54:47 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A541DDD0CF3; Wed, 16 Aug 2017 20:54:47 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (glebi.us [96.95.210.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 73EA46FA07; Wed, 16 Aug 2017 20:54:46 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id v7GKskR7017466 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 16 Aug 2017 13:54:46 -0700 (PDT) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id v7GKskQ7017465; Wed, 16 Aug 2017 13:54:46 -0700 (PDT) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@FreeBSD.org using -f Date: Wed, 16 Aug 2017 13:54:46 -0700 From: Gleb Smirnoff To: Sean Bruno , Matt Macy Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r322338 - head/sys/net Message-ID: <20170816205446.GL1113@FreeBSD.org> References: <201708100343.v7A3hNwR068837@repo.freebsd.org> <20170816204327.GK1113@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="0OAP2g/MAC+5xKAE" Content-Disposition: inline In-Reply-To: <20170816204327.GK1113@FreeBSD.org> User-Agent: Mutt/1.8.3 (2017-05-23) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2017 20:54:47 -0000 --0OAP2g/MAC+5xKAE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Aug 16, 2017 at 01:43:27PM -0700, Gleb Smirnoff wrote: T> S> MPASS(m->m_nextpkt == NULL); T> S> - T> S> - m_free(m); T> S> + /* if the number of clusters exceeds the number of segments T> S> + * there won't be space on the ring to save a pointer to each T> S> + * cluster so we simply free the list here T> S> + */ T> S> + if (m->m_flags & M_TOOBIG) { T> S> + m_freem(m); T> S> + } else { T> S> + m_free(m); T> S> + } T> S> ifsd_m[cidx] = NULL; T> S> #if MEMORY_LOGGING T> S> txq->ift_dequeued++; T> T> Can you please explain the goal of the change? AFAIK, the problem T> could be fixed with one liner: T> T> - m_free(m); T> + m_freem(m); T> T> n the iflib_tx_desc_free(). I'm probably wrong on one liner, but still I don't see reason to have flag. Since we clear m_next in normal case, doing m_freem() always is fine. Suggested patch attached. -- Totus tuus, Glebius. --0OAP2g/MAC+5xKAE Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="iflib.c.diff" Index: sys/net/iflib.c =================================================================== --- sys/net/iflib.c (revision 322587) +++ sys/net/iflib.c (working copy) @@ -267,8 +267,6 @@ iflib_get_sctx(if_ctx_t ctx) #define RX_SW_DESC_INUSE (1 << 3) #define TX_SW_DESC_MAPPED (1 << 4) -#define M_TOOBIG M_UNUSED_8 - typedef struct iflib_sw_rx_desc_array { bus_dmamap_t *ifsd_map; /* bus_dma maps for packet */ struct mbuf **ifsd_m; /* pkthdr mbufs */ @@ -2934,7 +2932,6 @@ iflib_busdma_load_mbuf_sg(iflib_txq_t txq, bus_dma } while (m != NULL); if (count > *nsegs) { ifsd_m[pidx] = *m0; - ifsd_m[pidx]->m_flags |= M_TOOBIG; return (0); } m = *m0; @@ -3246,15 +3243,7 @@ iflib_tx_desc_free(iflib_txq_t txq, int n) if ((m = ifsd_m[cidx]) != NULL) { /* XXX we don't support any drivers that batch packets yet */ MPASS(m->m_nextpkt == NULL); - /* if the number of clusters exceeds the number of segments - * there won't be space on the ring to save a pointer to each - * cluster so we simply free the list here - */ - if (m->m_flags & M_TOOBIG) { - m_freem(m); - } else { - m_free(m); - } + m_freem(m); ifsd_m[cidx] = NULL; #if MEMORY_LOGGING txq->ift_dequeued++; --0OAP2g/MAC+5xKAE-- From owner-svn-src-head@freebsd.org Wed Aug 16 21:42:29 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 700CCDD3CAF; Wed, 16 Aug 2017 21:42:29 +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 mx1.freebsd.org (Postfix) with ESMTPS id 3A64671203; Wed, 16 Aug 2017 21:42:29 +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 v7GLgShp052585; Wed, 16 Aug 2017 21:42:28 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7GLgSwN052583; Wed, 16 Aug 2017 21:42:28 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201708162142.v7GLgSwN052583@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 16 Aug 2017 21:42:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322596 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 322596 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2017 21:42:29 -0000 Author: cem Date: Wed Aug 16 21:42:27 2017 New Revision: 322596 URL: https://svnweb.freebsd.org/changeset/base/322596 Log: Add SI_SUB_TASKQ after SI_SUB_INTR and move taskqueue initialization there for EARLY_AP_STARTUP This fixes a regression accidentally introduced in r322588, due to an interaction with EARLY_AP_STARTUP. Reviewed by: bdrewery@, jhb@ Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D12053 Modified: head/sys/sys/kernel.h head/sys/sys/taskqueue.h Modified: head/sys/sys/kernel.h ============================================================================== --- head/sys/sys/kernel.h Wed Aug 16 20:29:00 2017 (r322595) +++ head/sys/sys/kernel.h Wed Aug 16 21:42:27 2017 (r322596) @@ -118,6 +118,7 @@ enum sysinit_sub_id { SI_SUB_SCHED_IDLE = 0x2600000, /* required idle procs */ SI_SUB_MBUF = 0x2700000, /* mbuf subsystem */ SI_SUB_INTR = 0x2800000, /* interrupt threads */ + SI_SUB_TASKQ = 0x2880000, /* task queues */ #ifdef EARLY_AP_STARTUP SI_SUB_SMP = 0x2900000, /* start the APs*/ #endif Modified: head/sys/sys/taskqueue.h ============================================================================== --- head/sys/sys/taskqueue.h Wed Aug 16 20:29:00 2017 (r322595) +++ head/sys/sys/taskqueue.h Wed Aug 16 21:42:27 2017 (r322596) @@ -149,7 +149,7 @@ taskqueue_define_##name(void *arg) \ init; \ } \ \ -SYSINIT(taskqueue_##name, SI_SUB_INIT_IF, SI_ORDER_SECOND, \ +SYSINIT(taskqueue_##name, SI_SUB_TASKQ, SI_ORDER_SECOND, \ taskqueue_define_##name, NULL); \ \ struct __hack @@ -174,7 +174,7 @@ taskqueue_define_##name(void *arg) \ init; \ } \ \ -SYSINIT(taskqueue_##name, SI_SUB_INIT_IF, SI_ORDER_SECOND, \ +SYSINIT(taskqueue_##name, SI_SUB_TASKQ, SI_ORDER_SECOND, \ taskqueue_define_##name, NULL); \ \ struct __hack From owner-svn-src-head@freebsd.org Wed Aug 16 22:54:37 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1B207DD8108; Wed, 16 Aug 2017 22:54:37 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 E50EF7370F; Wed, 16 Aug 2017 22:54:36 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7GMsZQU081004; Wed, 16 Aug 2017 22:54:35 GMT (envelope-from rlibby@FreeBSD.org) Received: (from rlibby@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7GMsZfO081002; Wed, 16 Aug 2017 22:54:35 GMT (envelope-from rlibby@FreeBSD.org) Message-Id: <201708162254.v7GMsZfO081002@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rlibby set sender to rlibby@FreeBSD.org using -f From: Ryan Libby Date: Wed, 16 Aug 2017 22:54:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322600 - head/sys/crypto/aesni X-SVN-Group: head X-SVN-Commit-Author: rlibby X-SVN-Commit-Paths: head/sys/crypto/aesni X-SVN-Commit-Revision: 322600 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2017 22:54:37 -0000 Author: rlibby Date: Wed Aug 16 22:54:35 2017 New Revision: 322600 URL: https://svnweb.freebsd.org/changeset/base/322600 Log: aesni: quiet -Wcast-qual Reviewed by: delphij Approved by: markj (mentor) Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D12021 Modified: head/sys/crypto/aesni/aesni_ghash.c head/sys/crypto/aesni/aesni_wrap.c Modified: head/sys/crypto/aesni/aesni_ghash.c ============================================================================== --- head/sys/crypto/aesni/aesni_ghash.c Wed Aug 16 22:48:52 2017 (r322599) +++ head/sys/crypto/aesni/aesni_ghash.c Wed Aug 16 22:54:35 2017 (r322600) @@ -277,7 +277,7 @@ AES_GCM_encrypt(const unsigned char *in, unsigned char __m128i tmp1, tmp2, tmp3, tmp4; __m128i tmp5, tmp6, tmp7, tmp8; __m128i H, H2, H3, H4, Y, T; - __m128i *KEY = (__m128i*)key; + const __m128i *KEY = (const __m128i *)key; __m128i ctr1, ctr2, ctr3, ctr4; __m128i ctr5, ctr6, ctr7, ctr8; __m128i last_block = _mm_setzero_si128(); @@ -290,7 +290,7 @@ AES_GCM_encrypt(const unsigned char *in, unsigned char __m128i X = _mm_setzero_si128(); if (ibytes == 96/8) { - Y = _mm_loadu_si128((__m128i*)ivec); + Y = _mm_loadu_si128((const __m128i *)ivec); Y = _mm_insert_epi32(Y, 0x1000000, 3); /*(Compute E[ZERO, KS] and E[Y0, KS] together*/ tmp1 = _mm_xor_si128(X, KEY[0]); @@ -319,7 +319,7 @@ AES_GCM_encrypt(const unsigned char *in, unsigned char Y = _mm_setzero_si128(); for (i=0; i < ibytes/16; i++) { - tmp1 = _mm_loadu_si128(&((__m128i*)ivec)[i]); + tmp1 = _mm_loadu_si128(&((const __m128i *)ivec)[i]); tmp1 = _mm_shuffle_epi8(tmp1, BSWAP_MASK); Y = _mm_xor_si128(Y, tmp1); gfmul(Y, H, &Y); @@ -349,10 +349,10 @@ AES_GCM_encrypt(const unsigned char *in, unsigned char gfmul(H,H3,&H4); for (i=0; i Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 78CE2DDA80F; Wed, 16 Aug 2017 23:40:33 +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 mx1.freebsd.org (Postfix) with ESMTPS id 4244574D0C; Wed, 16 Aug 2017 23:40:33 +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 v7GNeWQR098165; Wed, 16 Aug 2017 23:40:32 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7GNeWrL098164; Wed, 16 Aug 2017 23:40:32 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201708162340.v7GNeWrL098164@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 16 Aug 2017 23:40:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322601 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys X-SVN-Commit-Revision: 322601 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2017 23:40:33 -0000 Author: jhb Date: Wed Aug 16 23:40:32 2017 New Revision: 322601 URL: https://svnweb.freebsd.org/changeset/base/322601 Log: Mark ZFS ABD inline functions static. When built with -fno-inline-functions zfs.ko contains undefined references to these functions if they are only marked inline. Reviewed by: avg (earlier version) MFC after: 1 week Sponsored by: Chelsio Communications Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/abd.h Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/abd.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/abd.h Wed Aug 16 22:54:35 2017 (r322600) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/abd.h Wed Aug 16 23:40:32 2017 (r322601) @@ -61,7 +61,7 @@ typedef int abd_iter_func2_t(void *, void *, size_t, v extern boolean_t zfs_abd_scatter_enabled; -inline boolean_t +static inline boolean_t abd_is_linear(abd_t *abd) { return ((abd->abd_flags & ABD_FLAG_LINEAR) != 0 ? B_TRUE : B_FALSE); @@ -110,31 +110,31 @@ void abd_zero_off(abd_t *, size_t, size_t); * Wrappers for calls with offsets of 0 */ -inline void +static inline void abd_copy(abd_t *dabd, abd_t *sabd, size_t size) { abd_copy_off(dabd, sabd, 0, 0, size); } -inline void +static inline void abd_copy_from_buf(abd_t *abd, const void *buf, size_t size) { abd_copy_from_buf_off(abd, buf, 0, size); } -inline void +static inline void abd_copy_to_buf(void* buf, abd_t *abd, size_t size) { abd_copy_to_buf_off(buf, abd, 0, size); } -inline int +static inline int abd_cmp_buf(abd_t *abd, const void *buf, size_t size) { return (abd_cmp_buf_off(abd, buf, 0, size)); } -inline void +static inline void abd_zero(abd_t *abd, size_t size) { abd_zero_off(abd, 0, size); From owner-svn-src-head@freebsd.org Thu Aug 17 04:37:29 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 495D5DCA6E8; Thu, 17 Aug 2017 04:37:29 +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 mx1.freebsd.org (Postfix) with ESMTPS id 1392619DE; Thu, 17 Aug 2017 04:37:28 +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 v7H4bSYG019883; Thu, 17 Aug 2017 04:37:28 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7H4bSCR019882; Thu, 17 Aug 2017 04:37:28 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201708170437.v7H4bSCR019882@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Thu, 17 Aug 2017 04:37:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322611 - head/sys/x86/x86 X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/x86/x86 X-SVN-Commit-Revision: 322611 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Aug 2017 04:37:29 -0000 Author: cem Date: Thu Aug 17 04:37:27 2017 New Revision: 322611 URL: https://svnweb.freebsd.org/changeset/base/322611 Log: Fix unused varable warning in !SMP case Fallout from r322588. I'm not sure why !SMP is a knob we have, but, we have it. Reported by: Michael Butler Sponsored by: Dell EMC Isilon Modified: head/sys/x86/x86/intr_machdep.c Modified: head/sys/x86/x86/intr_machdep.c ============================================================================== --- head/sys/x86/x86/intr_machdep.c Thu Aug 17 04:30:31 2017 (r322610) +++ head/sys/x86/x86/intr_machdep.c Thu Aug 17 04:37:27 2017 (r322611) @@ -75,12 +75,14 @@ typedef void (*mask_fn)(void *); static int intrcnt_index; static struct intsrc *interrupt_sources[NUM_IO_INTS]; +#ifdef SMP static struct intsrc *interrupt_sorted[NUM_IO_INTS]; CTASSERT(sizeof(interrupt_sources) == sizeof(interrupt_sorted)); static int intrbalance; SYSCTL_INT(_hw, OID_AUTO, intrbalance, CTLFLAG_RW, &intrbalance, 0, "Interrupt auto-balance interval (seconds). Zero disables."); static struct timeout_task intrbalance_task; +#endif static struct sx intrsrc_lock; static struct mtx intrpic_lock; static struct mtx intrcnt_lock; From owner-svn-src-head@freebsd.org Thu Aug 17 06:36:22 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DB780DD0B82; Thu, 17 Aug 2017 06:36:22 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 A5969646BC; Thu, 17 Aug 2017 06:36:22 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7H6aLiu068617; Thu, 17 Aug 2017 06:36:21 GMT (envelope-from lstewart@FreeBSD.org) Received: (from lstewart@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7H6aLRT068616; Thu, 17 Aug 2017 06:36:21 GMT (envelope-from lstewart@FreeBSD.org) Message-Id: <201708170636.v7H6aLRT068616@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lstewart set sender to lstewart@FreeBSD.org using -f From: Lawrence Stewart Date: Thu, 17 Aug 2017 06:36:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322613 - head/bin/pkill X-SVN-Group: head X-SVN-Commit-Author: lstewart X-SVN-Commit-Paths: head/bin/pkill X-SVN-Commit-Revision: 322613 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Aug 2017 06:36:23 -0000 Author: lstewart Date: Thu Aug 17 06:36:21 2017 New Revision: 322613 URL: https://svnweb.freebsd.org/changeset/base/322613 Log: The r322210 change to pgrep's PID delimiting behaviour causes pgrep's default output to not include a trailing new line, which is a potential POLA violation for existing consumers. Change pgrep to always emit a trailing new line on completion of its output, regardless of the delimeter in use (which technically is also a potential POLA violation for existing consumers that rely on the pre-r322210 buggy behaviour, but a line has to be drawn somewhere). PR: 221534 Submitted by: kdrakehp zoho com Reported by: kdrakehp zoho com MFC after: 1 week X-MFC-with: r322210 Modified: head/bin/pkill/pkill.c Modified: head/bin/pkill/pkill.c ============================================================================== --- head/bin/pkill/pkill.c Thu Aug 17 05:09:22 2017 (r322612) +++ head/bin/pkill/pkill.c Thu Aug 17 06:36:21 2017 (r322613) @@ -568,6 +568,8 @@ main(int argc, char **argv) continue; rv |= (*action)(kp); } + if (rv && pgrep) + putchar('\n'); if (!did_action && !pgrep && longfmt) fprintf(stderr, "No matching processes belonging to you were found\n"); From owner-svn-src-head@freebsd.org Thu Aug 17 07:20:10 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BFD34DD22D4; Thu, 17 Aug 2017 07:20:10 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 967B7657BE; Thu, 17 Aug 2017 07:20:10 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7H7K9UL085134; Thu, 17 Aug 2017 07:20:09 GMT (envelope-from lstewart@FreeBSD.org) Received: (from lstewart@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7H7K9BO085131; Thu, 17 Aug 2017 07:20:09 GMT (envelope-from lstewart@FreeBSD.org) Message-Id: <201708170720.v7H7K9BO085131@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lstewart set sender to lstewart@FreeBSD.org using -f From: Lawrence Stewart Date: Thu, 17 Aug 2017 07:20:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322614 - in head: share/man/man9 sys/kern sys/sys X-SVN-Group: head X-SVN-Commit-Author: lstewart X-SVN-Commit-Paths: in head: share/man/man9 sys/kern sys/sys X-SVN-Commit-Revision: 322614 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Aug 2017 07:20:10 -0000 Author: lstewart Date: Thu Aug 17 07:20:09 2017 New Revision: 322614 URL: https://svnweb.freebsd.org/changeset/base/322614 Log: Implement simple record boundary tracking in sbuf(9) to avoid record splitting during drain operations. When an sbuf is configured to use this feature by way of the SBUF_DRAINTOEOR sbuf_new() flag, top-level sections started with sbuf_start_section() create a record boundary marker that is used to avoid flushing partial records. Reviewed by: cem,imp,wblock MFC after: 2 weeks Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D8536 Modified: head/share/man/man9/sbuf.9 head/sys/kern/subr_sbuf.c head/sys/sys/sbuf.h Modified: head/share/man/man9/sbuf.9 ============================================================================== --- head/share/man/man9/sbuf.9 Thu Aug 17 06:36:21 2017 (r322613) +++ head/share/man/man9/sbuf.9 Thu Aug 17 07:20:09 2017 (r322614) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 5, 2017 +.Dd August 17, 2017 .Dt SBUF 9 .Os .Sh NAME @@ -271,6 +271,14 @@ This indicates that the storage buffer may be extended as resources allow, to hold additional data. .It Dv SBUF_INCLUDENUL This causes the final nulterm byte to be counted in the length of the data. +.It Dv SBUF_DRAINTOEOR +Treat top-level sections started with +.Fn sbuf_start_section +as a record boundary marker that will be used during drain operations to avoid +records being split. +If a record grows sufficiently large such that it fills the +.Fa sbuf +and therefore cannot be drained without being split, an error of EDEADLK is set. .El .Pp Note that if Modified: head/sys/kern/subr_sbuf.c ============================================================================== --- head/sys/kern/subr_sbuf.c Thu Aug 17 06:36:21 2017 (r322613) +++ head/sys/kern/subr_sbuf.c Thu Aug 17 07:20:09 2017 (r322614) @@ -73,6 +73,8 @@ static MALLOC_DEFINE(M_SBUF, "sbuf", "string buffers") #define SBUF_CANEXTEND(s) ((s)->s_flags & SBUF_AUTOEXTEND) #define SBUF_ISSECTION(s) ((s)->s_flags & SBUF_INSECTION) #define SBUF_NULINCLUDED(s) ((s)->s_flags & SBUF_INCLUDENUL) +#define SBUF_ISDRAINTOEOR(s) ((s)->s_flags & SBUF_DRAINTOEOR) +#define SBUF_DODRAINTOEOR(s) (SBUF_ISSECTION(s) && SBUF_ISDRAINTOEOR(s)) /* * Set / clear flags @@ -308,6 +310,7 @@ sbuf_clear(struct sbuf *s) SBUF_CLEARFLAG(s, SBUF_FINISHED); s->s_error = 0; s->s_len = 0; + s->s_rec_off = 0; s->s_sect_len = 0; } @@ -362,7 +365,10 @@ sbuf_drain(struct sbuf *s) KASSERT(s->s_len > 0, ("Shouldn't drain empty sbuf %p", s)); KASSERT(s->s_error == 0, ("Called %s with error on %p", __func__, s)); - len = s->s_drain_func(s->s_drain_arg, s->s_buf, s->s_len); + if (SBUF_DODRAINTOEOR(s) && s->s_rec_off == 0) + return (s->s_error = EDEADLK); + len = s->s_drain_func(s->s_drain_arg, s->s_buf, + SBUF_DODRAINTOEOR(s) ? s->s_rec_off : s->s_len); if (len < 0) { s->s_error = -len; return (s->s_error); @@ -370,6 +376,7 @@ sbuf_drain(struct sbuf *s) KASSERT(len > 0 && len <= s->s_len, ("Bad drain amount %d for sbuf %p", len, s)); s->s_len -= len; + s->s_rec_off -= len; /* * Fast path for the expected case where all the data was * drained. @@ -835,6 +842,7 @@ sbuf_start_section(struct sbuf *s, ssize_t *old_lenp) ("s_sect_len != 0 when starting a section")); if (old_lenp != NULL) *old_lenp = -1; + s->s_rec_off = s->s_len; SBUF_SETFLAG(s, SBUF_INSECTION); } else { KASSERT(old_lenp != NULL, @@ -865,7 +873,7 @@ sbuf_end_section(struct sbuf *s, ssize_t old_len, size } len = s->s_sect_len; if (old_len == -1) { - s->s_sect_len = 0; + s->s_rec_off = s->s_sect_len = 0; SBUF_CLEARFLAG(s, SBUF_INSECTION); } else { s->s_sect_len += old_len; Modified: head/sys/sys/sbuf.h ============================================================================== --- head/sys/sys/sbuf.h Thu Aug 17 06:36:21 2017 (r322613) +++ head/sys/sys/sbuf.h Thu Aug 17 07:20:09 2017 (r322614) @@ -49,6 +49,7 @@ struct sbuf { #define SBUF_FIXEDLEN 0x00000000 /* fixed length buffer (default) */ #define SBUF_AUTOEXTEND 0x00000001 /* automatically extend buffer */ #define SBUF_INCLUDENUL 0x00000002 /* nulterm byte is counted in len */ +#define SBUF_DRAINTOEOR 0x00000004 /* use section 0 as drain EOR marker */ #define SBUF_USRFLAGMSK 0x0000ffff /* mask of flags the user may specify */ #define SBUF_DYNAMIC 0x00010000 /* s_buf must be freed */ #define SBUF_FINISHED 0x00020000 /* set by sbuf_finish() */ @@ -56,6 +57,7 @@ struct sbuf { #define SBUF_INSECTION 0x00100000 /* set by sbuf_start_section() */ int s_flags; /* flags */ ssize_t s_sect_len; /* current length of section */ + ssize_t s_rec_off; /* current record start offset */ }; #ifndef HD_COLUMN_MASK From owner-svn-src-head@freebsd.org Thu Aug 17 07:43:47 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 82783DD3306; Thu, 17 Aug 2017 07:43:47 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citapm.icyb.net.ua (citapm.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 3B0C96651F; Thu, 17 Aug 2017 07:43:45 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citapm.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id KAA15220; Thu, 17 Aug 2017 10:43:44 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1diFSy-000IGD-32; Thu, 17 Aug 2017 10:43:44 +0300 Subject: Re: svn commit: r322601 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys To: John Baldwin , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org References: <201708162340.v7GNeWrL098164@repo.freebsd.org> From: Andriy Gapon Message-ID: <4786e0df-cbbd-d0fe-2e45-682b9fe24652@FreeBSD.org> Date: Thu, 17 Aug 2017 10:42:51 +0300 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <201708162340.v7GNeWrL098164@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Aug 2017 07:43:47 -0000 On 17/08/2017 02:40, John Baldwin wrote: > Author: jhb > Date: Wed Aug 16 23:40:32 2017 > New Revision: 322601 > URL: https://svnweb.freebsd.org/changeset/base/322601 > > Log: > Mark ZFS ABD inline functions static. > > When built with -fno-inline-functions zfs.ko contains undefined references > to these functions if they are only marked inline. > > Reviewed by: avg (earlier version) I think that you rushed a little bit on this one: https://github.com/openzfs/openzfs/pull/444 But no big deal, it will be easy to merge once the upstream wakes up :-) > MFC after: 1 week > Sponsored by: Chelsio Communications > > Modified: > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/abd.h > > Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/abd.h > ============================================================================== > --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/abd.h Wed Aug 16 22:54:35 2017 (r322600) > +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/abd.h Wed Aug 16 23:40:32 2017 (r322601) > @@ -61,7 +61,7 @@ typedef int abd_iter_func2_t(void *, void *, size_t, v > > extern boolean_t zfs_abd_scatter_enabled; > > -inline boolean_t > +static inline boolean_t > abd_is_linear(abd_t *abd) > { > return ((abd->abd_flags & ABD_FLAG_LINEAR) != 0 ? B_TRUE : B_FALSE); > @@ -110,31 +110,31 @@ void abd_zero_off(abd_t *, size_t, size_t); > * Wrappers for calls with offsets of 0 > */ > > -inline void > +static inline void > abd_copy(abd_t *dabd, abd_t *sabd, size_t size) > { > abd_copy_off(dabd, sabd, 0, 0, size); > } > > -inline void > +static inline void > abd_copy_from_buf(abd_t *abd, const void *buf, size_t size) > { > abd_copy_from_buf_off(abd, buf, 0, size); > } > > -inline void > +static inline void > abd_copy_to_buf(void* buf, abd_t *abd, size_t size) > { > abd_copy_to_buf_off(buf, abd, 0, size); > } > > -inline int > +static inline int > abd_cmp_buf(abd_t *abd, const void *buf, size_t size) > { > return (abd_cmp_buf_off(abd, buf, 0, size)); > } > > -inline void > +static inline void > abd_zero(abd_t *abd, size_t size) > { > abd_zero_off(abd, 0, size); > -- Andriy Gapon From owner-svn-src-head@freebsd.org Thu Aug 17 13:40:46 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A4B5CDE27BF; Thu, 17 Aug 2017 13:40:46 +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 mx1.freebsd.org (Postfix) with ESMTPS id 6F29B7255C; Thu, 17 Aug 2017 13:40:46 +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 v7HDejSp040954; Thu, 17 Aug 2017 13:40:45 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7HDejMv040953; Thu, 17 Aug 2017 13:40:45 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201708171340.v7HDejMv040953@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 17 Aug 2017 13:40:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322618 - head/usr.bin/grep X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/usr.bin/grep X-SVN-Commit-Revision: 322618 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Aug 2017 13:40:46 -0000 Author: kevans Date: Thu Aug 17 13:40:45 2017 New Revision: 322618 URL: https://svnweb.freebsd.org/changeset/base/322618 Log: bsdgrep: cast pmatch.rm_so to fix build when linking against libgnuregex Reported by: many Approved by: emaste (mentor) MFC after: immediate Modified: head/usr.bin/grep/util.c Modified: head/usr.bin/grep/util.c ============================================================================== --- head/usr.bin/grep/util.c Thu Aug 17 11:36:39 2017 (r322617) +++ head/usr.bin/grep/util.c Thu Aug 17 13:40:45 2017 (r322618) @@ -443,7 +443,7 @@ procline(struct parsec *pc) */ if (r == REG_NOMATCH && (retry == pc->lnstart || - pmatch.rm_so + 1 < retry)) + (unsigned int)pmatch.rm_so + 1 < retry)) retry = pmatch.rm_so + 1; if (r == REG_NOMATCH) continue; From owner-svn-src-head@freebsd.org Thu Aug 17 16:54:38 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5C197DC9B9B; Thu, 17 Aug 2017 16:54:38 +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 mx1.freebsd.org (Postfix) with ESMTPS id 332C07F5AD; Thu, 17 Aug 2017 16:54:38 +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 v7HGsbxl030591; Thu, 17 Aug 2017 16:54:37 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7HGsb7U030590; Thu, 17 Aug 2017 16:54:37 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201708171654.v7HGsb7U030590@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Thu, 17 Aug 2017 16:54:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322621 - head/sys/x86/x86 X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/x86/x86 X-SVN-Commit-Revision: 322621 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Aug 2017 16:54:38 -0000 Author: cem Date: Thu Aug 17 16:54:37 2017 New Revision: 322621 URL: https://svnweb.freebsd.org/changeset/base/322621 Log: Discover CPU topology on multi-die AMD Zen systems The Nodes per Processor topology information determines how many bits of the APIC ID represent the Node (Zeppelin die, on Zen systems) ID. Documented in Ryzen and Epyc Processor Programming Reference (PPR). Correct topology information enables the scheduler to make better decisions on this hardware. Reviewed by: kib@ Tested by: jeff@ (earlier version) Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D11801 Modified: head/sys/x86/x86/mp_x86.c Modified: head/sys/x86/x86/mp_x86.c ============================================================================== --- head/sys/x86/x86/mp_x86.c Thu Aug 17 14:40:48 2017 (r322620) +++ head/sys/x86/x86/mp_x86.c Thu Aug 17 16:54:37 2017 (r322621) @@ -155,6 +155,7 @@ SYSCTL_INT(_machdep, OID_AUTO, hyperthreading_allowed, static struct topo_node topo_root; static int pkg_id_shift; +static int node_id_shift; static int core_id_shift; static int disabled_cpus; @@ -274,6 +275,15 @@ topo_probe_amd(void) cpuid_count(0x8000001e, 0, p); share_count = ((p[1] >> 8) & 0xff) + 1; core_id_shift = mask_width(share_count); + + /* + * For Zen (17h), gather Nodes per Processor. Each node is a + * Zeppelin die; TR and EPYC CPUs will have multiple dies per + * package. Communication latency between dies is higher than + * within them. + */ + nodes_per_socket = ((p[2] >> 8) & 0x7) + 1; + node_id_shift = pkg_id_shift - mask_width(nodes_per_socket); } if ((amd_feature2 & AMDID2_TOPOLOGY) != 0) { @@ -483,7 +493,7 @@ topo_probe(void) int type; int subtype; int id_shift; - } topo_layers[MAX_CACHE_LEVELS + 3]; + } topo_layers[MAX_CACHE_LEVELS + 4]; struct topo_node *parent; struct topo_node *node; int layer; @@ -515,6 +525,15 @@ topo_probe(void) printf("Package ID shift: %u\n", topo_layers[nlayers].id_shift); nlayers++; + if (pkg_id_shift > node_id_shift && node_id_shift != 0) { + topo_layers[nlayers].type = TOPO_TYPE_GROUP; + topo_layers[nlayers].id_shift = node_id_shift; + if (bootverbose) + printf("Node ID shift: %u\n", + topo_layers[nlayers].id_shift); + nlayers++; + } + /* * Consider all caches to be within a package/chip * and "in front" of all sub-components like @@ -522,6 +541,9 @@ topo_probe(void) */ for (i = MAX_CACHE_LEVELS - 1; i >= 0; --i) { if (caches[i].present) { + if (node_id_shift != 0) + KASSERT(caches[i].id_shift <= node_id_shift, + ("bug in APIC topology discovery")); KASSERT(caches[i].id_shift <= pkg_id_shift, ("bug in APIC topology discovery")); KASSERT(caches[i].id_shift >= core_id_shift, @@ -720,7 +742,8 @@ x86topo_add_sched_group(struct topo_node *root, struct int ncores; int i; - KASSERT(root->type == TOPO_TYPE_SYSTEM || root->type == TOPO_TYPE_CACHE, + KASSERT(root->type == TOPO_TYPE_SYSTEM || root->type == TOPO_TYPE_CACHE || + root->type == TOPO_TYPE_GROUP, ("x86topo_add_sched_group: bad type: %u", root->type)); CPU_COPY(&root->cpuset, &cg_root->cg_mask); cg_root->cg_count = root->cpu_count; @@ -760,7 +783,8 @@ x86topo_add_sched_group(struct topo_node *root, struct nchildren = 0; node = root; while (node != NULL) { - if (node->type != TOPO_TYPE_CACHE || + if ((node->type != TOPO_TYPE_GROUP && + node->type != TOPO_TYPE_CACHE) || (root->type != TOPO_TYPE_SYSTEM && CPU_CMP(&node->cpuset, &root->cpuset) == 0)) { node = topo_next_node(root, node); @@ -780,7 +804,8 @@ x86topo_add_sched_group(struct topo_node *root, struct node = root; i = 0; while (node != NULL) { - if (node->type != TOPO_TYPE_CACHE || + if ((node->type != TOPO_TYPE_GROUP && + node->type != TOPO_TYPE_CACHE) || (root->type != TOPO_TYPE_SYSTEM && CPU_CMP(&node->cpuset, &root->cpuset) == 0)) { node = topo_next_node(root, node); From owner-svn-src-head@freebsd.org Thu Aug 17 17:37:35 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3C47FDCBE17; Thu, 17 Aug 2017 17:37:35 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1A420813A0; Thu, 17 Aug 2017 17:37:35 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id E52D010AF07; Thu, 17 Aug 2017 13:37:19 -0400 (EDT) From: John Baldwin To: Andriy Gapon Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r322601 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys Date: Thu, 17 Aug 2017 10:07 -0700 Message-ID: <1870652.QF6rqaG5fn@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: <4786e0df-cbbd-d0fe-2e45-682b9fe24652@FreeBSD.org> References: <201708162340.v7GNeWrL098164@repo.freebsd.org> <4786e0df-cbbd-d0fe-2e45-682b9fe24652@FreeBSD.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Thu, 17 Aug 2017 13:37:20 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Aug 2017 17:37:35 -0000 On Thursday, August 17, 2017 10:42:51 AM Andriy Gapon wrote: > On 17/08/2017 02:40, John Baldwin wrote: > > Author: jhb > > Date: Wed Aug 16 23:40:32 2017 > > New Revision: 322601 > > URL: https://svnweb.freebsd.org/changeset/base/322601 > > > > Log: > > Mark ZFS ABD inline functions static. > > > > When built with -fno-inline-functions zfs.ko contains undefined references > > to these functions if they are only marked inline. > > > > Reviewed by: avg (earlier version) > > I think that you rushed a little bit on this one: > https://github.com/openzfs/openzfs/pull/444 > > But no big deal, it will be easy to merge once the upstream wakes up :-) Oof, I thought you had previously ok'd to commit this? (I just hadn't gotten around to it.) My apologies for misunderstanding. -- John Baldwin From owner-svn-src-head@freebsd.org Thu Aug 17 18:08:46 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DBBE5DCD625; Thu, 17 Aug 2017 18:08:46 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B2A458292E; Thu, 17 Aug 2017 18:08:46 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7HI8jLH061293; Thu, 17 Aug 2017 18:08:45 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7HI8jeR061291; Thu, 17 Aug 2017 18:08:45 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201708171808.v7HI8jeR061291@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Thu, 17 Aug 2017 18:08:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322626 - head/usr.sbin/vidcontrol X-SVN-Group: head X-SVN-Commit-Author: bde X-SVN-Commit-Paths: head/usr.sbin/vidcontrol X-SVN-Commit-Revision: 322626 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Aug 2017 18:08:47 -0000 Author: bde Date: Thu Aug 17 18:08:45 2017 New Revision: 322626 URL: https://svnweb.freebsd.org/changeset/base/322626 Log: Update vidcontrol -c to support all cursor appearance setting capabilities. Most of the capabilities (all of the arcane ones) were in FreeBSD-2.0.5, but were harder to use then, and vidcontrol didn't try. FreeBSD-4.1.0 added per-vty support, fixed the destructivness of the "destructive" cursor, and improved APIs. Start using the new APIs, support all of their capabilities, and document all of the capabilities and some of the historical mistakes. vt doesn't support any of this before or after the change. Fix minor unrelated bitrot in the usage message for the syscons case. Modified: head/usr.sbin/vidcontrol/vidcontrol.1 head/usr.sbin/vidcontrol/vidcontrol.c Modified: head/usr.sbin/vidcontrol/vidcontrol.1 ============================================================================== --- head/usr.sbin/vidcontrol/vidcontrol.1 Thu Aug 17 17:17:28 2017 (r322625) +++ head/usr.sbin/vidcontrol/vidcontrol.1 Thu Aug 17 18:08:45 2017 (r322626) @@ -125,15 +125,123 @@ Set border color to This option may not be always supported by the video driver. .It Fl C Clear the history buffer. -.It Fl c Cm normal | blink | destructive +.It Fl c Ar setting Ns Op , Ns Ar setting ... Change the cursor appearance. -The cursor is either an inverting block -.Pq Cm normal -that can optionally -.Cm blink , -or it can be like the old hardware cursor -.Pq Cm destructive . -The latter is actually a simulation. +The change is specified by a non-empty comma-separated list of +.Cm setting Ns s . +Each +.Cm setting +overrides or modifies previous ones in left to right order. +.Pp +The following override +.Cm setting Ns s +are available: +.Bl -tag -width indent +.It Cm block +Set to a block covering 1 character cell, +with a configuration-dependent coloring +that should be at worst inverse video. +.It Cm blinkingblock +Set to a blinking +.Cm block . +.It Cm underline +Set to +.Cm height +scanlines starting at +.Cm base . +This only gives an underline in normal configurations. +.It Cm blinkingunderline +Set to a blinking +.Cm underline . +.It Cm base Ns = Ns Ar value, Cm height Ns = Ns Ar value +Set the specified scanline parameters. +These parameters are only active in so-called +.Cm char ( underline ) +mode. +.Cm value +is an integer in any base supported by +.Xr strtol 3 . +Setting +.Cm height +to 0 turns off the cursor in +.Cm char +mode. +Negative +.Ar value Ns s +are silently ignored. +Positive +.Ar value Ns s +are clamped to fit in the character cell when the cursor is drawn. +.El +.Pp +The following override +.Cm setting Ns s +are provided for backwards compatibility: +.Bl -tag -width indent +.It Cm normal +Old name for +.Cm block . +.It Cm blink +Old name for +.Cm blinkingblock . +.It Cm destructive +Bad old name for +.Cm blinkingunderline . +The so-called +.Cm destructive +cursor was only destructive due to a bug that was fixed in +.Fx 4.1.0 . +The destruction in the non-blinking case was so large that +this case was not supported by +.Nm , +so no backwards compatible name is needed for this case. +.El +.Pp +The following modifier +.Cm setting Ns s +are available: +.Bl -tag -width indent +.It Cm blinking , noblinking +Set or clear the blinking attribute. +.It Cm char , nochar +Set or clear the so-called +.Cm char +attribute. +Names in this section follow the bad old names of +flags in the implementation. +.Cm char +now means +.Do +activate the scanline parameters, +and implement them using the best available method +(at worst, actually use the old +.Cm char +method with its destruction fixed if it is configured, +else silently ignore this flag). +.Dc +.It Cm hidden , nohidden +Set or clear the hidden attribute. +.It Cm local +Apply the changes (except for the +.Cm local +and +.Cm reset +control flags) +to the current vty. +The default is to apply them to all vtys. +.It Cm reset +Reset everything. +The default is to not reset. +When the +.Cm local +parameter is specified, the resetting is for the +current local settings to the current global settings. +Otherwise, the resetting is for the current global +settings to defaults configured a boot time. +Beware that the scanline parameters and not automatically +scaled by the font size and resetting tends to undo manual +fixups for this. +.El .It Fl d Print out current output screen map. .It Xo Modified: head/usr.sbin/vidcontrol/vidcontrol.c ============================================================================== --- head/usr.sbin/vidcontrol/vidcontrol.c Thu Aug 17 17:17:28 2017 (r322625) +++ head/usr.sbin/vidcontrol/vidcontrol.c Thu Aug 17 18:08:45 2017 (r322626) @@ -200,12 +200,13 @@ usage(void) " [-S on | off] [-s number] [-T xterm | cons25] [-t N | off]", " [mode] [foreground [background]] [show]"); else - fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n", + fprintf(stderr, "%s\n%s\n%s\n%s\n%s%s\n\n", "usage: vidcontrol [-CdHLPpx] [-b color] [-c appearance] [-f [size] file]", -" [-g geometry] [-h size] [-i adapter | mode] [-l screen_map]", -" [-M char] [-m on | off] [-r foreground background]", -" [-S on | off] [-s number] [-T xterm | cons25] [-t N | off]", -" [mode] [foreground [background]] [show]"); +" [-g geometry] [-h size] [-i active | adapter | mode]", +" [-l screen_map] [-M char] [-m on | off]", +" [-r foreground background] [-S on | off] [-s number]", +" [-T xterm | cons25] [-t N | off] [mode]", +" [foreground [background]] [show]"); exit(1); } @@ -619,30 +620,85 @@ set_screensaver_timeout(char *arg) } } +static void +parse_cursor_params(char *param, struct cshape *shape) +{ + char *dupparam, *word; + int type; + param = dupparam = strdup(param); + type = shape->shape[0]; + while ((word = strsep(¶m, ",")) != NULL) { + if (strcmp(word, "block") == 0) + type = 0; + else if (strcmp(word, "underline") == 0) + type = CONS_CHAR_CURSOR; + else if (strcmp(word, "blinkingblock") == 0) + type = CONS_BLINK_CURSOR; + else if (strcmp(word, "blinkingunderline") == 0) + type = CONS_BLINK_CURSOR | CONS_CHAR_CURSOR; + else if (strncmp(word, "base=", 5) == 0) + shape->shape[1] = strtol(word + 5, NULL, 0); + else if (strncmp(word, "height=", 7) == 0) + shape->shape[2] = strtol(word + 7, NULL, 0); + else if (strcmp(word, "blinking") == 0) + type |= CONS_BLINK_CURSOR; + else if (strcmp(word, "normal") == 0) + type = 0; + else if (strcmp(word, "blink") == 0) + type = CONS_BLINK_CURSOR; + else if (strcmp(word, "destructive") == 0) + type = CONS_BLINK_CURSOR | CONS_CHAR_CURSOR; + else if (strcmp(word, "noblinking") == 0) + type &= ~CONS_BLINK_CURSOR; + else if (strcmp(word, "char") == 0) + type |= CONS_CHAR_CURSOR; + else if (strcmp(word, "nochar") == 0) + type &= ~CONS_CHAR_CURSOR; + else if (strcmp(word, "hidden") == 0) + type |= CONS_HIDDEN_CURSOR; + else if (strcmp(word, "nohidden") == 0) + type &= ~CONS_HIDDEN_CURSOR; + else if (strcmp(word, "local") == 0) + type |= CONS_LOCAL_CURSOR; + else if (strcmp(word, "reset") == 0) + type |= CONS_RESET_CURSOR; + else { + revert(); + errx(1, + "invalid parameters for -c starting at '%s%s%s'", + word, param != NULL ? "," : "", + param != NULL ? param : ""); + } + } + free(dupparam); + shape->shape[0] = type; +} + + /* * Set the cursor's shape/type. */ static void -set_cursor_type(char *appearance) +set_cursor_type(char *param) { - int type; + struct cshape shape; - if (!strcmp(appearance, "normal")) - type = 0; - else if (!strcmp(appearance, "blink")) - type = 1; - else if (!strcmp(appearance, "destructive")) - type = 3; - else { + /* Determine if the new setting is local (default to non-local). */ + shape.shape[0] = 0; + parse_cursor_params(param, &shape); + + /* Get the relevant shape (the local flag is the only input arg). */ + if (ioctl(0, CONS_GETCURSORSHAPE, &shape) != 0) { revert(); - errx(1, "argument to -c must be normal, blink or destructive"); + err(1, "ioctl(CONS_GETCURSORSHAPE)"); } - if (ioctl(0, CONS_CURSORTYPE, &type) == -1) { + parse_cursor_params(param, &shape); + if (ioctl(0, CONS_SETCURSORSHAPE, &shape) != 0) { revert(); - err(1, "setting cursor type"); + err(1, "ioctl(CONS_SETCURSORSHAPE)"); } } From owner-svn-src-head@freebsd.org Thu Aug 17 19:16:25 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3C77ADD0E92; Thu, 17 Aug 2017 19:16:25 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 06826A4D; Thu, 17 Aug 2017 19:16:24 +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 v7HJGOEE092260; Thu, 17 Aug 2017 19:16:24 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7HJGO4C092259; Thu, 17 Aug 2017 19:16:24 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201708171916.v7HJGO4C092259@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 17 Aug 2017 19:16:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322627 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 322627 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Aug 2017 19:16:25 -0000 Author: emaste Date: Thu Aug 17 19:16:23 2017 New Revision: 322627 URL: https://svnweb.freebsd.org/changeset/base/322627 Log: arm64: return error instead of panic in unimplemented ptrace ops We don't need a panic as a reminder that these need to be implemented. Reported by: Shawn Webb MFC after: 3 week Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/arm64/machdep.c Modified: head/sys/arm64/arm64/machdep.c ============================================================================== --- head/sys/arm64/arm64/machdep.c Thu Aug 17 18:08:45 2017 (r322626) +++ head/sys/arm64/arm64/machdep.c Thu Aug 17 19:16:23 2017 (r322627) @@ -257,22 +257,24 @@ int fill_dbregs(struct thread *td, struct dbreg *regs) { - panic("ARM64TODO: fill_dbregs"); + printf("ARM64TODO: fill_dbregs"); + return (EDOOFUS); } int set_dbregs(struct thread *td, struct dbreg *regs) { - panic("ARM64TODO: set_dbregs"); + printf("ARM64TODO: set_dbregs"); + return (EDOOFUS); } int ptrace_set_pc(struct thread *td, u_long addr) { - panic("ARM64TODO: ptrace_set_pc"); - return (0); + printf("ARM64TODO: ptrace_set_pc"); + return (EDOOFUS); } int From owner-svn-src-head@freebsd.org Thu Aug 17 19:39:43 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7356EDD2574; Thu, 17 Aug 2017 19:39:43 +0000 (UTC) (envelope-from oleg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 3D51C1AD5; Thu, 17 Aug 2017 19:39:43 +0000 (UTC) (envelope-from oleg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7HJdgX9001023; Thu, 17 Aug 2017 19:39:42 GMT (envelope-from oleg@FreeBSD.org) Received: (from oleg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7HJdgbE001022; Thu, 17 Aug 2017 19:39:42 GMT (envelope-from oleg@FreeBSD.org) Message-Id: <201708171939.v7HJdgbE001022@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oleg set sender to oleg@FreeBSD.org using -f From: Oleg Bulyzhin Date: Thu, 17 Aug 2017 19:39:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322628 - head/sys/boot/common X-SVN-Group: head X-SVN-Commit-Author: oleg X-SVN-Commit-Paths: head/sys/boot/common X-SVN-Commit-Revision: 322628 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Aug 2017 19:39:43 -0000 Author: oleg Date: Thu Aug 17 19:39:42 2017 New Revision: 322628 URL: https://svnweb.freebsd.org/changeset/base/322628 Log: Fix BSD label partition end sector calculation. Reviewed by: ae MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D12066 Modified: head/sys/boot/common/part.c Modified: head/sys/boot/common/part.c ============================================================================== --- head/sys/boot/common/part.c Thu Aug 17 19:16:23 2017 (r322627) +++ head/sys/boot/common/part.c Thu Aug 17 19:39:42 2017 (r322628) @@ -506,7 +506,7 @@ ptable_bsdread(struct ptable *table, void *dev, diskre break; entry->part.start = le32toh(part->p_offset) - raw_offset; entry->part.end = entry->part.start + - le32toh(part->p_size) + 1; + le32toh(part->p_size) - 1; entry->part.type = bsd_parttype(part->p_fstype); entry->part.index = i; /* starts from zero */ entry->type.bsd = part->p_fstype; From owner-svn-src-head@freebsd.org Thu Aug 17 20:15:22 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2DD6DDD429E; Thu, 17 Aug 2017 20:15:22 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 EC791365D; Thu, 17 Aug 2017 20:15:21 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7HKFKto018740; Thu, 17 Aug 2017 20:15:20 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7HKFK7P018739; Thu, 17 Aug 2017 20:15:20 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201708172015.v7HKFK7P018739@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Thu, 17 Aug 2017 20:15:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322633 - head X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 322633 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Aug 2017 20:15:22 -0000 Author: ngie Date: Thu Aug 17 20:15:20 2017 New Revision: 322633 URL: https://svnweb.freebsd.org/changeset/base/322633 Log: Honor NO_RTLD for rtld-elf, similar to what's done in libexec/Makefile, with libexec/rtld-elf/... for MK_{LIB32,LIBSOFT}. MFC after: 1 week Modified: head/Makefile.libcompat Modified: head/Makefile.libcompat ============================================================================== --- head/Makefile.libcompat Thu Aug 17 20:10:30 2017 (r322632) +++ head/Makefile.libcompat Thu Aug 17 20:15:20 2017 (r322633) @@ -179,7 +179,7 @@ build${libcompat}: .PHONY .endfor ${_+_}cd ${.CURDIR}; \ ${LIBCOMPATWMAKE} -f Makefile.inc1 -DNO_FSCHG libraries -.if ${libcompat} == "32" +.if ${libcompat} == "32" && !defined(NO_RTLD) .for _t in ${_obj} all ${_+_}cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIBCOMPATWMAKE} \ -DNO_FSCHG DIRPRFX=libexec/rtld-elf/ ${_t} @@ -192,7 +192,7 @@ distribute${libcompat} install${libcompat}: .PHONY .for _dir in ${_LC_LIBDIRS.yes} ${_+_}cd ${.CURDIR}/${_dir}; ${LIBCOMPATIMAKE} ${.TARGET:S/${libcompat}$//} .endfor -.if ${libcompat} == "32" +.if ${libcompat} == "32" && !defined(NO_RTLD) ${_+_}cd ${.CURDIR}/libexec/rtld-elf; \ PROG=ld-elf32.so.1 ${LIBCOMPATIMAKE} ${.TARGET:S/32$//} ${_+_}cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIBCOMPATIMAKE} \ From owner-svn-src-head@freebsd.org Thu Aug 17 20:25:52 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0109ADD4C50; Thu, 17 Aug 2017 20:25:51 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BB75F3ED3; Thu, 17 Aug 2017 20:25:51 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7HKPoYE022633; Thu, 17 Aug 2017 20:25:50 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7HKPoea022632; Thu, 17 Aug 2017 20:25:50 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201708172025.v7HKPoea022632@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Thu, 17 Aug 2017 20:25:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322634 - head/usr.sbin/vidcontrol X-SVN-Group: head X-SVN-Commit-Author: bde X-SVN-Commit-Paths: head/usr.sbin/vidcontrol X-SVN-Commit-Revision: 322634 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Aug 2017 20:25:52 -0000 Author: bde Date: Thu Aug 17 20:25:50 2017 New Revision: 322634 URL: https://svnweb.freebsd.org/changeset/base/322634 Log: I misplaced a newline in the previous commit. Fix this, and move line breaks in the vt case to the same places that the man(1) puts then in the SYNOPSIS. This was already done for the syscons case. Man pages can't depend on the driver, and the SYNOPSIS is hard-coded for syscons except for -f where it is hard-coded for vt. The usage message reverses this for sc. The only other differences are whitespace and removing -[dL] and -l for vt. Modified: head/usr.sbin/vidcontrol/vidcontrol.c Modified: head/usr.sbin/vidcontrol/vidcontrol.c ============================================================================== --- head/usr.sbin/vidcontrol/vidcontrol.c Thu Aug 17 20:15:20 2017 (r322633) +++ head/usr.sbin/vidcontrol/vidcontrol.c Thu Aug 17 20:25:50 2017 (r322634) @@ -193,14 +193,15 @@ static void usage(void) { if (vt4_mode) - fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n", + fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n", "usage: vidcontrol [-CHPpx] [-b color] [-c appearance] [-f [[size] file]]", " [-g geometry] [-h size] [-i active | adapter | mode]", -" [-M char] [-m on | off] [-r foreground background]", -" [-S on | off] [-s number] [-T xterm | cons25] [-t N | off]", -" [mode] [foreground [background]] [show]"); +" [-M char] [-m on | off]", +" [-r foreground background] [-S on | off] [-s number]", +" [-T xterm | cons25] [-t N | off] [mode]", +" [foreground [background]] [show]"); else - fprintf(stderr, "%s\n%s\n%s\n%s\n%s%s\n\n", + fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n", "usage: vidcontrol [-CdHLPpx] [-b color] [-c appearance] [-f [size] file]", " [-g geometry] [-h size] [-i active | adapter | mode]", " [-l screen_map] [-M char] [-m on | off]", From owner-svn-src-head@freebsd.org Thu Aug 17 20:37:03 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0AC95DD58A0; Thu, 17 Aug 2017 20:37:03 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 C8EC163857; Thu, 17 Aug 2017 20:37:02 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7HKb1vm026855; Thu, 17 Aug 2017 20:37:01 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7HKb1gj026854; Thu, 17 Aug 2017 20:37:01 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201708172037.v7HKb1gj026854@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Thu, 17 Aug 2017 20:37:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322635 - head/usr.sbin/bootparamd/callbootd X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: head/usr.sbin/bootparamd/callbootd X-SVN-Commit-Revision: 322635 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Aug 2017 20:37:03 -0000 Author: ngie Date: Thu Aug 17 20:37:01 2017 New Revision: 322635 URL: https://svnweb.freebsd.org/changeset/base/322635 Log: Fix WARNS - Remove ad hoc inet_ntoa prototype declaration; it's already handled by the included headers. - De-K&Rify the function prototypes for eachres_whoami(..), eachres_getfile(..), and main(..). MFC after: 1 week PR: 71667 Tested with: clang (5.0), gcc (4.2.1, 5) Modified: head/usr.sbin/bootparamd/callbootd/callbootd.c Modified: head/usr.sbin/bootparamd/callbootd/callbootd.c ============================================================================== --- head/usr.sbin/bootparamd/callbootd/callbootd.c Thu Aug 17 20:25:50 2017 (r322634) +++ head/usr.sbin/bootparamd/callbootd/callbootd.c Thu Aug 17 20:37:01 2017 (r322635) @@ -32,15 +32,12 @@ int broadcast; char cln[MAX_MACHINE_NAME+1]; char dmn[MAX_MACHINE_NAME+1]; char path[MAX_PATH_LEN+1]; -extern char *inet_ntoa(); static void usage(void); int printgetfile(bp_getfile_res *); int printwhoami(bp_whoami_res *); -bool_t -eachres_whoami(resultp, raddr) -bp_whoami_res *resultp; -struct sockaddr_in *raddr; +static bool_t +eachres_whoami(bp_whoami_res *resultp, struct sockaddr_in *raddr) { struct hostent *he; @@ -51,10 +48,8 @@ struct sockaddr_in *raddr; return(0); } -bool_t -eachres_getfile(resultp, raddr) -bp_getfile_res *resultp; -struct sockaddr_in *raddr; +static bool_t +eachres_getfile(bp_getfile_res *resultp, struct sockaddr_in *raddr) { struct hostent *he; @@ -67,9 +62,7 @@ struct sockaddr_in *raddr; int -main(argc, argv) -int argc; -char **argv; +main(int argc, char **argv) { char *server; From owner-svn-src-head@freebsd.org Thu Aug 17 20:41:30 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0E613DD5CEC; Thu, 17 Aug 2017 20:41:30 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 CD01163D9E; Thu, 17 Aug 2017 20:41:29 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7HKfS2j028254; Thu, 17 Aug 2017 20:41:28 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7HKfSZw028253; Thu, 17 Aug 2017 20:41:28 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201708172041.v7HKfSZw028253@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Thu, 17 Aug 2017 20:41:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322636 - head/usr.sbin/bootparamd/bootparamd X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: head/usr.sbin/bootparamd/bootparamd X-SVN-Commit-Revision: 322636 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Aug 2017 20:41:30 -0000 Author: ngie Date: Thu Aug 17 20:41:28 2017 New Revision: 322636 URL: https://svnweb.freebsd.org/changeset/base/322636 Log: Don't leak bpf on early return when YP isn't defined (NIS support) MFC after: 1 week Reported by: cppcheck Modified: head/usr.sbin/bootparamd/bootparamd/bootparamd.c Modified: head/usr.sbin/bootparamd/bootparamd/bootparamd.c ============================================================================== --- head/usr.sbin/bootparamd/bootparamd/bootparamd.c Thu Aug 17 20:37:01 2017 (r322635) +++ head/usr.sbin/bootparamd/bootparamd/bootparamd.c Thu Aug 17 20:41:28 2017 (r322636) @@ -239,6 +239,8 @@ int blen; warnx("could not close %s", bootpfile); return(1); #else + if (fclose(bpf)) + warnx("could not close %s", bootpfile); return(0); /* ENOTSUP */ #endif } From owner-svn-src-head@freebsd.org Fri Aug 18 00:25:29 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3F4E5DE1C85; Fri, 18 Aug 2017 00:25:29 +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 mx1.freebsd.org (Postfix) with ESMTPS id 094396B476; Fri, 18 Aug 2017 00:25:28 +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 v7I0PSmt021391; Fri, 18 Aug 2017 00:25:28 GMT (envelope-from grog@FreeBSD.org) Received: (from grog@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7I0PSZ1021390; Fri, 18 Aug 2017 00:25:28 GMT (envelope-from grog@FreeBSD.org) Message-Id: <201708180025.v7I0PSZ1021390@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: grog set sender to grog@FreeBSD.org using -f From: Greg Lehey Date: Fri, 18 Aug 2017 00:25:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322638 - 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: 322638 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Aug 2017 00:25:29 -0000 Author: grog Date: Fri Aug 18 00:25:27 2017 New Revision: 322638 URL: https://svnweb.freebsd.org/changeset/base/322638 Log: Goodbye, ache. Modified: head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Fri Aug 18 00:11:02 2017 (r322637) +++ head/usr.bin/calendar/calendars/calendar.freebsd Fri Aug 18 00:25:27 2017 (r322638) @@ -300,6 +300,7 @@ 08/12 Joe Marcus Clarke born in Lakeland, Florida, United States, 1976 08/12 Max Brazhnikov born in Leningradskaya, Russian Federation, 1979 08/14 Stefan Esser born in Cologne, Nordrhein-Westfalen, Germany, 1961 +08/16 Andrey Chernov died, 2017 08/17 Olivier Houchard born in Nancy, France, 1980 08/19 Chin-San Huang born in Yi-Lan, Taiwan, Republic of China, 1979 08/19 Pav Lucistnik born in Kutna Hora, Czech Republic, 1980 From owner-svn-src-head@freebsd.org Fri Aug 18 02:06:30 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0038CDE673C; Fri, 18 Aug 2017 02:06:30 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 C0C0F6E0DC; Fri, 18 Aug 2017 02:06:29 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7I26SNC061402; Fri, 18 Aug 2017 02:06:28 GMT (envelope-from lstewart@FreeBSD.org) Received: (from lstewart@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7I26SaA061401; Fri, 18 Aug 2017 02:06:28 GMT (envelope-from lstewart@FreeBSD.org) Message-Id: <201708180206.v7I26SaA061401@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lstewart set sender to lstewart@FreeBSD.org using -f From: Lawrence Stewart Date: Fri, 18 Aug 2017 02:06:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322643 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: lstewart X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 322643 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Aug 2017 02:06:30 -0000 Author: lstewart Date: Fri Aug 18 02:06:28 2017 New Revision: 322643 URL: https://svnweb.freebsd.org/changeset/base/322643 Log: An off-by-one error exists in sbuf_vprintf()'s use of SBUF_HASROOM() when an sbuf is filled to capacity by vsnprintf(), the loop exits without error, and the sbuf is not marked as auto-extendable. SBUF_HASROOM() evaluates true if there is room for one or more non-NULL characters, but in the case that the sbuf was filled exactly to capacity, SBUF_HASROOM() evaluates false. Consequently, sbuf_vprintf() incorrectly assigns an ENOMEM error to the sbuf when in fact everything is fine, in turn poisoning the buffer for all subsequent operations. Correct by moving the ENOMEM assignment into the loop where it can be made unambiguously. As a related safety net change, explicitly check for the zero bytes drained case in sbuf_drain() and set EDEADLK as the error. This avoids an infinite loop in sbuf_vprintf() if a drain function were to inadvertently return a value of zero to sbuf_drain(). Reviewed by: cem, jtl, gallatin MFC after: 2 weeks Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D8535 Modified: head/sys/kern/subr_sbuf.c Modified: head/sys/kern/subr_sbuf.c ============================================================================== --- head/sys/kern/subr_sbuf.c Fri Aug 18 01:34:38 2017 (r322642) +++ head/sys/kern/subr_sbuf.c Fri Aug 18 02:06:28 2017 (r322643) @@ -369,8 +369,8 @@ sbuf_drain(struct sbuf *s) return (s->s_error = EDEADLK); len = s->s_drain_func(s->s_drain_arg, s->s_buf, SBUF_DODRAINTOEOR(s) ? s->s_rec_off : s->s_len); - if (len < 0) { - s->s_error = -len; + if (len <= 0) { + s->s_error = len ? -len : EDEADLK; return (s->s_error); } KASSERT(len > 0 && len <= s->s_len, @@ -640,9 +640,9 @@ sbuf_vprintf(struct sbuf *s, const char *fmt, va_list break; /* Cannot print with the current available space. */ if (s->s_drain_func != NULL && s->s_len > 0) - error = sbuf_drain(s); - else - error = sbuf_extend(s, len - SBUF_FREESPACE(s)); + error = sbuf_drain(s); /* sbuf_drain() sets s_error. */ + else if (sbuf_extend(s, len - SBUF_FREESPACE(s)) != 0) + s->s_error = error = ENOMEM; } while (error == 0); /* @@ -659,8 +659,6 @@ sbuf_vprintf(struct sbuf *s, const char *fmt, va_list s->s_len += len; if (SBUF_ISSECTION(s)) s->s_sect_len += len; - if (!SBUF_HASROOM(s) && !SBUF_CANEXTEND(s)) - s->s_error = ENOMEM; KASSERT(s->s_len < s->s_size, ("wrote past end of sbuf (%d >= %d)", s->s_len, s->s_size)); From owner-svn-src-head@freebsd.org Fri Aug 18 03:52:38 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 129CBDC685E; Fri, 18 Aug 2017 03:52:38 +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 mx1.freebsd.org (Postfix) with ESMTPS id D1D7E71A1A; Fri, 18 Aug 2017 03:52:37 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7I3qbr5007184; Fri, 18 Aug 2017 03:52:37 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7I3qasq007173; Fri, 18 Aug 2017 03:52:36 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201708180352.v7I3qasq007173@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 18 Aug 2017 03:52:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322644 - in head/sys: amd64/amd64 arm/arm arm64/arm64 i386/i386 kern mips/mips sparc64/sparc64 sys X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys: amd64/amd64 arm/arm arm64/arm64 i386/i386 kern mips/mips sparc64/sparc64 sys X-SVN-Commit-Revision: 322644 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Aug 2017 03:52:38 -0000 Author: markj Date: Fri Aug 18 03:52:35 2017 New Revision: 322644 URL: https://svnweb.freebsd.org/changeset/base/322644 Log: Factor out duplicated kernel dump code into dump_{start,finish}(). dump_start() and dump_finish() are responsible for writing kernel dump headers, optionally writing the key when encryption is enabled, and initializing the initial offset into the dump device. Also remove the unused dump_pad(), and make some functions static now that they're only called from kern_shutdown.c. No functional change intended. Reviewed by: cem, def Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D11584 Modified: head/sys/amd64/amd64/minidump_machdep.c head/sys/arm/arm/minidump_machdep.c head/sys/arm64/arm64/minidump_machdep.c head/sys/i386/i386/minidump_machdep.c head/sys/kern/kern_dump.c head/sys/kern/kern_shutdown.c head/sys/mips/mips/minidump_machdep.c head/sys/sparc64/sparc64/dump_machdep.c head/sys/sys/conf.h head/sys/sys/kerneldump.h Modified: head/sys/amd64/amd64/minidump_machdep.c ============================================================================== --- head/sys/amd64/amd64/minidump_machdep.c Fri Aug 18 02:06:28 2017 (r322643) +++ head/sys/amd64/amd64/minidump_machdep.c Fri Aug 18 03:52:35 2017 (r322644) @@ -52,12 +52,6 @@ __FBSDID("$FreeBSD$"); CTASSERT(sizeof(struct kerneldumpheader) == 512); -/* - * Don't touch the first SIZEOF_METADATA bytes on the dump device. This - * is to protect us from metadata and to protect metadata from us. - */ -#define SIZEOF_METADATA (64*1024) - uint64_t *vm_page_dump; int vm_page_dump_size; @@ -320,22 +314,8 @@ minidumpsys(struct dumperinfo *di) } dumpsize += PAGE_SIZE; - /* Determine dump offset on device. */ - if (di->mediasize < SIZEOF_METADATA + dumpsize + di->blocksize * 2 + - kerneldumpcrypto_dumpkeysize(di->kdc)) { - error = E2BIG; - goto fail; - } - dumplo = di->mediaoffset + di->mediasize - dumpsize; - dumplo -= di->blocksize * 2; - dumplo -= kerneldumpcrypto_dumpkeysize(di->kdc); progress = dumpsize; - /* Initialize kernel dump crypto. */ - error = kerneldumpcrypto_init(di->kdc); - if (error) - goto fail; - /* Initialize mdhdr */ bzero(&mdhdr, sizeof(mdhdr)); strcpy(mdhdr.magic, MINIDUMP_MAGIC); @@ -353,18 +333,10 @@ minidumpsys(struct dumperinfo *di) printf("Dumping %llu out of %ju MB:", (long long)dumpsize >> 20, ptoa((uintmax_t)physmem) / 1048576); - /* Dump leader */ - error = dump_write_header(di, &kdh, 0, dumplo); - if (error) + error = dump_start(di, &kdh, &dumplo); + if (error != 0) goto fail; - dumplo += di->blocksize; - /* Dump key */ - error = dump_write_key(di, 0, dumplo); - if (error) - goto fail; - dumplo += kerneldumpcrypto_dumpkeysize(di->kdc); - /* Dump my header */ bzero(&fakepd, sizeof(fakepd)); bcopy(&mdhdr, &fakepd, sizeof(mdhdr)); @@ -447,14 +419,10 @@ minidumpsys(struct dumperinfo *di) if (error) goto fail; - /* Dump trailer */ - error = dump_write_header(di, &kdh, 0, dumplo); - if (error) + error = dump_finish(di, &kdh, dumplo); + if (error != 0) goto fail; - dumplo += di->blocksize; - /* Signal completion, signoff and exit stage left. */ - dump_write(di, NULL, 0, 0, 0); printf("\nDump complete\n"); return (0); Modified: head/sys/arm/arm/minidump_machdep.c ============================================================================== --- head/sys/arm/arm/minidump_machdep.c Fri Aug 18 02:06:28 2017 (r322643) +++ head/sys/arm/arm/minidump_machdep.c Fri Aug 18 03:52:35 2017 (r322644) @@ -53,12 +53,6 @@ __FBSDID("$FreeBSD$"); CTASSERT(sizeof(struct kerneldumpheader) == 512); -/* - * Don't touch the first SIZEOF_METADATA bytes on the dump device. This - * is to protect us from metadata and to protect metadata from us. - */ -#define SIZEOF_METADATA (64*1024) - uint32_t *vm_page_dump; int vm_page_dump_size; @@ -219,7 +213,6 @@ minidumpsys(struct dumperinfo *di) dumpsize = ptesize; dumpsize += round_page(msgbufp->msg_size); dumpsize += round_page(vm_page_dump_size); - for (i = 0; i < vm_page_dump_size / sizeof(*vm_page_dump); i++) { bits = vm_page_dump[i]; while (bits) { @@ -234,26 +227,10 @@ minidumpsys(struct dumperinfo *di) bits &= ~(1ul << bit); } } - dumpsize += PAGE_SIZE; - /* Determine dump offset on device. */ - if (di->mediasize < SIZEOF_METADATA + dumpsize + di->blocksize * 2 + - kerneldumpcrypto_dumpkeysize(di->kdc)) { - error = ENOSPC; - goto fail; - } - - dumplo = di->mediaoffset + di->mediasize - dumpsize; - dumplo -= di->blocksize * 2; - dumplo -= kerneldumpcrypto_dumpkeysize(di->kdc); progress = dumpsize; - /* Initialize kernel dump crypto. */ - error = kerneldumpcrypto_init(di->kdc); - if (error) - goto fail; - /* Initialize mdhdr */ bzero(&mdhdr, sizeof(mdhdr)); strcpy(mdhdr.magic, MINIDUMP_MAGIC); @@ -274,18 +251,10 @@ minidumpsys(struct dumperinfo *di) printf("Physical memory: %u MB\n", ptoa((uintmax_t)physmem) / 1048576); printf("Dumping %llu MB:", (long long)dumpsize >> 20); - /* Dump leader */ - error = dump_write_header(di, &kdh, 0, dumplo); - if (error) + error = dump_start(di, &kdh, &dumplo); + if (error != 0) goto fail; - dumplo += di->blocksize; - /* Dump key */ - error = dump_write_key(di, 0, dumplo); - if (error) - goto fail; - dumplo += kerneldumpcrypto_dumpkeysize(di->kdc); - /* Dump my header */ bzero(dumpbuf, sizeof(dumpbuf)); bcopy(&mdhdr, dumpbuf, sizeof(mdhdr)); @@ -360,14 +329,10 @@ minidumpsys(struct dumperinfo *di) if (error) goto fail; - /* Dump trailer */ - error = dump_write_header(di, &kdh, 0, dumplo); - if (error) + error = dump_finish(di, &kdh, dumplo); + if (error != 0) goto fail; - dumplo += di->blocksize; - /* Signal completion, signoff and exit stage left. */ - dump_write(di, NULL, 0, 0, 0); printf("\nDump complete\n"); return (0); @@ -377,7 +342,7 @@ fail: if (error == ECANCELED) printf("\nDump aborted\n"); - else if (error == ENOSPC) + else if (error == E2BIG || error == ENOSPC) printf("\nDump failed. Partition too small.\n"); else printf("\n** DUMP FAILED (ERROR %d) **\n", error); Modified: head/sys/arm64/arm64/minidump_machdep.c ============================================================================== --- head/sys/arm64/arm64/minidump_machdep.c Fri Aug 18 02:06:28 2017 (r322643) +++ head/sys/arm64/arm64/minidump_machdep.c Fri Aug 18 03:52:35 2017 (r322644) @@ -58,12 +58,6 @@ __FBSDID("$FreeBSD$"); CTASSERT(sizeof(struct kerneldumpheader) == 512); -/* - * Don't touch the first SIZEOF_METADATA bytes on the dump device. This - * is to protect us from metadata and to protect metadata from us. - */ -#define SIZEOF_METADATA (64*1024) - uint64_t *vm_page_dump; int vm_page_dump_size; @@ -281,22 +275,8 @@ minidumpsys(struct dumperinfo *di) } dumpsize += PAGE_SIZE; - /* Determine dump offset on device. */ - if (di->mediasize < SIZEOF_METADATA + dumpsize + di->blocksize * 2 + - kerneldumpcrypto_dumpkeysize(di->kdc)) { - error = E2BIG; - goto fail; - } - dumplo = di->mediaoffset + di->mediasize - dumpsize; - dumplo -= di->blocksize * 2; - dumplo -= kerneldumpcrypto_dumpkeysize(di->kdc); progress = dumpsize; - /* Initialize kernel dump crypto. */ - error = kerneldumpcrypto_init(di->kdc); - if (error) - goto fail; - /* Initialize mdhdr */ bzero(&mdhdr, sizeof(mdhdr)); strcpy(mdhdr.magic, MINIDUMP_MAGIC); @@ -315,18 +295,10 @@ minidumpsys(struct dumperinfo *di) printf("Dumping %llu out of %ju MB:", (long long)dumpsize >> 20, ptoa((uintmax_t)physmem) / 1048576); - /* Dump leader */ - error = dump_write_header(di, &kdh, 0, dumplo); - if (error) + error = dump_start(di, &kdh, &dumplo); + if (error != 0) goto fail; - dumplo += di->blocksize; - /* Dump key */ - error = dump_write_key(di, 0, dumplo); - if (error) - goto fail; - dumplo += kerneldumpcrypto_dumpkeysize(di->kdc); - /* Dump my header */ bzero(&tmpbuffer, sizeof(tmpbuffer)); bcopy(&mdhdr, &tmpbuffer, sizeof(mdhdr)); @@ -423,18 +395,14 @@ minidumpsys(struct dumperinfo *di) if (error) goto fail; - /* Dump trailer */ - error = dump_write_header(di, &kdh, 0, dumplo); - if (error) + error = dump_finish(di, &kdh, dumplo); + if (error != 0) goto fail; - dumplo += di->blocksize; - /* Signal completion, signoff and exit stage left. */ - dump_write(di, NULL, 0, 0, 0); printf("\nDump complete\n"); return (0); - fail: +fail: if (error < 0) error = -error; Modified: head/sys/i386/i386/minidump_machdep.c ============================================================================== --- head/sys/i386/i386/minidump_machdep.c Fri Aug 18 02:06:28 2017 (r322643) +++ head/sys/i386/i386/minidump_machdep.c Fri Aug 18 03:52:35 2017 (r322644) @@ -47,12 +47,6 @@ __FBSDID("$FreeBSD$"); CTASSERT(sizeof(struct kerneldumpheader) == 512); -/* - * Don't touch the first SIZEOF_METADATA bytes on the dump device. This - * is to protect us from metadata and to protect metadata from us. - */ -#define SIZEOF_METADATA (64*1024) - #define MD_ALIGN(x) (((off_t)(x) + PAGE_MASK) & ~PAGE_MASK) #define DEV_ALIGN(x) roundup2((off_t)(x), DEV_BSIZE) @@ -244,22 +238,8 @@ minidumpsys(struct dumperinfo *di) } dumpsize += PAGE_SIZE; - /* Determine dump offset on device. */ - if (di->mediasize < SIZEOF_METADATA + dumpsize + di->blocksize * 2 + - kerneldumpcrypto_dumpkeysize(di->kdc)) { - error = ENOSPC; - goto fail; - } - dumplo = di->mediaoffset + di->mediasize - dumpsize; - dumplo -= di->blocksize * 2; - dumplo -= kerneldumpcrypto_dumpkeysize(di->kdc); progress = dumpsize; - /* Initialize kernel dump crypto. */ - error = kerneldumpcrypto_init(di->kdc); - if (error) - goto fail; - /* Initialize mdhdr */ bzero(&mdhdr, sizeof(mdhdr)); strcpy(mdhdr.magic, MINIDUMP_MAGIC); @@ -278,18 +258,10 @@ minidumpsys(struct dumperinfo *di) printf("Physical memory: %ju MB\n", ptoa((uintmax_t)physmem) / 1048576); printf("Dumping %llu MB:", (long long)dumpsize >> 20); - /* Dump leader */ - error = dump_write_header(di, &kdh, 0, dumplo); - if (error) + error = dump_start(di, &kdh, &dumplo); + if (error != 0) goto fail; - dumplo += di->blocksize; - /* Dump key */ - error = dump_write_key(di, 0, dumplo); - if (error) - goto fail; - dumplo += kerneldumpcrypto_dumpkeysize(di->kdc); - /* Dump my header */ bzero(&fakept, sizeof(fakept)); bcopy(&mdhdr, &fakept, sizeof(mdhdr)); @@ -362,14 +334,10 @@ minidumpsys(struct dumperinfo *di) if (error) goto fail; - /* Dump trailer */ - error = dump_write_header(di, &kdh, 0, dumplo); - if (error) + error = dump_finish(di, &kdh, dumplo); + if (error != 0) goto fail; - dumplo += di->blocksize; - /* Signal completion, signoff and exit stage left. */ - dump_write(di, NULL, 0, 0, 0); printf("\nDump complete\n"); return (0); @@ -379,7 +347,7 @@ minidumpsys(struct dumperinfo *di) if (error == ECANCELED) printf("\nDump aborted\n"); - else if (error == ENOSPC) + else if (error == E2BIG || error == ENOSPC) printf("\nDump failed. Partition too small.\n"); else printf("\n** DUMP FAILED (ERROR %d) **\n", error); Modified: head/sys/kern/kern_dump.c ============================================================================== --- head/sys/kern/kern_dump.c Fri Aug 18 02:06:28 2017 (r322643) +++ head/sys/kern/kern_dump.c Fri Aug 18 03:52:35 2017 (r322644) @@ -49,12 +49,6 @@ __FBSDID("$FreeBSD$"); CTASSERT(sizeof(struct kerneldumpheader) == 512); -/* - * Don't touch the first SIZEOF_METADATA bytes on the dump device. This - * is to protect us from metadata and to protect metadata from us. - */ -#define SIZEOF_METADATA (64*1024) - #define MD_ALIGN(x) roundup2((off_t)(x), PAGE_SIZE) off_t dumplo; @@ -347,39 +341,16 @@ dumpsys_generic(struct dumperinfo *di) dumpsize += fileofs; hdrgap = fileofs - roundup2((off_t)hdrsz, di->blocksize); - /* Determine dump offset on device. */ - if (di->mediasize < SIZEOF_METADATA + dumpsize + di->blocksize * 2 + - kerneldumpcrypto_dumpkeysize(di->kdc)) { - error = ENOSPC; - goto fail; - } - dumplo = di->mediaoffset + di->mediasize - dumpsize; - dumplo -= di->blocksize * 2; - dumplo -= kerneldumpcrypto_dumpkeysize(di->kdc); - - /* Initialize kernel dump crypto. */ - error = kerneldumpcrypto_init(di->kdc); - if (error) - goto fail; - mkdumpheader(&kdh, KERNELDUMPMAGIC, KERNELDUMP_ARCH_VERSION, dumpsize, kerneldumpcrypto_dumpkeysize(di->kdc), di->blocksize); printf("Dumping %ju MB (%d chunks)\n", (uintmax_t)dumpsize >> 20, ehdr.e_phnum - DUMPSYS_NUM_AUX_HDRS); - /* Dump leader */ - error = dump_write_header(di, &kdh, 0, dumplo); - if (error) + error = dump_start(di, &kdh, &dumplo); + if (error != 0) goto fail; - dumplo += di->blocksize; - /* Dump key */ - error = dump_write_key(di, 0, dumplo); - if (error) - goto fail; - dumplo += kerneldumpcrypto_dumpkeysize(di->kdc); - /* Dump ELF header */ error = dumpsys_buf_write(di, (char*)&ehdr, sizeof(ehdr)); if (error) @@ -410,14 +381,10 @@ dumpsys_generic(struct dumperinfo *di) if (error < 0) goto fail; - /* Dump trailer */ - error = dump_write_header(di, &kdh, 0, dumplo); - if (error) + error = dump_finish(di, &kdh, dumplo); + if (error != 0) goto fail; - dumplo += di->blocksize; - /* Signal completion, signoff and exit stage left. */ - dump_write(di, NULL, 0, 0, 0); printf("\nDump complete\n"); return (0); @@ -427,7 +394,7 @@ dumpsys_generic(struct dumperinfo *di) if (error == ECANCELED) printf("\nDump aborted\n"); - else if (error == ENOSPC) + else if (error == E2BIG || error == ENOSPC) printf("\nDump failed. Partition too small.\n"); else printf("\n** DUMP FAILED (ERROR %d) **\n", error); Modified: head/sys/kern/kern_shutdown.c ============================================================================== --- head/sys/kern/kern_shutdown.c Fri Aug 18 02:06:28 2017 (r322643) +++ head/sys/kern/kern_shutdown.c Fri Aug 18 03:52:35 2017 (r322644) @@ -897,7 +897,7 @@ failed: } #endif /* EKCD */ -int +static int kerneldumpcrypto_init(struct kerneldumpcrypto *kdc) { #ifndef EKCD @@ -1180,21 +1180,7 @@ dump_raw_write_pad(struct dumperinfo *di, void *virtua return (dump_raw_write(di, buf, physical, offset, *size)); } -int -dump_write_pad(struct dumperinfo *di, void *virtual, vm_offset_t physical, - off_t offset, size_t length, size_t *size) -{ - void *buf; - int error; - - error = dump_pad(di, virtual, length, &buf, size); - if (error != 0) - return (error); - - return (dump_write(di, buf, physical, offset, *size)); -} - -int +static int dump_write_header(struct dumperinfo *di, struct kerneldumpheader *kdh, vm_offset_t physical, off_t offset) { @@ -1208,7 +1194,7 @@ dump_write_header(struct dumperinfo *di, struct kernel return (ret); } -int +static int dump_write_key(struct dumperinfo *di, vm_offset_t physical, off_t offset) { #ifndef EKCD @@ -1223,6 +1209,64 @@ dump_write_key(struct dumperinfo *di, vm_offset_t phys return (dump_raw_write(di, kdc->kdc_dumpkey, physical, offset, kdc->kdc_dumpkeysize)); #endif /* !EKCD */ +} + +/* + * Don't touch the first SIZEOF_METADATA bytes on the dump device. This is to + * protect us from metadata and metadata from us. + */ +#define SIZEOF_METADATA (64 * 1024) + +/* + * Do some preliminary setup for a kernel dump: verify that we have enough space + * on the dump device, write the leading header, and optionally write the crypto + * key. + */ +int +dump_start(struct dumperinfo *di, struct kerneldumpheader *kdh, off_t *dumplop) +{ + uint64_t dumpsize; + int error; + + error = kerneldumpcrypto_init(di->kdc); + if (error != 0) + return (error); + + dumpsize = dtoh64(kdh->dumplength) + 2 * di->blocksize + + kerneldumpcrypto_dumpkeysize(di->kdc); + if (di->mediasize < SIZEOF_METADATA + dumpsize) + return (E2BIG); + + *dumplop = di->mediaoffset + di->mediasize - dumpsize; + + error = dump_write_header(di, kdh, 0, *dumplop); + if (error != 0) + return (error); + *dumplop += di->blocksize; + + error = dump_write_key(di, 0, *dumplop); + if (error != 0) + return (error); + *dumplop += kerneldumpcrypto_dumpkeysize(di->kdc); + + return (0); +} + +/* + * Write the trailing kernel dump header and signal to the lower layers that the + * dump has completed. + */ +int +dump_finish(struct dumperinfo *di, struct kerneldumpheader *kdh, off_t dumplo) +{ + int error; + + error = dump_write_header(di, kdh, 0, dumplo); + if (error != 0) + return (error); + + (void)dump_write(di, NULL, 0, 0, 0); + return (0); } void Modified: head/sys/mips/mips/minidump_machdep.c ============================================================================== --- head/sys/mips/mips/minidump_machdep.c Fri Aug 18 02:06:28 2017 (r322643) +++ head/sys/mips/mips/minidump_machdep.c Fri Aug 18 03:52:35 2017 (r322644) @@ -52,18 +52,11 @@ __FBSDID("$FreeBSD$"); CTASSERT(sizeof(struct kerneldumpheader) == 512); -/* - * Don't touch the first SIZEOF_METADATA bytes on the dump device. This - * is to protect us from metadata and to protect metadata from us. - */ -#define SIZEOF_METADATA (64*1024) - uint32_t *vm_page_dump; int vm_page_dump_size; static struct kerneldumpheader kdh; static off_t dumplo; -static off_t origdumplo; /* Handle chunked writes. */ static uint64_t counter, progress, dumpsize; @@ -241,7 +234,6 @@ minidumpsys(struct dumperinfo *di) dumpsize = ptesize; dumpsize += round_page(msgbufp->msg_size); dumpsize += round_page(vm_page_dump_size); - for (i = 0; i < vm_page_dump_size / sizeof(*vm_page_dump); i++) { bits = vm_page_dump[i]; while (bits) { @@ -256,26 +248,10 @@ minidumpsys(struct dumperinfo *di) bits &= ~(1ul << bit); } } - dumpsize += PAGE_SIZE; - /* Determine dump offset on device. */ - if (di->mediasize < SIZEOF_METADATA + dumpsize + di->blocksize * 2 + - kerneldumpcrypto_dumpkeysize(di->kdc)) { - error = ENOSPC; - goto fail; - } - - origdumplo = dumplo = di->mediaoffset + di->mediasize - dumpsize; - dumplo -= di->blocksize * 2; - dumplo -= kerneldumpcrypto_dumpkeysize(di->kdc); progress = dumpsize; - /* Initialize kernel dump crypto. */ - error = kerneldumpcrypto_init(di->kdc); - if (error) - goto fail; - /* Initialize mdhdr */ bzero(&mdhdr, sizeof(mdhdr)); strcpy(mdhdr.magic, MINIDUMP_MAGIC); @@ -291,18 +267,10 @@ minidumpsys(struct dumperinfo *di) printf("Dumping %llu out of %ju MB:", (long long)dumpsize >> 20, ptoa((uintmax_t)physmem) / 1048576); - /* Dump leader */ - error = dump_write_header(di, &kdh, 0, dumplo); - if (error) + error = dump_start(di, &kdh, &dumplo); + if (error != 0) goto fail; - dumplo += di->blocksize; - /* Dump key */ - error = dump_write_key(di, 0, dumplo); - if (error) - goto fail; - dumplo += kerneldumpcrypto_dumpkeysize(di->kdc); - /* Dump my header */ bzero(tmpbuffer, sizeof(tmpbuffer)); bcopy(&mdhdr, tmpbuffer, sizeof(mdhdr)); @@ -329,8 +297,7 @@ minidumpsys(struct dumperinfo *di) if (!count) { prev_pte = (vm_offset_t)pte; count++; - } - else { + } else { if ((vm_offset_t)pte == (prev_pte + count * PAGE_SIZE)) count++; else { @@ -368,14 +335,10 @@ minidumpsys(struct dumperinfo *di) } } - /* Dump trailer */ - error = dump_write_header(di, &kdh, 0, dumplo); - if (error) + error = dump_finish(di, &kdh, dumplo); + if (error != 0) goto fail; - dumplo += di->blocksize; - /* Signal completion, signoff and exit stage left. */ - dump_write(di, NULL, 0, 0, 0); printf("\nDump complete\n"); return (0); @@ -385,7 +348,7 @@ fail: if (error == ECANCELED) printf("\nDump aborted\n"); - else if (error == ENOSPC) + else if (error == E2BIG || error == ENOSPC) printf("\nDump failed. Partition too small.\n"); else printf("\n** DUMP FAILED (ERROR %d) **\n", error); Modified: head/sys/sparc64/sparc64/dump_machdep.c ============================================================================== --- head/sys/sparc64/sparc64/dump_machdep.c Fri Aug 18 02:06:28 2017 (r322643) +++ head/sys/sparc64/sparc64/dump_machdep.c Fri Aug 18 03:52:35 2017 (r322644) @@ -78,7 +78,7 @@ dumpsys(struct dumperinfo *di) { static struct kerneldumpheader kdh; struct sparc64_dump_hdr hdr; - vm_size_t size, totsize, hdrsize; + vm_size_t size, hdrsize; int error, i, nreg; /* Set up dump_map and calculate dump size. */ @@ -94,41 +94,15 @@ dumpsys(struct dumperinfo *di) DEV_BSIZE); size += hdrsize; - totsize = size + 2 * di->blocksize + - kerneldumpcrypto_dumpkeysize(di->kdc); - if (totsize > di->mediasize) { - printf("Insufficient space on device (need %ld, have %ld), " - "refusing to dump.\n", (long)totsize, - (long)di->mediasize); - error = ENOSPC; - goto fail; - } - - /* Determine dump offset on device. */ - dumplo = di->mediaoffset + di->mediasize - totsize; - - /* Initialize kernel dump crypto. */ - error = kerneldumpcrypto_init(di->kdc); - if (error) - goto fail; - mkdumpheader(&kdh, KERNELDUMPMAGIC, KERNELDUMP_SPARC64_VERSION, size, kerneldumpcrypto_dumpkeysize(di->kdc), di->blocksize); printf("Dumping %lu MB (%d chunks)\n", (u_long)(size >> 20), nreg); - /* Dump leader */ - error = dump_write_header(di, &kdh, 0, dumplo); - if (error) + error = dump_start(di, &kdh, &dumplo); + if (error != 0) goto fail; - dumplo += di->blocksize; - /* Dump key */ - error = dump_write_key(di, 0, dumplo); - if (error) - goto fail; - dumplo += kerneldumpcrypto_dumpkeysize(di->kdc); - /* Dump the private header. */ hdr.dh_hdr_size = hdrsize; hdr.dh_tsb_pa = tsb_kernel_phys; @@ -154,14 +128,10 @@ dumpsys(struct dumperinfo *di) if (error < 0) goto fail; - /* Dump trailer */ - error = dump_write_header(di, &kdh, 0, dumplo); - if (error) + error = dump_finish(di, &kdh, dumplo); + if (error != 0) goto fail; - dumplo += di->blocksize; - /* Signal completion, signoff and exit stage left. */ - dump_write(di, NULL, 0, 0, 0); printf("\nDump complete\n"); return (0); Modified: head/sys/sys/conf.h ============================================================================== --- head/sys/sys/conf.h Fri Aug 18 02:06:28 2017 (r322643) +++ head/sys/sys/conf.h Fri Aug 18 03:52:35 2017 (r322644) @@ -342,12 +342,11 @@ struct dumperinfo { int set_dumper(struct dumperinfo *di, const char *devname, struct thread *td, uint8_t encrypt, const uint8_t *key, uint32_t encryptedkeysize, const uint8_t *encryptedkey); +int dump_start(struct dumperinfo *di, struct kerneldumpheader *kdh, + off_t *dumplop); +int dump_finish(struct dumperinfo *di, struct kerneldumpheader *kdh, + off_t dumplo); int dump_write(struct dumperinfo *, void *, vm_offset_t, off_t, size_t); -int dump_write_pad(struct dumperinfo *, void *, vm_offset_t, off_t, size_t, - size_t *); -int dump_write_header(struct dumperinfo *di, struct kerneldumpheader *kdh, - vm_offset_t physical, off_t offset); -int dump_write_key(struct dumperinfo *di, vm_offset_t physical, off_t offset); int doadump(boolean_t); extern int dumping; /* system is dumping */ Modified: head/sys/sys/kerneldump.h ============================================================================== --- head/sys/sys/kerneldump.h Fri Aug 18 02:06:28 2017 (r322643) +++ head/sys/sys/kerneldump.h Fri Aug 18 03:52:35 2017 (r322644) @@ -125,7 +125,6 @@ struct dump_pa { vm_paddr_t pa_size; }; -int kerneldumpcrypto_init(struct kerneldumpcrypto *kdc); uint32_t kerneldumpcrypto_dumpkeysize(const struct kerneldumpcrypto *kdc); void mkdumpheader(struct kerneldumpheader *kdh, char *magic, uint32_t archver, From owner-svn-src-head@freebsd.org Fri Aug 18 04:04:12 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 02766DC73E3; Fri, 18 Aug 2017 04:04:12 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BD68A72002; Fri, 18 Aug 2017 04:04:11 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7I44ApH011468; Fri, 18 Aug 2017 04:04:10 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7I449oY011456; Fri, 18 Aug 2017 04:04:09 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201708180404.v7I449oY011456@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 18 Aug 2017 04:04:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322645 - in head/sys: amd64/amd64 arm/arm arm64/arm64 ddb i386/i386 kern mips/mips sparc64/sparc64 sys X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys: amd64/amd64 arm/arm arm64/arm64 ddb i386/i386 kern mips/mips sparc64/sparc64 sys X-SVN-Commit-Revision: 322645 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Aug 2017 04:04:12 -0000 Author: markj Date: Fri Aug 18 04:04:09 2017 New Revision: 322645 URL: https://svnweb.freebsd.org/changeset/base/322645 Log: Rename mkdumpheader() and group EKCD functions in kern_shutdown.c. This helps simplify the code in kern_shutdown.c and reduces the number of globally visible functions. No functional change intended. Reviewed by: cem, def Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D11603 Modified: head/sys/amd64/amd64/minidump_machdep.c head/sys/arm/arm/minidump_machdep.c head/sys/arm64/arm64/minidump_machdep.c head/sys/ddb/db_textdump.c head/sys/i386/i386/minidump_machdep.c head/sys/kern/kern_dump.c head/sys/kern/kern_shutdown.c head/sys/mips/mips/minidump_machdep.c head/sys/sparc64/sparc64/dump_machdep.c head/sys/sys/conf.h head/sys/sys/kerneldump.h Modified: head/sys/amd64/amd64/minidump_machdep.c ============================================================================== --- head/sys/amd64/amd64/minidump_machdep.c Fri Aug 18 03:52:35 2017 (r322644) +++ head/sys/amd64/amd64/minidump_machdep.c Fri Aug 18 04:04:09 2017 (r322645) @@ -327,8 +327,8 @@ minidumpsys(struct dumperinfo *di) mdhdr.dmapbase = DMAP_MIN_ADDRESS; mdhdr.dmapend = DMAP_MAX_ADDRESS; - mkdumpheader(&kdh, KERNELDUMPMAGIC, KERNELDUMP_AMD64_VERSION, dumpsize, - kerneldumpcrypto_dumpkeysize(di->kdc), di->blocksize); + dump_init_header(di, &kdh, KERNELDUMPMAGIC, KERNELDUMP_AMD64_VERSION, + dumpsize); printf("Dumping %llu out of %ju MB:", (long long)dumpsize >> 20, ptoa((uintmax_t)physmem) / 1048576); Modified: head/sys/arm/arm/minidump_machdep.c ============================================================================== --- head/sys/arm/arm/minidump_machdep.c Fri Aug 18 03:52:35 2017 (r322644) +++ head/sys/arm/arm/minidump_machdep.c Fri Aug 18 04:04:09 2017 (r322645) @@ -245,8 +245,8 @@ minidumpsys(struct dumperinfo *di) #else mdhdr.mmuformat = MINIDUMP_MMU_FORMAT_V4; #endif - mkdumpheader(&kdh, KERNELDUMPMAGIC, KERNELDUMP_ARM_VERSION, dumpsize, - kerneldumpcrypto_dumpkeysize(di->kdc), di->blocksize); + dump_init_header(di, &kdh, KERNELDUMPMAGIC, KERNELDUMP_ARM_VERSION, + dumpsize); printf("Physical memory: %u MB\n", ptoa((uintmax_t)physmem) / 1048576); printf("Dumping %llu MB:", (long long)dumpsize >> 20); Modified: head/sys/arm64/arm64/minidump_machdep.c ============================================================================== --- head/sys/arm64/arm64/minidump_machdep.c Fri Aug 18 03:52:35 2017 (r322644) +++ head/sys/arm64/arm64/minidump_machdep.c Fri Aug 18 04:04:09 2017 (r322645) @@ -289,8 +289,8 @@ minidumpsys(struct dumperinfo *di) mdhdr.dmapbase = DMAP_MIN_ADDRESS; mdhdr.dmapend = DMAP_MAX_ADDRESS; - mkdumpheader(&kdh, KERNELDUMPMAGIC, KERNELDUMP_AARCH64_VERSION, - dumpsize, kerneldumpcrypto_dumpkeysize(di->kdc), di->blocksize); + dump_init_header(di, &kdh, KERNELDUMPMAGIC, KERNELDUMP_AARCH64_VERSION, + dumpsize); printf("Dumping %llu out of %ju MB:", (long long)dumpsize >> 20, ptoa((uintmax_t)physmem) / 1048576); Modified: head/sys/ddb/db_textdump.c ============================================================================== --- head/sys/ddb/db_textdump.c Fri Aug 18 03:52:35 2017 (r322644) +++ head/sys/ddb/db_textdump.c Fri Aug 18 04:04:09 2017 (r322645) @@ -463,8 +463,7 @@ textdump_dumpsys(struct dumperinfo *di) */ textdump_offset = di->mediasize - sizeof(kdh); textdump_saveoff(&trailer_offset); - mkdumpheader(&kdh, TEXTDUMPMAGIC, KERNELDUMP_TEXT_VERSION, 0, 0, - TEXTDUMP_BLOCKSIZE); + dump_init_header(di, &kdh, TEXTDUMPMAGIC, KERNELDUMP_TEXT_VERSION, 0); (void)textdump_writenextblock(di, (char *)&kdh); /* @@ -489,8 +488,8 @@ textdump_dumpsys(struct dumperinfo *di) * size. */ dumplen = trailer_offset - (textdump_offset + TEXTDUMP_BLOCKSIZE); - mkdumpheader(&kdh, TEXTDUMPMAGIC, KERNELDUMP_TEXT_VERSION, dumplen, 0, - TEXTDUMP_BLOCKSIZE); + dump_init_header(di, &kdh, TEXTDUMPMAGIC, KERNELDUMP_TEXT_VERSION, + dumplen); (void)textdump_writenextblock(di, (char *)&kdh); textdump_restoreoff(trailer_offset); (void)textdump_writenextblock(di, (char *)&kdh); Modified: head/sys/i386/i386/minidump_machdep.c ============================================================================== --- head/sys/i386/i386/minidump_machdep.c Fri Aug 18 03:52:35 2017 (r322644) +++ head/sys/i386/i386/minidump_machdep.c Fri Aug 18 04:04:09 2017 (r322645) @@ -252,8 +252,8 @@ minidumpsys(struct dumperinfo *di) mdhdr.paemode = 1; #endif - mkdumpheader(&kdh, KERNELDUMPMAGIC, KERNELDUMP_I386_VERSION, dumpsize, - kerneldumpcrypto_dumpkeysize(di->kdc), di->blocksize); + dump_init_header(di, &kdh, KERNELDUMPMAGIC, KERNELDUMP_I386_VERSION, + dumpsize); printf("Physical memory: %ju MB\n", ptoa((uintmax_t)physmem) / 1048576); printf("Dumping %llu MB:", (long long)dumpsize >> 20); Modified: head/sys/kern/kern_dump.c ============================================================================== --- head/sys/kern/kern_dump.c Fri Aug 18 03:52:35 2017 (r322644) +++ head/sys/kern/kern_dump.c Fri Aug 18 04:04:09 2017 (r322645) @@ -341,8 +341,8 @@ dumpsys_generic(struct dumperinfo *di) dumpsize += fileofs; hdrgap = fileofs - roundup2((off_t)hdrsz, di->blocksize); - mkdumpheader(&kdh, KERNELDUMPMAGIC, KERNELDUMP_ARCH_VERSION, dumpsize, - kerneldumpcrypto_dumpkeysize(di->kdc), di->blocksize); + dump_init_header(di, &kdh, KERNELDUMPMAGIC, KERNELDUMP_ARCH_VERSION, + dumpsize); printf("Dumping %ju MB (%d chunks)\n", (uintmax_t)dumpsize >> 20, ehdr.e_phnum - DUMPSYS_NUM_AUX_HDRS); Modified: head/sys/kern/kern_shutdown.c ============================================================================== --- head/sys/kern/kern_shutdown.c Fri Aug 18 03:52:35 2017 (r322644) +++ head/sys/kern/kern_shutdown.c Fri Aug 18 04:04:09 2017 (r322645) @@ -895,14 +895,10 @@ failed: free(kdc, M_EKCD); return (NULL); } -#endif /* EKCD */ static int kerneldumpcrypto_init(struct kerneldumpcrypto *kdc) { -#ifndef EKCD - return (0); -#else uint8_t hash[SHA256_DIGEST_LENGTH]; SHA256_CTX ctx; struct kerneldumpkey *kdk; @@ -942,21 +938,17 @@ kerneldumpcrypto_init(struct kerneldumpcrypto *kdc) out: explicit_bzero(hash, sizeof(hash)); return (error); -#endif } -uint32_t +static uint32_t kerneldumpcrypto_dumpkeysize(const struct kerneldumpcrypto *kdc) { -#ifdef EKCD if (kdc == NULL) return (0); return (kdc->kdc_dumpkeysize); -#else - return (0); -#endif } +#endif /* EKCD */ /* Registration of dumpers */ int @@ -1036,6 +1028,20 @@ dump_check_bounds(struct dumperinfo *di, off_t offset, return (0); } +/* Call dumper with bounds checking. */ +static int +dump_raw_write(struct dumperinfo *di, void *virtual, vm_offset_t physical, + off_t offset, size_t length) +{ + int error; + + error = dump_check_bounds(di, offset, length); + if (error != 0) + return (error); + + return (di->dumper(di->priv, virtual, physical, offset, length)); +} + #ifdef EKCD static int dump_encrypt(struct kerneldumpcrypto *kdc, uint8_t *buf, size_t size) @@ -1115,21 +1121,20 @@ dump_encrypted_write(struct dumperinfo *di, void *virt return (0); } -#endif /* EKCD */ -/* Call dumper with bounds checking. */ static int -dump_raw_write(struct dumperinfo *di, void *virtual, vm_offset_t physical, - off_t offset, size_t length) +dump_write_key(struct dumperinfo *di, vm_offset_t physical, off_t offset) { - int error; + struct kerneldumpcrypto *kdc; - error = dump_check_bounds(di, offset, length); - if (error != 0) - return (error); + kdc = di->kdc; + if (kdc == NULL) + return (0); - return (di->dumper(di->priv, virtual, physical, offset, length)); + return (dump_raw_write(di, kdc->kdc_dumpkey, physical, offset, + kdc->kdc_dumpkeysize)); } +#endif /* EKCD */ int dump_write(struct dumperinfo *di, void *virtual, vm_offset_t physical, @@ -1194,23 +1199,6 @@ dump_write_header(struct dumperinfo *di, struct kernel return (ret); } -static int -dump_write_key(struct dumperinfo *di, vm_offset_t physical, off_t offset) -{ -#ifndef EKCD - return (0); -#else /* EKCD */ - struct kerneldumpcrypto *kdc; - - kdc = di->kdc; - if (kdc == NULL) - return (0); - - return (dump_raw_write(di, kdc->kdc_dumpkey, physical, offset, - kdc->kdc_dumpkeysize)); -#endif /* !EKCD */ -} - /* * Don't touch the first SIZEOF_METADATA bytes on the dump device. This is to * protect us from metadata and metadata from us. @@ -1226,14 +1214,19 @@ int dump_start(struct dumperinfo *di, struct kerneldumpheader *kdh, off_t *dumplop) { uint64_t dumpsize; + uint32_t keysize; int error; +#ifdef EKCD error = kerneldumpcrypto_init(di->kdc); if (error != 0) return (error); + keysize = kerneldumpcrypto_dumpkeysize(di->kdc); +#else + keysize = 0; +#endif - dumpsize = dtoh64(kdh->dumplength) + 2 * di->blocksize + - kerneldumpcrypto_dumpkeysize(di->kdc); + dumpsize = dtoh64(kdh->dumplength) + 2 * di->blocksize + keysize; if (di->mediasize < SIZEOF_METADATA + dumpsize) return (E2BIG); @@ -1244,10 +1237,12 @@ dump_start(struct dumperinfo *di, struct kerneldumphea return (error); *dumplop += di->blocksize; +#ifdef EKCD error = dump_write_key(di, 0, *dumplop); if (error != 0) return (error); - *dumplop += kerneldumpcrypto_dumpkeysize(di->kdc); + *dumplop += keysize; +#endif return (0); } @@ -1270,8 +1265,8 @@ dump_finish(struct dumperinfo *di, struct kerneldumphe } void -mkdumpheader(struct kerneldumpheader *kdh, char *magic, uint32_t archver, - uint64_t dumplen, uint32_t dumpkeysize, uint32_t blksz) +dump_init_header(const struct dumperinfo *di, struct kerneldumpheader *kdh, + char *magic, uint32_t archver, uint64_t dumplen) { size_t dstsize; @@ -1282,8 +1277,12 @@ mkdumpheader(struct kerneldumpheader *kdh, char *magic kdh->architectureversion = htod32(archver); kdh->dumplength = htod64(dumplen); kdh->dumptime = htod64(time_second); - kdh->dumpkeysize = htod32(dumpkeysize); - kdh->blocksize = htod32(blksz); +#ifdef EKCD + kdh->dumpkeysize = htod32(kerneldumpcrypto_dumpkeysize(di->kdc)); +#else + kdh->dumpkeysize = 0; +#endif + kdh->blocksize = htod32(di->blocksize); strlcpy(kdh->hostname, prison0.pr_hostname, sizeof(kdh->hostname)); dstsize = sizeof(kdh->versionstring); if (strlcpy(kdh->versionstring, version, dstsize) >= dstsize) Modified: head/sys/mips/mips/minidump_machdep.c ============================================================================== --- head/sys/mips/mips/minidump_machdep.c Fri Aug 18 03:52:35 2017 (r322644) +++ head/sys/mips/mips/minidump_machdep.c Fri Aug 18 04:04:09 2017 (r322645) @@ -261,8 +261,8 @@ minidumpsys(struct dumperinfo *di) mdhdr.ptesize = ptesize; mdhdr.kernbase = VM_MIN_KERNEL_ADDRESS; - mkdumpheader(&kdh, KERNELDUMPMAGIC, KERNELDUMP_MIPS_VERSION, dumpsize, - kerneldumpcrypto_dumpkeysize(di->kdc), di->blocksize); + dump_init_header(di, &kdh, KERNELDUMPMAGIC, KERNELDUMP_MIPS_VERSION, + dumpsize); printf("Dumping %llu out of %ju MB:", (long long)dumpsize >> 20, ptoa((uintmax_t)physmem) / 1048576); Modified: head/sys/sparc64/sparc64/dump_machdep.c ============================================================================== --- head/sys/sparc64/sparc64/dump_machdep.c Fri Aug 18 03:52:35 2017 (r322644) +++ head/sys/sparc64/sparc64/dump_machdep.c Fri Aug 18 04:04:09 2017 (r322645) @@ -94,8 +94,8 @@ dumpsys(struct dumperinfo *di) DEV_BSIZE); size += hdrsize; - mkdumpheader(&kdh, KERNELDUMPMAGIC, KERNELDUMP_SPARC64_VERSION, size, - kerneldumpcrypto_dumpkeysize(di->kdc), di->blocksize); + dump_init_header(di, &kdh, KERNELDUMPMAGIC, KERNELDUMP_SPARC64_VERSION, + size); printf("Dumping %lu MB (%d chunks)\n", (u_long)(size >> 20), nreg); Modified: head/sys/sys/conf.h ============================================================================== --- head/sys/sys/conf.h Fri Aug 18 03:52:35 2017 (r322644) +++ head/sys/sys/conf.h Fri Aug 18 04:04:09 2017 (r322645) @@ -342,6 +342,8 @@ struct dumperinfo { int set_dumper(struct dumperinfo *di, const char *devname, struct thread *td, uint8_t encrypt, const uint8_t *key, uint32_t encryptedkeysize, const uint8_t *encryptedkey); +void dump_init_header(const struct dumperinfo *di, struct kerneldumpheader *kdh, + char *magic, uint32_t archver, uint64_t dumplen); int dump_start(struct dumperinfo *di, struct kerneldumpheader *kdh, off_t *dumplop); int dump_finish(struct dumperinfo *di, struct kerneldumpheader *kdh, Modified: head/sys/sys/kerneldump.h ============================================================================== --- head/sys/sys/kerneldump.h Fri Aug 18 03:52:35 2017 (r322644) +++ head/sys/sys/kerneldump.h Fri Aug 18 04:04:09 2017 (r322645) @@ -125,11 +125,6 @@ struct dump_pa { vm_paddr_t pa_size; }; -uint32_t kerneldumpcrypto_dumpkeysize(const struct kerneldumpcrypto *kdc); - -void mkdumpheader(struct kerneldumpheader *kdh, char *magic, uint32_t archver, - uint64_t dumplen, uint32_t dumpkeysize, uint32_t blksz); - int dumpsys_generic(struct dumperinfo *); void dumpsys_map_chunk(vm_paddr_t, size_t, void **); From owner-svn-src-head@freebsd.org Fri Aug 18 04:07:27 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 23D8BDC77DB; Fri, 18 Aug 2017 04:07:27 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E7BAF721F3; Fri, 18 Aug 2017 04:07:26 +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 v7I47QA7011621; Fri, 18 Aug 2017 04:07:26 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7I47Qhd011620; Fri, 18 Aug 2017 04:07:26 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201708180407.v7I47Qhd011620@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 18 Aug 2017 04:07:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322646 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 322646 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Aug 2017 04:07:27 -0000 Author: markj Date: Fri Aug 18 04:07:25 2017 New Revision: 322646 URL: https://svnweb.freebsd.org/changeset/base/322646 Log: Remove some unneeded subroutines for padding writes to dump devices. Right now we only need to pad when writing kernel dump headers, so flatten three related subroutines into one. The encrypted kernel dump code already writes out its key in a dumper.blocksize-sized block. No functional change intended. Reviewed by: cem, def Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D11647 Modified: head/sys/kern/kern_shutdown.c Modified: head/sys/kern/kern_shutdown.c ============================================================================== --- head/sys/kern/kern_shutdown.c Fri Aug 18 04:04:09 2017 (r322645) +++ head/sys/kern/kern_shutdown.c Fri Aug 18 04:07:25 2017 (r322646) @@ -1152,51 +1152,25 @@ dump_write(struct dumperinfo *di, void *virtual, vm_of } static int -dump_pad(struct dumperinfo *di, void *virtual, size_t length, void **buf, - size_t *size) +dump_write_header(struct dumperinfo *di, struct kerneldumpheader *kdh, + vm_offset_t physical, off_t offset) { + void *buf; + size_t hdrsz; - if (length > di->blocksize) + hdrsz = sizeof(*kdh); + if (hdrsz > di->blocksize) return (ENOMEM); - *size = di->blocksize; - if (length == di->blocksize) { - *buf = virtual; - } else { - *buf = di->blockbuf; - memcpy(*buf, virtual, length); - memset((uint8_t *)*buf + length, 0, di->blocksize - length); + if (hdrsz == di->blocksize) + buf = kdh; + else { + buf = di->blockbuf; + memset(buf, 0, di->blocksize); + memcpy(buf, kdh, hdrsz); } - return (0); -} - -static int -dump_raw_write_pad(struct dumperinfo *di, void *virtual, vm_offset_t physical, - off_t offset, size_t length, size_t *size) -{ - void *buf; - int error; - - error = dump_pad(di, virtual, length, &buf, size); - if (error != 0) - return (error); - - return (dump_raw_write(di, buf, physical, offset, *size)); -} - -static int -dump_write_header(struct dumperinfo *di, struct kerneldumpheader *kdh, - vm_offset_t physical, off_t offset) -{ - size_t size; - int ret; - - ret = dump_raw_write_pad(di, kdh, physical, offset, sizeof(*kdh), - &size); - if (ret == 0 && size != di->blocksize) - ret = EINVAL; - return (ret); + return (dump_raw_write(di, buf, physical, offset, di->blocksize)); } /* From owner-svn-src-head@freebsd.org Fri Aug 18 07:21:39 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5BEADDCF51E; Fri, 18 Aug 2017 07:21:39 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citapm.icyb.net.ua (citapm.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 18AE17681F; Fri, 18 Aug 2017 07:21:37 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citapm.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id KAA20029; Fri, 18 Aug 2017 10:21:30 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1dibb0-000JJl-6j; Fri, 18 Aug 2017 10:21:30 +0300 Subject: Re: svn commit: r322601 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys To: John Baldwin References: <201708162340.v7GNeWrL098164@repo.freebsd.org> <4786e0df-cbbd-d0fe-2e45-682b9fe24652@FreeBSD.org> <1870652.QF6rqaG5fn@ralph.baldwin.cx> Cc: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org From: Andriy Gapon Message-ID: Date: Fri, 18 Aug 2017 10:20:37 +0300 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <1870652.QF6rqaG5fn@ralph.baldwin.cx> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Aug 2017 07:21:39 -0000 On 17/08/2017 20:07, John Baldwin wrote: > On Thursday, August 17, 2017 10:42:51 AM Andriy Gapon wrote: >> On 17/08/2017 02:40, John Baldwin wrote: >>> Author: jhb >>> Date: Wed Aug 16 23:40:32 2017 >>> New Revision: 322601 >>> URL: https://svnweb.freebsd.org/changeset/base/322601 >>> >>> Log: >>> Mark ZFS ABD inline functions static. >>> >>> When built with -fno-inline-functions zfs.ko contains undefined references >>> to these functions if they are only marked inline. >>> >>> Reviewed by: avg (earlier version) >> >> I think that you rushed a little bit on this one: >> https://github.com/openzfs/openzfs/pull/444 >> >> But no big deal, it will be easy to merge once the upstream wakes up :-) > > Oof, I thought you had previously ok'd to commit this? (I just hadn't gotten > around to it.) My apologies for misunderstanding. I think I did. It's good to have a fix sooner rather than later even if it's not a final version. Thanks! -- Andriy Gapon From owner-svn-src-head@freebsd.org Fri Aug 18 07:27:17 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0DEE7DCF8AC; Fri, 18 Aug 2017 07:27:17 +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 mx1.freebsd.org (Postfix) with ESMTPS id CF71B76B3A; Fri, 18 Aug 2017 07:27:16 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7I7RGYg092095; Fri, 18 Aug 2017 07:27:16 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7I7RGn7092094; Fri, 18 Aug 2017 07:27:16 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201708180727.v7I7RGn7092094@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Fri, 18 Aug 2017 07:27:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322648 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 322648 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Aug 2017 07:27:17 -0000 Author: tuexen Date: Fri Aug 18 07:27:15 2017 New Revision: 322648 URL: https://svnweb.freebsd.org/changeset/base/322648 Log: Ensure inp_vflag is consistently set for TCP endpoints. Make sure that the flags INP_IPV4 and INP_IPV6 are consistently set for inpcbs used for TCP sockets, no matter if the setting is derived from the net.inet6.ip6.v6only sysctl or the IPV6_V6ONLY socket option. For UDP this was already done right. PR: 221385 MFC after: 1 week Modified: head/sys/netinet/tcp_usrreq.c Modified: head/sys/netinet/tcp_usrreq.c ============================================================================== --- head/sys/netinet/tcp_usrreq.c Fri Aug 18 07:00:00 2017 (r322647) +++ head/sys/netinet/tcp_usrreq.c Fri Aug 18 07:27:15 2017 (r322648) @@ -1918,6 +1918,8 @@ tcp_attach(struct socket *so) #ifdef INET6 if (inp->inp_vflag & INP_IPV6PROTO) { inp->inp_vflag |= INP_IPV6; + if ((inp->inp_flags & IN6P_IPV6_V6ONLY) == 0) + inp->inp_vflag |= INP_IPV4; inp->in6p_hops = -1; /* use kernel default */ } else From owner-svn-src-head@freebsd.org Fri Aug 18 07:34:35 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D7C7FDCFE72; Fri, 18 Aug 2017 07:34:35 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 A644D76FF8; Fri, 18 Aug 2017 07:34:35 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7I7YYBp096320; Fri, 18 Aug 2017 07:34:34 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7I7YYT7096319; Fri, 18 Aug 2017 07:34:34 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201708180734.v7I7YYT7096319@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Fri, 18 Aug 2017 07:34:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322649 - head/usr.bin/calendar/calendars X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: head/usr.bin/calendar/calendars X-SVN-Commit-Revision: 322649 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Aug 2017 07:34:36 -0000 Author: ngie Date: Fri Aug 18 07:34:34 2017 New Revision: 322649 URL: https://svnweb.freebsd.org/changeset/base/322649 Log: Clarify the fact that Andrey (ache) passed away in Moscow Take care friend <3. Modified: head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Fri Aug 18 07:27:15 2017 (r322648) +++ head/usr.bin/calendar/calendars/calendar.freebsd Fri Aug 18 07:34:34 2017 (r322649) @@ -300,7 +300,7 @@ 08/12 Joe Marcus Clarke born in Lakeland, Florida, United States, 1976 08/12 Max Brazhnikov born in Leningradskaya, Russian Federation, 1979 08/14 Stefan Esser born in Cologne, Nordrhein-Westfalen, Germany, 1961 -08/16 Andrey Chernov died, 2017 +08/16 Andrey Chernov died in Moscow, Russian Federation, 2017 08/17 Olivier Houchard born in Nancy, France, 1980 08/19 Chin-San Huang born in Yi-Lan, Taiwan, Republic of China, 1979 08/19 Pav Lucistnik born in Kutna Hora, Czech Republic, 1980 From owner-svn-src-head@freebsd.org Fri Aug 18 08:05:35 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 297EFDD142A; Fri, 18 Aug 2017 08:05:35 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 EA33D7C119; Fri, 18 Aug 2017 08:05:34 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7I85YQt008189; Fri, 18 Aug 2017 08:05:34 GMT (envelope-from rlibby@FreeBSD.org) Received: (from rlibby@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7I85YS8008188; Fri, 18 Aug 2017 08:05:34 GMT (envelope-from rlibby@FreeBSD.org) Message-Id: <201708180805.v7I85YS8008188@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rlibby set sender to rlibby@FreeBSD.org using -f From: Ryan Libby Date: Fri, 18 Aug 2017 08:05:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322650 - head/sys/dev/safe X-SVN-Group: head X-SVN-Commit-Author: rlibby X-SVN-Commit-Paths: head/sys/dev/safe X-SVN-Commit-Revision: 322650 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Aug 2017 08:05:35 -0000 Author: rlibby Date: Fri Aug 18 08:05:33 2017 New Revision: 322650 URL: https://svnweb.freebsd.org/changeset/base/322650 Log: safe: quiet -Wtautological-compare Code was testing that an unsigned type was >= 0. Reviewed by: markj Approved by: markj (mentor) Sponsored by: Dell EMC Isilon Modified: head/sys/dev/safe/safe.c Modified: head/sys/dev/safe/safe.c ============================================================================== --- head/sys/dev/safe/safe.c Fri Aug 18 07:34:34 2017 (r322649) +++ head/sys/dev/safe/safe.c Fri Aug 18 08:05:33 2017 (r322650) @@ -1593,9 +1593,7 @@ safe_mcopy(struct mbuf *srcm, struct mbuf *dstm, u_int * Advance src and dst to offset. */ j = offset; - while (j >= 0) { - if (srcm->m_len > j) - break; + while (j >= srcm->m_len) { j -= srcm->m_len; srcm = srcm->m_next; if (srcm == NULL) @@ -1605,9 +1603,7 @@ safe_mcopy(struct mbuf *srcm, struct mbuf *dstm, u_int slen = srcm->m_len - j; j = offset; - while (j >= 0) { - if (dstm->m_len > j) - break; + while (j >= dstm->m_len) { j -= dstm->m_len; dstm = dstm->m_next; if (dstm == NULL) From owner-svn-src-head@freebsd.org Fri Aug 18 10:38:51 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0D9E1DD7DCA; Fri, 18 Aug 2017 10:38:51 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CF4AB805C2; Fri, 18 Aug 2017 10:38:50 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7IAcopi069288; Fri, 18 Aug 2017 10:38:50 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7IAcn5j069283; Fri, 18 Aug 2017 10:38:49 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201708181038.v7IAcn5j069283@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Fri, 18 Aug 2017 10:38:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322651 - in head/sys: dev/syscons teken X-SVN-Group: head X-SVN-Commit-Author: bde X-SVN-Commit-Paths: in head/sys: dev/syscons teken X-SVN-Commit-Revision: 322651 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Aug 2017 10:38:51 -0000 Author: bde Date: Fri Aug 18 10:38:49 2017 New Revision: 322651 URL: https://svnweb.freebsd.org/changeset/base/322651 Log: Fix missing syscons escape sequence for setting the border color. Modified: head/sys/dev/syscons/scterm-teken.c head/sys/teken/sequences head/sys/teken/teken.h head/sys/teken/teken_subr_compat.h Modified: head/sys/dev/syscons/scterm-teken.c ============================================================================== --- head/sys/dev/syscons/scterm-teken.c Fri Aug 18 08:05:33 2017 (r322650) +++ head/sys/dev/syscons/scterm-teken.c Fri Aug 18 10:38:49 2017 (r322651) @@ -676,6 +676,11 @@ scteken_param(void *arg, int cmd, unsigned int value) scr_stat *scp = arg; switch (cmd) { + case TP_SETBORDER: + scp->border = value & 0xff; + if (scp == scp->sc->cur_scp) + sc_set_border(scp, scp->border); + break; case TP_SHOWCURSOR: if (value) { sc_change_cursor_shape(scp, Modified: head/sys/teken/sequences ============================================================================== --- head/sys/teken/sequences Fri Aug 18 08:05:33 2017 (r322650) +++ head/sys/teken/sequences Fri Aug 18 10:38:49 2017 (r322651) @@ -101,6 +101,7 @@ TBC Tab Clear ^[ [ g r VPA Vertical Position Absolute ^[ [ d n # Cons25 compatibility sequences +C25ADX Cons25 set adapter border ^[ [ = A r C25ADBG Cons25 set adapter background ^[ [ = G r C25ADFG Cons25 set adapter foreground ^[ [ = F r C25BLPD Cons25 set bell pitch duration ^[ [ = B r r Modified: head/sys/teken/teken.h ============================================================================== --- head/sys/teken/teken.h Fri Aug 18 08:05:33 2017 (r322650) +++ head/sys/teken/teken.h Fri Aug 18 10:38:49 2017 (r322651) @@ -101,6 +101,7 @@ typedef void tf_param_t(void *, int, unsigned int); #define TP_SETBELLPD_PITCH(pd) ((pd) >> 16) #define TP_SETBELLPD_DURATION(pd) ((pd) & 0xffff) #define TP_MOUSE 6 +#define TP_SETBORDER 7 typedef void tf_respond_t(void *, const void *, size_t); typedef struct { Modified: head/sys/teken/teken_subr_compat.h ============================================================================== --- head/sys/teken/teken_subr_compat.h Fri Aug 18 08:05:33 2017 (r322650) +++ head/sys/teken/teken_subr_compat.h Fri Aug 18 10:38:49 2017 (r322651) @@ -27,6 +27,13 @@ */ static void +teken_subr_cons25_set_adapter_border(teken_t *t, unsigned int c) +{ + + teken_funcs_param(t, TP_SETBORDER, c); +} + +static void teken_subr_cons25_set_cursor_type(teken_t *t, unsigned int type) { From owner-svn-src-head@freebsd.org Fri Aug 18 11:33:11 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BB85ADDA64A; Fri, 18 Aug 2017 11:33:11 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6FA7F821B2; Fri, 18 Aug 2017 11:33:11 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7IBXAOi093411; Fri, 18 Aug 2017 11:33:10 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7IBXA9h093410; Fri, 18 Aug 2017 11:33:10 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201708181133.v7IBXA9h093410@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Fri, 18 Aug 2017 11:33:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322654 - head/contrib/zstd/examples X-SVN-Group: head X-SVN-Commit-Author: bapt X-SVN-Commit-Paths: head/contrib/zstd/examples X-SVN-Commit-Revision: 322654 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Aug 2017 11:33:11 -0000 Author: bapt Date: Fri Aug 18 11:33:10 2017 New Revision: 322654 URL: https://svnweb.freebsd.org/changeset/base/322654 Log: Remove example from zstd sources, their license does not allow redistribution Reported by: joerg@NetBSD Deleted: head/contrib/zstd/examples/ Modified: Directory Properties: head/contrib/zstd/ (props changed) From owner-svn-src-head@freebsd.org Fri Aug 18 12:45:01 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3167BDDEFF0; Fri, 18 Aug 2017 12:45:01 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 00F711986; Fri, 18 Aug 2017 12:45:00 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7ICj0m4022495; Fri, 18 Aug 2017 12:45:00 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7ICj0FI022494; Fri, 18 Aug 2017 12:45:00 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201708181245.v7ICj0FI022494@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Fri, 18 Aug 2017 12:45:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322655 - head/sys/dev/syscons X-SVN-Group: head X-SVN-Commit-Author: bde X-SVN-Commit-Paths: head/sys/dev/syscons X-SVN-Commit-Revision: 322655 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Aug 2017 12:45:01 -0000 Author: bde Date: Fri Aug 18 12:45:00 2017 New Revision: 322655 URL: https://svnweb.freebsd.org/changeset/base/322655 Log: Fix vt100 escape sequence for showing and hiding the cursor in syscons. It should toggle between 2 states, but it used a cut-down version of support for a related 3-state syscons escape sequence and inherited bugs from that. The usual misbehaviour was that hiding and showing the cursor reset it to a global default. Support for the 3-state sequence remains broken by aliasing to the 2-state sequence. This works better but incompatibly for the 2 cases that it supports. Modified: head/sys/dev/syscons/scterm-teken.c Modified: head/sys/dev/syscons/scterm-teken.c ============================================================================== --- head/sys/dev/syscons/scterm-teken.c Fri Aug 18 11:33:10 2017 (r322654) +++ head/sys/dev/syscons/scterm-teken.c Fri Aug 18 12:45:00 2017 (r322655) @@ -674,6 +674,7 @@ static void scteken_param(void *arg, int cmd, unsigned int value) { scr_stat *scp = arg; + int flags; switch (cmd) { case TP_SETBORDER: @@ -682,13 +683,11 @@ scteken_param(void *arg, int cmd, unsigned int value) sc_set_border(scp, scp->border); break; case TP_SHOWCURSOR: - if (value) { - sc_change_cursor_shape(scp, - CONS_RESET_CURSOR|CONS_LOCAL_CURSOR, -1, -1); - } else { - sc_change_cursor_shape(scp, - CONS_HIDDEN_CURSOR|CONS_LOCAL_CURSOR, -1, -1); - } + if (value != 0) + flags = scp->curr_curs_attr.flags & ~CONS_HIDDEN_CURSOR; + else + flags = scp->curr_curs_attr.flags | CONS_HIDDEN_CURSOR; + sc_change_cursor_shape(scp, flags | CONS_LOCAL_CURSOR, -1, -1); break; case TP_SWITCHVT: sc_switch_scr(scp->sc, value); From owner-svn-src-head@freebsd.org Fri Aug 18 14:04:15 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DADBADE37CE; Fri, 18 Aug 2017 14:04:15 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B79906466A; Fri, 18 Aug 2017 14:04:15 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7IE4E6A055698; Fri, 18 Aug 2017 14:04:14 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7IE4Eal055696; Fri, 18 Aug 2017 14:04:14 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201708181404.v7IE4Eal055696@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Fri, 18 Aug 2017 14:04:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322656 - head/sys/teken X-SVN-Group: head X-SVN-Commit-Author: bde X-SVN-Commit-Paths: head/sys/teken X-SVN-Commit-Revision: 322656 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Aug 2017 14:04:16 -0000 Author: bde Date: Fri Aug 18 14:04:14 2017 New Revision: 322656 URL: https://svnweb.freebsd.org/changeset/base/322656 Log: Improve names for cons25 sequences. In a recent commit, I forgot to expand an X to an abbreviation of "BORDER". Fix this and some nearby bad names. The descriptions were copied from comments in scterm-sc.c, but some of these are bad. The border [color] was inconsistently described as a property of the "display", but I had changed this to "adapter" to match the descriptions for other color settings. All colors supported by the cons25 sequences are actually properties of the current vty and that should not be described. But the other colors are defaults. Change "adapter" to "default" for them and remove "adapter" for the border. Reduce the verbosity of the abbreviation from AD to D. Modified: head/sys/teken/sequences head/sys/teken/teken_subr_compat.h Modified: head/sys/teken/sequences ============================================================================== --- head/sys/teken/sequences Fri Aug 18 12:45:00 2017 (r322655) +++ head/sys/teken/sequences Fri Aug 18 14:04:14 2017 (r322656) @@ -101,11 +101,11 @@ TBC Tab Clear ^[ [ g r VPA Vertical Position Absolute ^[ [ d n # Cons25 compatibility sequences -C25ADX Cons25 set adapter border ^[ [ = A r -C25ADBG Cons25 set adapter background ^[ [ = G r -C25ADFG Cons25 set adapter foreground ^[ [ = F r C25BLPD Cons25 set bell pitch duration ^[ [ = B r r +C25BORD Cons25 set border ^[ [ = A r C25CURS Cons25 set cursor type ^[ [ = S r +C25DBG Cons25 set default background ^[ [ = G r +C25DFG Cons25 set default foreground ^[ [ = F r C25MODE Cons25 set terminal mode ^[ [ = T r C25SGR Cons25 set graphic rendition ^[ [ x r r C25VTSW Cons25 switch virtual terminal ^[ [ z r Modified: head/sys/teken/teken_subr_compat.h ============================================================================== --- head/sys/teken/teken_subr_compat.h Fri Aug 18 12:45:00 2017 (r322655) +++ head/sys/teken/teken_subr_compat.h Fri Aug 18 14:04:14 2017 (r322656) @@ -27,7 +27,7 @@ */ static void -teken_subr_cons25_set_adapter_border(teken_t *t, unsigned int c) +teken_subr_cons25_set_border(teken_t *t, unsigned int c) { teken_funcs_param(t, TP_SETBORDER, c); @@ -44,7 +44,7 @@ static const teken_color_t cons25_colors[8] = { TC_BLA TC_GREEN, TC_CYAN, TC_RED, TC_MAGENTA, TC_BROWN, TC_WHITE }; static void -teken_subr_cons25_set_adapter_background(teken_t *t, unsigned int c) +teken_subr_cons25_set_default_background(teken_t *t, unsigned int c) { t->t_defattr.ta_bgcolor = cons25_colors[c % 8] | (c & 8); @@ -52,7 +52,7 @@ teken_subr_cons25_set_adapter_background(teken_t *t, u } static void -teken_subr_cons25_set_adapter_foreground(teken_t *t, unsigned int c) +teken_subr_cons25_set_default_foreground(teken_t *t, unsigned int c) { t->t_defattr.ta_fgcolor = cons25_colors[c % 8] | (c & 8); From owner-svn-src-head@freebsd.org Fri Aug 18 14:17:14 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0D932DE4482; Fri, 18 Aug 2017 14:17:14 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CBEAA64ED7; Fri, 18 Aug 2017 14:17:13 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7IEHCvJ060022; Fri, 18 Aug 2017 14:17:12 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7IEHCOH060021; Fri, 18 Aug 2017 14:17:12 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201708181417.v7IEHCOH060021@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Fri, 18 Aug 2017 14:17:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322657 - head/contrib/mdocml X-SVN-Group: head X-SVN-Commit-Author: sevan X-SVN-Commit-Paths: head/contrib/mdocml X-SVN-Commit-Revision: 322657 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Aug 2017 14:17:14 -0000 Author: sevan (doc committer) Date: Fri Aug 18 14:17:12 2017 New Revision: 322657 URL: https://svnweb.freebsd.org/changeset/base/322657 Log: typo PR: 211160 Submitted by: Dan Robertson Reviewed by: oshogbo MFC after: 7 days Differential Revision: https://reviews.freebsd.org/D12005 Modified: head/contrib/mdocml/lib.in Modified: head/contrib/mdocml/lib.in ============================================================================== --- head/contrib/mdocml/lib.in Fri Aug 18 14:04:14 2017 (r322656) +++ head/contrib/mdocml/lib.in Fri Aug 18 14:17:12 2017 (r322657) @@ -34,7 +34,7 @@ LINE("libc", "Standard C\\~Library (libc, \\-lc)") LINE("libc_r", "Reentrant C\\~Library (libc_r, \\-lc_r)") LINE("libcalendar", "Calendar Arithmetic Library (libcalendar, \\-lcalendar)") LINE("libcam", "Common Access Method User Library (libcam, \\-lcam)") -LINE("libcasper", "Casper Library (libcasper, \\-lcapser)") +LINE("libcasper", "Casper Library (libcasper, \\-lcasper)") LINE("libcdk", "Curses Development Kit Library (libcdk, \\-lcdk)") LINE("libcipher", "FreeSec Crypt Library (libcipher, \\-lcipher)") LINE("libcompat", "Compatibility Library (libcompat, \\-lcompat)") From owner-svn-src-head@freebsd.org Fri Aug 18 14:30:13 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C9E57DE502E; Fri, 18 Aug 2017 14:30:13 +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 mx1.freebsd.org (Postfix) with ESMTPS id 959B16588E; Fri, 18 Aug 2017 14:30:13 +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 v7IEUCA7064392; Fri, 18 Aug 2017 14:30:12 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7IEUCT1064391; Fri, 18 Aug 2017 14:30:12 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201708181430.v7IEUCT1064391@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Fri, 18 Aug 2017 14:30:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322659 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 322659 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Aug 2017 14:30:13 -0000 Author: glebius Date: Fri Aug 18 14:30:12 2017 New Revision: 322659 URL: https://svnweb.freebsd.org/changeset/base/322659 Log: Fix cut and paste typo that prevented T5 firmware to be compiled in. Reviewed by: np Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Fri Aug 18 14:25:07 2017 (r322658) +++ head/sys/conf/files Fri Aug 18 14:30:12 2017 (r322659) @@ -1399,7 +1399,7 @@ t4fw.fw optional cxgbe \ no-obj no-implicit-rule \ clean "t4fw.fw" t5fw_cfg.c optional cxgbe \ - compile-with "${AWK} -f $S/tools/fw_stub.awk t5fw_cfg.fw:t5fw_cfg t5fw_cfg_uwire.fw:t5fw_cfg_uwire t4fw.fw:t4fw -mt5fw_cfg -c${.TARGET}" \ + compile-with "${AWK} -f $S/tools/fw_stub.awk t5fw_cfg.fw:t5fw_cfg t5fw_cfg_uwire.fw:t5fw_cfg_uwire t5fw.fw:t5fw -mt5fw_cfg -c${.TARGET}" \ no-implicit-rule before-depend local \ clean "t5fw_cfg.c" t5fw_cfg.fwo optional cxgbe \ From owner-svn-src-head@freebsd.org Fri Aug 18 14:47:08 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5DB7ADE5F67; Fri, 18 Aug 2017 14:47:08 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 287B26647E; Fri, 18 Aug 2017 14:47:08 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7IEl7uM072514; Fri, 18 Aug 2017 14:47:07 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7IEl7ab072513; Fri, 18 Aug 2017 14:47:07 GMT (envelope-from br@FreeBSD.org) Message-Id: <201708181447.v7IEl7ab072513@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Fri, 18 Aug 2017 14:47:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322660 - head/sys/amd64/sgx X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: head/sys/amd64/sgx X-SVN-Commit-Revision: 322660 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Aug 2017 14:47:08 -0000 Author: br Date: Fri Aug 18 14:47:06 2017 New Revision: 322660 URL: https://svnweb.freebsd.org/changeset/base/322660 Log: Fix module unload when SGX support is not present in CPU. Sponsored by: DARPA, AFRL Modified: head/sys/amd64/sgx/sgx.c Modified: head/sys/amd64/sgx/sgx.c ============================================================================== --- head/sys/amd64/sgx/sgx.c Fri Aug 18 14:30:12 2017 (r322659) +++ head/sys/amd64/sgx/sgx.c Fri Aug 18 14:47:06 2017 (r322660) @@ -1132,9 +1132,6 @@ sgx_load(void) if ((cpu_stdext_feature & CPUID_STDEXT_SGX) == 0) return (ENXIO); - mtx_init(&sc->mtx_encls, "SGX ENCLS", NULL, MTX_DEF); - mtx_init(&sc->mtx, "SGX driver", NULL, MTX_DEF); - error = sgx_get_epc_area(sc); if (error) { printf("%s: Failed to get Processor Reserved Memory area.\n", @@ -1142,6 +1139,9 @@ sgx_load(void) return (ENXIO); } + mtx_init(&sc->mtx_encls, "SGX ENCLS", NULL, MTX_DEF); + mtx_init(&sc->mtx, "SGX driver", NULL, MTX_DEF); + TAILQ_INIT(&sc->enclaves); sc->sgx_cdev = make_dev(&sgx_cdevsw, 0, UID_ROOT, GID_WHEEL, @@ -1161,6 +1161,9 @@ sgx_unload(void) struct sgx_softc *sc; sc = &sgx_sc; + + if ((sc->state & SGX_STATE_RUNNING) == 0) + return (0); mtx_lock(&sc->mtx); if (!TAILQ_EMPTY(&sc->enclaves)) { From owner-svn-src-head@freebsd.org Fri Aug 18 15:40:42 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9739BDE8B69; Fri, 18 Aug 2017 15:40:42 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6E2B668B9A; Fri, 18 Aug 2017 15:40:42 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7IFef4t093606; Fri, 18 Aug 2017 15:40:41 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7IFefLG093601; Fri, 18 Aug 2017 15:40:41 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201708181540.v7IFefLG093601@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Fri, 18 Aug 2017 15:40:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322662 - in head/sys: dev/syscons dev/vt teken X-SVN-Group: head X-SVN-Commit-Author: bde X-SVN-Commit-Paths: in head/sys: dev/syscons dev/vt teken X-SVN-Commit-Revision: 322662 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Aug 2017 15:40:42 -0000 Author: bde Date: Fri Aug 18 15:40:40 2017 New Revision: 322662 URL: https://svnweb.freebsd.org/changeset/base/322662 Log: Fix syscons escape sequence for setting the local cursor type. This sequence was aliased to a vt sequence, causing and fixing various bugs. For syscons, this restores support for arg 2 which sets blinking block too forcefully, and restores bugs for arg 0 and 1. Arg 2 is used for vs in the cons25 entry in termcap, but I've never noticed an application that uses this. The bugs involve replacing local settings by global ones and need better handling of defaults to fix. For vt, this requires moving the aliasing code from teken to vt where it belongs. This sequences is very important for cons25 compatibility in vt since it is used by the cons25 termcap entries for ve, vi and vs. vt can't properly support vs for either cons25 or xterm since it doesn't support blinking. For xterm, the termcap entry for vs asks for something different using 12;25h instead of 25h. Rename C25CURS for this to C25LCT and change its description to be closer to echoing the old comment about it. CURS is too generic. Fix missing syscons escape sequence for setting the global cursor shape (and type). Only support this in syscons since vt can't emulate anything in it. Modified: head/sys/dev/syscons/scterm-teken.c head/sys/dev/vt/vt_core.c head/sys/teken/sequences head/sys/teken/teken.h head/sys/teken/teken_subr_compat.h Modified: head/sys/dev/syscons/scterm-teken.c ============================================================================== --- head/sys/dev/syscons/scterm-teken.c Fri Aug 18 15:38:08 2017 (r322661) +++ head/sys/dev/syscons/scterm-teken.c Fri Aug 18 15:40:40 2017 (r322662) @@ -673,14 +673,60 @@ scteken_copy(void *arg, const teken_rect_t *r, const t static void scteken_param(void *arg, int cmd, unsigned int value) { + static int cattrs[] = { + 0, /* block */ + CONS_BLINK_CURSOR, /* blinking block */ + CONS_CHAR_CURSOR, /* underline */ + CONS_CHAR_CURSOR | CONS_BLINK_CURSOR, /* blinking underline */ + CONS_RESET_CURSOR, /* reset to default */ + CONS_HIDDEN_CURSOR, /* hide cursor */ + }; + static int tcattrs[] = { + CONS_RESET_CURSOR | CONS_LOCAL_CURSOR, /* normal */ + CONS_HIDDEN_CURSOR | CONS_LOCAL_CURSOR, /* invisible */ + CONS_BLINK_CURSOR | CONS_LOCAL_CURSOR, /* very visible */ + }; scr_stat *scp = arg; - int flags; + int flags, n, v0, v1, v2; switch (cmd) { case TP_SETBORDER: scp->border = value & 0xff; if (scp == scp->sc->cur_scp) sc_set_border(scp, scp->border); + break; + case TP_SETGLOBALCURSOR: + n = value & 0xff; + v0 = (value >> 8) & 0xff; + v1 = (value >> 16) & 0xff; + v2 = (value >> 24) & 0xff; + switch (n) { + case 1: /* flags only */ + if (v0 < sizeof(cattrs) / sizeof(cattrs[0])) + v0 = cattrs[v0]; + else /* backward compatibility */ + v0 = cattrs[v0 & 0x3]; + sc_change_cursor_shape(scp, v0, -1, -1); + break; + case 2: + v2 = 0; + v0 &= 0x1f; /* backward compatibility */ + v1 &= 0x1f; + /* FALL THROUGH */ + case 3: /* base and height */ + if (v2 == 0) /* count from top */ + sc_change_cursor_shape(scp, -1, + scp->font_size - v1 - 1, + v1 - v0 + 1); + else if (v2 == 1) /* count from bottom */ + sc_change_cursor_shape(scp, -1, + v0, v1 - v0 + 1); + break; + } + break; + case TP_SETLOCALCURSOR: + if (value < sizeof(tcattrs) / sizeof(tcattrs[0])) + sc_change_cursor_shape(scp, tcattrs[value], -1, -1); break; case TP_SHOWCURSOR: if (value != 0) Modified: head/sys/dev/vt/vt_core.c ============================================================================== --- head/sys/dev/vt/vt_core.c Fri Aug 18 15:38:08 2017 (r322661) +++ head/sys/dev/vt/vt_core.c Fri Aug 18 15:40:40 2017 (r322662) @@ -1052,6 +1052,15 @@ vtterm_param(struct terminal *tm, int cmd, unsigned in struct vt_window *vw = tm->tm_softc; switch (cmd) { + case TP_SETLOCALCURSOR: + /* + * 0 means normal (usually block), 1 means hidden, and + * 2 means blinking (always block) for compatibility with + * syscons. We don't support any changes except hiding, + * so must map 2 to 0. + */ + arg = (arg == 1) ? 0 : 1; + /* FALLTHROUGH */ case TP_SHOWCURSOR: vtbuf_cursor_visibility(&vw->vw_buf, arg); vt_resume_flush_timer(vw->vw_device, 0); Modified: head/sys/teken/sequences ============================================================================== --- head/sys/teken/sequences Fri Aug 18 15:38:08 2017 (r322661) +++ head/sys/teken/sequences Fri Aug 18 15:40:40 2017 (r322662) @@ -103,9 +103,10 @@ VPA Vertical Position Absolute ^[ [ d n # Cons25 compatibility sequences C25BLPD Cons25 set bell pitch duration ^[ [ = B r r C25BORD Cons25 set border ^[ [ = A r -C25CURS Cons25 set cursor type ^[ [ = S r C25DBG Cons25 set default background ^[ [ = G r C25DFG Cons25 set default foreground ^[ [ = F r +C25GCS Cons25 set global cursor shape ^[ [ = C v +C25LCT Cons25 set local cursor type ^[ [ = S r C25MODE Cons25 set terminal mode ^[ [ = T r C25SGR Cons25 set graphic rendition ^[ [ x r r C25VTSW Cons25 switch virtual terminal ^[ [ z r Modified: head/sys/teken/teken.h ============================================================================== --- head/sys/teken/teken.h Fri Aug 18 15:38:08 2017 (r322661) +++ head/sys/teken/teken.h Fri Aug 18 15:40:40 2017 (r322662) @@ -102,6 +102,8 @@ typedef void tf_param_t(void *, int, unsigned int); #define TP_SETBELLPD_DURATION(pd) ((pd) & 0xffff) #define TP_MOUSE 6 #define TP_SETBORDER 7 +#define TP_SETLOCALCURSOR 8 +#define TP_SETGLOBALCURSOR 9 typedef void tf_respond_t(void *, const void *, size_t); typedef struct { Modified: head/sys/teken/teken_subr_compat.h ============================================================================== --- head/sys/teken/teken_subr_compat.h Fri Aug 18 15:38:08 2017 (r322661) +++ head/sys/teken/teken_subr_compat.h Fri Aug 18 15:40:40 2017 (r322662) @@ -34,10 +34,32 @@ teken_subr_cons25_set_border(teken_t *t, unsigned int } static void -teken_subr_cons25_set_cursor_type(teken_t *t, unsigned int type) +teken_subr_cons25_set_global_cursor_shape(teken_t *t, unsigned int ncmds, + unsigned int cmds[]) { + unsigned int code, i; - teken_funcs_param(t, TP_SHOWCURSOR, type != 1); + /* + * Pack the args to work around API deficiencies. This requires + * knowing too much about the low level to be fully compatible. + * Returning when ncmds > 3 is necessary and happens to be + * compatible. Discarding high bits is necessary and happens to + * be incompatible only for invalid args when ncmds == 3. + */ + if (ncmds > 3) + return; + code = 0; + for (i = ncmds; i > 0; i--) + code = (code << 8) | (cmds[i - 1] & 0xff); + code = (code << 8) | ncmds; + teken_funcs_param(t, TP_SETGLOBALCURSOR, code); +} + +static void +teken_subr_cons25_set_local_cursor_type(teken_t *t, unsigned int type) +{ + + teken_funcs_param(t, TP_SETLOCALCURSOR, type); } static const teken_color_t cons25_colors[8] = { TC_BLACK, TC_BLUE, From owner-svn-src-head@freebsd.org Fri Aug 18 16:14:42 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E7F85DEA967; Fri, 18 Aug 2017 16:14:42 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B527C6AE13; Fri, 18 Aug 2017 16:14:42 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7IGEfRo011161; Fri, 18 Aug 2017 16:14:41 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7IGEfCv011160; Fri, 18 Aug 2017 16:14:41 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201708181614.v7IGEfCv011160@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Fri, 18 Aug 2017 16:14:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322663 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: sevan X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 322663 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Aug 2017 16:14:43 -0000 Author: sevan (doc committer) Date: Fri Aug 18 16:14:41 2017 New Revision: 322663 URL: https://svnweb.freebsd.org/changeset/base/322663 Log: Correct multicast address used in pfsync(4) As stated in src/sys/netinet/in.h L395, address used is 224.0.0.240. PR: 216885 Submitted by: Matthias Ordner Reviewed by: kp Approved by: bcr (mentor) MFC after: 5 days Differential Revision: https://reviews.freebsd.org/D12011 Modified: head/share/man/man4/pfsync.4 Modified: head/share/man/man4/pfsync.4 ============================================================================== --- head/share/man/man4/pfsync.4 Fri Aug 18 15:40:40 2017 (r322662) +++ head/share/man/man4/pfsync.4 Fri Aug 18 16:14:41 2017 (r322663) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 20, 2011 +.Dd August 18, 2017 .Dt PFSYNC 4 .Os .Sh NAME @@ -90,7 +90,7 @@ interface: .Ed .Pp By default, state change messages are sent out on the synchronisation -interface using IP multicast packets to the 244.0.0.240 group address. +interface using IP multicast packets to the 224.0.0.240 group address. An alternative destination address for .Nm packets can be specified using the From owner-svn-src-head@freebsd.org Fri Aug 18 16:38:34 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E3716DC6129; Fri, 18 Aug 2017 16:38:34 +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 mx1.freebsd.org (Postfix) with ESMTPS id B9CCD6BDC4; Fri, 18 Aug 2017 16:38:34 +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 v7IGcXYD019835; Fri, 18 Aug 2017 16:38:33 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7IGcXvn019834; Fri, 18 Aug 2017 16:38:33 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201708181638.v7IGcXvn019834@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 18 Aug 2017 16:38:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322664 - head/sys/cam X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/cam X-SVN-Commit-Revision: 322664 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Aug 2017 16:38:35 -0000 Author: emaste Date: Fri Aug 18 16:38:33 2017 New Revision: 322664 URL: https://svnweb.freebsd.org/changeset/base/322664 Log: cam iosched: fix typos in comments PR: 220947 Submitted by: Fabian Keil Obtained from: ElectroBSD Modified: head/sys/cam/cam_iosched.c Modified: head/sys/cam/cam_iosched.c ============================================================================== --- head/sys/cam/cam_iosched.c Fri Aug 18 16:14:41 2017 (r322663) +++ head/sys/cam/cam_iosched.c Fri Aug 18 16:38:33 2017 (r322664) @@ -130,13 +130,13 @@ typedef int l_tick_t(struct iop_stats *); /* * Called to see if the limiter thinks this IOP can be allowed to - * proceed. If so, the limiter assumes that the while IOP proceeded + * proceed. If so, the limiter assumes that the IOP proceeded * and makes any accounting of it that's needed. */ typedef int l_iop_t(struct iop_stats *, struct bio *); /* - * Called when an I/O completes so the limiter can updates its + * Called when an I/O completes so the limiter can update its * accounting. Pending I/Os may complete in any order (even when * sent to the hardware at the same time), so the limiter may not * make any assumptions other than this I/O has completed. If it @@ -493,8 +493,8 @@ cam_iosched_bw_caniop(struct iop_stats *ios, struct bi { /* * So if we have any more bw quota left, allow it, - * otherwise wait. Not, we'll go negative and that's - * OK. We'll just get a lettle less next quota. + * otherwise wait. Note, we'll go negative and that's + * OK. We'll just get a little less next quota. * * Note on going negative: that allows us to process * requests in order better, since we won't allow @@ -639,7 +639,7 @@ cam_iosched_cl_maybe_steer(struct control_loop *clp) * ~10. At .25 it only takes ~8. However some preliminary data * from the SSD drives suggests a reasponse time in 10's of * seconds before latency drops regardless of the new write - * rate. Careful observation will be reqiured to tune this + * rate. Careful observation will be required to tune this * effectively. * * Also, when there's no read traffic, we jack up the write @@ -1214,7 +1214,7 @@ cam_iosched_put_back_trim(struct cam_iosched_softc *is * gets the next trim from the trim queue. * * Assumes we're called with the periph lock held. It removes this - * trim from the queue and the device must explicitly reinstert it + * trim from the queue and the device must explicitly reinsert it * should the need arise. */ struct bio * @@ -1235,9 +1235,9 @@ cam_iosched_next_trim(struct cam_iosched_softc *isc) } /* - * gets the an available trim from the trim queue, if there's no trim + * gets an available trim from the trim queue, if there's no trim * already pending. It removes this trim from the queue and the device - * must explicitly reinstert it should the need arise. + * must explicitly reinsert it should the need arise. * * Assumes we're called with the periph lock held. */ @@ -1476,7 +1476,7 @@ cam_iosched_clr_work_flags(struct cam_iosched_softc *i #ifdef CAM_IOSCHED_DYNAMIC /* * After the method presented in Jack Crenshaw's 1998 article "Integer - * Suqare Roots," reprinted at + * Square Roots," reprinted at * http://www.embedded.com/electronics-blogs/programmer-s-toolbox/4219659/Integer-Square-Roots * and well worth the read. Briefly, we find the power of 4 that's the * largest smaller than val. We then check each smaller power of 4 to @@ -1485,7 +1485,7 @@ cam_iosched_clr_work_flags(struct cam_iosched_softc *i * accumulating the right answer. It could also have been accumulated * using a separate root counter, but this code is smaller and faster * than that method. This method is also integer size invariant. - * It returns floor(sqrt((float)val)), or the larget integer less than + * It returns floor(sqrt((float)val)), or the largest integer less than * or equal to the square root. */ static uint64_t @@ -1553,7 +1553,7 @@ cam_iosched_update(struct iop_stats *iop, sbintime_t s iop->latencies[i]++; /* Put all > 1024ms values into the last bucket. */ /* - * Classic expoentially decaying average with a tiny alpha + * Classic exponentially decaying average with a tiny alpha * (2 ^ -alpha_bits). For more info see the NIST statistical * handbook. * From owner-svn-src-head@freebsd.org Fri Aug 18 16:43:00 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 531F3DC678F; Fri, 18 Aug 2017 16:43:00 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 226FB6C33D; Fri, 18 Aug 2017 16:43:00 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7IGgwWd023583; Fri, 18 Aug 2017 16:42:58 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7IGgw2g023582; Fri, 18 Aug 2017 16:42:58 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201708181642.v7IGgw2g023582@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Fri, 18 Aug 2017 16:42:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322665 - head/lib/libutil X-SVN-Group: head X-SVN-Commit-Author: sevan X-SVN-Commit-Paths: head/lib/libutil X-SVN-Commit-Revision: 322665 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Aug 2017 16:43:00 -0000 Author: sevan (doc committer) Date: Fri Aug 18 16:42:58 2017 New Revision: 322665 URL: https://svnweb.freebsd.org/changeset/base/322665 Log: Add caveat to kinfo_getvmmap(3) explaining high CPU utilisation. Based on kib's reply on https://lists.freebsd.org/pipermail/freebsd-hackers/2016-July/049710.html PR: 210904 Submitted by: Yuri Victorovich Reviewed by: jilles Approved by: bcr (mentor) MFC after: 5 days Differential Revision: https://reviews.freebsd.org/D12004 Modified: head/lib/libutil/kinfo_getvmmap.3 Modified: head/lib/libutil/kinfo_getvmmap.3 ============================================================================== --- head/lib/libutil/kinfo_getvmmap.3 Fri Aug 18 16:38:33 2017 (r322664) +++ head/lib/libutil/kinfo_getvmmap.3 Fri Aug 18 16:42:58 2017 (r322665) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 27, 2015 +.Dd August 18, 2017 .Dt KINFO_GETVMMAP 3 .Os .Sh NAME @@ -58,6 +58,13 @@ with the mib. While the kernel returns a packed structure, this function expands the data into a fixed record format. +.Sh CAVEAT +.Fn kinfo_getvmmap +calls can cause significant CPU consumption because calculating the residency +counts requires iterating over all memory pages of the process. +Setting the sysctl variable +.Va kern.proc_vmmap_skip_resident_count +to 1 prevents this calculation. .Sh RETURN VALUES On success the .Fn kinfo_getvmmap From owner-svn-src-head@freebsd.org Fri Aug 18 17:11:16 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7CAA6DC8086; Fri, 18 Aug 2017 17:11:16 +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 mx1.freebsd.org (Postfix) with ESMTPS id 4C19F6D256; Fri, 18 Aug 2017 17:11:16 +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 v7IHBFJ1036109; Fri, 18 Aug 2017 17:11:15 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7IHBFtO036108; Fri, 18 Aug 2017 17:11:15 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708181711.v7IHBFtO036108@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 18 Aug 2017 17:11:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322667 - head/sys/i386/i386 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/i386/i386 X-SVN-Commit-Revision: 322667 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Aug 2017 17:11:16 -0000 Author: kib Date: Fri Aug 18 17:11:15 2017 New Revision: 322667 URL: https://svnweb.freebsd.org/changeset/base/322667 Log: When checking that #UD comes from kernel mode, check that the exception did not happen in vm86 mode. A vm86 userland process could have a %cs that matches GSEL_KPL, while dtrace cannot hook it. Submitted by: Maxime Villard MFC after: 3 days Modified: head/sys/i386/i386/exception.s Modified: head/sys/i386/i386/exception.s ============================================================================== --- head/sys/i386/i386/exception.s Fri Aug 18 16:43:59 2017 (r322666) +++ head/sys/i386/i386/exception.s Fri Aug 18 17:11:15 2017 (r322667) @@ -187,11 +187,14 @@ IDTVEC(ill) cmpl $0,dtrace_invop_jump_addr je norm_ill - /* Check if this is a user fault. */ - cmpl $GSEL_KPL, 4(%esp) /* Check the code segment. */ - - /* If so, just handle it as a normal trap. */ + /* + * Check if this is a user fault. If so, just handle it as a normal + * trap. + */ + cmpl $GSEL_KPL, 4(%esp) /* Check the code segment */ jne norm_ill + testl $PSL_VM, 8(%esp) /* and vm86 mode. */ + jnz norm_ill /* * This is a kernel instruction fault that might have been caused From owner-svn-src-head@freebsd.org Fri Aug 18 17:32:15 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E7E23DC9728; Fri, 18 Aug 2017 17:32:15 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 B609C6E19E; Fri, 18 Aug 2017 17:32:15 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7IHWETn044483; Fri, 18 Aug 2017 17:32:14 GMT (envelope-from maxim@FreeBSD.org) Received: (from maxim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7IHWEpT044482; Fri, 18 Aug 2017 17:32:14 GMT (envelope-from maxim@FreeBSD.org) Message-Id: <201708181732.v7IHWEpT044482@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: maxim set sender to maxim@FreeBSD.org using -f From: Maxim Konovalov Date: Fri, 18 Aug 2017 17:32:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322668 - head/share/misc X-SVN-Group: head X-SVN-Commit-Author: maxim X-SVN-Commit-Paths: head/share/misc X-SVN-Commit-Revision: 322668 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Aug 2017 17:32:16 -0000 Author: maxim Date: Fri Aug 18 17:32:14 2017 New Revision: 322668 URL: https://svnweb.freebsd.org/changeset/base/322668 Log: FreeBSD 11.1 release added. Modified: head/share/misc/bsd-family-tree Modified: head/share/misc/bsd-family-tree ============================================================================== --- head/share/misc/bsd-family-tree Fri Aug 18 17:11:15 2017 (r322667) +++ head/share/misc/bsd-family-tree Fri Aug 18 17:32:14 2017 (r322668) @@ -350,9 +350,11 @@ FreeBSD 5.2 | | | | | | | | *--FreeBSD macOS | OpenBSD 6.0 | | 11.0 10.12 | | | - | | NetBSD 7.1 | | - | | | | DragonFly 4.8.0 - | | | OpenBSD 6.1 | + | | | NetBSD 7.1 | | + | | | | | DragonFly 4.8.0 + | | | | OpenBSD 6.1 | + | FreeBSD | | | | + | 11.1 | | | | | | | | | FreeBSD 12 -current | NetBSD -current OpenBSD -current DragonFly -current | | | | | @@ -712,6 +714,7 @@ FreeBSD 11.0 2016-10-10 [FBD] NetBSD 7.1 2017-03-11 [NBD] DragonFly 4.8.0 2017-03-27 [DFB] OpenBSD 6.1 2017-04-11 [OBD] +FreeBSD 11.1 2017-07-26 [FBD] Bibliography ------------------------ From owner-svn-src-head@freebsd.org Fri Aug 18 18:20:37 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C5F24DCC610; Fri, 18 Aug 2017 18:20:37 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 953706F7D3; Fri, 18 Aug 2017 18:20:37 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7IIKaXL061067; Fri, 18 Aug 2017 18:20:36 GMT (envelope-from des@FreeBSD.org) Received: (from des@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7IIKaFv061066; Fri, 18 Aug 2017 18:20:36 GMT (envelope-from des@FreeBSD.org) Message-Id: <201708181820.v7IIKaFv061066@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: des set sender to des@FreeBSD.org using -f From: =?UTF-8?Q?Dag-Erling_Sm=c3=b8rgrav?= Date: Fri, 18 Aug 2017 18:20:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322669 - head/lib/libfetch X-SVN-Group: head X-SVN-Commit-Author: des X-SVN-Commit-Paths: head/lib/libfetch X-SVN-Commit-Revision: 322669 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Aug 2017 18:20:37 -0000 Author: des Date: Fri Aug 18 18:20:36 2017 New Revision: 322669 URL: https://svnweb.freebsd.org/changeset/base/322669 Log: In fetch_resolve(), if the port number or service name is included in the host argument (e.g. "www.freebsd.org:443"), the service pointer, which is supposed to point to the port or service part, instead points to the separator, causing getaddrinfo() to fail. Note that I have not been able to trigger this bug with fetch(1), nor do I believe it is possible, as libfetch always parses the host:port specification itself. I discovered it when I copied fetch_resolve() into an unrelated project. MFC after: 3 days Modified: head/lib/libfetch/common.c Modified: head/lib/libfetch/common.c ============================================================================== --- head/lib/libfetch/common.c Fri Aug 18 17:32:14 2017 (r322668) +++ head/lib/libfetch/common.c Fri Aug 18 18:20:36 2017 (r322669) @@ -291,7 +291,7 @@ fetch_resolve(const char *addr, int port, int af) goto syserr; service = sbuf; } else if (*sep != '\0') { - service = sep; + service = sep + 1; } else { service = NULL; } From owner-svn-src-head@freebsd.org Fri Aug 18 18:20:52 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E4922DCC66B; Fri, 18 Aug 2017 18:20:52 +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 mx1.freebsd.org (Postfix) with ESMTPS id B45426F8D1; Fri, 18 Aug 2017 18:20:52 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7IIKpRi062080; Fri, 18 Aug 2017 18:20:51 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7IIKpam062065; Fri, 18 Aug 2017 18:20:51 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201708181820.v7IIKpam062065@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 18 Aug 2017 18:20:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322670 - head/contrib/binutils/bfd X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/contrib/binutils/bfd X-SVN-Commit-Revision: 322670 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Aug 2017 18:20:53 -0000 Author: emaste Date: Fri Aug 18 18:20:51 2017 New Revision: 322670 URL: https://svnweb.freebsd.org/changeset/base/322670 Log: bfd: cast BFD_ALIGN to fix clang error on mips error: implicit conversion from 'bfd_vma' (aka 'unsigned long long') to 'int' changes value from 18446744073709551615 to -1 return BFD_ALIGN (ret, 16); ~~~~~~ ^~~~~~~~~~~~~~~~~~~ note: expanded from macro 'BFD_ALIGN' : ~ (bfd_vma) 0) ^~~~~~~~~~~~~ Sponsored by: The FreeBSD Foundation Modified: head/contrib/binutils/bfd/ecoff.c Modified: head/contrib/binutils/bfd/ecoff.c ============================================================================== --- head/contrib/binutils/bfd/ecoff.c Fri Aug 18 18:20:36 2017 (r322669) +++ head/contrib/binutils/bfd/ecoff.c Fri Aug 18 18:20:51 2017 (r322670) @@ -1878,7 +1878,7 @@ _bfd_ecoff_sizeof_headers (bfd *abfd, ret = (bfd_coff_filhsz (abfd) + bfd_coff_aoutsz (abfd) + c * bfd_coff_scnhsz (abfd)); - return BFD_ALIGN (ret, 16); + return (int) BFD_ALIGN (ret, 16); } /* Get the contents of a section. */ From owner-svn-src-head@freebsd.org Fri Aug 18 18:26:31 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 80B85DCCC84; Fri, 18 Aug 2017 18:26:31 +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 mx1.freebsd.org (Postfix) with ESMTPS id 4E3906FD8A; Fri, 18 Aug 2017 18:26:31 +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 v7IIQUAN065097; Fri, 18 Aug 2017 18:26:30 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7IIQUUQ065096; Fri, 18 Aug 2017 18:26:30 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201708181826.v7IIQUUQ065096@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 18 Aug 2017 18:26:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322671 - head/contrib/binutils/gas/config X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/contrib/binutils/gas/config X-SVN-Commit-Revision: 322671 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Aug 2017 18:26:31 -0000 Author: emaste Date: Fri Aug 18 18:26:30 2017 New Revision: 322671 URL: https://svnweb.freebsd.org/changeset/base/322671 Log: gas: fix "format string is not a string literal" errors on mips Sponsored by: The FreeBSD Foundation Modified: head/contrib/binutils/gas/config/tc-mips.c Modified: head/contrib/binutils/gas/config/tc-mips.c ============================================================================== --- head/contrib/binutils/gas/config/tc-mips.c Fri Aug 18 18:20:51 2017 (r322670) +++ head/contrib/binutils/gas/config/tc-mips.c Fri Aug 18 18:26:30 2017 (r322671) @@ -3310,7 +3310,7 @@ macro_end (void) warning now. */ const char *msg = macro_warning (subtype); if (msg != 0) - as_warn (msg); + as_warn ("%s", msg); } else { @@ -14463,7 +14463,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, segT asec { const char *msg = macro_warning (fragp->fr_subtype); if (msg != 0) - as_warn_where (fragp->fr_file, fragp->fr_line, msg); + as_warn_where (fragp->fr_file, fragp->fr_line, "%s", msg); } /* Go through all the fixups for the first sequence. Disable them From owner-svn-src-head@freebsd.org Fri Aug 18 18:55:08 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C478FDCEB39; Fri, 18 Aug 2017 18:55:08 +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 mx1.freebsd.org (Postfix) with ESMTPS id A0E0071097; Fri, 18 Aug 2017 18:55:08 +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 v7IIt7nk077723; Fri, 18 Aug 2017 18:55:07 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7IIt76l077720; Fri, 18 Aug 2017 18:55:07 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201708181855.v7IIt76l077720@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Fri, 18 Aug 2017 18:55:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322672 - in head/sys: compat/linuxkpi/common/src sys X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/sys: compat/linuxkpi/common/src sys X-SVN-Commit-Revision: 322672 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Aug 2017 18:55:08 -0000 Author: cem Date: Fri Aug 18 18:55:07 2017 New Revision: 322672 URL: https://svnweb.freebsd.org/changeset/base/322672 Log: Move some other SI_SUB_INIT_IF initializations to SI_SUB_TASKQ Drop the EARLY_AP_STARTUP gtaskqueue code, as gtaskqueues are now initialized before APs are started. Reviewed by: hselasky@, jhb@ Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D12054 Modified: head/sys/compat/linuxkpi/common/src/linux_tasklet.c head/sys/compat/linuxkpi/common/src/linux_work.c head/sys/sys/gtaskqueue.h Modified: head/sys/compat/linuxkpi/common/src/linux_tasklet.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_tasklet.c Fri Aug 18 18:26:30 2017 (r322671) +++ head/sys/compat/linuxkpi/common/src/linux_tasklet.c Fri Aug 18 18:55:07 2017 (r322672) @@ -110,7 +110,7 @@ tasklet_subsystem_init(void *arg __unused) "tasklet", i, -1, buf); } } -SYSINIT(linux_tasklet, SI_SUB_INIT_IF, SI_ORDER_THIRD, tasklet_subsystem_init, NULL); +SYSINIT(linux_tasklet, SI_SUB_TASKQ, SI_ORDER_THIRD, tasklet_subsystem_init, NULL); static void tasklet_subsystem_uninit(void *arg __unused) @@ -128,7 +128,7 @@ tasklet_subsystem_uninit(void *arg __unused) mtx_destroy(&tw->mtx); } } -SYSUNINIT(linux_tasklet, SI_SUB_INIT_IF, SI_ORDER_THIRD, tasklet_subsystem_uninit, NULL); +SYSUNINIT(linux_tasklet, SI_SUB_TASKQ, SI_ORDER_THIRD, tasklet_subsystem_uninit, NULL); void tasklet_init(struct tasklet_struct *ts, Modified: head/sys/compat/linuxkpi/common/src/linux_work.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_work.c Fri Aug 18 18:26:30 2017 (r322671) +++ head/sys/compat/linuxkpi/common/src/linux_work.c Fri Aug 18 18:55:07 2017 (r322672) @@ -577,7 +577,7 @@ linux_work_init(void *arg) system_power_efficient_wq = linux_system_short_wq; system_unbound_wq = linux_system_short_wq; } -SYSINIT(linux_work_init, SI_SUB_INIT_IF, SI_ORDER_THIRD, linux_work_init, NULL); +SYSINIT(linux_work_init, SI_SUB_TASKQ, SI_ORDER_THIRD, linux_work_init, NULL); static void linux_work_uninit(void *arg) @@ -591,4 +591,4 @@ linux_work_uninit(void *arg) system_power_efficient_wq = NULL; system_unbound_wq = NULL; } -SYSUNINIT(linux_work_uninit, SI_SUB_INIT_IF, SI_ORDER_THIRD, linux_work_uninit, NULL); +SYSUNINIT(linux_work_uninit, SI_SUB_TASKQ, SI_ORDER_THIRD, linux_work_uninit, NULL); Modified: head/sys/sys/gtaskqueue.h ============================================================================== --- head/sys/sys/gtaskqueue.h Fri Aug 18 18:26:30 2017 (r322671) +++ head/sys/sys/gtaskqueue.h Fri Aug 18 18:55:07 2017 (r322672) @@ -80,7 +80,6 @@ int taskqgroup_adjust(struct taskqgroup *qgroup, int c #define TASKQGROUP_DECLARE(name) \ extern struct taskqgroup *qgroup_##name -#ifdef EARLY_AP_STARTUP #define TASKQGROUP_DEFINE(name, cnt, stride) \ \ struct taskqgroup *qgroup_##name; \ @@ -89,23 +88,9 @@ static void \ taskqgroup_define_##name(void *arg) \ { \ qgroup_##name = taskqgroup_create(#name); \ - taskqgroup_adjust(qgroup_##name, (cnt), (stride)); \ } \ \ -SYSINIT(taskqgroup_##name, SI_SUB_INIT_IF, SI_ORDER_FIRST, \ - taskqgroup_define_##name, NULL) -#else /* !EARLY_AP_STARTUP */ -#define TASKQGROUP_DEFINE(name, cnt, stride) \ - \ -struct taskqgroup *qgroup_##name; \ - \ -static void \ -taskqgroup_define_##name(void *arg) \ -{ \ - qgroup_##name = taskqgroup_create(#name); \ -} \ - \ -SYSINIT(taskqgroup_##name, SI_SUB_INIT_IF, SI_ORDER_FIRST, \ +SYSINIT(taskqgroup_##name, SI_SUB_TASKQ, SI_ORDER_FIRST, \ taskqgroup_define_##name, NULL); \ \ static void \ @@ -116,7 +101,6 @@ taskqgroup_adjust_##name(void *arg) \ \ SYSINIT(taskqgroup_adj_##name, SI_SUB_SMP, SI_ORDER_ANY, \ taskqgroup_adjust_##name, NULL) -#endif /* EARLY_AP_STARTUP */ TASKQGROUP_DECLARE(net); TASKQGROUP_DECLARE(softirq); From owner-svn-src-head@freebsd.org Fri Aug 18 20:35:36 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 37380DD56D1; Fri, 18 Aug 2017 20:35:36 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 06886748A1; Fri, 18 Aug 2017 20:35:35 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7IKZZjs019919; Fri, 18 Aug 2017 20:35:35 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7IKZZsF019918; Fri, 18 Aug 2017 20:35:35 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201708182035.v7IKZZsF019918@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Fri, 18 Aug 2017 20:35:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322674 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: sevan X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 322674 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Aug 2017 20:35:36 -0000 Author: sevan (doc committer) Date: Fri Aug 18 20:35:35 2017 New Revision: 322674 URL: https://svnweb.freebsd.org/changeset/base/322674 Log: Add Thunderbolt Apple interfaces to the bge(4) supported list. Document message reported by kernel upon removal in DIAGNOSTIC section. Document shortcomings in BUGS section. Approved by: bcr (mentor) MFC after: 5 days Differential Revision: https://reviews.freebsd.org/D11771 Modified: head/share/man/man4/bge.4 Modified: head/share/man/man4/bge.4 ============================================================================== --- head/share/man/man4/bge.4 Fri Aug 18 20:20:49 2017 (r322673) +++ head/share/man/man4/bge.4 Fri Aug 18 20:35:35 2017 (r322674) @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 19, 2012 +.Dd August 18, 2017 .Dt BGE 4 .Os .Sh NAME @@ -159,6 +159,10 @@ following: .It 3Com 3c996-T (10/100/1000baseTX) .It +Apple Thunderbolt Display (10/100/1000baseTX) +.It +Apple Thunderbolt to Gigabit Ethernet Adapter (10/100/1000baseTX) +.It Dell PowerEdge 1750 integrated BCM5704C NIC (10/100/1000baseTX) .It Dell PowerEdge 2550 integrated BCM5700 NIC (10/100/1000baseTX) @@ -236,6 +240,9 @@ during initialization. The driver failed to initialize PCI shared memory mapping. This might happen if the card is not in a bus-master slot. +.It "bge%d: firmware handshake timed out, found 0xffffffff" +The device was physically disconnected from the system, or there is a problem with +the device causing it to stop responding to the host it is attached to. .It "bge%d: no memory for jumbo buffers!" The driver failed to allocate memory for jumbo frames during initialization. @@ -262,3 +269,12 @@ The .Nm driver was written by .An Bill Paul Aq Mt wpaul@windriver.com . +.Sh BUGS +Hotplug is not currently supported in +.Fx , +hence, Thunderbolt interfaces need to be connected prior to system power up on +Apple systems in order for the interface to be detected. +Also, due to the lack of hotplug support, Thunderbolt-based interfaces must not be removed +while the system is up as the kernel is currently unable to cope with a +.Nm +interface disappearing. From owner-svn-src-head@freebsd.org Fri Aug 18 21:20:39 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9FF3DDD829E; Fri, 18 Aug 2017 21:20:39 +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 mx1.freebsd.org (Postfix) with ESMTPS id 6DD05760EA; Fri, 18 Aug 2017 21:20:39 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7ILKcca037211; Fri, 18 Aug 2017 21:20:38 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7ILKcIw037210; Fri, 18 Aug 2017 21:20:38 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201708182120.v7ILKcIw037210@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 18 Aug 2017 21:20:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322675 - head/contrib/binutils/gas/config X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/contrib/binutils/gas/config X-SVN-Commit-Revision: 322675 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Aug 2017 21:20:39 -0000 Author: emaste Date: Fri Aug 18 21:20:38 2017 New Revision: 322675 URL: https://svnweb.freebsd.org/changeset/base/322675 Log: gas: add parens to clarify expression and eliminate clang warning Building mips64 w/ Clang failed with -Werror,-Wshift-negative-value error: shifting a negative signed value is undefined Modified: head/contrib/binutils/gas/config/tc-mips.c Modified: head/contrib/binutils/gas/config/tc-mips.c ============================================================================== --- head/contrib/binutils/gas/config/tc-mips.c Fri Aug 18 20:35:35 2017 (r322674) +++ head/contrib/binutils/gas/config/tc-mips.c Fri Aug 18 21:20:38 2017 (r322675) @@ -2920,7 +2920,7 @@ append_insn (struct mips_cl_insn *ip, expressionS *add instruction. May want to add this support in the future. */ } /* Never set the bit for $0, which is always zero. */ - mips_gprmask &= ~1 << 0; + mips_gprmask &= ~(1 << 0); } else { From owner-svn-src-head@freebsd.org Sat Aug 19 00:19:25 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2467DDE27F7; Sat, 19 Aug 2017 00:19:25 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E070D7F57F; Sat, 19 Aug 2017 00:19:24 +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 v7J0JOuq009816; Sat, 19 Aug 2017 00:19:24 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7J0JOtL009813; Sat, 19 Aug 2017 00:19:24 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201708190019.v7J0JOtL009813@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Sat, 19 Aug 2017 00:19:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322677 - in head/usr.sbin/pw: . tests X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head/usr.sbin/pw: . tests X-SVN-Commit-Revision: 322677 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Aug 2017 00:19:25 -0000 Author: emaste Date: Sat Aug 19 00:19:23 2017 New Revision: 322677 URL: https://svnweb.freebsd.org/changeset/base/322677 Log: pw usermod: Properly deal with empty secondary group lists (-G '') "pw usermod someuser -G ''" is supposed make sure that someuser doesn't have any secondary group memberships. Previouly it was a nop because split_groups() only intitialised "groups" if at least one group was specified. As a result the existing secondary group memberships were kept. PR: 221417 Submitted by: Fabian Keil Obtained from: ElectroBSD MFC after: 1 week Relnotes: yes Modified: head/usr.sbin/pw/pw_user.c head/usr.sbin/pw/tests/pw_usermod_test.sh Modified: head/usr.sbin/pw/pw_user.c ============================================================================== --- head/usr.sbin/pw/pw_user.c Fri Aug 18 21:37:26 2017 (r322676) +++ head/usr.sbin/pw/pw_user.c Sat Aug 19 00:19:23 2017 (r322677) @@ -1087,10 +1087,10 @@ split_groups(StringList **groups, char *groupsstr) char *p; char tok[] = ", \t"; + if (*groups == NULL) + *groups = sl_init(); for (p = strtok(groupsstr, tok); p != NULL; p = strtok(NULL, tok)) { grp = group_from_name_or_id(p); - if (*groups == NULL) - *groups = sl_init(); sl_add(*groups, newstr(grp->gr_name)); } } Modified: head/usr.sbin/pw/tests/pw_usermod_test.sh ============================================================================== --- head/usr.sbin/pw/tests/pw_usermod_test.sh Fri Aug 18 21:37:26 2017 (r322676) +++ head/usr.sbin/pw/tests/pw_usermod_test.sh Sat Aug 19 00:19:23 2017 (r322677) @@ -128,6 +128,9 @@ user_mod_nogroups_body() { atf_check -s exit:0 ${PW} usermod foo -G test3,test4 atf_check -s exit:0 -o inline:"test3\ntest4\n" \ awk -F\: '$4 == "foo" { print $1 }' ${HOME}/group + atf_check -s exit:0 ${PW} usermod foo -G "" + atf_check -s exit:0 -o empty \ + awk -F\: '$4 == "foo" { print $1 }' ${HOME}/group } atf_test_case user_mod_rename From owner-svn-src-head@freebsd.org Sat Aug 19 00:32:27 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A2BA3DE358E; Sat, 19 Aug 2017 00:32:27 +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 mx1.freebsd.org (Postfix) with ESMTPS id 7CD1C7FE82; Sat, 19 Aug 2017 00:32:27 +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 v7J0WQqG017553; Sat, 19 Aug 2017 00:32:26 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7J0WQAa017551; Sat, 19 Aug 2017 00:32:26 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201708190032.v7J0WQAa017551@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Sat, 19 Aug 2017 00:32:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322678 - in head/usr.sbin/pw: . tests X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head/usr.sbin/pw: . tests X-SVN-Commit-Revision: 322678 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Aug 2017 00:32:27 -0000 Author: emaste Date: Sat Aug 19 00:32:26 2017 New Revision: 322678 URL: https://svnweb.freebsd.org/changeset/base/322678 Log: pw useradd: Validate the user name before creating the entry Previouly it was possible to create users with spaces in the name with: pw useradd -u 1234 -g 1234 -n 'test user' The "-g 1234" is relevant, without it the name was already rejected as expected: [fk@test ~]$ sudo pw useradd -u 1234 -n 'test user' pw: invalid character ` ' at position 4 in userid/group name Bug unintentionally found with a salt config without explicit name entry: test user: user.present: - uid: 1234 - gid: 1234 - fullname: Test user - shell: /usr/local/bin/bash - home: /home/test - groups: - wheel - salt "Luckily" salt modules rarely bother with input validation either ... PR: 221416 Submitted by: Fabian Keil Obtained from: ElectroBSD MFC after: 1 week Modified: head/usr.sbin/pw/pw_user.c head/usr.sbin/pw/tests/pw_useradd_test.sh Modified: head/usr.sbin/pw/pw_user.c ============================================================================== --- head/usr.sbin/pw/pw_user.c Sat Aug 19 00:19:23 2017 (r322677) +++ head/usr.sbin/pw/pw_user.c Sat Aug 19 00:32:26 2017 (r322678) @@ -1202,7 +1202,7 @@ pw_user_add(int argc, char **argv, char *arg1) if (arg1[strspn(arg1, "0123456789")] == '\0') id = pw_checkid(arg1, UID_MAX); else - name = arg1; + name = pw_checkname(arg1, 0); } while ((ch = getopt(argc, argv, args)) != -1) { @@ -1214,7 +1214,7 @@ pw_user_add(int argc, char **argv, char *arg1) quiet = true; break; case 'n': - name = optarg; + name = pw_checkname(optarg, 0); break; case 'u': userid = optarg; Modified: head/usr.sbin/pw/tests/pw_useradd_test.sh ============================================================================== --- head/usr.sbin/pw/tests/pw_useradd_test.sh Sat Aug 19 00:19:23 2017 (r322677) +++ head/usr.sbin/pw/tests/pw_useradd_test.sh Sat Aug 19 00:32:26 2017 (r322678) @@ -176,6 +176,43 @@ user_add_name_too_long_body() { ${PW} useradd name_very_vert_very_very_very_long } +atf_test_case user_add_name_with_spaces +user_add_name_with_spaces_body() { + populate_etc_skel + atf_check -s exit:65 -e match:"invalid character" \ + ${PW} useradd 'test user' + atf_check -s exit:1 -o empty grep "^test user:.*" $HOME/master.passwd + # Try again with -n which uses a slightly different code path. + atf_check -s exit:65 -e match:"invalid character" \ + ${PW} useradd -n 'test user' + atf_check -s exit:1 -o empty grep "^test user:.*" $HOME/master.passwd +} + +atf_test_case user_add_name_with_spaces_and_gid_specified +user_add_name_with_spaces_and_gid_specified_body() { + populate_etc_skel + gid=12345 + user_name="test user" + # pw useradd should fail because of the space in the user + # name, not because the group doesn't exist. + atf_check -s exit:65 -e match:"invalid character" \ + ${PW} useradd "${user_name}" -g ${gid} + atf_check -s exit:1 -o empty grep "^${user_name}:.*" $HOME/master.passwd + # Try again with -n which uses a slightly different code path. + atf_check -s exit:65 -e match:"invalid character" \ + ${PW} useradd -n "${user_name}" -g ${gid} + atf_check -s exit:1 -o empty grep "^${user_name}:.*" $HOME/master.passwd + # Make sure the user isn't added even if the group exists + atf_check -s exit:0 ${PW} groupadd blafasel -g ${gid} + atf_check -s exit:65 -e match:"invalid character" \ + ${PW} useradd "${user_name}" -g ${gid} + atf_check -s exit:1 -o empty grep "^${user_name}:.*" $HOME/master.passwd + # Try again with the -n option. + atf_check -s exit:65 -e match:"invalid character" \ + ${PW} useradd -n "${user_name}" -g ${gid} + atf_check -s exit:1 -o empty grep "^${user_name}:.*" $HOME/master.passwd +} + atf_test_case user_add_expiration user_add_expiration_body() { populate_etc_skel @@ -415,6 +452,8 @@ atf_init_test_cases() { atf_add_test_case user_add_password_expiration_date_month atf_add_test_case user_add_password_expiration_date_relative atf_add_test_case user_add_name_too_long + atf_add_test_case user_add_name_with_spaces + atf_add_test_case user_add_name_with_spaces_and_gid_specified atf_add_test_case user_add_expiration atf_add_test_case user_add_invalid_user_entry atf_add_test_case user_add_invalid_group_entry From owner-svn-src-head@freebsd.org Sat Aug 19 00:37:34 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 83D08DE3AF0; Sat, 19 Aug 2017 00:37:34 +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 mx1.freebsd.org (Postfix) with ESMTPS id 4E8248019C; Sat, 19 Aug 2017 00:37:34 +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 v7J0bXFx017835; Sat, 19 Aug 2017 00:37:33 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7J0bX1d017834; Sat, 19 Aug 2017 00:37:33 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201708190037.v7J0bX1d017834@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Sat, 19 Aug 2017 00:37:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322680 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 322680 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Aug 2017 00:37:34 -0000 Author: emaste Date: Sat Aug 19 00:37:33 2017 New Revision: 322680 URL: https://svnweb.freebsd.org/changeset/base/322680 Log: sa.4: fix spelling of 'suppresses' PR: 221302 Submitted by: Fabian Keil Obtained from: ElectroBSD MFC after: 1 week Modified: head/share/man/man4/sa.4 Modified: head/share/man/man4/sa.4 ============================================================================== --- head/share/man/man4/sa.4 Sat Aug 19 00:37:31 2017 (r322679) +++ head/share/man/man4/sa.4 Sat Aug 19 00:37:33 2017 (r322680) @@ -270,7 +270,7 @@ on tape reads. Tape drives normally return sense data (which contains the residual) when the application reads a block that is not the same length as the amount of data requested. -The SILI bit supresses that notification in most cases. +The SILI bit suppresses that notification in most cases. See the SSC-5 spec (available at t10.org), specifically the section on the READ(6) command, for more information. .It eot_warn From owner-svn-src-head@freebsd.org Sat Aug 19 00:45:30 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CAD65DE42EA; Sat, 19 Aug 2017 00:45:30 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9A94B80859; Sat, 19 Aug 2017 00:45:30 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7J0jTqA022045; Sat, 19 Aug 2017 00:45:29 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7J0jTlb022044; Sat, 19 Aug 2017 00:45:29 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201708190045.v7J0jTlb022044@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Sat, 19 Aug 2017 00:45:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322682 - head/sys/modules X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/modules X-SVN-Commit-Revision: 322682 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Aug 2017 00:45:30 -0000 Author: emaste Date: Sat Aug 19 00:45:29 2017 New Revision: 322682 URL: https://svnweb.freebsd.org/changeset/base/322682 Log: sys/modules: don't build bxe if the user objects to sourceless ucode PR: 204747 Submitted by: Fabian Keil Obtained from: ElectroBSD MFC after: 1 week Modified: head/sys/modules/Makefile Modified: head/sys/modules/Makefile ============================================================================== --- head/sys/modules/Makefile Sat Aug 19 00:40:04 2017 (r322681) +++ head/sys/modules/Makefile Sat Aug 19 00:45:29 2017 (r322682) @@ -568,7 +568,9 @@ _an= an _aout= aout _bios= bios _bktr= bktr +.if ${MK_SOURCELESS_UCODE} != "no" _bxe= bxe +.endif _cardbus= cardbus _cbb= cbb _cpuctl= cpuctl From owner-svn-src-head@freebsd.org Sat Aug 19 00:51:46 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7717DDE4966; Sat, 19 Aug 2017 00:51:46 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 53B1680D82; Sat, 19 Aug 2017 00:51:46 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7J0pjYJ025820; Sat, 19 Aug 2017 00:51:45 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7J0pjDk025819; Sat, 19 Aug 2017 00:51:45 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201708190051.v7J0pjDk025819@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Sat, 19 Aug 2017 00:51:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322683 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 322683 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Aug 2017 00:51:46 -0000 Author: emaste Date: Sat Aug 19 00:51:45 2017 New Revision: 322683 URL: https://svnweb.freebsd.org/changeset/base/322683 Log: ena.4: fix spelling of 'occurred' PR: 331298 Submitted by: Fabian Keil Obtained from: ElectroBSD MFC after: 1 week Modified: head/share/man/man4/ena.4 Modified: head/share/man/man4/ena.4 ============================================================================== --- head/share/man/man4/ena.4 Sat Aug 19 00:45:29 2017 (r322682) +++ head/share/man/man4/ena.4 Sat Aug 19 00:51:45 2017 (r322683) @@ -102,7 +102,7 @@ Supported PCI vendor ID/device IDs: .Bl -diag .It ena%d: failed to init mmio read less .Pp -Error occured during initialization of the mmio register read request. +Error occurred during initialization of the mmio register read request. .It ena%d: Can not reset device .Pp Device could not be reset; device may not be responding or is already @@ -123,7 +123,7 @@ was a problem with initialization of the resources. Failed to get attributes of the device from the controller. .It ena%d: Cannot configure aenq groups rc: %d .Pp -Errors occured when trying to configure AENQ groups. +Errors occurred when trying to configure AENQ groups. .El .Ss Driver initialisation/shutdown phase: .Bl -diag @@ -148,13 +148,13 @@ be attached. Device initialization failed; driver will not be attached. .It ena%d: could not activate irq vector: %d .Pp -Error occured when trying to activate interrupt vectors for Admin Queue. +Error occurred when trying to activate interrupt vectors for Admin Queue. .It ena%d: failed to register interrupt handler for irq %ju: %d .Pp -Error occured when trying to register Admin Queue interrupt handler. +Error occurred when trying to register Admin Queue interrupt handler. .It ena%d: Cannot setup mgmnt queue intr .Pp -Error occured during configuration of the Admin Queue interrupts. +Error occurred during configuration of the Admin Queue interrupts. .It ena%d: Enable MSI-X failed .Pp Configuration of the MSI-X for Admin Queue failed; there could be lack @@ -167,7 +167,7 @@ first and then detach routine should be called again. .It ena%d: Unmapped RX DMA tag associations .It ena%d: Unmapped TX DMA tag associations .Pp -Error occured when trying to destroy RX/TX DMA tag. +Error occurred when trying to destroy RX/TX DMA tag. .It ena%d: Cannot init RSS .It ena%d: Cannot fill indirect table .It ena%d: Cannot fill indirect table @@ -175,7 +175,7 @@ Error occured when trying to destroy RX/TX DMA tag. .It ena%d: Cannot fill hash control .It ena%d: WARNING: RSS was not properly initialized, it will affect bandwidth .Pp -Error occured during initialization of one of RSS resources; device is still +Error occurred during initialization of one of RSS resources; device is still going to work but it will affect performance because all RX packets will be passed to queue 0 and there will be no hash information. .It ena%d: failed to tear down irq: %d From owner-svn-src-head@freebsd.org Sat Aug 19 01:09:16 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C416ADE58D1; Sat, 19 Aug 2017 01:09:16 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pg0-x22f.google.com (mail-pg0-x22f.google.com [IPv6:2607:f8b0:400e:c05::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9037E815B0; Sat, 19 Aug 2017 01:09:16 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pg0-x22f.google.com with SMTP id n4so10097466pgn.1; Fri, 18 Aug 2017 18:09:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:mime-version:from:in-reply-to:date:cc:message-id:references :to; bh=+AibSXbEROeLc40iq9zylK3qz8IXX022mLR/UFSYpUk=; b=OL+M+RHJFm195VeUTtpJBVs0Ds6xnndJg7y/qYLBKfEVqZhNEH1ychaYXQq37MPPW2 RDAhfyu7EVHIIKwW+vY6M5MpMZuf2HA306uMA0Z0QCqMhHAuqov0vU0AnP1+FHeqZsgV g2kE3BntFEhlqN9ixCL6nwH4Ylg9hbTl761OwKid28JzDlH6OM9voN/sYM7o2pUzfS43 +6AzRNZjiR83l088+vQ5julPbJ/MgJDac+IEvkEtb0ZfEkRVWRZa3wJ7JaW1h5Y5jOhG /VeUNBmbm8mKMCI6Lhs5Ka/ffAI4vHAJCA0imKHFgSt8jkNmMFW5JW3x4+H8xx1UIXrG BDmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:mime-version:from:in-reply-to:date:cc :message-id:references:to; bh=+AibSXbEROeLc40iq9zylK3qz8IXX022mLR/UFSYpUk=; b=mAhovg4dglX1ApZz/S2xKHNzbL9tbCrX9grm5ibtRU+6L3NiNd/YI1Pie69E16gWPB a2kDtnMHa23SFWXgzFnPYNXS4Hnxg7zjy9I7Awtpi/F9ylS1s6D74vm9x+LLn22waTMi ekBC8KguUtgejyUeBD8gwrsilh3sFAyhUqHGiG1c5R3Ig78029tqQTV0Js76+YO+0ErO crF+knq+9VCbFNqEhWxtMR5gQQQG7jjvBYd+7sMl3vfdImwAGTDjcghNUe3Z1PZL8Qxr 7DM1eXFlNVN9DHlRfkZ+Y6eVtSCNXpLN3GU0ngW6DLKAY+QlS7iQ1VcRBo8I6wNTzaYf 4xGA== X-Gm-Message-State: AHYfb5gZe6WWeJ/U8VgHzTeMWYmwn8xjxoQqPDD7pqqBXtH9ZsxCjeP7 zasgIk+YRCKYeELstvobrw== X-Received: by 10.99.176.4 with SMTP id h4mr9909406pgf.300.1503104955802; Fri, 18 Aug 2017 18:09:15 -0700 (PDT) Received: from [10.9.41.183] ([70.42.240.31]) by smtp.gmail.com with ESMTPSA id a63sm12288909pfc.165.2017.08.18.18.09.13 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 18 Aug 2017 18:09:15 -0700 (PDT) Subject: Re: svn commit: r322678 - in head/usr.sbin/pw: . tests Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/signed; boundary="Apple-Mail=_22802188-9797-4792-A343-4BD1D2E4FDF4"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail From: "Ngie Cooper (yaneurabeya)" In-Reply-To: <201708190032.v7J0WQAa017551@repo.freebsd.org> Date: Fri, 18 Aug 2017 18:08:54 -0700 Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-Id: References: <201708190032.v7J0WQAa017551@repo.freebsd.org> To: Ed Maste X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Aug 2017 01:09:16 -0000 --Apple-Mail=_22802188-9797-4792-A343-4BD1D2E4FDF4 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii > On Aug 18, 2017, at 17:32, Ed Maste wrote: > > Author: emaste > Date: Sat Aug 19 00:32:26 2017 > New Revision: 322678 > URL: https://svnweb.freebsd.org/changeset/base/322678 > > Log: > pw useradd: Validate the user name before creating the entry > > Previouly it was possible to create users with spaces in the name with: > pw useradd -u 1234 -g 1234 -n 'test user' > > The "-g 1234" is relevant, without it the name was already rejected > as expected: > > [fk@test ~]$ sudo pw useradd -u 1234 -n 'test user' > pw: invalid character ` ' at position 4 in userid/group name > > Bug unintentionally found with a salt config without explicit name entry: > > test user: > user.present: > - uid: 1234 > - gid: 1234 > - fullname: Test user > - shell: /usr/local/bin/bash > - home: /home/test > - groups: > - wheel > - salt > > "Luckily" salt modules rarely bother with input validation either ... > > PR: 221416 > Submitted by: Fabian Keil > Obtained from: ElectroBSD > MFC after: 1 week > > Modified: > head/usr.sbin/pw/pw_user.c > head/usr.sbin/pw/tests/pw_useradd_test.sh Usernames with passwords are permitted in some cases, e.g., AD. Thanks, -Ngie --Apple-Mail=_22802188-9797-4792-A343-4BD1D2E4FDF4 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJZl4+nAAoJEPWDqSZpMIYVGY0P/0M/T4jiP5+n1Cmqcw4qTJDD SzzAKN4yQxttQrhLYEuACOvWKOwexyBO307+zCluN2Xm0zkMdFY/iUbjr6Z3uQtD HZMcLvp40l1uyQtjXI4Xr3B86ElnYD5PFP0M3h/mjGZ6alG+dzcFUvzu5AItWN4E IaTa2JsGhQoE5u4b00818fO3RnoKRKic8AvJcEfkNTDdZ4hcdluOAWDlyw3sleXy JxoROMcCakkFkHSWcOmTGXw6ud1z4u5oDXWLzzLi+K57JwroATrRDHpzWcaJCxLG NKAvbLvCdBhDEWzfdAnEaEEgtQ9J7By2Au2jZNOqrKKgnwP8XwFd3wgYAgN5A2wF xetdTcE1+Qd0c75AE4++2RKWXYFHqTZLv4K4lv59GR9pX8IQgRWtGOHMWltr/bCj Jn9lmXUYqpBNmPjOyBdBTiMwZ0kfvR1axvFcnUnszwC0+qqGrp82eCw7g0RqT4EF vCwiRoREFNTSNS2pfEhXOWx6Mz+VHt3P1M9nbGaVOeXNyZRaK75uR8ltMGnn5KJq yItVQ2llg050ijpAqoPHdkvf+sPRz38Rrwf1y0jdmua9dtRELzZFCNocczgaZcUp SFG4167v15b9tcTUxtkm724Gh22/lIofdgJqdzstiUfICU4SEa6shPqi+G3t1XPa IVwQtbe68RYVEnZW8zvE =Q4jO -----END PGP SIGNATURE----- --Apple-Mail=_22802188-9797-4792-A343-4BD1D2E4FDF4-- From owner-svn-src-head@freebsd.org Sat Aug 19 01:12:06 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C4732DE5B70; Sat, 19 Aug 2017 01:12: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 mx1.freebsd.org (Postfix) with ESMTPS id 8F9B78195D; Sat, 19 Aug 2017 01:12:06 +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 v7J1C5wT033973; Sat, 19 Aug 2017 01:12:05 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7J1C57X033972; Sat, 19 Aug 2017 01:12:05 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201708190112.v7J1C57X033972@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Sat, 19 Aug 2017 01:12:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322684 - head/sys/modules X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/modules X-SVN-Commit-Revision: 322684 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Aug 2017 01:12:06 -0000 Author: emaste Date: Sat Aug 19 01:12:05 2017 New Revision: 322684 URL: https://svnweb.freebsd.org/changeset/base/322684 Log: sys/modules: don't build qlxgbe if the user objects to sourceless ucode PR: 204749 Submitted by: Fabian Keil Obtained from: ElectroBSD MFC after: 1 week Modified: head/sys/modules/Makefile Modified: head/sys/modules/Makefile ============================================================================== --- head/sys/modules/Makefile Sat Aug 19 00:51:45 2017 (r322683) +++ head/sys/modules/Makefile Sat Aug 19 01:12:05 2017 (r322684) @@ -710,7 +710,9 @@ _ntb= ntb _pms= pms _qlxge= qlxge _qlxgb= qlxgb +.if ${MK_SOURCELESS_UCODE} != "no" _qlxgbe= qlxgbe +.endif _qlnx= qlnx _sfxge= sfxge _sgx= sgx From owner-svn-src-head@freebsd.org Sat Aug 19 12:14:47 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D9198DE6047; Sat, 19 Aug 2017 12:14:47 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B24B2724F1; Sat, 19 Aug 2017 12:14:47 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7JCEkAp003279; Sat, 19 Aug 2017 12:14:46 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7JCEkIv003277; Sat, 19 Aug 2017 12:14:46 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201708191214.v7JCEkIv003277@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Sat, 19 Aug 2017 12:14:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322693 - head/usr.sbin/vidcontrol X-SVN-Group: head X-SVN-Commit-Author: bde X-SVN-Commit-Paths: head/usr.sbin/vidcontrol X-SVN-Commit-Revision: 322693 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Aug 2017 12:14:48 -0000 Author: bde Date: Sat Aug 19 12:14:46 2017 New Revision: 322693 URL: https://svnweb.freebsd.org/changeset/base/322693 Log: Reduce complexity and backwards compatibilty a little by removing new aliases and repurposing "blink". Improve accuracy of documentation of historical mistakes and other bugs. "blink" now means "set the blink attribute for the target(s)" instead of "set the blink attribute and clear other attributes [and control flags]". It was even more confusing to use "blinking" for the single attribute to keep the old meaning for "blink". "destructive" is not as historically broken or gone as the previous version said. The bugs involving resetting from defaults are now understood and partly documented (the defaults are mis-initialized). Modified: head/usr.sbin/vidcontrol/vidcontrol.1 head/usr.sbin/vidcontrol/vidcontrol.c Modified: head/usr.sbin/vidcontrol/vidcontrol.1 ============================================================================== --- head/usr.sbin/vidcontrol/vidcontrol.1 Sat Aug 19 09:38:43 2017 (r322692) +++ head/usr.sbin/vidcontrol/vidcontrol.1 Sat Aug 19 12:14:46 2017 (r322693) @@ -137,26 +137,38 @@ The following override .Cm setting Ns s are available: .Bl -tag -width indent -.It Cm block +.It Cm normal Set to a block covering 1 character cell, with a configuration-dependent coloring that should be at worst inverse video. -.It Cm blinkingblock -Set to a blinking -.Cm block . -.It Cm underline -Set to +.It Cm destructive +Set to a blinking sub-block with .Cm height scanlines starting at .Cm base . -This only gives an underline in normal configurations. -.It Cm blinkingunderline -Set to a blinking -.Cm underline . +The name +.Dq destructive +is bad for backwards compatibility. +This +.Cm setting +should not force destructiveness, +and it now only gives destructiveness in some +configurations (typically for hardware cursors +in text mode). +Blinking limits destructiveness. +This +.Cm setting +should now be spelled +.Cm normal , Ns Cm blink , Ns Cm noblock . +A non-blinking destructive cursor would be unusable, +so old versions of +.Nm +didn't support it, +and this version doesn't have an override for it. .It Cm base Ns = Ns Ar value, Cm height Ns = Ns Ar value Set the specified scanline parameters. -These parameters are only active in so-called -.Cm char ( underline ) +These parameters are only active in +.Cm noblock mode. .Cm value is an integer in any base supported by @@ -164,7 +176,7 @@ is an integer in any base supported by Setting .Cm height to 0 turns off the cursor in -.Cm char +.Cm noblock mode. Negative .Ar value Ns s @@ -174,73 +186,57 @@ Positive are clamped to fit in the character cell when the cursor is drawn. .El .Pp -The following override -.Cm setting Ns s -are provided for backwards compatibility: -.Bl -tag -width indent -.It Cm normal -Old name for -.Cm block . -.It Cm blink -Old name for -.Cm blinkingblock . -.It Cm destructive -Bad old name for -.Cm blinkingunderline . -The so-called -.Cm destructive -cursor was only destructive due to a bug that was fixed in -.Fx 4.1.0 . -The destruction in the non-blinking case was so large that -this case was not supported by -.Nm , -so no backwards compatible name is needed for this case. -.El -.Pp The following modifier .Cm setting Ns s are available: .Bl -tag -width indent -.It Cm blinking , noblinking +.It Cm blink , noblink Set or clear the blinking attribute. -.It Cm char , nochar -Set or clear the so-called -.Cm char +This is not quite backwards compatible. +In old versions of +.Nm , Cm blink +was an override to a blinking block. +.It Cm block , noblock +Set or clear the +.Cm block attribute. -Names in this section follow the bad old names of -flags in the implementation. -.Cm char -now means -.Do -activate the scanline parameters, -and implement them using the best available method -(at worst, actually use the old -.Cm char -method with its destruction fixed if it is configured, -else silently ignore this flag). -.Dc +This attribute is the inverse of the flag +.Dv CONS_CHAR_CURSOR +in the implementation. +It deactivates the scanline parameters, +and expresses a preference for using a +simpler method of implementation. +Its inverse does the opposite. +When the scanline parameters give a full block, +this attribute reduces to a method selection bit. +The +.Cm block +method tends to give better coloring. .It Cm hidden , nohidden Set or clear the hidden attribute. +.El +.Pp +The following (non-sticky) flags control application of the +.Cm setting Ns s : +.Bl -tag -width indent .It Cm local -Apply the changes (except for the -.Cm local -and -.Cm reset -control flags) -to the current vty. -The default is to apply them to all vtys. +Apply the changes to the current vty. +The default is to apply them to a global place +and copy from there to all vtys. .It Cm reset Reset everything. The default is to not reset. When the .Cm local -parameter is specified, the resetting is for the -current local settings to the current global settings. -Otherwise, the resetting is for the current global -settings to defaults configured a boot time. -Beware that the scanline parameters and not automatically -scaled by the font size and resetting tends to undo manual -fixups for this. +parameter is specified, the current local settings are reset +to default local settings. +Otherwise, the current global settings are reset to default +global settings and then copied to the current and default +settings for all vtys. +The global defaults are decided (not quite right) at boot time +and cannot be fixed up. +The local defaults are obtained as above and cannot be fixed up +locally. .El .It Fl d Print out current output screen map. Modified: head/usr.sbin/vidcontrol/vidcontrol.c ============================================================================== --- head/usr.sbin/vidcontrol/vidcontrol.c Sat Aug 19 09:38:43 2017 (r322692) +++ head/usr.sbin/vidcontrol/vidcontrol.c Sat Aug 19 12:14:46 2017 (r322693) @@ -630,36 +630,26 @@ parse_cursor_params(char *param, struct cshape *shape) param = dupparam = strdup(param); type = shape->shape[0]; while ((word = strsep(¶m, ",")) != NULL) { - if (strcmp(word, "block") == 0) + if (strcmp(word, "normal") == 0) type = 0; - else if (strcmp(word, "underline") == 0) - type = CONS_CHAR_CURSOR; - else if (strcmp(word, "blinkingblock") == 0) - type = CONS_BLINK_CURSOR; - else if (strcmp(word, "blinkingunderline") == 0) - type = CONS_BLINK_CURSOR | CONS_CHAR_CURSOR; - else if (strncmp(word, "base=", 5) == 0) - shape->shape[1] = strtol(word + 5, NULL, 0); - else if (strncmp(word, "height=", 7) == 0) - shape->shape[2] = strtol(word + 7, NULL, 0); - else if (strcmp(word, "blinking") == 0) - type |= CONS_BLINK_CURSOR; - else if (strcmp(word, "normal") == 0) - type = 0; - else if (strcmp(word, "blink") == 0) - type = CONS_BLINK_CURSOR; else if (strcmp(word, "destructive") == 0) type = CONS_BLINK_CURSOR | CONS_CHAR_CURSOR; - else if (strcmp(word, "noblinking") == 0) + else if (strcmp(word, "blink") == 0) + type |= CONS_BLINK_CURSOR; + else if (strcmp(word, "noblink") == 0) type &= ~CONS_BLINK_CURSOR; - else if (strcmp(word, "char") == 0) - type |= CONS_CHAR_CURSOR; - else if (strcmp(word, "nochar") == 0) + else if (strcmp(word, "block") == 0) type &= ~CONS_CHAR_CURSOR; + else if (strcmp(word, "noblock") == 0) + type |= CONS_CHAR_CURSOR; else if (strcmp(word, "hidden") == 0) type |= CONS_HIDDEN_CURSOR; else if (strcmp(word, "nohidden") == 0) type &= ~CONS_HIDDEN_CURSOR; + else if (strncmp(word, "base=", 5) == 0) + shape->shape[1] = strtol(word + 5, NULL, 0); + else if (strncmp(word, "height=", 7) == 0) + shape->shape[2] = strtol(word + 7, NULL, 0); else if (strcmp(word, "local") == 0) type |= CONS_LOCAL_CURSOR; else if (strcmp(word, "reset") == 0) From owner-svn-src-head@freebsd.org Sat Aug 19 14:27:12 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C4BF3DC8C14; Sat, 19 Aug 2017 14:27:12 +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 mx1.freebsd.org (Postfix) with ESMTPS id 86AD476C04; Sat, 19 Aug 2017 14:27:12 +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 v7JERBcU057521; Sat, 19 Aug 2017 14:27:11 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7JERBvn057518; Sat, 19 Aug 2017 14:27:11 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201708191427.v7JERBvn057518@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Sat, 19 Aug 2017 14:27:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322694 - in head/sys: boot/fdt/dts/arm modules/dtb/rpi X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: in head/sys: boot/fdt/dts/arm modules/dtb/rpi X-SVN-Commit-Revision: 322694 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Aug 2017 14:27:12 -0000 Author: manu Date: Sat Aug 19 14:27:11 2017 New Revision: 322694 URL: https://svnweb.freebsd.org/changeset/base/322694 Log: RPI DTS: Add value previously set by VideoCore and DTB links Using latest U-Boot for RPI 1 or 2 the DTB loaded by the firmware is discarded. The DTB was previously patched by the firmware to contain the DMA channel mask. DTB provided by the rpi firmware or DTS in the Linux tree contain the raw value directly. Do the same for our DTS as we cannot switch to the upstream ones yet. Not having the DMA channel mask setup properly cause mmc not to be detected (and probably other problems on driver using DMA). Also, add links for rpi dtb to the name used by u-boot. This way the dtb can be loaded by ubldr using the U-Boot env variable fdtfile. Tested On: RPI B Rev2, RPI Zero, RPI 2 v1.1 RPI 2 v1.2 Thanks to Sylvain Garrigues for the help. PR: 218344 Modified: head/sys/boot/fdt/dts/arm/bcm2835.dtsi head/sys/boot/fdt/dts/arm/bcm2836.dtsi head/sys/modules/dtb/rpi/Makefile Modified: head/sys/boot/fdt/dts/arm/bcm2835.dtsi ============================================================================== --- head/sys/boot/fdt/dts/arm/bcm2835.dtsi Sat Aug 19 12:14:46 2017 (r322693) +++ head/sys/boot/fdt/dts/arm/bcm2835.dtsi Sat Aug 19 14:27:11 2017 (r322694) @@ -439,7 +439,7 @@ interrupts = <24 25 26 27 28 29 30 31 32 33 34 35 36>; interrupt-parent = <&intc>; - broadcom,channels = <0>; /* Set by VideoCore */ + broadcom,channels = <0x7f35>; }; vc_mbox: mbox { Modified: head/sys/boot/fdt/dts/arm/bcm2836.dtsi ============================================================================== --- head/sys/boot/fdt/dts/arm/bcm2836.dtsi Sat Aug 19 12:14:46 2017 (r322693) +++ head/sys/boot/fdt/dts/arm/bcm2836.dtsi Sat Aug 19 14:27:11 2017 (r322694) @@ -432,7 +432,7 @@ interrupts = <24 25 26 27 28 29 30 31 32 33 34 35 36>; interrupt-parent = <&intc>; - broadcom,channels = <0>; /* Set by VideoCore */ + broadcom,channels = <0x7f35>; }; vc_mbox: mbox { Modified: head/sys/modules/dtb/rpi/Makefile ============================================================================== --- head/sys/modules/dtb/rpi/Makefile Sat Aug 19 12:14:46 2017 (r322693) +++ head/sys/modules/dtb/rpi/Makefile Sat Aug 19 14:27:11 2017 (r322694) @@ -2,4 +2,11 @@ # DTS files for the Raspberry Pi-B DTS=rpi.dts rpi2.dts +LINKS= \ + ${DTBDIR}/rpi.dtb ${DTBDIR}/bcm2835-rpi-b.dtb \ + ${DTBDIR}/rpi.dtb ${DTBDIR}/bcm2835-rpi-b-rev2.dtb \ + ${DTBDIR}/rpi.dtb ${DTBDIR}/bcm2835-rpi-b-plus.dtb \ + ${DTBDIR}/rpi.dtb ${DTBDIR}/bcm2835-rpi-zero.dtb \ + ${DTBDIR}/rpi2.dtb ${DTBDIR}/bcm2836-rpi-2-b.dtb + .include From owner-svn-src-head@freebsd.org Sat Aug 19 17:00:12 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 48FA5DD474A; Sat, 19 Aug 2017 17:00:12 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 D97B7814C7; Sat, 19 Aug 2017 17:00:11 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7JH0BvK021893; Sat, 19 Aug 2017 17:00:11 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7JH0Ao0021883; Sat, 19 Aug 2017 17:00:10 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201708191700.v7JH0Ao0021883@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sat, 19 Aug 2017 17:00:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322695 - in head: share/man/man4 sys/conf sys/dev/usb sys/dev/usb/input sys/dev/usb/quirk sys/modules/usb sys/modules/usb/wmt X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: in head: share/man/man4 sys/conf sys/dev/usb sys/dev/usb/input sys/dev/usb/quirk sys/modules/usb sys/modules/usb/wmt X-SVN-Commit-Revision: 322695 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Aug 2017 17:00:12 -0000 Author: wulf Date: Sat Aug 19 17:00:10 2017 New Revision: 322695 URL: https://svnweb.freebsd.org/changeset/base/322695 Log: Add support for generic MS Windows 7/8/10-compatible USB HID touchscreens found in many laptops. Reviewed by: hps, gonzo, bcr (manpages) Approved by: gonzo (mentor) Differential Revision: https://reviews.freebsd.org/D12017 Added: head/share/man/man4/wmt.4 (contents, props changed) head/sys/dev/usb/input/wmt.c (contents, props changed) head/sys/modules/usb/wmt/ head/sys/modules/usb/wmt/Makefile (contents, props changed) Modified: head/share/man/man4/Makefile head/share/man/man4/usb_quirk.4 head/sys/conf/files head/sys/dev/usb/quirk/usb_quirk.c head/sys/dev/usb/quirk/usb_quirk.h head/sys/dev/usb/usb_hid.c head/sys/dev/usb/usbhid.h head/sys/modules/usb/Makefile Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Sat Aug 19 14:27:11 2017 (r322694) +++ head/share/man/man4/Makefile Sat Aug 19 17:00:10 2017 (r322695) @@ -562,6 +562,7 @@ MAN= aac.4 \ wlan_tkip.4 \ wlan_wep.4 \ wlan_xauth.4 \ + wmt.4 \ ${_wpi.4} \ wsp.4 \ xe.4 \ Modified: head/share/man/man4/usb_quirk.4 ============================================================================== --- head/share/man/man4/usb_quirk.4 Sat Aug 19 14:27:11 2017 (r322694) +++ head/share/man/man4/usb_quirk.4 Sat Aug 19 17:00:10 2017 (r322695) @@ -16,7 +16,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 17, 2017 +.Dd August 19, 2017 .Dt USB_QUIRK 4 .Os .Sh NAME @@ -98,6 +98,8 @@ select configuration index 4 by default select configuration index 0 by default .It UQ_ASSUME_CM_OVER_DATA assume cm over data feature +.It UQ_WMT_IGNORE +device should be ignored by wmt driver .El .Sh USB Mass Storage quirks: .Bl -tag -width Ds Added: head/share/man/man4/wmt.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/wmt.4 Sat Aug 19 17:00:10 2017 (r322695) @@ -0,0 +1,84 @@ +.\" Copyright (c) 2014-2017 Vladimir Kondratyev +.\" 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 19, 2017 +.Dt WMT 4 +.Os +.Sh NAME +.Nm wmt +.Nd MS Windows 7/8/10 - compatible USB HID multi-touch device driver +.Sh SYNOPSIS +To compile this driver into the kernel, place the following lines into +your kernel configuration file: +.Bd -ragged -offset indent +.Cd "device wmt" +.Cd "device usb" +.Cd "device evdev" +.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 +wmt_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for the MS Windows 7/8/10 - compatible USB HID +multi-touch devices found in many laptops. +.Pp +To get multi-touch device working in +.Xr X 7 , +install +.Pa ports/x11-drivers/xf86-input-evdev . +.Sh FILES +.Nm +creates a pseudo-device file, +.Pa /dev/input/eventX +which presents the multi-touch device as an input event device. +.Sh SEE ALSO +.Xr usb 4 , +.Xr loader.conf 5 , +.Xr xorg.conf 5 Pq Pa ports/x11/xorg , +.Xr evdev 4 Pq Pa ports/x11-drivers/xf86-input-evdev . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Vladimir Kondratyev Aq Mt wulf@FreeBSD.org . +.Sh BUGS +.Nm +works only with touchscreens now. +Neither pens nor touchpads are supported. +.Pp +.Nm +cannot act like +.Xr sysmouse 4 , +as +.Xr sysmouse 4 +does not support absolute motion events. Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sat Aug 19 14:27:11 2017 (r322694) +++ head/sys/conf/files Sat Aug 19 17:00:10 2017 (r322695) @@ -3220,6 +3220,7 @@ dev/usb/input/uep.c optional uep dev/usb/input/uhid.c optional uhid dev/usb/input/ukbd.c optional ukbd dev/usb/input/ums.c optional ums +dev/usb/input/wmt.c optional wmt dev/usb/input/wsp.c optional wsp # # USB quirks Added: head/sys/dev/usb/input/wmt.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/usb/input/wmt.c Sat Aug 19 17:00:10 2017 (r322695) @@ -0,0 +1,729 @@ +/*- + * Copyright (c) 2014-2017 Vladimir Kondratyev + * 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$"); + +/* + * MS Windows 7/8/10 compatible USB HID Multi-touch Device driver. + * https://msdn.microsoft.com/en-us/library/windows/hardware/jj151569(v=vs.85).aspx + * https://www.kernel.org/doc/Documentation/input/multi-touch-protocol.txt + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "usbdevs.h" +#include +#include +#include +#include + +#include + +#include +#include + +#define USB_DEBUG_VAR wmt_debug +#include + +#ifdef USB_DEBUG +static int wmt_debug = 0; + +static SYSCTL_NODE(_hw_usb, OID_AUTO, wmt, CTLFLAG_RW, 0, + "USB MSWindows 7/8/10 compatible Multi-touch Device"); +SYSCTL_INT(_hw_usb_wmt, OID_AUTO, debug, CTLFLAG_RWTUN, + &wmt_debug, 1, "Debug level"); +#endif + +#define WMT_BSIZE 1024 /* bytes, buffer size */ + +enum { + WMT_INTR_DT, + WMT_N_TRANSFER, +}; + +enum { + WMT_TIP_SWITCH, +#define WMT_SLOT WMT_TIP_SWITCH + WMT_WIDTH, +#define WMT_MAJOR WMT_WIDTH + WMT_HEIGHT, +#define WMT_MINOR WMT_HEIGHT + WMT_ORIENTATION, + WMT_X, + WMT_Y, + WMT_CONTACTID, + WMT_PRESSURE, + WMT_IN_RANGE, + WMT_CONFIDENCE, + WMT_TOOL_X, + WMT_TOOL_Y, + WMT_N_USAGES, +}; + +#define WMT_NO_CODE (ABS_MAX + 10) +#define WMT_NO_USAGE -1 + +struct wmt_hid_map_item { + char name[5]; + int32_t usage; /* HID usage */ + uint32_t code; /* Evdev event code */ + bool required; /* Required for MT Digitizers */ +}; + +static const struct wmt_hid_map_item wmt_hid_map[WMT_N_USAGES] = { + + [WMT_TIP_SWITCH] = { /* WMT_SLOT */ + .name = "TIP", + .usage = HID_USAGE2(HUP_DIGITIZERS, HUD_TIP_SWITCH), + .code = ABS_MT_SLOT, + .required = true, + }, + [WMT_WIDTH] = { /* WMT_MAJOR */ + .name = "WDTH", + .usage = HID_USAGE2(HUP_DIGITIZERS, HUD_WIDTH), + .code = ABS_MT_TOUCH_MAJOR, + .required = false, + }, + [WMT_HEIGHT] = { /* WMT_MINOR */ + .name = "HGHT", + .usage = HID_USAGE2(HUP_DIGITIZERS, HUD_HEIGHT), + .code = ABS_MT_TOUCH_MINOR, + .required = false, + }, + [WMT_ORIENTATION] = { + .name = "ORIE", + .usage = WMT_NO_USAGE, + .code = ABS_MT_ORIENTATION, + .required = false, + }, + [WMT_X] = { + .name = "X", + .usage = HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_X), + .code = ABS_MT_POSITION_X, + .required = true, + }, + [WMT_Y] = { + .name = "Y", + .usage = HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_Y), + .code = ABS_MT_POSITION_Y, + .required = true, + }, + [WMT_CONTACTID] = { + .name = "C_ID", + .usage = HID_USAGE2(HUP_DIGITIZERS, HUD_CONTACTID), + .code = ABS_MT_TRACKING_ID, + .required = true, + }, + [WMT_PRESSURE] = { + .name = "PRES", + .usage = HID_USAGE2(HUP_DIGITIZERS, HUD_TIP_PRESSURE), + .code = ABS_MT_PRESSURE, + .required = false, + }, + [WMT_IN_RANGE] = { + .name = "RANG", + .usage = HID_USAGE2(HUP_DIGITIZERS, HUD_IN_RANGE), + .code = ABS_MT_DISTANCE, + .required = false, + }, + [WMT_CONFIDENCE] = { + .name = "CONF", + .usage = HID_USAGE2(HUP_DIGITIZERS, HUD_CONFIDENCE), + .code = WMT_NO_CODE, + .required = false, + }, + [WMT_TOOL_X] = { /* Shares HID usage with WMT_X */ + .name = "TL_X", + .usage = HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_X), + .code = ABS_MT_TOOL_X, + .required = false, + }, + [WMT_TOOL_Y] = { /* Shares HID usage with WMT_Y */ + .name = "TL_Y", + .usage = HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_Y), + .code = ABS_MT_TOOL_Y, + .required = false, + }, +}; + +struct wmt_absinfo { + int32_t min; + int32_t max; + int32_t res; +}; + +struct wmt_softc +{ + device_t dev; + struct mtx mtx; + struct wmt_absinfo ai[WMT_N_USAGES]; + struct hid_location locs[MAX_MT_SLOTS][WMT_N_USAGES]; + struct hid_location nconts_loc; + + struct usb_xfer *xfer[WMT_N_TRANSFER]; + struct evdev_dev *evdev; + + uint32_t slot_data[WMT_N_USAGES]; + uint32_t caps; + uint32_t isize; + uint32_t nconts_max; + uint8_t report_id; + + uint8_t buf[WMT_BSIZE] __aligned(4); +}; + +#define USAGE_SUPPORTED(caps, usage) ((caps) & (1 << (usage))) +#define WMT_FOREACH_USAGE(caps, usage) \ + for ((usage) = 0; (usage) < WMT_N_USAGES; ++(usage)) \ + if (USAGE_SUPPORTED((caps), (usage))) + +static bool wmt_hid_parse(struct wmt_softc *, const void *, uint16_t); + +static usb_callback_t wmt_intr_callback; + +static device_probe_t wmt_probe; +static device_attach_t wmt_attach; +static device_detach_t wmt_detach; + +static evdev_open_t wmt_ev_open; +static evdev_close_t wmt_ev_close; + +static const struct evdev_methods wmt_evdev_methods = { + .ev_open = &wmt_ev_open, + .ev_close = &wmt_ev_close, +}; + +static const struct usb_config wmt_config[WMT_N_TRANSFER] = { + + [WMT_INTR_DT] = { + .type = UE_INTERRUPT, + .endpoint = UE_ADDR_ANY, + .direction = UE_DIR_IN, + .flags = { .pipe_bof = 1, .short_xfer_ok = 1 }, + .bufsize = WMT_BSIZE, + .callback = &wmt_intr_callback, + }, +}; + +static int +wmt_probe(device_t dev) +{ + struct usb_attach_arg *uaa = device_get_ivars(dev); + void *d_ptr; + uint16_t d_len; + int err; + + if (uaa->usb_mode != USB_MODE_HOST) + return (ENXIO); + + if (uaa->info.bInterfaceClass != UICLASS_HID) + return (ENXIO); + + if (usb_test_quirk(uaa, UQ_WMT_IGNORE)) + return (ENXIO); + + err = usbd_req_get_hid_desc(uaa->device, NULL, + &d_ptr, &d_len, M_TEMP, uaa->info.bIfaceIndex); + if (err) + return (ENXIO); + + if (wmt_hid_parse(NULL, d_ptr, d_len)) + err = BUS_PROBE_DEFAULT; + else + err = ENXIO; + + free(d_ptr, M_TEMP); + return (err); +} + +static int +wmt_attach(device_t dev) +{ + struct usb_attach_arg *uaa = device_get_ivars(dev); + struct wmt_softc *sc = device_get_softc(dev); + void *d_ptr; + uint16_t d_len; + size_t i; + int err; + + device_set_usb_desc(dev); + sc->dev = dev; + + /* Get HID descriptor */ + err = usbd_req_get_hid_desc(uaa->device, NULL, + &d_ptr, &d_len, M_TEMP, uaa->info.bIfaceIndex); + if (err) { + DPRINTF("usbd_req_get_hid_desc error=%s\n", usbd_errstr(err)); + return (ENXIO); + } + + mtx_init(&sc->mtx, "wmt lock", NULL, MTX_DEF); + + /* Get HID report length */ + sc->isize = hid_report_size(d_ptr, d_len, hid_input, NULL); + if (sc->isize <= 0 || sc->isize > WMT_BSIZE) { + DPRINTF("Input size invalid or too large: %d\n", sc->isize); + goto detach; + } + + err = usbd_transfer_setup(uaa->device, &uaa->info.bIfaceIndex, + sc->xfer, wmt_config, WMT_N_TRANSFER, sc, &sc->mtx); + if (err) { + DPRINTF("usbd_transfer_setup error=%s\n", usbd_errstr(err)); + goto detach; + } + + if (!wmt_hid_parse(sc, d_ptr, d_len)) + goto detach; + + sc->evdev = evdev_alloc(); + evdev_set_name(sc->evdev, device_get_desc(dev)); + evdev_set_phys(sc->evdev, device_get_nameunit(dev)); + evdev_set_id(sc->evdev, BUS_USB, uaa->info.idVendor, + uaa->info.idProduct, 0); + evdev_set_serial(sc->evdev, usb_get_serial(uaa->device)); + evdev_set_methods(sc->evdev, sc, &wmt_evdev_methods); + evdev_set_flag(sc->evdev, EVDEV_FLAG_MT_STCOMPAT); + evdev_support_prop(sc->evdev, INPUT_PROP_DIRECT); + evdev_support_event(sc->evdev, EV_SYN); + evdev_support_event(sc->evdev, EV_ABS); + WMT_FOREACH_USAGE(sc->caps, i) { + if (wmt_hid_map[i].code != WMT_NO_CODE) + evdev_support_abs(sc->evdev, wmt_hid_map[i].code, 0, + sc->ai[i].min, sc->ai[i].max, 0, 0, sc->ai[i].res); + } + + err = evdev_register_mtx(sc->evdev, &sc->mtx); + if (err) + goto detach; + + return (0); + +detach: + free(d_ptr, M_TEMP); + wmt_detach(dev); + return (ENXIO); +} + +static int +wmt_detach(device_t dev) +{ + struct wmt_softc *sc = device_get_softc(dev); + + evdev_free(sc->evdev); + usbd_transfer_unsetup(sc->xfer, WMT_N_TRANSFER); + mtx_destroy(&sc->mtx); + return (0); +} + +static void +wmt_process_report(struct wmt_softc *sc, uint8_t *buf, int len) +{ + size_t usage; + uint32_t *slot_data = sc->slot_data; + uint32_t cont; + uint32_t nconts; + uint32_t width; + uint32_t height; + int32_t slot; + + nconts = hid_get_data_unsigned(buf, len, &sc->nconts_loc); + +#ifdef USB_DEBUG + DPRINTFN(6, "nconts = %u ", (unsigned)nconts); + if (wmt_debug >= 6) { + WMT_FOREACH_USAGE(sc->caps, usage) { + if (wmt_hid_map[usage].usage != WMT_NO_USAGE) + printf(" %-4s", wmt_hid_map[usage].name); + } + printf("\n"); + } +#endif + + if (nconts > sc->nconts_max) { + DPRINTF("Contact count overflow %u\n", (unsigned)nconts); + nconts = sc->nconts_max; + } + + /* Use protocol Type B for reporting events */ + for (cont = 0; cont < nconts; cont++) { + + bzero(slot_data, sizeof(sc->slot_data)); + WMT_FOREACH_USAGE(sc->caps, usage) { + if (sc->locs[cont][usage].size > 0) + slot_data[usage] = hid_get_data_unsigned( + buf, len, &sc->locs[cont][usage]); + } + + slot = evdev_get_mt_slot_by_tracking_id(sc->evdev, + slot_data[WMT_CONTACTID]); + +#ifdef USB_DEBUG + DPRINTFN(6, "cont%01x: data = ", cont); + if (wmt_debug >= 6) { + WMT_FOREACH_USAGE(sc->caps, usage) { + if (wmt_hid_map[usage].usage != WMT_NO_USAGE) + printf("%04x ", slot_data[usage]); + } + printf("slot = %d\n", (int)slot); + } +#endif + + if (slot == -1) { + DPRINTF("Slot overflow for contact_id %u\n", + (unsigned)slot_data[WMT_CONTACTID]); + continue; + } + + if (slot_data[WMT_TIP_SWITCH] != 0 && + !(USAGE_SUPPORTED(sc->caps, WMT_CONFIDENCE) && + slot_data[WMT_CONFIDENCE] == 0)) { + /* This finger is in proximity of the sensor */ + slot_data[WMT_SLOT] = slot; + slot_data[WMT_IN_RANGE] = !slot_data[WMT_IN_RANGE]; + /* Divided by two to match visual scale of touch */ + width = slot_data[WMT_WIDTH] >> 1; + height = slot_data[WMT_HEIGHT] >> 1; + slot_data[WMT_ORIENTATION] = width > height; + slot_data[WMT_MAJOR] = MAX(width, height); + slot_data[WMT_MINOR] = MIN(width, height); + + WMT_FOREACH_USAGE(sc->caps, usage) + if (wmt_hid_map[usage].code != WMT_NO_CODE) + evdev_push_abs(sc->evdev, + wmt_hid_map[usage].code, + slot_data[usage]); + } else { + evdev_push_abs(sc->evdev, ABS_MT_SLOT, slot); + evdev_push_abs(sc->evdev, ABS_MT_TRACKING_ID, -1); + } + } + evdev_sync(sc->evdev); +} + +static void +wmt_intr_callback(struct usb_xfer *xfer, usb_error_t error) +{ + struct wmt_softc *sc = usbd_xfer_softc(xfer); + struct usb_page_cache *pc; + uint8_t *buf = sc->buf; + int len; + + usbd_xfer_status(xfer, &len, NULL, NULL, NULL); + + switch (USB_GET_STATE(xfer)) { + case USB_ST_TRANSFERRED: + pc = usbd_xfer_get_frame(xfer, 0); + + DPRINTFN(6, "sc=%p actlen=%d\n", sc, len); + + if (len >= (int)sc->isize || (len > 0 && sc->report_id != 0)) { + /* Limit report length to the maximum */ + if (len > (int)sc->isize) + len = sc->isize; + + usbd_copy_out(pc, 0, buf, len); + + /* Ignore irrelevant reports */ + if (sc->report_id && *buf != sc->report_id) + goto tr_ignore; + + /* Make sure we don't process old data */ + if (len < sc->isize) + bzero(buf + len, sc->isize - len); + + /* Strip leading "report ID" byte */ + if (sc->report_id) { + len--; + buf++; + } + + wmt_process_report(sc, buf, len); + } else { +tr_ignore: + DPRINTF("Ignored transfer, %d bytes\n", len); + } + + case USB_ST_SETUP: +tr_setup: + usbd_xfer_set_frame_len(xfer, 0, sc->isize); + usbd_transfer_submit(xfer); + break; + default: + if (error != USB_ERR_CANCELLED) { + /* Try clear stall first */ + usbd_xfer_set_stall(xfer); + goto tr_setup; + } + break; + } +} + +static void +wmt_ev_close(struct evdev_dev *evdev, void *ev_softc) +{ + struct wmt_softc *sc = (struct wmt_softc *)ev_softc; + + mtx_assert(&sc->mtx, MA_OWNED); + usbd_transfer_stop(sc->xfer[WMT_INTR_DT]); +} + +static int +wmt_ev_open(struct evdev_dev *evdev, void *ev_softc) +{ + struct wmt_softc *sc = (struct wmt_softc *)ev_softc; + + mtx_assert(&sc->mtx, MA_OWNED); + usbd_transfer_start(sc->xfer[WMT_INTR_DT]); + + return (0); +} + +static bool +wmt_hid_parse(struct wmt_softc *sc, const void *d_ptr, uint16_t d_len) +{ + struct hid_item hi; + struct hid_data *hd; + size_t i; + size_t cont = 0; + uint32_t caps = 0; + int32_t cont_count_max = 0; + uint8_t report_id = 0; + bool touch_coll = false; + bool finger_coll = false; + bool cont_count_found = false; + bool scan_time_found = false; + +#define WMT_HI_ABSOLUTE(hi) \ + (((hi).flags & (HIO_CONST|HIO_VARIABLE|HIO_RELATIVE)) == HIO_VARIABLE) + + /* Parse features for maximum contact count */ + hd = hid_start_parse(d_ptr, d_len, 1 << hid_feature); + while (hid_get_item(hd, &hi)) { + switch (hi.kind) { + case hid_collection: + if (hi.collevel == 1 && hi.usage == + HID_USAGE2(HUP_DIGITIZERS, HUD_TOUCHSCREEN)) + touch_coll = true; + break; + case hid_endcollection: + if (hi.collevel == 0 && touch_coll) + touch_coll = false; + break; + case hid_feature: + if (hi.collevel == 1 && touch_coll && + WMT_HI_ABSOLUTE(hi) && hi.usage == + HID_USAGE2(HUP_DIGITIZERS, HUD_CONTACT_MAX)) + cont_count_max = hi.logical_maximum; + break; + default: + break; + } + } + hid_end_parse(hd); + + /* Maximum contact count is required usage */ + if (cont_count_max < 1) + return (false); + + touch_coll = false; + + /* Parse input for other parameters */ + hd = hid_start_parse(d_ptr, d_len, 1 << hid_input); + while (hid_get_item(hd, &hi)) { + switch (hi.kind) { + case hid_collection: + if (hi.collevel == 1 && hi.usage == + HID_USAGE2(HUP_DIGITIZERS, HUD_TOUCHSCREEN)) + touch_coll = true; + else if (touch_coll && hi.collevel == 2 && + (report_id == 0 || report_id == hi.report_ID) && + hi.usage == HID_USAGE2(HUP_DIGITIZERS, HUD_FINGER)) + finger_coll = true; + break; + case hid_endcollection: + if (hi.collevel == 1 && finger_coll) { + finger_coll = false; + cont++; + } else if (hi.collevel == 0 && touch_coll) + touch_coll = false; + break; + case hid_input: + /* + * Ensure that all usages are located within the same + * report and proper collection. + */ + if (WMT_HI_ABSOLUTE(hi) && touch_coll && + (report_id == 0 || report_id == hi.report_ID)) + report_id = hi.report_ID; + else + break; + + if (hi.collevel == 1 && hi.usage == + HID_USAGE2(HUP_DIGITIZERS, HUD_CONTACTCOUNT)) { + cont_count_found = true; + if (sc != NULL) + sc->nconts_loc = hi.loc; + break; + } + /* Scan time is required but clobbered by evdev */ + if (hi.collevel == 1 && hi.usage == + HID_USAGE2(HUP_DIGITIZERS, HUD_SCAN_TIME)) { + scan_time_found = true; + break; + } + + if (!finger_coll || hi.collevel != 2) + break; + if (sc == NULL && cont > 0) + break; + if (cont >= MAX_MT_SLOTS) { + DPRINTF("Finger %zu ignored\n", cont); + break; + } + + for (i = 0; i < WMT_N_USAGES; i++) { + if (hi.usage == wmt_hid_map[i].usage) { + if (sc == NULL) { + if (USAGE_SUPPORTED(caps, i)) + continue; + caps |= 1 << i; + break; + } + /* + * HUG_X usage is an array mapped to + * both ABS_MT_POSITION and ABS_MT_TOOL + * events. So don`t stop search if we + * already have HUG_X mapping done. + */ + if (sc->locs[cont][i].size) + continue; + sc->locs[cont][i] = hi.loc; + /* + * Hid parser returns valid logical and + * physical sizes for first finger only + * at least on ElanTS 0x04f3:0x0012. + */ + if (cont > 0) + break; + caps |= 1 << i; + sc->ai[i] = (struct wmt_absinfo) { + .max = hi.logical_maximum, + .min = hi.logical_minimum, + .res = hid_item_resolution(&hi), + }; + break; + } + } + break; + default: + break; + } + } + hid_end_parse(hd); + + /* Check for required HID Usages */ + if (!cont_count_found || !scan_time_found || cont == 0) + return (false); + for (i = 0; i < WMT_N_USAGES; i++) { + if (wmt_hid_map[i].required && !USAGE_SUPPORTED(caps, i)) + return (false); + } + + /* Stop probing here */ + if (sc == NULL) + return (true); + + /* Cap contact count maximum to MAX_MT_SLOTS */ + if (cont_count_max > MAX_MT_SLOTS) { + DPRINTF("Hardware reported %d contacts while only %d is " + "supported\n", (int)cont_count_max, MAX_MT_SLOTS); + cont_count_max = MAX_MT_SLOTS; + } + + /* Set number of MT protocol type B slots */ + sc->ai[WMT_SLOT] = (struct wmt_absinfo) { + .min = 0, + .max = cont_count_max - 1, + .res = 0, + }; + + /* Report touch orientation if both width and height are supported */ + if (USAGE_SUPPORTED(caps, WMT_WIDTH) && + USAGE_SUPPORTED(caps, WMT_HEIGHT)) { + caps |= (1 << WMT_ORIENTATION); + sc->ai[WMT_ORIENTATION].max = 1; + } + + sc->report_id = report_id; + sc->caps = caps; + sc->nconts_max = cont; + + /* Announce information about the touch device */ + device_printf(sc->dev, + "%d contacts and [%s%s%s%s%s]. Report range [%d:%d] - [%d:%d]\n", + (int)cont_count_max, + USAGE_SUPPORTED(sc->caps, WMT_IN_RANGE) ? "R" : "", + USAGE_SUPPORTED(sc->caps, WMT_CONFIDENCE) ? "C" : "", + USAGE_SUPPORTED(sc->caps, WMT_WIDTH) ? "W" : "", + USAGE_SUPPORTED(sc->caps, WMT_HEIGHT) ? "H" : "", + USAGE_SUPPORTED(sc->caps, WMT_PRESSURE) ? "P" : "", + (int)sc->ai[WMT_X].min, (int)sc->ai[WMT_Y].min, + (int)sc->ai[WMT_X].max, (int)sc->ai[WMT_Y].max); + return (true); +} + +static devclass_t wmt_devclass; + +static device_method_t wmt_methods[] = { + DEVMETHOD(device_probe, wmt_probe), + DEVMETHOD(device_attach, wmt_attach), + DEVMETHOD(device_detach, wmt_detach), + + DEVMETHOD_END +}; + +static driver_t wmt_driver = { + .name = "wmt", + .methods = wmt_methods, + .size = sizeof(struct wmt_softc), +}; + +DRIVER_MODULE(wmt, uhub, wmt_driver, wmt_devclass, NULL, 0); +MODULE_DEPEND(wmt, usb, 1, 1, 1); +MODULE_DEPEND(wmt, evdev, 1, 1, 1); +MODULE_VERSION(wmt, 1); Modified: head/sys/dev/usb/quirk/usb_quirk.c ============================================================================== --- head/sys/dev/usb/quirk/usb_quirk.c Sat Aug 19 14:27:11 2017 (r322694) +++ head/sys/dev/usb/quirk/usb_quirk.c Sat Aug 19 17:00:10 2017 (r322695) @@ -606,6 +606,7 @@ static const char *usb_quirk_str[USB_QUIRK_MAX] = { [UQ_SINGLE_CMD_MIDI] = "UQ_SINGLE_CMD_MIDI", [UQ_MSC_DYMO_EJECT] = "UQ_MSC_DYMO_EJECT", [UQ_AU_SET_SPDIF_CM6206] = "UQ_AU_SET_SPDIF_CM6206", + [UQ_WMT_IGNORE] = "UQ_WMT_IGNORE", }; /*------------------------------------------------------------------------* Modified: head/sys/dev/usb/quirk/usb_quirk.h ============================================================================== --- head/sys/dev/usb/quirk/usb_quirk.h Sat Aug 19 14:27:11 2017 (r322694) +++ head/sys/dev/usb/quirk/usb_quirk.h Sat Aug 19 17:00:10 2017 (r322695) @@ -110,6 +110,7 @@ enum { UQ_SINGLE_CMD_MIDI, /* at most one command per USB packet */ UQ_MSC_DYMO_EJECT, /* ejects Dymo MSC device */ UQ_AU_SET_SPDIF_CM6206, /* enable S/PDIF audio output */ + UQ_WMT_IGNORE, /* device should be ignored by wmt driver */ USB_QUIRK_MAX }; Modified: head/sys/dev/usb/usb_hid.c ============================================================================== --- head/sys/dev/usb/usb_hid.c Sat Aug 19 14:27:11 2017 (r322694) +++ head/sys/dev/usb/usb_hid.c Sat Aug 19 17:00:10 2017 (r322695) @@ -849,6 +849,80 @@ usbd_req_get_hid_desc(struct usb_device *udev, struct } /*------------------------------------------------------------------------* + * calculate HID item resolution. unit/mm for distances, unit/rad for angles + *------------------------------------------------------------------------*/ +int32_t +hid_item_resolution(struct hid_item *hi) +{ + /* + * hid unit scaling table according to HID Usage Table Review + * Request 39 Tbl 17 http://www.usb.org/developers/hidpage/HUTRR39b.pdf + */ + static const int64_t scale[0x10][2] = { + [0x00] = { 1, 1 }, + [0x01] = { 1, 10 }, + [0x02] = { 1, 100 }, + [0x03] = { 1, 1000 }, + [0x04] = { 1, 10000 }, + [0x05] = { 1, 100000 }, + [0x06] = { 1, 1000000 }, + [0x07] = { 1, 10000000 }, + [0x08] = { 100000000, 1 }, + [0x09] = { 10000000, 1 }, + [0x0A] = { 1000000, 1 }, + [0x0B] = { 100000, 1 }, + [0x0C] = { 10000, 1 }, + [0x0D] = { 1000, 1 }, + [0x0E] = { 100, 1 }, + [0x0F] = { 10, 1 }, + }; + int64_t logical_size; + int64_t physical_size; + int64_t multiplier; + int64_t divisor; + int64_t resolution; + + switch (hi->unit) { + case HUM_CENTIMETER: + multiplier = 1; + divisor = 10; + break; + case HUM_INCH: + multiplier = 10; + divisor = 254; + break; + case HUM_RADIAN: + multiplier = 1; + divisor = 1; + break; + case HUM_DEGREE: + multiplier = 573; + divisor = 10; + break; + default: + return (0); + } + + if ((hi->logical_maximum <= hi->logical_minimum) || + (hi->physical_maximum <= hi->physical_minimum) || + (hi->unit_exponent < 0) || (hi->unit_exponent >= nitems(scale))) + return (0); + + logical_size = (int64_t)hi->logical_maximum - + (int64_t)hi->logical_minimum; + physical_size = (int64_t)hi->physical_maximum - + (int64_t)hi->physical_minimum; + /* Round to ceiling */ + resolution = logical_size * multiplier * scale[hi->unit_exponent][0] / + (physical_size * divisor * scale[hi->unit_exponent][1]); + + if (resolution > INT32_MAX) + return (0); + + return (resolution); +} + +/*------------------------------------------------------------------------* * hid_is_mouse * * This function will decide if a USB descriptor belongs to a USB mouse. Modified: head/sys/dev/usb/usbhid.h ============================================================================== --- head/sys/dev/usb/usbhid.h Sat Aug 19 14:27:11 2017 (r322694) +++ head/sys/dev/usb/usbhid.h Sat Aug 19 17:00:10 2017 (r322695) @@ -134,6 +134,12 @@ struct usb_hid_descriptor { /* Usages Digitizers */ #define HUD_UNDEFINED 0x0000 +#define HUD_DIGITIZER 0x0001 +#define HUD_PEN 0x0002 +#define HUD_TOUCHSCREEN 0x0004 +#define HUD_TOUCHPAD 0x0005 +#define HUD_CONFIG 0x000e +#define HUD_FINGER 0x0022 #define HUD_TIP_PRESSURE 0x0030 #define HUD_BARREL_PRESSURE 0x0031 #define HUD_IN_RANGE 0x0032 @@ -157,6 +163,16 @@ struct usb_hid_descriptor { #define HUD_BARREL_SWITCH 0x0044 #define HUD_ERASER 0x0045 #define HUD_TABLET_PICK 0x0046 +#define HUD_CONFIDENCE 0x0047 +#define HUD_WIDTH 0x0048 +#define HUD_HEIGHT 0x0049 +#define HUD_CONTACTID 0x0051 +#define HUD_INPUT_MODE 0x0052 +#define HUD_DEVICE_INDEX 0x0053 +#define HUD_CONTACTCOUNT 0x0054 +#define HUD_CONTACT_MAX 0x0055 +#define HUD_SCAN_TIME 0x0056 +#define HUD_BUTTON_TYPE 0x0059 /* Usages, Consumer */ #define HUC_AC_PAN 0x0238 @@ -178,6 +194,12 @@ struct usb_hid_descriptor { #define HIO_VOLATILE 0x080 #define HIO_BUFBYTES 0x100 +/* Units of Measure */ +#define HUM_CENTIMETER 0x11 *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Sat Aug 19 17:00:54 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 821D7DD4836; Sat, 19 Aug 2017 17:00:54 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.blih.net", Issuer "mail.blih.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id BC66B81778; Sat, 19 Aug 2017 17:00:53 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) by mail.blih.net (OpenSMTPD) with ESMTP id 94f204b5; Sat, 19 Aug 2017 19:00:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=bidouilliste.com; h=date :from:to:subject:message-id:in-reply-to:references:mime-version :content-type:content-transfer-encoding; s=mail; bh=lWHP3hnZTgLM vwfEHY72uO0r1zE=; b=K5wzMMeMWkN4aMACymE9eP7J0ICCRq/f2Ok9PxySsFC9 vBumhZ7U7ONhfBLZb0oqo8o5P5zSt34o+92MAWb8G82flDjwoJzRuqfg6PNdLCLj VJuAKTS+r/5uOMnzyumcYTWrM4l23/sqJfVZsNLGnNukyy5EnkN7Pp0Xp132q3A= DomainKey-Signature: a=rsa-sha1; c=nofws; d=bidouilliste.com; h=date :from:to:subject:message-id:in-reply-to:references:mime-version :content-type:content-transfer-encoding; q=dns; s=mail; b=alTRPv JC1GzxdSJHZyIfOQM0bnibNl+Kp6vCpogKI2/MIe59OV2xSDLiVwFQPxl2SaKVEJ leFyLFDMZrj2QlKSsVXVUy6Xra+XXv+YZF9Y1NIIvZfjKZx5dVA+gLGbhKcz2cFl NjBZ23KjfH/UFRRARaD6YRfSnm5vF57nzKKx4= Received: from knuckles.blih.net (ip-54.net-82-216-203.roubaix.rev.numericable.fr [82.216.203.54]) by mail.blih.net (OpenSMTPD) with ESMTPSA id 6b90dd84 TLS version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO; Sat, 19 Aug 2017 19:00:44 +0200 (CEST) Date: Sat, 19 Aug 2017 19:00:40 +0200 From: Emmanuel Vadot To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r322694 - in head/sys: boot/fdt/dts/arm modules/dtb/rpi Message-Id: <20170819190040.e9b7e90fd5a158ed439ff952@bidouilliste.com> In-Reply-To: <201708191427.v7JERBvn057518@repo.freebsd.org> References: <201708191427.v7JERBvn057518@repo.freebsd.org> X-Mailer: Sylpheed 3.6.0 (GTK+ 2.24.31; amd64-portbld-freebsd12.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Aug 2017 17:00:54 -0000 On Sat, 19 Aug 2017 14:27:11 +0000 (UTC) Emmanuel Vadot wrote: > Author: manu > Date: Sat Aug 19 14:27:11 2017 > New Revision: 322694 > URL: https://svnweb.freebsd.org/changeset/base/322694 > > Log: > RPI DTS: Add value previously set by VideoCore and DTB links > > Using latest U-Boot for RPI 1 or 2 the DTB loaded by the firmware is discarded. > The DTB was previously patched by the firmware to contain the DMA channel mask. > DTB provided by the rpi firmware or DTS in the Linux tree contain the raw value > directly. Do the same for our DTS as we cannot switch to the upstream ones yet. > Not having the DMA channel mask setup properly cause mmc not to be detected > (and probably other problems on driver using DMA). > > Also, add links for rpi dtb to the name used by u-boot. This way the dtb can be > loaded by ubldr using the U-Boot env variable fdtfile. > > Tested On: RPI B Rev2, RPI Zero, RPI 2 v1.1 RPI 2 v1.2 > > Thanks to Sylvain Garrigues for the help. > > PR: 218344 MFC after: 3 days > Modified: > head/sys/boot/fdt/dts/arm/bcm2835.dtsi > head/sys/boot/fdt/dts/arm/bcm2836.dtsi > head/sys/modules/dtb/rpi/Makefile > > Modified: head/sys/boot/fdt/dts/arm/bcm2835.dtsi > ============================================================================== > --- head/sys/boot/fdt/dts/arm/bcm2835.dtsi Sat Aug 19 12:14:46 2017 (r322693) > +++ head/sys/boot/fdt/dts/arm/bcm2835.dtsi Sat Aug 19 14:27:11 2017 (r322694) > @@ -439,7 +439,7 @@ > interrupts = <24 25 26 27 28 29 30 31 32 33 34 35 36>; > interrupt-parent = <&intc>; > > - broadcom,channels = <0>; /* Set by VideoCore */ > + broadcom,channels = <0x7f35>; > }; > > vc_mbox: mbox { > > Modified: head/sys/boot/fdt/dts/arm/bcm2836.dtsi > ============================================================================== > --- head/sys/boot/fdt/dts/arm/bcm2836.dtsi Sat Aug 19 12:14:46 2017 (r322693) > +++ head/sys/boot/fdt/dts/arm/bcm2836.dtsi Sat Aug 19 14:27:11 2017 (r322694) > @@ -432,7 +432,7 @@ > interrupts = <24 25 26 27 28 29 30 31 32 33 34 35 36>; > interrupt-parent = <&intc>; > > - broadcom,channels = <0>; /* Set by VideoCore */ > + broadcom,channels = <0x7f35>; > }; > > vc_mbox: mbox { > > Modified: head/sys/modules/dtb/rpi/Makefile > ============================================================================== > --- head/sys/modules/dtb/rpi/Makefile Sat Aug 19 12:14:46 2017 (r322693) > +++ head/sys/modules/dtb/rpi/Makefile Sat Aug 19 14:27:11 2017 (r322694) > @@ -2,4 +2,11 @@ > # DTS files for the Raspberry Pi-B > DTS=rpi.dts rpi2.dts > > +LINKS= \ > + ${DTBDIR}/rpi.dtb ${DTBDIR}/bcm2835-rpi-b.dtb \ > + ${DTBDIR}/rpi.dtb ${DTBDIR}/bcm2835-rpi-b-rev2.dtb \ > + ${DTBDIR}/rpi.dtb ${DTBDIR}/bcm2835-rpi-b-plus.dtb \ > + ${DTBDIR}/rpi.dtb ${DTBDIR}/bcm2835-rpi-zero.dtb \ > + ${DTBDIR}/rpi2.dtb ${DTBDIR}/bcm2836-rpi-2-b.dtb > + > .include -- Emmanuel Vadot From owner-svn-src-head@freebsd.org Sat Aug 19 17:10:19 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 58BA9DD55E2; Sat, 19 Aug 2017 17:10:19 +0000 (UTC) (envelope-from vladimir@kondratyev.su) Received: from corp.infotel.ru (corp.infotel.ru [195.170.219.3]) by mx1.freebsd.org (Postfix) with ESMTP id 0E81681D75; Sat, 19 Aug 2017 17:10:18 +0000 (UTC) (envelope-from vladimir@kondratyev.su) Received: from corp (corp.infotel.ru [195.170.219.3]) by corp.infotel.ru (Postfix) with ESMTP id A86EEF1E4; Sat, 19 Aug 2017 20:10:07 +0300 (MSK) X-Virus-Scanned: amavisd-new at corp.infotel.ru Received: from corp.infotel.ru ([195.170.219.3]) by corp (corp.infotel.ru [195.170.219.3]) (amavisd-new, port 10024) with ESMTP id XuP1t4OZCLd7; Sat, 19 Aug 2017 20:10:06 +0300 (MSK) Received: from mail.cicgroup.ru (unknown [195.170.219.74]) by corp.infotel.ru (Postfix) with ESMTP id D4CA9F1DE; Sat, 19 Aug 2017 20:10:06 +0300 (MSK) Received: from mail.cicgroup.ru (localhost [127.0.0.1]) by mail.cicgroup.ru (Postfix) with ESMTP id 9C0903AC8F1; Sat, 19 Aug 2017 20:10:02 +0300 (MSK) X-Virus-Scanned: amavisd-new at cicgroup.ru Received: from mail.cicgroup.ru ([127.0.0.1]) by mail.cicgroup.ru (mail.cicgroup.ru [127.0.0.1]) (amavisd-new, port 10024) with SMTP id zeX4N1mE8TWp; Sat, 19 Aug 2017 20:09:55 +0300 (MSK) Received: from localhost (localhost [127.0.0.1]) by mail.cicgroup.ru (Postfix) with ESMTPA id BF4FD3AC8EA; Sat, 19 Aug 2017 20:09:55 +0300 (MSK) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Sat, 19 Aug 2017 20:09:55 +0300 From: Vladimir Kondratyev To: svn-src-head@freebsd.org Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, owner-src-committers@freebsd.org Subject: Re: svn commit: r322695 - in head: share/man/man4 sys/conf sys/dev/usb sys/dev/usb/input sys/dev/usb/quirk sys/modules/usb sys/modules/usb/wmt In-Reply-To: <201708191700.v7JH0Ao0021883@repo.freebsd.org> References: <201708191700.v7JH0Ao0021883@repo.freebsd.org> Message-ID: X-Sender: vladimir@kondratyev.su User-Agent: Roundcube Webmail/1.2.5 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Aug 2017 17:10:19 -0000 On 2017-08-19 20:00, Vladimir Kondratyev wrote: > Author: wulf > Date: Sat Aug 19 17:00:10 2017 > New Revision: 322695 > URL: https://svnweb.freebsd.org/changeset/base/322695 > > Log: > Add support for generic MS Windows 7/8/10-compatible USB HID > touchscreens > found in many laptops. > > Reviewed by: hps, gonzo, bcr (manpages) > Approved by: gonzo (mentor) > Differential Revision: https://reviews.freebsd.org/D12017 MFC after: 2 weeks From owner-svn-src-head@freebsd.org Sat Aug 19 17:15:42 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 22CC2DD5D60; Sat, 19 Aug 2017 17:15:42 +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 mx1.freebsd.org (Postfix) with ESMTPS id E5ED8822E2; Sat, 19 Aug 2017 17:15:41 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7JHFfub030132; Sat, 19 Aug 2017 17:15:41 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7JHFeUN030128; Sat, 19 Aug 2017 17:15:40 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201708191715.v7JHFeUN030128@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Sat, 19 Aug 2017 17:15:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322696 - in head/sys: conf modules/armv8crypto X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: in head/sys: conf modules/armv8crypto X-SVN-Commit-Revision: 322696 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Aug 2017 17:15:42 -0000 Author: andrew Date: Sat Aug 19 17:15:40 2017 New Revision: 322696 URL: https://svnweb.freebsd.org/changeset/base/322696 Log: Use armv8-a in -march, it is accepted by both clang and gcc. Sponsored by: DARPA, AFRL Modified: head/sys/conf/files.arm64 head/sys/modules/armv8crypto/Makefile Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Sat Aug 19 17:00:10 2017 (r322695) +++ head/sys/conf/files.arm64 Sat Aug 19 17:15:40 2017 (r322696) @@ -146,7 +146,7 @@ contrib/vchiq/interface/vchiq_arm/vchiq_util.c optiona crypto/armv8/armv8_crypto.c optional armv8crypto armv8_crypto_wrap.o optional armv8crypto \ dependency "$S/crypto/armv8/armv8_crypto_wrap.c" \ - compile-with "${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc:N-mgeneral-regs-only} ${WERROR} ${NO_WCAST_QUAL} ${PROF} -march=armv8a+crypto ${.IMPSRC}" \ + compile-with "${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc:N-mgeneral-regs-only} ${WERROR} ${NO_WCAST_QUAL} ${PROF} -march=armv8-a+crypto ${.IMPSRC}" \ no-implicit-rule \ clean "armv8_crypto_wrap.o" crypto/blowfish/bf_enc.c optional crypto | ipsec | ipsec_support Modified: head/sys/modules/armv8crypto/Makefile ============================================================================== --- head/sys/modules/armv8crypto/Makefile Sat Aug 19 17:00:10 2017 (r322695) +++ head/sys/modules/armv8crypto/Makefile Sat Aug 19 17:15:40 2017 (r322696) @@ -12,7 +12,7 @@ OBJS+= armv8_crypto_wrap.o armv8_crypto_wrap.o: armv8_crypto_wrap.c ${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc:N-mgeneral-regs-only} \ ${WERROR} ${PROF} \ - -march=armv8a+crypto ${.IMPSRC} + -march=armv8-a+crypto ${.IMPSRC} ${CTFCONVERT_CMD} armv8_crypto_wrap.o: armv8_crypto.h From owner-svn-src-head@freebsd.org Sat Aug 19 17:18:28 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AD581DD613D; Sat, 19 Aug 2017 17:18:28 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7C6DC82584; Sat, 19 Aug 2017 17:18:28 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7JHIRdc030277; Sat, 19 Aug 2017 17:18:27 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7JHIRLI030275; Sat, 19 Aug 2017 17:18:27 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201708191718.v7JHIRLI030275@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Sat, 19 Aug 2017 17:18:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322697 - in head/sys/dev: extres/hwreset pci X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: in head/sys/dev: extres/hwreset pci X-SVN-Commit-Revision: 322697 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Aug 2017 17:18:28 -0000 Author: andrew Date: Sat Aug 19 17:18:27 2017 New Revision: 322697 URL: https://svnweb.freebsd.org/changeset/base/322697 Log: Remove redundant declarations. Newer gcc has a warning for these so will fail when building with -Werror. Sponsored by: DARPA, AFRL Modified: head/sys/dev/extres/hwreset/hwreset.h head/sys/dev/pci/pci_host_generic.h Modified: head/sys/dev/extres/hwreset/hwreset.h ============================================================================== --- head/sys/dev/extres/hwreset/hwreset.h Sat Aug 19 17:15:40 2017 (r322696) +++ head/sys/dev/extres/hwreset/hwreset.h Sat Aug 19 17:18:27 2017 (r322697) @@ -40,8 +40,6 @@ typedef struct hwreset *hwreset_t; * Provider interface */ #ifdef FDT -int hwreset_default_ofw_map(device_t provider_dev, phandle_t xref, int ncells, - pcell_t *cells, intptr_t *id); void hwreset_register_ofw_provider(device_t provider_dev); void hwreset_unregister_ofw_provider(device_t provider_dev); #endif Modified: head/sys/dev/pci/pci_host_generic.h ============================================================================== --- head/sys/dev/pci/pci_host_generic.h Sat Aug 19 17:15:40 2017 (r322696) +++ head/sys/dev/pci/pci_host_generic.h Sat Aug 19 17:18:27 2017 (r322697) @@ -66,8 +66,6 @@ struct generic_pcie_core_softc { DECLARE_CLASS(generic_pcie_core_driver); -struct resource *pci_host_generic_core_alloc_resource(device_t, - device_t, int, int *, rman_res_t, rman_res_t, rman_res_t, u_int); int pci_host_generic_core_attach(device_t); struct resource *pci_host_generic_core_alloc_resource(device_t, device_t, int, int *, rman_res_t, rman_res_t, rman_res_t, u_int); From owner-svn-src-head@freebsd.org Sat Aug 19 19:33:18 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 01E6EDDF431; Sat, 19 Aug 2017 19:33:18 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D1FC82770; Sat, 19 Aug 2017 19:33:17 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7JJXGPD087683; Sat, 19 Aug 2017 19:33:16 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7JJXGju087677; Sat, 19 Aug 2017 19:33:16 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201708191933.v7JJXGju087677@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Sat, 19 Aug 2017 19:33:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322705 - in head/sys: arm/arm dev/syscons isa mips/mips powerpc/powerpc X-SVN-Group: head X-SVN-Commit-Author: bde X-SVN-Commit-Paths: in head/sys: arm/arm dev/syscons isa mips/mips powerpc/powerpc X-SVN-Commit-Revision: 322705 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Aug 2017 19:33:18 -0000 Author: bde Date: Sat Aug 19 19:33:16 2017 New Revision: 322705 URL: https://svnweb.freebsd.org/changeset/base/322705 Log: Use better hard-coded defaults for the cursor shape, and remove nearby redundant initializations. Hard-code base = 0, height = (approx. 1/8 of the boot-time font height) in all cases, and remove the BIOS/MD support for setting these values. This asks for an underline cursor sized for the boot-time font instead of various less hard-coded but worse values. I used that think that the x86 BIOS always gave the same values as the above hard-coding, but on 1 of my systems it gives the wrong value of base = 1. The remaining BIOS fields are shift_state and bell_pitch. These are now consistently not explicitly reinitialized to 0. All sc_get_bios_value() functions except x86's are now empty, and the only useful thing that x86 returns is shift_state. This really belongs in atkbdc, but heavier use of the BIOS to read the more useful typematic rate has been removed there. fb still makes much heavier use of the BIOS. Modified: head/sys/arm/arm/sc_machdep.c head/sys/dev/syscons/syscons.c head/sys/dev/syscons/syscons.h head/sys/isa/syscons_isa.c head/sys/mips/mips/sc_machdep.c head/sys/powerpc/powerpc/sc_machdep.c Modified: head/sys/arm/arm/sc_machdep.c ============================================================================== --- head/sys/arm/arm/sc_machdep.c Sat Aug 19 19:06:40 2017 (r322704) +++ head/sys/arm/arm/sc_machdep.c Sat Aug 19 19:33:16 2017 (r322705) @@ -78,9 +78,6 @@ sc_get_softc(int unit, int flags) void sc_get_bios_values(bios_values_t *values) { - values->cursor_start = 0; - values->cursor_end = 32; - values->shift_state = 0; } int Modified: head/sys/dev/syscons/syscons.c ============================================================================== --- head/sys/dev/syscons/syscons.c Sat Aug 19 19:06:40 2017 (r322704) +++ head/sys/dev/syscons/syscons.c Sat Aug 19 19:33:16 2017 (r322705) @@ -3208,14 +3208,8 @@ scinit(int unit, int flags) scp->cursor_pos = scp->cursor_oldpos = row*scp->xsize + col; (*scp->tsw->te_sync)(scp); - /* Sync BIOS cursor shape to s/w (sc only). */ - if (bios_value.cursor_end < scp->font_size) - sc->dflt_curs_attr.base = scp->font_size - - bios_value.cursor_end - 1; - else - sc->dflt_curs_attr.base = 0; - i = bios_value.cursor_end - bios_value.cursor_start + 1; - sc->dflt_curs_attr.height = imin(i, scp->font_size); + sc->dflt_curs_attr.base = 0; + sc->dflt_curs_attr.height = howmany(scp->font_size, 8); sc->dflt_curs_attr.flags = 0; sc->curs_attr = sc->dflt_curs_attr; scp->curr_curs_attr = scp->dflt_curs_attr = sc->curs_attr; Modified: head/sys/dev/syscons/syscons.h ============================================================================== --- head/sys/dev/syscons/syscons.h Sat Aug 19 19:06:40 2017 (r322704) +++ head/sys/dev/syscons/syscons.h Sat Aug 19 19:33:16 2017 (r322705) @@ -516,8 +516,6 @@ typedef struct sc_renderer { SI_SUB_DRIVERS, SI_ORDER_MIDDLE) typedef struct { - int cursor_start; - int cursor_end; int shift_state; int bell_pitch; } bios_values_t; Modified: head/sys/isa/syscons_isa.c ============================================================================== --- head/sys/isa/syscons_isa.c Sat Aug 19 19:06:40 2017 (r322704) +++ head/sys/isa/syscons_isa.c Sat Aug 19 19:33:16 2017 (r322705) @@ -207,17 +207,11 @@ sc_get_bios_values(bios_values_t *values) #if defined(__i386__) || defined(__amd64__) uint8_t shift; - values->cursor_start = *(uint8_t *)BIOS_PADDRTOVADDR(0x461); - values->cursor_end = *(uint8_t *)BIOS_PADDRTOVADDR(0x460); shift = *(uint8_t *)BIOS_PADDRTOVADDR(0x417); values->shift_state = ((shift & BIOS_CLKED) != 0 ? CLKED : 0) | ((shift & BIOS_NLKED) != 0 ? NLKED : 0) | ((shift & BIOS_SLKED) != 0 ? SLKED : 0) | ((shift & BIOS_ALKED) != 0 ? ALKED : 0); -#else - values->cursor_start = 0; - values->cursor_end = 32; - values->shift_state = 0; #endif values->bell_pitch = BELL_PITCH; } Modified: head/sys/mips/mips/sc_machdep.c ============================================================================== --- head/sys/mips/mips/sc_machdep.c Sat Aug 19 19:06:40 2017 (r322704) +++ head/sys/mips/mips/sc_machdep.c Sat Aug 19 19:33:16 2017 (r322705) @@ -78,9 +78,6 @@ sc_get_softc(int unit, int flags) void sc_get_bios_values(bios_values_t *values) { - values->cursor_start = 0; - values->cursor_end = 32; - values->shift_state = 0; } int Modified: head/sys/powerpc/powerpc/sc_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/sc_machdep.c Sat Aug 19 19:06:40 2017 (r322704) +++ head/sys/powerpc/powerpc/sc_machdep.c Sat Aug 19 19:33:16 2017 (r322705) @@ -78,9 +78,6 @@ sc_get_softc(int unit, int flags) void sc_get_bios_values(bios_values_t *values) { - values->cursor_start = 0; - values->cursor_end = 32; - values->shift_state = 0; } int From owner-svn-src-head@freebsd.org Sat Aug 19 21:00:04 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2B3D9DE435D; Sat, 19 Aug 2017 21:00:04 +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 mx1.freebsd.org (Postfix) with ESMTPS id EBCAC64718; Sat, 19 Aug 2017 21:00:03 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7JL033e020424; Sat, 19 Aug 2017 21:00:03 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7JL03tm020423; Sat, 19 Aug 2017 21:00:03 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708192100.v7JL03tm020423@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 19 Aug 2017 21:00:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322706 - head/sys/i386/i386 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/i386/i386 X-SVN-Commit-Revision: 322706 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Aug 2017 21:00:04 -0000 Author: kib Date: Sat Aug 19 21:00:02 2017 New Revision: 322706 URL: https://svnweb.freebsd.org/changeset/base/322706 Log: Use the known valid segment when accessing memory in #UD handler. Make sure that %eflags.D flag is cleared for hook. Improve comments. When #UD dtrace code checks for a registered hook before checking that the exception was raised from kernel mode, we might run with the user %ds, trapping on access. Exception entry from userspace automatically load valid %ss, which we can use there instead. Noted and reviewed by: bde Sponsored by: The FreeBSD Foundation MFC after: 3 days Modified: head/sys/i386/i386/exception.s Modified: head/sys/i386/i386/exception.s ============================================================================== --- head/sys/i386/i386/exception.s Sat Aug 19 19:33:16 2017 (r322705) +++ head/sys/i386/i386/exception.s Sat Aug 19 21:00:02 2017 (r322706) @@ -183,12 +183,16 @@ calltrap: #ifdef KDTRACE_HOOKS SUPERALIGN_TEXT IDTVEC(ill) - /* Check if there is no DTrace hook registered. */ - cmpl $0,dtrace_invop_jump_addr + /* + * Check if a DTrace hook is registered. The default (data) segment + * cannot be used for this since %ds is not known good until we + * verify that the entry was from kernel mode. + */ + cmpl $0,%ss:dtrace_invop_jump_addr je norm_ill /* - * Check if this is a user fault. If so, just handle it as a normal + * Check if this is a user fault. If so, just handle it as a normal * trap. */ cmpl $GSEL_KPL, 4(%esp) /* Check the code segment */ @@ -200,7 +204,8 @@ IDTVEC(ill) * This is a kernel instruction fault that might have been caused * by a DTrace provider. */ - pushal /* Push all registers onto the stack. */ + pushal + cld /* * Set our jump address for the jump back in the event that From owner-svn-src-head@freebsd.org Sat Aug 19 21:40:43 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C9196DE6C41; Sat, 19 Aug 2017 21:40:43 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A592965FDA; Sat, 19 Aug 2017 21:40:43 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7JLegMN036602; Sat, 19 Aug 2017 21:40:42 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7JLeg7e036598; Sat, 19 Aug 2017 21:40:42 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201708192140.v7JLeg7e036598@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Sat, 19 Aug 2017 21:40:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322708 - in head/sys: dev/syscons sys X-SVN-Group: head X-SVN-Commit-Author: bde X-SVN-Commit-Paths: in head/sys: dev/syscons sys X-SVN-Commit-Revision: 322708 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Aug 2017 21:40:43 -0000 Author: bde Date: Sat Aug 19 21:40:42 2017 New Revision: 322708 URL: https://svnweb.freebsd.org/changeset/base/322708 Log: Rename curr_curs_attr to base_curr_attr. The actual current cursor attribute field is curs_attr. The base field holds user data translated in a reversible way and is needed because current field holds this in an irreversible way for efficiency. Factor out some common code for the reversible translation. This is slightly simpler now, and much easier to expand. Translate the magic flags value -1 to a single control flag internally up front so other flags can be trusted later. This can be used for the relevant ioctl() too. Remove CONS_CURSOR_FLAGS which contained all the control flags. It was unused and not useful. After adding more flags, there will be tests on a couple at a time but never on them all. This API should have used this to disallow unknown flags. Modified: head/sys/dev/syscons/scterm-teken.c head/sys/dev/syscons/syscons.c head/sys/dev/syscons/syscons.h head/sys/sys/consio.h Modified: head/sys/dev/syscons/scterm-teken.c ============================================================================== --- head/sys/dev/syscons/scterm-teken.c Sat Aug 19 21:17:53 2017 (r322707) +++ head/sys/dev/syscons/scterm-teken.c Sat Aug 19 21:40:42 2017 (r322708) @@ -730,9 +730,9 @@ scteken_param(void *arg, int cmd, unsigned int value) break; case TP_SHOWCURSOR: if (value != 0) - flags = scp->curr_curs_attr.flags & ~CONS_HIDDEN_CURSOR; + flags = scp->base_curs_attr.flags & ~CONS_HIDDEN_CURSOR; else - flags = scp->curr_curs_attr.flags | CONS_HIDDEN_CURSOR; + flags = scp->base_curs_attr.flags | CONS_HIDDEN_CURSOR; sc_change_cursor_shape(scp, flags | CONS_LOCAL_CURSOR, -1, -1); break; case TP_SWITCHVT: Modified: head/sys/dev/syscons/syscons.c ============================================================================== --- head/sys/dev/syscons/syscons.c Sat Aug 19 21:17:53 2017 (r322707) +++ head/sys/dev/syscons/syscons.c Sat Aug 19 21:40:42 2017 (r322708) @@ -873,6 +873,7 @@ sctty_ioctl(struct tty *tp, u_long cmd, caddr_t data, { int error; int i; + struct cursor_attr *cap; sc_softc_t *sc; scr_stat *scp; int s; @@ -942,15 +943,17 @@ sctty_ioctl(struct tty *tp, u_long cmd, caddr_t data, return 0; case CONS_GETCURSORSHAPE: /* get cursor shape (new interface) */ - if (((int *)data)[0] & CONS_LOCAL_CURSOR) { - ((int *)data)[0] = scp->curr_curs_attr.flags; - ((int *)data)[1] = scp->curr_curs_attr.base; - ((int *)data)[2] = scp->curr_curs_attr.height; - } else { - ((int *)data)[0] = sc->curs_attr.flags; - ((int *)data)[1] = sc->curs_attr.base; - ((int *)data)[2] = sc->curs_attr.height; + switch (((int *)data)[0] & CONS_LOCAL_CURSOR) { + case 0: + cap = &sc->curs_attr; + break; + case CONS_LOCAL_CURSOR: + cap = &scp->base_curs_attr; + break; } + ((int *)data)[1] = cap->base; + ((int *)data)[2] = cap->height; + ((int *)data)[0] = cap->flags; return 0; case CONS_SETCURSORSHAPE: /* set cursor shape (new interface) */ @@ -2982,15 +2985,15 @@ update_cursor_image(scr_stat *scp) void sc_set_cursor_image(scr_stat *scp) { - scp->curs_attr.flags = scp->curr_curs_attr.flags; + scp->curs_attr = scp->base_curs_attr; if (scp->curs_attr.flags & CONS_HIDDEN_CURSOR) { /* hidden cursor is internally represented as zero-height underline */ scp->curs_attr.flags = CONS_CHAR_CURSOR; scp->curs_attr.base = scp->curs_attr.height = 0; } else if (scp->curs_attr.flags & CONS_CHAR_CURSOR) { - scp->curs_attr.base = imin(scp->curr_curs_attr.base, + scp->curs_attr.base = imin(scp->base_curs_attr.base, scp->font_size - 1); - scp->curs_attr.height = imin(scp->curr_curs_attr.height, + scp->curs_attr.height = imin(scp->base_curs_attr.height, scp->font_size - scp->curs_attr.base); } else { /* block cursor */ scp->curs_attr.base = 0; @@ -3005,19 +3008,30 @@ sc_set_cursor_image(scr_stat *scp) } static void +sc_adjust_ca(struct cursor_attr *cap, int flags, int base, int height) +{ + if (0) { + /* Dummy clause to avoid changing indentation later. */ + } else { + if (base >= 0) + cap->base = base; + if (height >= 0) + cap->height = height; + if (!(flags & CONS_SHAPEONLY_CURSOR)) + cap->flags = flags & CONS_CURSOR_ATTRS; + } +} + +static void change_cursor_shape(scr_stat *scp, int flags, int base, int height) { if ((scp == scp->sc->cur_scp) && !ISGRAPHSC(scp)) sc_remove_cursor_image(scp); - if (base >= 0) - scp->curr_curs_attr.base = base; - if (height >= 0) - scp->curr_curs_attr.height = height; if (flags & CONS_RESET_CURSOR) - scp->curr_curs_attr = scp->dflt_curs_attr; + scp->base_curs_attr = scp->dflt_curs_attr; else - scp->curr_curs_attr.flags = flags & CONS_CURSOR_ATTRS; + sc_adjust_ca(&scp->base_curs_attr, flags, base, height); if ((scp == scp->sc->cur_scp) && !ISGRAPHSC(scp)) { sc_set_cursor_image(scp); @@ -3033,8 +3047,11 @@ sc_change_cursor_shape(scr_stat *scp, int flags, int b int s; int i; + if (flags == -1) + flags = CONS_SHAPEONLY_CURSOR; + s = spltty(); - if ((flags != -1) && (flags & CONS_LOCAL_CURSOR)) { + if (flags & CONS_LOCAL_CURSOR) { /* local (per vty) change */ change_cursor_shape(scp, flags, base, height); splx(s); @@ -3043,16 +3060,10 @@ sc_change_cursor_shape(scr_stat *scp, int flags, int b /* global change */ sc = scp->sc; - if (base >= 0) - sc->curs_attr.base = base; - if (height >= 0) - sc->curs_attr.height = height; - if (flags != -1) { - if (flags & CONS_RESET_CURSOR) - sc->curs_attr = sc->dflt_curs_attr; - else - sc->curs_attr.flags = flags & CONS_CURSOR_ATTRS; - } + if (flags & CONS_RESET_CURSOR) + sc->curs_attr = sc->dflt_curs_attr; + else + sc_adjust_ca(&sc->curs_attr, flags, base, height); for (i = sc->first_vty; i < sc->first_vty + sc->vtys; ++i) { if ((tp = SC_DEV(sc, i)) == NULL) @@ -3212,7 +3223,7 @@ scinit(int unit, int flags) sc->dflt_curs_attr.height = howmany(scp->font_size, 8); sc->dflt_curs_attr.flags = 0; sc->curs_attr = sc->dflt_curs_attr; - scp->curr_curs_attr = scp->dflt_curs_attr = sc->curs_attr; + scp->base_curs_attr = scp->dflt_curs_attr = sc->curs_attr; #ifndef SC_NO_SYSMOUSE sc_mouse_move(scp, scp->xpixel/2, scp->ypixel/2); @@ -3525,7 +3536,7 @@ init_scp(sc_softc_t *sc, int vty, scr_stat *scp) scp->ts = NULL; scp->rndr = NULL; scp->border = (SC_NORM_ATTR >> 4) & 0x0f; - scp->curr_curs_attr = scp->dflt_curs_attr = sc->curs_attr; + scp->base_curs_attr = scp->dflt_curs_attr = sc->curs_attr; scp->mouse_cut_start = scp->xsize*scp->ysize; scp->mouse_cut_end = -1; scp->mouse_signal = 0; Modified: head/sys/dev/syscons/syscons.h ============================================================================== --- head/sys/dev/syscons/syscons.h Sat Aug 19 21:17:53 2017 (r322707) +++ head/sys/dev/syscons/syscons.h Sat Aug 19 21:40:42 2017 (r322708) @@ -313,7 +313,7 @@ typedef struct scr_stat { int cursor_pos; /* cursor buffer position */ int cursor_oldpos; /* cursor old buffer position */ struct cursor_attr dflt_curs_attr; - struct cursor_attr curr_curs_attr; + struct cursor_attr base_curs_attr; struct cursor_attr curs_attr; int mouse_pos; /* mouse buffer position */ Modified: head/sys/sys/consio.h ============================================================================== --- head/sys/sys/consio.h Sat Aug 19 21:17:53 2017 (r322707) +++ head/sys/sys/consio.h Sat Aug 19 21:40:42 2017 (r322708) @@ -187,9 +187,9 @@ typedef struct mouse_info mouse_info_t; #define CONS_HIDDEN_CURSOR (1 << 2) #define CONS_CURSOR_ATTRS (CONS_BLINK_CURSOR | CONS_CHAR_CURSOR | \ CONS_HIDDEN_CURSOR) +#define CONS_SHAPEONLY_CURSOR (1 << 29) #define CONS_RESET_CURSOR (1 << 30) #define CONS_LOCAL_CURSOR (1U << 31) -#define CONS_CURSOR_FLAGS (CONS_RESET_CURSOR | CONS_LOCAL_CURSOR) struct cshape { /* shape[0]: flags, shape[1]: base, shape[2]: height */ int shape[3]; From owner-svn-src-head@freebsd.org Sat Aug 19 23:13:35 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 758FADC635B; Sat, 19 Aug 2017 23:13:35 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4F36F6930B; Sat, 19 Aug 2017 23:13:35 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7JNDYo2076456; Sat, 19 Aug 2017 23:13:34 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7JNDYfo076452; Sat, 19 Aug 2017 23:13:34 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201708192313.v7JNDYfo076452@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Sat, 19 Aug 2017 23:13:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322709 - in head/sys: dev/syscons sys X-SVN-Group: head X-SVN-Commit-Author: bde X-SVN-Commit-Paths: in head/sys: dev/syscons sys X-SVN-Commit-Revision: 322709 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Aug 2017 23:13:35 -0000 Author: bde Date: Sat Aug 19 23:13:33 2017 New Revision: 322709 URL: https://svnweb.freebsd.org/changeset/base/322709 Log: Fix setting of defaults for the text cursor. There was already a per-vty defaults field, but it was useless since it was only initialized when propagating the global settings and thus no different from the current global settings and not per-vty. The global defaults field was also invariant after boot time, but not quite so useless. Fix this by adding a second selection bit the the control flags of the relevant ioctl(). vidcontrol doesn't support this yet. Setting either default propagates the change to the current setting for the same level and then to all lower levels. Improve the 3-way escape sequence used by termcap to control the cursor. The "normal" (ve) case has always used reset, so the user could set it to anything, but since the reset is to a global value this is not very useful, especially since the "very visible" (vs) case doesn't reset but inconsistently forces to a blinking block. Change vs to first reset and then XOR the blinking bit so that it is predictably different from ve. Modified: head/sys/dev/syscons/scterm-teken.c head/sys/dev/syscons/syscons.c head/sys/sys/consio.h Modified: head/sys/dev/syscons/scterm-teken.c ============================================================================== --- head/sys/dev/syscons/scterm-teken.c Sat Aug 19 21:40:42 2017 (r322708) +++ head/sys/dev/syscons/scterm-teken.c Sat Aug 19 23:13:33 2017 (r322709) @@ -684,7 +684,6 @@ scteken_param(void *arg, int cmd, unsigned int value) static int tcattrs[] = { CONS_RESET_CURSOR | CONS_LOCAL_CURSOR, /* normal */ CONS_HIDDEN_CURSOR | CONS_LOCAL_CURSOR, /* invisible */ - CONS_BLINK_CURSOR | CONS_LOCAL_CURSOR, /* very visible */ }; scr_stat *scp = arg; int flags, n, v0, v1, v2; @@ -727,6 +726,13 @@ scteken_param(void *arg, int cmd, unsigned int value) case TP_SETLOCALCURSOR: if (value < sizeof(tcattrs) / sizeof(tcattrs[0])) sc_change_cursor_shape(scp, tcattrs[value], -1, -1); + else if (value == 2) { + sc_change_cursor_shape(scp, + CONS_RESET_CURSOR | CONS_LOCAL_CURSOR, -1, -1); + flags = scp->base_curs_attr.flags ^ CONS_BLINK_CURSOR; + sc_change_cursor_shape(scp, + flags | CONS_LOCAL_CURSOR, -1, -1); + } break; case TP_SHOWCURSOR: if (value != 0) Modified: head/sys/dev/syscons/syscons.c ============================================================================== --- head/sys/dev/syscons/syscons.c Sat Aug 19 21:40:42 2017 (r322708) +++ head/sys/dev/syscons/syscons.c Sat Aug 19 23:13:33 2017 (r322709) @@ -943,13 +943,19 @@ sctty_ioctl(struct tty *tp, u_long cmd, caddr_t data, return 0; case CONS_GETCURSORSHAPE: /* get cursor shape (new interface) */ - switch (((int *)data)[0] & CONS_LOCAL_CURSOR) { + switch (((int *)data)[0] & (CONS_DEFAULT_CURSOR | CONS_LOCAL_CURSOR)) { case 0: cap = &sc->curs_attr; break; case CONS_LOCAL_CURSOR: cap = &scp->base_curs_attr; break; + case CONS_DEFAULT_CURSOR: + cap = &sc->dflt_curs_attr; + break; + case CONS_DEFAULT_CURSOR | CONS_LOCAL_CURSOR: + cap = &scp->dflt_curs_attr; + break; } ((int *)data)[1] = cap->base; ((int *)data)[2] = cap->height; @@ -3030,7 +3036,10 @@ change_cursor_shape(scr_stat *scp, int flags, int base if (flags & CONS_RESET_CURSOR) scp->base_curs_attr = scp->dflt_curs_attr; - else + else if (flags & CONS_DEFAULT_CURSOR) { + sc_adjust_ca(&scp->dflt_curs_attr, flags, base, height); + scp->base_curs_attr = scp->dflt_curs_attr; + } else sc_adjust_ca(&scp->base_curs_attr, flags, base, height); if ((scp == scp->sc->cur_scp) && !ISGRAPHSC(scp)) { @@ -3062,7 +3071,10 @@ sc_change_cursor_shape(scr_stat *scp, int flags, int b sc = scp->sc; if (flags & CONS_RESET_CURSOR) sc->curs_attr = sc->dflt_curs_attr; - else + else if (flags & CONS_DEFAULT_CURSOR) { + sc_adjust_ca(&sc->dflt_curs_attr, flags, base, height); + sc->curs_attr = sc->dflt_curs_attr; + } else sc_adjust_ca(&sc->curs_attr, flags, base, height); for (i = sc->first_vty; i < sc->first_vty + sc->vtys; ++i) { Modified: head/sys/sys/consio.h ============================================================================== --- head/sys/sys/consio.h Sat Aug 19 21:40:42 2017 (r322708) +++ head/sys/sys/consio.h Sat Aug 19 23:13:33 2017 (r322709) @@ -187,6 +187,7 @@ typedef struct mouse_info mouse_info_t; #define CONS_HIDDEN_CURSOR (1 << 2) #define CONS_CURSOR_ATTRS (CONS_BLINK_CURSOR | CONS_CHAR_CURSOR | \ CONS_HIDDEN_CURSOR) +#define CONS_DEFAULT_CURSOR (1 << 28) #define CONS_SHAPEONLY_CURSOR (1 << 29) #define CONS_RESET_CURSOR (1 << 30) #define CONS_LOCAL_CURSOR (1U << 31)